00001 00002 // MathGUI = a WYSIWYG equation editor + a powerful math engine // 00003 // Copyright (C) 2003 by Francesco Montorsi // 00004 // // 00005 // This library is free software; you can redistribute it and/or // 00006 // modify it under the terms of the GNU Lesser General Public // 00007 // License as published by the Free Software Foundation; either // 00008 // version 2.1 of the License, or (at your option) any later // 00009 // version. // 00010 // // 00011 // This library is distributed in the hope that it will be useful, // 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 00014 // GNU Lesser General Public License for more details. // 00015 // // 00016 // You should have received a copy of the GNU Lesser General Public // 00017 // License along with this program; if not, write to the Free // 00018 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, // 00019 // MA 02111-1307, USA. // 00020 // // 00021 // For any comment, suggestion or feature request, please contact // 00022 // the administrator of the project at frm@users.sourceforge.net // 00023 // // 00030 00031 00032 00033 00034 #ifndef DIALOGS_OPTIONSDLG_H 00035 #define DIALOGS_OPTIONSDLG_H 00036 00037 00038 #if defined(__GNUG__) && !defined(__APPLE__) 00039 #pragma interface "OptDlg.h" 00040 #endif 00041 00042 // For compilers that support precompilation, includes "wx/wx.h". 00043 /*#include "wx/wxprec.h" 00044 00045 #ifdef __BORLANDC__ 00046 #pragma hdrstop 00047 #endif 00048 00049 // for all others, include the necessary headers 00050 #ifndef WX_PRECOMP 00051 #include "wx/wx.h" 00052 #endif 00053 */ 00054 00055 // includes 00056 #include "mg/Setup.h" 00057 #include "mg/GUIUtils.h" 00058 #include "mg/OptTreeCtrl.h" 00059 #include <wx/config.h> 00060 00061 // forward declarations 00062 class mgOptionsBtnPanel; 00063 class mgOptionsTreeCtrl; 00064 class mgOptBasePanel; 00065 00066 00067 // identifiers for child controls 00068 #define OPTIONSDLG_BTN_OK mgOPTIONSDLG_BASEID+1 00069 #define OPTIONSDLG_BTN_CANCEL mgOPTIONSDLG_BASEID+2 00070 #define OPTIONSDLG_BTN_APPLY mgOPTIONSDLG_BASEID+3 00071 #define OPTIONSDLG_TREELIST mgOPTIONSDLG_BASEID+4 00072 #define OPTIONSDLG_MAX_TREELIST_DEPTH 6 00073 00074 00075 // base ids for the panels 00076 #define OPTIONSDLG_KEYPANEL_BASEID mgOPTIONSDLG_BASEID+100 00077 #define OPTIONSDLG_FONTPANEL_BASEID mgOPTIONSDLG_BASEID+200 00078 00079 00080 00081 00082 // The custom wxCommandEvent event used by the Edit | Options 00083 // dialog box to force an application and/or UI updating. 00084 // This event is 'posted' to the application object when the 00085 // user clicks OK or Apply by the mgOptBasePanel-derived class 00086 // in function CommitChanges(). 00087 // To add a new event type just add a line in the following macro table 00088 // In the .cpp file you have to add the definition of the event: 00089 // 00090 // DEFINE_EVENT_TYPE( mgEVT_NEW_EVENT_TYPE ) 00091 // 00092 // and then add an entry in the event table definition 00093 // 00094 // BEGIN_EVENT_TABLE( CMathApp, wxApp ) 00095 // EVT_CUSTOM( mgEVT_NEW_EVENT_TYPE, id, function) 00096 // END_EVENT_TABLE 00097 // 00098 // You have to declare and define the wxT('function') event handler. 'id' could 00099 // be -1 (or wxID_ALL 00100 // 00101 BEGIN_DECLARE_EVENT_TYPES() 00102 DECLARE_EVENT_TYPE( mgEVT_OPTIONS_CHANGED, mgOPTIONSDLG_EVENTS_BASEID ) 00103 END_DECLARE_EVENT_TYPES() 00104 00105 #define EVT_OPTIONS_CHANGED(func) \ 00106 DECLARE_EVENT_TABLE_ENTRY( mgEVT_OPTIONS_CHANGED, wxID_ANY, \ 00107 wxID_ANY, (wxObjectEventFunction) (wxEventFunction) \ 00108 wxStaticCastEvent( wxCommandEventFunction, & func ), \ 00109 (wxObject *) NULL ), 00110 00111 00112 00113 00147 class mgOptDlg : public wxDialog 00148 { 00149 public: 00151 00167 enum mgOptChangedType { 00168 OptChanged_None = 0, 00169 OptChanged_App = 1, 00170 OptChanged_MainWnd = 2, 00171 OptChanged_ParamWnd = 4, 00172 OptChanged_UnknonwWnd = 8, 00173 OptChanged_ConstWnd = 16 00174 }; 00175 00195 mgOptDlg( wxWindow* parent, wxWindowID id, wxConfig* config = 0 ); 00196 00197 virtual ~mgOptDlg(); 00198 00199 00200 00201 00203 00222 void CreateLayout( wxWindow* parent ); 00223 00224 00225 00227 00242 mgOptBasePanel* CreatePanel( mgOptTreeCtrlItemData *itemData, 00243 const wxString& itemLabel ); 00244 00246 00256 void DisplayPanel( wxTreeItemId id ); 00257 00258 00260 00268 void CommitChanges(); 00269 00270 00274 void SetClientEvtHandler(wxEvtHandler *p) { 00275 m_pClientEvtHandler = p; 00276 } 00277 00278 00279 00280 00281 protected: 00282 00284 wxConfig* m_config; 00285 00287 mgOptionsBtnPanel* m_buttonWnd; 00288 00290 mgOptionsTreeCtrl* m_treeWnd; 00291 00293 wxPanel* m_actualPanel; 00294 00296 //wxPanel* m_emptyPanel; 00297 00299 wxEvtHandler *m_pClientEvtHandler; 00300 00301 00302 00303 #ifdef OPTIONSDLG_USE_LAYOUTCONSTRAINTS 00304 00306 wxLayoutConstraints* m_optionLayout; 00307 00308 #else // use wxSizers 00309 00311 wxBoxSizer *m_mainSizer; 00312 00314 wxBoxSizer* m_optionSizer; 00315 00316 #endif 00317 00318 00319 protected: // event handlers 00320 00321 00323 /*| 00324 Calls \c CommitChanges and then \c EndModal( wxID_OK ) 00325 */ 00326 void OnOkButton( wxCommandEvent &ev ); 00327 00329 00332 void OnCancelButton( wxCommandEvent &ev ); 00333 00335 00338 void OnApplyButton( wxCommandEvent &ev ); 00339 00341 00345 void OnItemSelected( wxTreeEvent& ev ); 00346 00347 private: 00348 DECLARE_CLASS( mgOptDlg ) 00349 DECLARE_EVENT_TABLE() 00350 }; 00351 00352 00353 #endif // not defined DIALOGS_OPTIONSDLG_H 00354
[ Top ] |