mgui/formnrgl.h

Go to the documentation of this file.
00001 /**
00002  * \file migui/formnrgl.h 
00003  * \brief FORM_NAMEDREGION_LIST class definitions.
00004  *
00005  * \if NODOC
00006  * $Id: formnrgl.h_v 1.5 2003/10/03 19:58:19 linux32build!build Exp $
00007  *
00008  * $Log: formnrgl.h_v $
00009  * Revision 1.5  2003/10/03 19:58:19  linux32build!build
00010  * Doxygen
00011  *
00012  * Revision 1.4  2003/09/15 13:49:32  fileserver!dwilliss
00013  * Doxygen
00014  *
00015  * Revision 1.3  2003/04/09 20:50:17  dwilliss
00016  * Don't use _T in templates. Mac's ctype.h defines a global _T
00017  *
00018  * Revision 1.2  2002/10/09 17:04:56  mju
00019  * Moved to 'mgui' folder.
00020  *
00021  * Revision 1.1  2002/08/13 20:25:25  mju
00022  * Initial revision
00023  *
00024  * 
00025  * 11    6/25/02 12:06p Mju
00026  * Update list when region saved.
00027  * 
00028  * 9     2/08/02 5:27p Dwilliss
00029  * Changed to use new CTRL_GRID
00030  * 
00031  * 8     12/13/01 10:55a Mju
00032  * MGUI unificiation with X.
00033  * 
00034  * 7     12/03/01 11:05a Mju
00035  * Remove references to old deprecated MGUI names.
00036  * Include miwin/CtrlList where needed.
00037  * 
00038  * 6     10/29/01 2:31p Mju
00039  * Use OnItemSelect instead of Activate
00040  * 
00041  * 1     1/24/01 8:47a Mju
00042  * \endif
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       //! Constructor.
00068       FORM_NAMEDREGION_LIST (
00069          NAMEDREGION_LIST& RegionList
00070          );
00071 
00072       //! Destructor.
00073       virtual ~FORM_NAMEDREGION_LIST (
00074          );
00075 
00076       //! Create the form.
00077       void Create (
00078          MGUI::LAYOUT_PANE_BASE& ParentPane,
00079          MGUI::LAYOUT_SIZEALIGN sizing = MGUI::LAYOUT_SIZEALIGN_Expand
00080          );
00081 
00082       //! Get reference to currently selected region.
00083       //! Make sure a region is selected using IsRegionSelected().
00084       const NAMEDREGION& GetSelectedRegion (
00085          ) const { return (GetSelRegion()); }
00086 
00087       //! Determine if a region is currently selected in the list.
00088       bool IsRegionSelected (
00089          ) const { return (m_ListCtrl.GetSelectedCount() > 0); }
00090 
00091    protected:
00092 
00093       //! Called when a region gets selected or all regions become unselected.
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       // UNIMPLEMENTED / UNSUPPORTED
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       //! Constructor.
00146       FORM_NAMEDREGION_LIST_T (
00147          NAMEDREGION_LIST& RegionList
00148          ): FORM_NAMEDREGION_LIST(RegionList), m_container(0), m_funcptr(0)
00149          { }
00150 
00151       //! Destructor.
00152       virtual ~FORM_NAMEDREGION_LIST_T (
00153          ) { }
00154 
00155       //! Create the form.
00156       void Create (
00157          MGUI::LAYOUT_PANE_BASE& ParentPane,
00158          _CT *cbcontainer,                      //!< Pointer to callback container class
00159          void (_CT::*cbfuncptr)(),              //! Callback function pointer
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       //! Called when a region gets selected or all regions become unselected.
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

Generated on Thu Aug 12 06:18:28 2004 for TNTsdk by doxygen 1.3.4-20031026