form.h

Go to the documentation of this file.
00001 /**
00002  * \file mgui/form.h
00003  * \brief Definitions for MGUI::FORM interface class.
00004  *
00005  * \if NODOC
00006  * $Id: form.h_v 1.9 2004/04/08 21:22:58 mju Exp $
00007  *
00008  * $Log: form.h_v $
00009  * Revision 1.9  2004/04/08 21:22:58  mju
00010  * Change setfocus to v_setfocus and use inline to call.
00011  *
00012  * Revision 1.8  2003/10/03 19:58:19  linux32build!build
00013  * Doxygen
00014  *
00015  * Revision 1.7  2003/09/15 13:49:32  fileserver!dwilliss
00016  * Doxygen
00017  *
00018  * Revision 1.6  2002/10/11 15:27:56  mju
00019  * Fix guard test.
00020  *
00021  * Revision 1.5  2002/10/09 15:10:56  mju
00022  * Moved to mgui include folder.
00023  * Make GetSML... not inline as virtuals should not be inline.
00024  *
00025  * Revision 1.4  2002/09/03 22:37:27  dwilliss
00026  * Added virtual method to support SML hooks
00027  *
00028  * Revision 1.3  2002/08/08 17:06:48  mju
00029  * Add GetDlgParent to form_composite.
00030  *
00031  * Revision 1.2  2001/12/13 16:58:11  mju
00032  * MGUI unification with X.
00033  *
00034  * Revision 1.1  2001/11/30 17:27:32  mju
00035  * Initial revision
00036  * \endif
00037 **/
00038 
00039 #ifndef  INC_MGUI_FORM_H
00040 #define  INC_MGUI_FORM_H
00041 
00042 #ifndef INC_MGUI_LAYOUT_H
00043 #include <mgui/layout.h>
00044 #endif
00045 
00046 class SML_GUI_INTERFACE_BASE; //!< Hook for the SML interface to MGUI controls
00047 
00048 namespace MGUI {
00049 
00050 //------------------------------------------------------------------------------------------------
00051 //! Interface class for graphical user interface controls and forms.
00052 
00053 class FORM {
00054    public:
00055 
00056       //! Destructor.
00057       virtual ~FORM (
00058          ) = 0;
00059 
00060       //! Determine if form has been created.
00061       //! @return true if created, false if not.
00062       virtual bool IsCreated (
00063          ) const = 0;
00064 
00065       //! Set whether mouse or keyboard input to form is allowed.
00066       virtual void SetEnabled (
00067          bool enabled = true
00068          ) = 0;
00069 
00070       //! Set focus to first interactive control in form.
00071       void SetFocus (
00072          ) const { v_SetFocus(); }
00073 
00074       //! Set whether form is visible or not.
00075       virtual void SetVisible (
00076          bool visible = true
00077          ) = 0;
00078 
00079       #ifndef GENERATING_DOXYGEN_OUTPUT
00080       //! Function private to SML implementation of MGUI classes.
00081       //! Used to prevent the need for ugly multiple inheritance.
00082       virtual SML_GUI_INTERFACE_BASE* GetSMLInterface (
00083          );
00084       #endif // GENERATING_DOXYGEN_OUTPUT
00085 
00086    private:
00087 
00088       //! Set focus to first interactive control in form.
00089       //! Default implementation does nothing.
00090       virtual void v_SetFocus (
00091          ) const;
00092 
00093    };
00094 
00095 //------------------------------------------------------------------------------------------------
00096 //! Base class for composite forms.
00097 class FORM_COMPOSITE : public MGUI::FORM {
00098    public:
00099 
00100       //! Constructor.
00101       FORM_COMPOSITE (
00102          );
00103 
00104       //! Destructor.
00105       virtual ~FORM_COMPOSITE (
00106          ) = 0;
00107 
00108       //! Get suitable parent for dialog launched from form.
00109       MDLGPARENT GetDlgParent (
00110          ) const { return (m_pane.GetDlgParent()); }
00111 
00112       //! Determine if form has been created.
00113       //! @return true if created, false if not.
00114       virtual bool IsCreated (
00115          ) const;
00116 
00117       //! Set whether mouse or keyboard input to form is allowed.
00118       virtual void SetEnabled (
00119          bool enabled = true
00120          );
00121 
00122       //! Set whether form is visible or not.
00123       virtual void SetVisible (
00124          bool visible = true
00125          );
00126 
00127    protected:
00128 
00129       //! Create layout pane.
00130       //! Use GetPane() to retrieve reference to pane.
00131       void CreatePane (
00132          MGUI::LAYOUT_PANE_BASE& ParentPane,    //!< 'Parent' pane
00133          MGUI::LAYOUT_ORIENTATION orientation,  //!< Pane orientation
00134          MGUI::LAYOUT_SIZEALIGN sizealign,      //!< Sizing and alignment
00135          int ChildSpacing = 4,                  //!< Spacing between 'children' of pane
00136          int ExtraBorder = 0                    //!< Extra border around pane, in addition to ChildSpacing
00137          ) { m_pane.Create(ParentPane,orientation,sizealign,ChildSpacing,ExtraBorder); }
00138 
00139       //! Get layout pane.
00140       MGUI::LAYOUT_PANE& GetPane (
00141          ) { return (m_pane); }
00142 
00143    private:
00144       #ifndef GENERATING_DOXYGEN_OUTPUT
00145       LAYOUT_PANE m_pane;
00146 
00147       FORM_COMPOSITE (const FORM_COMPOSITE&);
00148       FORM_COMPOSITE& operator= (const FORM_COMPOSITE&);
00149       #endif // GENERATING_DOXYGEN_OUTPUT
00150    };
00151 
00152 //------------------------------------------------------------------------------------------------
00153 }  // End namespace MGUI
00154 
00155 #endif   // INC_MGUI_FORM_H

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