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