00001 00011 #ifndef __EDITATIONWINDOWBASE__H__ 00012 #define __EDITATIONWINDOWBASE__H__ 00013 00014 #include <wx/wx.h> 00015 #include <wx/utils.h> 00016 #include <wx/evtloop.h> 00017 #include <wx/event.h> 00018 00019 #include "../common.h" 00020 #include "../configs/EditableInWindowConfig.h" 00021 00022 // A part of the GUI 00023 namespace GUI { 00024 00031 class EditationWindowBase: public wxFrame { 00032 protected: 00034 enum { 00035 // Events 00036 ID_OkButton = 11000, 00037 ID_CancelButton, 00038 }; 00039 00040 public: 00041 // Event handlers 00042 virtual void OnWindowClose(wxCloseEvent & event); 00043 00044 virtual void OnOkButton(wxCommandEvent & event) =0; 00045 virtual void OnCancelButton(wxCommandEvent & event); 00046 00047 DECLARE_EVENT_TABLE() 00048 00049 public: 00056 EditationWindowBase(wxWindow * parent, 00057 EditableInWindowConfig & editedConfig, 00058 const string & windowTitle = "Editation window"); 00059 00063 virtual ~EditationWindowBase(); 00064 00072 void SetModalEventLoop(wxModalEventLoop * eventLoop); 00073 00077 void ExitModalEventLoop(); 00078 00079 private: 00085 void BeginBaseWindowCreation(); 00086 00090 void EndBaseWindowCreation(); 00091 00092 protected: 00096 virtual void CreateBasicForm() =0; 00097 00101 virtual void CreateHorizontalLine(); 00102 00106 virtual void CreateButtons(); 00107 00112 virtual bool SaveConfig() =0; 00113 00117 wxBoxSizer * GetMainSizer() { 00118 return topsizer; 00119 } 00120 00124 wxPanel * GetMainPanel() { 00125 return p; 00126 } 00127 00128 private: 00130 EditableInWindowConfig & config; 00131 00133 wxPanel * p; 00135 wxBoxSizer * topsizer; 00136 00138 wxModalEventLoop * loop; 00139 00140 protected: 00141 // Size constants 00142 static const int HLINE_SIZE = 3; 00143 static const int BUTTON_BORDER_SIZE = 7; 00144 static const int GRIDER_BASIC_FORM_COLS = 2; 00145 static const int MAIN_SIZER_BORDER_SIZE = 5; 00146 static const wxSize FORM_TEXT_BOX_SIZE; 00147 }; 00148 00149 } /* namespace GUI */ 00150 00151 #endif /* #ifndef __EDITATIONWINDOWBASE__H__ */ 00152 00153 /* End of file EditationWindowBase.h */