| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: configbrowser.cpp |
| 3 | // Purpose: Configuration browser |
| 4 | // Author: Julian Smart |
| 5 | // Modified by: |
| 6 | // Created: 2003-08-14 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) Julian Smart |
| 9 | // Licence: |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | // For compilers that support precompilation, includes "wx/wx.h". |
| 13 | #include "wx/wxprec.h" |
| 14 | |
| 15 | #ifdef __BORLANDC__ |
| 16 | #pragma hdrstop |
| 17 | #endif |
| 18 | |
| 19 | #ifndef WX_PRECOMP |
| 20 | |
| 21 | #include "wx/wx.h" |
| 22 | #include "wx/splitter.h" |
| 23 | #include "wx/treectrl.h" |
| 24 | |
| 25 | #endif |
| 26 | |
| 27 | #include "configbrowser.h" |
| 28 | |
| 29 | ////@begin XPM images |
| 30 | ////@end XPM images |
| 31 | |
| 32 | /*! |
| 33 | * ctConfigurationBrowserWindow type definition |
| 34 | */ |
| 35 | |
| 36 | IMPLEMENT_CLASS( ctConfigurationBrowserWindow, wxPanel ) |
| 37 | |
| 38 | /*! |
| 39 | * ctConfigurationBrowserWindow event table definition |
| 40 | */ |
| 41 | |
| 42 | BEGIN_EVENT_TABLE( ctConfigurationBrowserWindow, wxPanel ) |
| 43 | |
| 44 | ////@begin ctConfigurationBrowserWindow event table entries |
| 45 | EVT_TREE_SEL_CHANGED( ID_CONFIGURATION_BROWSER_TREECTRL, ctConfigurationBrowserWindow::OnConfigurationBrowserTreectrl ) |
| 46 | |
| 47 | ////@end ctConfigurationBrowserWindow event table entries |
| 48 | |
| 49 | END_EVENT_TABLE() |
| 50 | |
| 51 | /*! |
| 52 | * ctConfigurationBrowserWindow constructor |
| 53 | */ |
| 54 | |
| 55 | ctConfigurationBrowserWindow::ctConfigurationBrowserWindow( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) |
| 56 | { |
| 57 | ////@begin ctConfigurationBrowserWindow member initialisation |
| 58 | ////@end ctConfigurationBrowserWindow member initialisation |
| 59 | |
| 60 | wxPanel::Create( parent, id, pos, size, style ); |
| 61 | |
| 62 | CreateControls(); |
| 63 | } |
| 64 | |
| 65 | /*! |
| 66 | * Control creation for ctConfigurationBrowserWindow |
| 67 | */ |
| 68 | |
| 69 | void ctConfigurationBrowserWindow::CreateControls() |
| 70 | { |
| 71 | ////@begin ctConfigurationBrowserWindow content construction |
| 72 | |
| 73 | ctConfigurationBrowserWindow* item1 = this; |
| 74 | |
| 75 | wxBoxSizer* item2 = new wxBoxSizer(wxVERTICAL); |
| 76 | item1->SetSizer(item2); |
| 77 | |
| 78 | wxSplitterWindow* item3 = new wxSplitterWindow(item1, ID_CONFIGBROWSER_SPLITTERWINDOW, wxDefaultPosition, wxSize(400, 400), wxSP_3DBORDER|wxSP_3DSASH|wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE); |
| 79 | wxTreeCtrl* item4 = new wxTreeCtrl(item3, ID_CONFIGURATION_BROWSER_TREECTRL, wxDefaultPosition, wxSize(100, 100), wxTR_SINGLE|wxNO_BORDER); |
| 80 | ctConfigurationBrowserControlPanel* item5 = new ctConfigurationBrowserControlPanel(item3, ID_PANEL, wxDefaultPosition, wxSize(100, 80), wxNO_BORDER|wxTAB_TRAVERSAL); |
| 81 | item3->SplitVertically(item4, item5, 200); |
| 82 | item2->Add(item3, 1, wxGROW, 5); |
| 83 | |
| 84 | ////@end ctConfigurationBrowserWindow content construction |
| 85 | } |
| 86 | |
| 87 | /*! |
| 88 | * Event handler for ID_CONFIGURATION_BROWSER_TREECTRL |
| 89 | */ |
| 90 | |
| 91 | void ctConfigurationBrowserWindow::OnConfigurationBrowserTreectrl( wxTreeEvent& event ) |
| 92 | { |
| 93 | // Replace with custom code |
| 94 | event.Skip(); |
| 95 | } |
| 96 | |
| 97 | /*! |
| 98 | * Should we show tooltips? |
| 99 | */ |
| 100 | |
| 101 | bool ctConfigurationBrowserWindow::ShowToolTips() |
| 102 | { |
| 103 | return true; |
| 104 | } |
| 105 | |
| 106 | /*! |
| 107 | * ctConfigurationBrowserControlPanel type definition |
| 108 | */ |
| 109 | |
| 110 | IMPLEMENT_CLASS( ctConfigurationBrowserControlPanel, wxPanel ) |
| 111 | |
| 112 | /*! |
| 113 | * ctConfigurationBrowserControlPanel event table definition |
| 114 | */ |
| 115 | |
| 116 | BEGIN_EVENT_TABLE( ctConfigurationBrowserControlPanel, wxPanel ) |
| 117 | |
| 118 | ////@begin ctConfigurationBrowserControlPanel event table entries |
| 119 | EVT_BUTTON( ID_ADD_CONFIGURATION, ctConfigurationBrowserControlPanel::OnAddConfiguration ) |
| 120 | EVT_UPDATE_UI( ID_ADD_CONFIGURATION, ctConfigurationBrowserControlPanel::OnUpdateAddConfiguration ) |
| 121 | |
| 122 | EVT_BUTTON( ID_REMOVE_CONFIGURATION, ctConfigurationBrowserControlPanel::OnRemoveConfiguration ) |
| 123 | EVT_UPDATE_UI( ID_REMOVE_CONFIGURATION, ctConfigurationBrowserControlPanel::OnUpdateRemoveConfiguration ) |
| 124 | |
| 125 | EVT_BUTTON( ID_RENAME_CONFIGURATION, ctConfigurationBrowserControlPanel::OnRenameConfiguration ) |
| 126 | EVT_UPDATE_UI( ID_RENAME_CONFIGURATION, ctConfigurationBrowserControlPanel::OnUpdateRenameConfiguration ) |
| 127 | |
| 128 | ////@end ctConfigurationBrowserControlPanel event table entries |
| 129 | |
| 130 | END_EVENT_TABLE() |
| 131 | |
| 132 | /*! |
| 133 | * ctConfigurationBrowserControlPanel constructor |
| 134 | */ |
| 135 | |
| 136 | ctConfigurationBrowserControlPanel::ctConfigurationBrowserControlPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) |
| 137 | { |
| 138 | ////@begin ctConfigurationBrowserControlPanel member initialisation |
| 139 | ////@end ctConfigurationBrowserControlPanel member initialisation |
| 140 | |
| 141 | ////@begin ctConfigurationBrowserControlPanel creation |
| 142 | wxPanel::Create( parent, id, pos, size, style ); |
| 143 | |
| 144 | CreateControls(); |
| 145 | ////@end ctConfigurationBrowserControlPanel creation |
| 146 | } |
| 147 | |
| 148 | /*! |
| 149 | * Control creation for ctConfigurationBrowserControlPanel |
| 150 | */ |
| 151 | |
| 152 | void ctConfigurationBrowserControlPanel::CreateControls() |
| 153 | { |
| 154 | ////@begin ctConfigurationBrowserControlPanel content construction |
| 155 | |
| 156 | ctConfigurationBrowserControlPanel* item5 = this; |
| 157 | |
| 158 | wxBoxSizer* item6 = new wxBoxSizer(wxVERTICAL); |
| 159 | item5->SetSizer(item6); |
| 160 | |
| 161 | wxStaticText* item7 = new wxStaticText(item5, wxID_STATIC, _("Browse, add and remove configurations"), wxDefaultPosition, wxDefaultSize, 0); |
| 162 | item6->Add(item7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxADJUST_MINSIZE, 5); |
| 163 | |
| 164 | item6->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
| 165 | |
| 166 | wxButton* item9 = new wxButton(item5, ID_ADD_CONFIGURATION, _("&Add..."), wxDefaultPosition, wxDefaultSize, 0); |
| 167 | item6->Add(item9, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
| 168 | |
| 169 | wxButton* item10 = new wxButton(item5, ID_REMOVE_CONFIGURATION, _("&Remove..."), wxDefaultPosition, wxDefaultSize, 0); |
| 170 | item6->Add(item10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
| 171 | |
| 172 | wxButton* item11 = new wxButton(item5, ID_RENAME_CONFIGURATION, _("&Rename..."), wxDefaultPosition, wxDefaultSize, 0); |
| 173 | item6->Add(item11, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
| 174 | |
| 175 | item6->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
| 176 | |
| 177 | wxStaticText* item13 = new wxStaticText(item5, ID_CONFIGURATION_NAME, _("Configuration:"), wxDefaultPosition, wxDefaultSize, 0); |
| 178 | item6->Add(item13, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); |
| 179 | |
| 180 | wxTextCtrl* item14 = new wxTextCtrl(item5, ID_CONFIGURATION_DESCRIPTION, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH); |
| 181 | item6->Add(item14, 1, wxGROW|wxALL, 5); |
| 182 | |
| 183 | ////@end ctConfigurationBrowserControlPanel content construction |
| 184 | } |
| 185 | |
| 186 | /*! |
| 187 | * Event handler for ID_ADD_CONFIGURATION |
| 188 | */ |
| 189 | |
| 190 | void ctConfigurationBrowserControlPanel::OnAddConfiguration( wxCommandEvent& event ) |
| 191 | { |
| 192 | // Replace with custom code |
| 193 | event.Skip(); |
| 194 | } |
| 195 | |
| 196 | /*! |
| 197 | * Update event handler for ID_ADD_CONFIGURATION |
| 198 | */ |
| 199 | |
| 200 | void ctConfigurationBrowserControlPanel::OnUpdateAddConfiguration( wxUpdateUIEvent& event ) |
| 201 | { |
| 202 | // Replace with custom code |
| 203 | event.Skip(); |
| 204 | } |
| 205 | |
| 206 | /*! |
| 207 | * Event handler for ID_REMOVE_CONFIGURATION |
| 208 | */ |
| 209 | |
| 210 | void ctConfigurationBrowserControlPanel::OnRemoveConfiguration( wxCommandEvent& event ) |
| 211 | { |
| 212 | // Replace with custom code |
| 213 | event.Skip(); |
| 214 | } |
| 215 | |
| 216 | /*! |
| 217 | * Update event handler for ID_REMOVE_CONFIGURATION |
| 218 | */ |
| 219 | |
| 220 | void ctConfigurationBrowserControlPanel::OnUpdateRemoveConfiguration( wxUpdateUIEvent& event ) |
| 221 | { |
| 222 | // Replace with custom code |
| 223 | event.Skip(); |
| 224 | } |
| 225 | |
| 226 | /*! |
| 227 | * Event handler for ID_RENAME_CONFIGURATION |
| 228 | */ |
| 229 | |
| 230 | void ctConfigurationBrowserControlPanel::OnRenameConfiguration( wxCommandEvent& event ) |
| 231 | { |
| 232 | // Replace with custom code |
| 233 | event.Skip(); |
| 234 | } |
| 235 | |
| 236 | /*! |
| 237 | * Update event handler for ID_RENAME_CONFIGURATION |
| 238 | */ |
| 239 | |
| 240 | void ctConfigurationBrowserControlPanel::OnUpdateRenameConfiguration( wxUpdateUIEvent& event ) |
| 241 | { |
| 242 | // Replace with custom code |
| 243 | event.Skip(); |
| 244 | } |
| 245 | |
| 246 | /*! |
| 247 | * Should we show tooltips? |
| 248 | */ |
| 249 | |
| 250 | bool ctConfigurationBrowserControlPanel::ShowToolTips() |
| 251 | { |
| 252 | return true; |
| 253 | } |