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