00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef INC_MGUI_FORMNRGL_H
00046 #define INC_MGUI_FORMNRGL_H
00047 #ifndef GENERATING_DOXYGEN_OUTPUT
00048 #define INC_MGUI_FORMNRGL_H
00049 #endif // GENERATING_DOXYGEN_OUTPUT
00050
00051 #ifndef INC_MI32_NAMEDRGN_H
00052 #include <mi32/namedrgn.h>
00053 #endif
00054
00055 #ifndef INC_MGUI_CTRL_H
00056 #include <mgui/ctrl.h>
00057 #endif
00058
00059 #ifndef INC_MGUI_GRID_H
00060 #include <mgui/grid.h>
00061 #endif
00062
00063
00064 class FORM_NAMEDREGION_LIST {
00065 public:
00066
00067
00068 FORM_NAMEDREGION_LIST (
00069 NAMEDREGION_LIST& RegionList
00070 );
00071
00072
00073 virtual ~FORM_NAMEDREGION_LIST (
00074 );
00075
00076
00077 void Create (
00078 MGUI::LAYOUT_PANE_BASE& ParentPane,
00079 MGUI::LAYOUT_SIZEALIGN sizing = MGUI::LAYOUT_SIZEALIGN_Expand
00080 );
00081
00082
00083
00084 const NAMEDREGION& GetSelectedRegion (
00085 ) const { return (GetSelRegion()); }
00086
00087
00088 bool IsRegionSelected (
00089 ) const { return (m_ListCtrl.GetSelectedCount() > 0); }
00090
00091 protected:
00092
00093
00094 virtual void OnChangeSelection (
00095 );
00096
00097 private:
00098 #ifndef GENERATING_DOXYGEN_OUTPUT
00099
00100 class LISTOBSERVER : public NAMEDREGION_LIST::OBSERVER {
00101 public:
00102 LISTOBSERVER (
00103 FORM_NAMEDREGION_LIST& form
00104 );
00105 virtual void OnChanged (const NAMEDREGION& item);
00106 virtual void OnClear ();
00107 virtual void OnInsert (const NAMEDREGION& item);
00108 virtual void OnRemove (const NAMEDREGION& item);
00109 private:
00110 FORM_NAMEDREGION_LIST& m_form;
00111 };
00112
00113 NAMEDREGION_LIST& m_RegionList;
00114 LISTOBSERVER m_ListObserver;
00115 MGUI::CTRL_GRID_T<FORM_NAMEDREGION_LIST> m_ListCtrl;
00116 MGUI::CTRL_PUSHBUTTON_T<FORM_NAMEDREGION_LIST> m_AddPB;
00117 MGUI::CTRL_PUSHBUTTON_T<FORM_NAMEDREGION_LIST> m_SaveAsPB;
00118 MGUI::CTRL_PUSHBUTTON_T<FORM_NAMEDREGION_LIST> m_RemovePB;
00119 MGUI::CTRL_PUSHBUTTON_T<FORM_NAMEDREGION_LIST> m_CombinePB;
00120 MDLGPARENT m_DlgParent;
00121
00122 void AddListCtrlItem (const NAMEDREGION&);
00123 NAMEDREGION& GetSelRegion () const;
00124 void OnAdd ();
00125 void OnCombine ();
00126 bool OnListCtrlBeginLabelEdit (int, int);
00127 void OnListCtrlItemSelect (int itemnum, int subitem);
00128 bool OnListCtrlEndLabelEdit (int, int, const MISTRING&);
00129 void OnRemove ();
00130 void OnSaveAs ();
00131
00132
00133 FORM_NAMEDREGION_LIST (const FORM_NAMEDREGION_LIST&);
00134 FORM_NAMEDREGION_LIST& operator= (const FORM_NAMEDREGION_LIST&);
00135
00136 friend class LISTOBSERVER;
00137 friend class LISTCTRL;
00138 #endif // GENERATING_DOXYGEN_OUTPUT
00139 };
00140
00141
00142 template <class _CT> class FORM_NAMEDREGION_LIST_T : public FORM_NAMEDREGION_LIST {
00143 public:
00144
00145
00146 FORM_NAMEDREGION_LIST_T (
00147 NAMEDREGION_LIST& RegionList
00148 ): FORM_NAMEDREGION_LIST(RegionList), m_container(0), m_funcptr(0)
00149 { }
00150
00151
00152 virtual ~FORM_NAMEDREGION_LIST_T (
00153 ) { }
00154
00155
00156 void Create (
00157 MGUI::LAYOUT_PANE_BASE& ParentPane,
00158 _CT *cbcontainer,
00159 void (_CT::*cbfuncptr)(),
00160 MGUI::LAYOUT_SIZEALIGN sizing = MGUI::LAYOUT_SIZEALIGN_Expand
00161 ) {
00162 m_container = cbcontainer;
00163 m_funcptr = cbfuncptr;
00164 FORM_NAMEDREGION_LIST::Create(ParentPane,sizing);
00165 return;
00166 }
00167
00168 protected:
00169
00170
00171 virtual void OnChangeSelection (
00172 ) { (m_container->*m_funcptr)(); }
00173
00174 private:
00175 #ifndef GENERATING_DOXYGEN_OUTPUT
00176 _CT *m_container;
00177 void (_CT::*m_funcptr)();
00178 #endif // GENERATING_DOXYGEN_OUTPUT
00179 };
00180
00181 #endif // INC_MGUI_FORMNRGL_H