00001 /***************************************************************************** 00002 * 00003 * \file mgui/xmldlg.h 00004 * \brief XML Dialog 00005 * 00006 * \if NODOC 00007 * $Log: xmldlg.h_v $ 00008 * Revision 1.5 2003/10/01 22:34:17 dwilliss 00009 * doxygen 00010 * 00011 * Revision 1.4 2003/09/15 13:49:32 fileserver!dwilliss 00012 * Doxygen 00013 * 00014 * Revision 1.3 2003/07/08 18:01:24 dwilliss 00015 * Moved XMLFORM_DATA to its own include file 00016 * 00017 * Revision 1.2 2002/10/09 22:41:00 dwilliss 00018 * Moved to mgui subdirectory 00019 * 00020 * Revision 1.1 2002/10/09 22:38:13 dwilliss 00021 * Initial revision 00022 * 00023 * Revision 1.2 2002/09/19 22:34:09 dwilliss 00024 * Major update. Almost complete 00025 * 00026 * Revision 1.1 2002/09/03 22:38:57 dwilliss 00027 * Initial revision 00028 * 00029 * 00030 * \endif 00031 ****************************************************************************/ 00032 00033 #ifndef INC_MGUI_XMLDLG_H 00034 #define INC_MGUI_XMLDLG_H 00035 00036 00037 #ifndef INC_MGUI_LAYOUT_H 00038 #include <mgui/layout.h> 00039 #endif 00040 00041 #ifndef INC_MGUI_DLGBASE_H 00042 #include <mgui/dlgbase.h> 00043 #endif 00044 00045 #ifndef INC_MI32_XML_H 00046 #include <mi32/xml.h> 00047 #endif 00048 00049 #ifndef INC_MGUI_XMLDATA_H 00050 #include <mgui/xmldata.h> 00051 #endif 00052 00053 00054 struct SMLCONTEXT; 00055 00056 namespace MGUI { 00057 00058 class GUIXMLPRIVDATA; // Actually defined in smlctrl.c 00059 00060 00061 class LAYOUT_PANE_XMLFORM : public MGUI::LAYOUT_PANE { 00062 public: 00063 LAYOUT_PANE_XMLFORM(); 00064 virtual ~LAYOUT_PANE_XMLFORM(); 00065 00066 //! Create a layout from a <form> in an XML document 00067 00068 ERRVALUE Create ( 00069 MGUI::LAYOUT_PANE_BASE& ParentPane, //!< Parent pane 00070 const XMLNODE* xmlnode, //!< XML document node describing the form 00071 SMLCONTEXT* context = 0 //!< Context to use if being created from SML 00072 ); 00073 00074 //! Get a control by it's XML id attribute. 00075 //! This version just returns a pointer to an MGUI::FORM. This should 00076 //! only be used in cases where you don't really care what the control 00077 //! type is. If you expect the control to be of a specific type, use 00078 //! the override that takes a referenct to a pointer. 00079 //! @return NULL if there was no such control. 00080 MGUI::FORM* GetCtrlByID ( 00081 const UNICODE* id 00082 ) const; 00083 00084 //! Get a control by it's XML id attribute. 00085 //! Returns true if there was such a control, false if not. 00086 //! Also returns false if there was a control with the given id 00087 //! but was not of the requested type. 00088 bool GetCtrlByID ( 00089 const UNICODE* id, 00090 MGUI::CTRL_LABEL*& ctrl 00091 ) const; 00092 00093 //! Get a control by it's XML id attribute. 00094 //! Returns true if there was such a control, false if not. 00095 //! Also returns false if there was a control with the given id 00096 //! but was not of the requested type. 00097 bool GetCtrlByID ( 00098 const UNICODE* id, 00099 MGUI::CTRL_GROUPBOX*& ctrl 00100 ) const; 00101 00102 //! Get a control by it's XML id attribute. 00103 //! Returns true if there was such a control, false if not. 00104 //! Also returns false if there was a control with the given id 00105 //! but was not of the requested type. 00106 bool GetCtrlByID ( 00107 const UNICODE* id, 00108 MGUI::CTRL_PUSHBUTTON*& ctrl 00109 ) const; 00110 00111 //! Get a control by it's XML id attribute. 00112 //! Returns true if there was such a control, false if not. 00113 //! Also returns false if there was a control with the given id 00114 //! but was not of the requested type. 00115 bool GetCtrlByID ( 00116 const UNICODE* id, 00117 MGUI::CTRL_TOGGLEBUTTON*& ctrl 00118 ) const; 00119 00120 //! Get a control by it's XML id attribute. 00121 //! Returns true if there was such a control, false if not. 00122 //! Also returns false if there was a control with the given id 00123 //! but was not of the requested type. 00124 bool GetCtrlByID ( 00125 const UNICODE* id, 00126 MGUI::CTRL_EDIT_STRING*& ctrl 00127 ) const; 00128 00129 //! Get a control by it's XML id attribute. 00130 //! Returns true if there was such a control, false if not. 00131 //! Also returns false if there was a control with the given id 00132 //! but was not of the requested type. 00133 bool GetCtrlByID ( 00134 const UNICODE* id, 00135 MGUI::CTRL_EDIT_NUMBER*& ctrl 00136 ) const; 00137 00138 //! Get a control by it's XML id attribute. 00139 //! Returns true if there was such a control, false if not. 00140 //! Also returns false if there was a control with the given id 00141 //! but was not of the requested type. 00142 bool GetCtrlByID ( 00143 const UNICODE* id, 00144 MGUI::FORM_EDIT_RANGE*& ctrl 00145 ) const; 00146 00147 00148 //! Get the current values of the controls. 00149 //! Controls with no id attribute are ignored 00150 ERRVALUE GetValues ( 00151 MGUI::XMLFORM_DATA& values 00152 ) const; 00153 00154 //! Get the current values of the controls. 00155 //! Controls with no id attribute are ignored 00156 ERRVALUE SetValues ( 00157 const MGUI::XMLFORM_DATA& values 00158 ); 00159 00160 private: 00161 #ifndef GENERATING_DOXYGEN_OUTPUT 00162 GUIXMLPRIVDATA* m_priv; 00163 #endif // GENERATING_DOXYGEN_OUTPUT 00164 }; 00165 00166 00167 class DLG_XML : public MGUI::DLG_BASE { 00168 public: 00169 DLG_XML(); 00170 virtual ~DLG_XML(); 00171 00172 //! Get a control by it's XML id attribute. 00173 //! This version just returns a pointer to an MGUI::FORM. This should 00174 //! only be used in cases where you don't really care what the control 00175 //! type is. If you expect the control to be of a specific type, use 00176 //! the override that takes a referenct to a pointer. 00177 //! @return NULL if there was no such control. 00178 MGUI::FORM* GetCtrlByID ( 00179 const UNICODE* id 00180 ) const; 00181 00182 //! Get a control by it's XML id attribute. 00183 //! Returns true if there was such a control, false if not. 00184 //! Also returns false if there was a control with the given id 00185 //! but was not of the requested type. 00186 bool GetCtrlByID ( 00187 const UNICODE* id, 00188 MGUI::CTRL_LABEL*& ctrl 00189 ) const; 00190 00191 //! Get a control by it's XML id attribute. 00192 //! Returns true if there was such a control, false if not. 00193 //! Also returns false if there was a control with the given id 00194 //! but was not of the requested type. 00195 bool GetCtrlByID ( 00196 const UNICODE* id, 00197 MGUI::CTRL_GROUPBOX*& ctrl 00198 ) const; 00199 00200 //! Get a control by it's XML id attribute. 00201 //! Returns true if there was such a control, false if not. 00202 //! Also returns false if there was a control with the given id 00203 //! but was not of the requested type. 00204 bool GetCtrlByID ( 00205 const UNICODE* id, 00206 MGUI::CTRL_PUSHBUTTON*& ctrl 00207 ) const; 00208 00209 //! Get a control by it's XML id attribute. 00210 //! Returns true if there was such a control, false if not. 00211 //! Also returns false if there was a control with the given id 00212 //! but was not of the requested type. 00213 bool GetCtrlByID ( 00214 const UNICODE* id, 00215 MGUI::CTRL_TOGGLEBUTTON*& ctrl 00216 ) const; 00217 00218 //! Get a control by it's XML id attribute. 00219 //! Returns true if there was such a control, false if not. 00220 //! Also returns false if there was a control with the given id 00221 //! but was not of the requested type. 00222 bool GetCtrlByID ( 00223 const UNICODE* id, 00224 MGUI::CTRL_EDIT_STRING*& ctrl 00225 ) const; 00226 00227 //! Get a control by it's XML id attribute. 00228 //! Returns true if there was such a control, false if not. 00229 //! Also returns false if there was a control with the given id 00230 //! but was not of the requested type. 00231 bool GetCtrlByID ( 00232 const UNICODE* id, 00233 MGUI::CTRL_EDIT_NUMBER*& ctrl 00234 ) const; 00235 00236 //! Get a control by it's XML id attribute. 00237 //! Returns true if there was such a control, false if not. 00238 //! Also returns false if there was a control with the given id 00239 //! but was not of the requested type. 00240 bool GetCtrlByID ( 00241 const UNICODE* id, 00242 MGUI::FORM_EDIT_RANGE*& ctrl 00243 ) const; 00244 00245 00246 //! Get the current values of the controls. 00247 //! Controls with no id attribute are ignored 00248 ERRVALUE GetValues ( 00249 MGUI::XMLFORM_DATA& values 00250 ) const; 00251 00252 //! Get the current values of the controls. 00253 //! Controls with no id attribute are ignored 00254 ERRVALUE SetValues ( 00255 const MGUI::XMLFORM_DATA& values 00256 ); 00257 00258 00259 //! Create a layout from a <form> in an XML document 00260 ERRVALUE SetXMLNode ( 00261 const XMLNODE* xmlnode, //!< XML document node describing the dialog 00262 SMLCONTEXT* context = 0 //!< Context to use if being created from SML 00263 ); 00264 00265 00266 protected: 00267 00268 virtual ERRVALUE OnInitDialog (); //! Creates the body from the form contents 00269 virtual void OnApply (); 00270 virtual void OnOK (); 00271 virtual void OnCancel (); 00272 virtual void OnOpen (); 00273 virtual void OnClose (); 00274 virtual void OnDestroy (); 00275 00276 GUIXMLPRIVDATA* GetPriv() const { return (m_priv); } 00277 00278 private: 00279 #ifndef GENERATING_DOXYGEN_OUTPUT 00280 virtual const char* GetDialogHelpID () const; 00281 virtual const char* GetDialogName () const; 00282 00283 GUIXMLPRIVDATA* m_priv; 00284 mutable char *m_helpid; //!< GetDialogHelpID() may set it so we'll free it in the dtor 00285 #endif // GENERATING_DOXYGEN_OUTPUT 00286 }; 00287 00288 00289 00290 00291 } // End of MGUI namespace 00292 00293 #endif 00294
1.3.4-20031026