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