00001 /** 00002 * \file mgui/formextents.h 00003 * \brief Definitions for MGUI::FORM_EDIT_EXTENTS class. 00004 * 00005 * \if NODOC 00006 * $Id: formextents.h_v 1.6 2004/11/24 17:15:05 mju Exp $ 00007 * 00008 * $Log: formextents.h_v $ 00009 * Revision 1.6 2004/11/24 17:15:05 mju 00010 * Change flag names to clarify purpose. 00011 * 00012 * Revision 1.5 2004/07/08 13:24:19 mju 00013 * Add ClearExtents. 00014 * 00015 * Revision 1.4 2004/06/30 13:54:41 mju 00016 * Add HasAllRangeValues. 00017 * 00018 * Revision 1.3 2004/06/22 19:41:48 scowan 00019 * Updated to use coord ref system. 00020 * 00021 * Revision 1.2 2004/06/11 17:30:11 scowan 00022 * Added doxygen wrappers. 00023 * 00024 * Revision 1.1 2004/06/10 21:28:09 scowan 00025 * Initial revision 00026 * 00027 * \endif 00028 **/ 00029 00030 #ifndef INC_MGUI_FORM_EDIT_EXTENTS_H 00031 #define INC_MGUI_FORM_EDIT_EXTENTS_H 00032 00033 #ifndef INC_MGUI_FORM_H 00034 #include <mgui/form.h> 00035 #endif 00036 00037 #ifndef INC_MGUI_CTRL_H 00038 #include <mgui/ctrl.h> 00039 #endif 00040 00041 #ifndef INC_MGUI_FORMBTXT_H 00042 #include <mgui/formbtxt.h> 00043 #endif 00044 00045 #ifndef INC_MGUI_COMBOBOX_H 00046 #include <mgui/combobox.h> 00047 #endif 00048 00049 #ifndef INC_MI32_SPATREF_H 00050 #include <mi32/spatref.h> 00051 #endif 00052 00053 namespace MGUI { 00054 00055 //:>=================================================================================================================== 00056 //! Form consisting of label and string edit field. 00057 class FORM_EDIT_EXTENTS : public MGUI::FORM_COMPOSITE { 00058 public: 00059 00060 enum FLAGS { 00061 FLAG_None = 0x00, 00062 FLAG_AllowAllGeorefDatumTypes = 0x01, //!< Allow all georeference-supported datum types 00063 FLAG_NoChangeCoordRefSys = 0x02 //!< Disallow changing of coordinate reference system 00064 }; 00065 00066 //! Constructor. 00067 FORM_EDIT_EXTENTS ( 00068 ); 00069 00070 //! Destructor. 00071 virtual ~FORM_EDIT_EXTENTS ( 00072 ); 00073 00074 //! Clear range edit controls. 00075 void ClearExtents ( 00076 bool notify = true 00077 ); 00078 00079 //! Create form with label from resource lookup. 00080 void Create ( 00081 MGUI::LAYOUT_PANE_BASE& ParentPane, //!< Parent pane 00082 bool IsRangeEditable = true, 00083 FLAGS flags = FLAG_None, 00084 MGUI::LAYOUT_SIZEALIGN sizealign = MGUI::LAYOUT_SIZEALIGN_FixedSize 00085 ); 00086 00087 //! Get the extents of the form 00088 const DRECT2D& GetExtents ( 00089 ) const { return (m_Extents); } 00090 00091 //! Get the projection to use for extents selection. 00092 const SPATREF::COORDREFSYS& GetCoordRefSys ( 00093 ) const { return (m_CoordRefSys); } 00094 00095 //! Determine if user has entered values for all range fields. 00096 bool HasAllRangeValues ( 00097 ); 00098 00099 //! Set the extents of the form 00100 //! Do this after the call to SetProjection() or the call to the method will alter the extents 00101 void SetExtents ( 00102 const DRECT2D& Extents, 00103 bool notify = true 00104 ); 00105 00106 //! Set the projection to use for extents selection. 00107 //! If a projection and value coordinates exists, the coordinates will be converted to the new projection 00108 void SetCoordRefSys ( 00109 const SPATREF::COORDREFSYS& CoordRefSys, 00110 bool notify = true 00111 ); 00112 00113 //! Set the extents section to be editable 00114 void SetRangeEditable ( 00115 bool IsRangeEditable 00116 ); 00117 00118 private: 00119 #ifndef GENERATING_DOXYGEN_OUTPUT 00120 SPATREF::COORDREFSYS m_CoordRefSys; 00121 DRECT2D m_Extents; 00122 bool m_IsRangeEditable; 00123 FLAGS m_flags; 00124 00125 FORM_BUTTONTEXT_T<FORM_EDIT_EXTENTS> m_Projection; 00126 00127 LAYOUT_PANE m_YPane; 00128 CTRL_LABEL m_YLabel; 00129 CTRL_EDIT_NUMBER_T<FORM_EDIT_EXTENTS> m_YInit; 00130 CTRL_LABEL m_YTo; 00131 CTRL_EDIT_NUMBER_T<FORM_EDIT_EXTENTS> m_YLast; 00132 00133 LAYOUT_PANE m_XPane; 00134 CTRL_LABEL m_XLabel; 00135 CTRL_EDIT_NUMBER_T<FORM_EDIT_EXTENTS> m_XInit; 00136 CTRL_LABEL m_XTo; 00137 CTRL_EDIT_NUMBER_T<FORM_EDIT_EXTENTS> m_XLast; 00138 00139 virtual void v_OnChangeExtents (); 00140 virtual void v_OnChangeProjection (); 00141 00142 void OnExtentsChanged (); 00143 void OnProjectionPressed (); 00144 00145 void UpdateProjection (); 00146 #endif // GENERATING_DOXYGEN_OUTPUT 00147 }; 00148 00149 DEFINE_ENUM_OP_BITWISE(FORM_EDIT_EXTENTS::FLAGS); 00150 00151 //:>------------------------------------------------------------------------------------------------------------------- 00152 // Convenience template for FORM_EDIT_EXTENTS to allow method in container class to be called. 00153 template <class _CT> class FORM_EDIT_EXTENTS_T : public MGUI::FORM_EDIT_EXTENTS { 00154 public: 00155 00156 //! Constructor. 00157 explicit FORM_EDIT_EXTENTS_T ( 00158 _CT *pContainer 00159 ): m_pContainer(pContainer), m_pfOnChangeExtents(0), m_pfOnChangeCoordRefSys(0) 00160 { } 00161 00162 //! Set container pointer. 00163 //! Container may also be specified in constructor. 00164 void SetContainer ( 00165 _CT *pContainer 00166 ) { m_pContainer = pContainer; } 00167 00168 //! Set container method to call for OnChangeExtents(). 00169 void SetFuncChangeExtents ( 00170 void (_CT::*pfOnChangeExtents)() 00171 ) { m_pfOnChangeExtents = pfOnChangeExtents; }; 00172 00173 //! Set container method to call for OnChangeProjection() 00174 void SetFuncChangeCoordRefSys ( 00175 void (_CT::*pfOnChangeCoordRefSys)() 00176 ) { m_pfOnChangeCoordRefSys = pfOnChangeCoordRefSys; }; 00177 00178 private: 00179 00180 #ifndef GENERATING_DOXYGEN_OUTPUT 00181 _CT *m_pContainer; 00182 void (_CT::*m_pfOnChangeExtents)(); 00183 void (_CT::*m_pfOnChangeCoordRefSys)(); 00184 00185 virtual void v_OnChangeExtents ( 00186 ) { if (m_pfOnChangeExtents != 0) (m_pContainer->*m_pfOnChangeExtents)(); } 00187 00188 virtual void v_OnChangeCoordRefSys ( 00189 ) { if (m_pfOnChangeCoordRefSys != 0) (m_pContainer->*m_pfOnChangeCoordRefSys)(); } 00190 #endif // GENERATING_DOXYGEN_OUTPUT 00191 }; 00192 00193 } // End of MGUI namespace 00194 00195 #endif // INC_MGUI_FORM_EXTENTS_H
1.3.8-20040913