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

Generated on Tue Dec 14 13:18:17 2004 for TNTsdk by  doxygen 1.3.8-20040913