]>
Commit | Line | Data |
---|---|---|
1c005ff7 | 1 | ///////////////////////////////////////////////////////////////////////////// |
dfad0599 | 2 | // Name: controls.cpp |
1c005ff7 RR |
3 | // Purpose: Controls wxWindows sample |
4 | // Author: Robert Roebling | |
5 | // Modified by: | |
6 | // RCS-ID: $Id$ | |
c67d8618 | 7 | // Copyright: (c) Robert Roebling, Julian Smart |
655822f3 | 8 | // Licence: wxWindows license |
1c005ff7 RR |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifdef __GNUG__ | |
9f3362c4 | 12 | #pragma implementation "controls.h" |
1c005ff7 RR |
13 | #endif |
14 | ||
15 | // For compilers that support precompilation, includes "wx/wx.h". | |
16 | #include "wx/wxprec.h" | |
17 | ||
18 | #ifdef __BORLANDC__ | |
9f3362c4 | 19 | #pragma hdrstop |
1c005ff7 RR |
20 | #endif |
21 | ||
22 | #ifndef WX_PRECOMP | |
9f3362c4 | 23 | #include "wx/wx.h" |
1c005ff7 RR |
24 | #endif |
25 | ||
3372145d | 26 | #if !defined( __WXMSW__ ) || defined( __WIN95__ ) |
4fabb575 | 27 | #include "wx/spinbutt.h" |
3372145d | 28 | #endif |
53b28675 | 29 | #include "wx/notebook.h" |
2cb21a45 | 30 | #include "wx/imaglist.h" |
b8653fbf VZ |
31 | |
32 | #if wxUSE_TOOLTIPS | |
33 | #include "wx/tooltip.h" | |
34 | #endif | |
1c005ff7 | 35 | |
4b5f3fe6 | 36 | #if defined(__WXGTK__) || defined(__WXMOTIF__) |
73c700fd | 37 | #define USE_XPM |
4fabb575 JS |
38 | #endif |
39 | ||
40 | #ifdef USE_XPM | |
73c700fd VZ |
41 | #include "mondrian.xpm" |
42 | #include "icons/choice.xpm" | |
43 | #include "icons/combo.xpm" | |
44 | #include "icons/list.xpm" | |
45 | #include "icons/radio.xpm" | |
46 | #include "icons/text.xpm" | |
47 | #include "icons/gauge.xpm" | |
47908e25 RR |
48 | #endif |
49 | ||
9726da4f VZ |
50 | #ifdef __WIN16__ |
51 | // Win16 doesn't have them | |
ad556aa9 | 52 | #ifdef wxUSE_SPINBTN |
0e528b99 | 53 | #undef wxUSE_SPINBTN |
ad556aa9 | 54 | #endif |
0e528b99 | 55 | #define wxUSE_SPINBTN 0 |
b782f2e0 | 56 | #else |
ad556aa9 JS |
57 | #ifndef wxUSE_SPINBTN |
58 | #define wxUSE_SPINBTN 1 | |
b782f2e0 | 59 | #endif |
9726da4f VZ |
60 | #endif // __WIN16__ |
61 | ||
62 | #include "wx/progdlg.h" | |
63 | ||
b782f2e0 VZ |
64 | #if wxUSE_SPINCTRL |
65 | #include "wx/spinctrl.h" | |
66 | #endif // wxUSE_SPINCTRL | |
67 | ||
1c005ff7 RR |
68 | //---------------------------------------------------------------------- |
69 | // class definitions | |
70 | //---------------------------------------------------------------------- | |
71 | ||
72 | class MyApp: public wxApp | |
655822f3 | 73 | { |
b8653fbf VZ |
74 | public: |
75 | bool OnInit(); | |
1c005ff7 RR |
76 | }; |
77 | ||
78 | class MyPanel: public wxPanel | |
79 | { | |
b8653fbf | 80 | public: |
1c005ff7 | 81 | MyPanel(wxFrame *frame, int x, int y, int w, int h); |
2cb21a45 | 82 | virtual ~MyPanel(); |
16f6dfd8 | 83 | |
1c005ff7 RR |
84 | void OnSize( wxSizeEvent& event ); |
85 | void OnListBox( wxCommandEvent &event ); | |
5b077d48 | 86 | void OnListBoxDoubleClick( wxCommandEvent &event ); |
1c005ff7 | 87 | void OnListBoxButtons( wxCommandEvent &event ); |
47908e25 RR |
88 | void OnChoice( wxCommandEvent &event ); |
89 | void OnChoiceButtons( wxCommandEvent &event ); | |
90 | void OnCombo( wxCommandEvent &event ); | |
91 | void OnComboButtons( wxCommandEvent &event ); | |
92 | void OnRadio( wxCommandEvent &event ); | |
93 | void OnRadioButtons( wxCommandEvent &event ); | |
868a2826 | 94 | void OnSetFont( wxCommandEvent &event ); |
cb43b372 | 95 | void OnPageChanged( wxNotebookEvent &event ); |
4d0f3cd6 | 96 | void OnPageChanging( wxNotebookEvent &event ); |
7bce6aec | 97 | void OnSliderUpdate( wxCommandEvent &event ); |
185fa6bf | 98 | void OnUpdateLabel( wxCommandEvent &event ); |
0e528b99 | 99 | #if wxUSE_SPINBTN |
8c3c31d4 VZ |
100 | void OnSpinUp( wxSpinEvent &event ); |
101 | void OnSpinDown( wxSpinEvent &event ); | |
e380f72b | 102 | void OnSpinUpdate( wxSpinEvent &event ); |
9726da4f VZ |
103 | void OnUpdateShowProgress( wxUpdateUIEvent& event ); |
104 | void OnShowProgress( wxCommandEvent &event ); | |
0e528b99 | 105 | #endif // wxUSE_SPINBTN |
16f6dfd8 | 106 | |
baccb514 | 107 | #if wxUSE_SPINCTRL |
57160afe | 108 | void OnSpinCtrl(wxCommandEvent& event); |
baccb514 VZ |
109 | #endif // wxUSE_SPINCTRL |
110 | ||
87a1e308 VZ |
111 | void OnEnableAll(wxCommandEvent& event); |
112 | void OnChangeColour(wxCommandEvent& event); | |
113 | ||
6c8a980f VZ |
114 | wxListBox *m_listbox, |
115 | *m_listboxSorted; | |
b56c2246 VZ |
116 | wxChoice *m_choice, |
117 | *m_choiceSorted; | |
e380f72b RR |
118 | wxComboBox *m_combo; |
119 | wxRadioBox *m_radio; | |
120 | wxGauge *m_gauge; | |
121 | wxSlider *m_slider; | |
122 | wxButton *m_fontButton; | |
85eb36c2 RR |
123 | wxButton *m_lbSelectNum; |
124 | wxButton *m_lbSelectThis; | |
0e528b99 | 125 | #if wxUSE_SPINBTN |
e380f72b | 126 | wxSpinButton *m_spinbutton; |
9726da4f | 127 | wxButton *m_btnProgress; |
0e528b99 | 128 | #endif // wxUSE_SPINBTN |
b782f2e0 VZ |
129 | |
130 | #if wxUSE_SPINCTRL | |
131 | wxSpinCtrl *m_spinctrl; | |
132 | #endif // wxUSE_SPINCTRL | |
133 | ||
e380f72b | 134 | wxTextCtrl *m_spintext; |
ae0bdb01 | 135 | wxCheckBox *m_checkbox; |
16f6dfd8 | 136 | |
e380f72b | 137 | wxTextCtrl *m_text; |
655822f3 VZ |
138 | wxNotebook *m_notebook; |
139 | ||
185fa6bf VZ |
140 | wxStaticText *m_label; |
141 | ||
b8653fbf VZ |
142 | private: |
143 | DECLARE_EVENT_TABLE() | |
1c005ff7 RR |
144 | }; |
145 | ||
146 | class MyFrame: public wxFrame | |
147 | { | |
b8653fbf | 148 | public: |
1c005ff7 | 149 | MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h); |
655822f3 | 150 | |
1c005ff7 RR |
151 | void OnQuit(wxCommandEvent& event); |
152 | void OnAbout(wxCommandEvent& event); | |
87a1e308 | 153 | |
16f6dfd8 VZ |
154 | #if wxUSE_TOOLTIPS |
155 | void OnSetTooltipDelay(wxCommandEvent& event); | |
156 | void OnToggleTooltips(wxCommandEvent& event); | |
157 | #endif // wxUSE_TOOLTIPS | |
87a1e308 VZ |
158 | |
159 | void OnEnableAll(wxCommandEvent& event); | |
160 | ||
9f3362c4 | 161 | void OnIdle( wxIdleEvent& event ); |
5fb9fcfc | 162 | void OnSize( wxSizeEvent& event ); |
97206645 | 163 | void OnMove( wxMoveEvent& event ); |
655822f3 | 164 | |
f048e32f VZ |
165 | MyPanel *GetPanel() const { return m_panel; } |
166 | ||
b8653fbf | 167 | private: |
97206645 VZ |
168 | void UpdateStatusBar(const wxPoint& pos, const wxSize& size) |
169 | { | |
170 | wxString msg; | |
171 | msg.Printf(_("pos=(%d, %d), size=%dx%d"), | |
172 | pos.x, pos.y, size.x, size.y); | |
173 | SetStatusText(msg, 1); | |
174 | } | |
175 | ||
f048e32f | 176 | MyPanel *m_panel; |
87a1e308 | 177 | |
b8653fbf | 178 | DECLARE_EVENT_TABLE() |
1c005ff7 RR |
179 | }; |
180 | ||
181 | //---------------------------------------------------------------------- | |
6c8a980f | 182 | // other |
1c005ff7 RR |
183 | //---------------------------------------------------------------------- |
184 | ||
6c8a980f VZ |
185 | static void SetControlClientData(const char *name, |
186 | wxControlWithItems *control); | |
187 | ||
d59051dd | 188 | IMPLEMENT_APP(MyApp) |
1c005ff7 RR |
189 | |
190 | //---------------------------------------------------------------------- | |
191 | // MyApp | |
192 | //---------------------------------------------------------------------- | |
193 | ||
16f6dfd8 VZ |
194 | enum |
195 | { | |
196 | MINIMAL_QUIT = 100, | |
197 | MINIMAL_TEXT, | |
198 | MINIMAL_ABOUT, | |
199 | ||
200 | // tooltip menu | |
201 | MINIMAL_SET_TOOLTIP_DELAY = 200, | |
87a1e308 VZ |
202 | MINIMAL_ENABLE_TOOLTIPS, |
203 | ||
204 | // panel menu | |
205 | MINIMAL_ENABLE_ALL | |
16f6dfd8 | 206 | }; |
1c005ff7 | 207 | |
b8653fbf | 208 | bool MyApp::OnInit() |
1c005ff7 | 209 | { |
e66ad5c6 VZ |
210 | // parse the cmd line |
211 | int x = 50, | |
212 | y = 50; | |
213 | if ( argc == 2 ) | |
214 | { | |
215 | wxSscanf(argv[1], "%d", &x); | |
216 | wxSscanf(argv[2], "%d", &y); | |
217 | } | |
218 | ||
ec9f7884 VZ |
219 | // Create the main frame window |
220 | MyFrame *frame = new MyFrame((wxFrame *) NULL, | |
221 | "Controls wxWindows App", | |
fb5dc8a2 RR |
222 | x, y, 540, 430); |
223 | ||
224 | frame->SetSizeHints( 500, 425 ); | |
655822f3 | 225 | |
ec9f7884 VZ |
226 | // Give it an icon |
227 | // The wxICON() macros loads an icon from a resource under Windows | |
228 | // and uses an #included XPM image under GTK+ and Motif | |
655822f3 | 229 | |
ec9f7884 | 230 | frame->SetIcon( wxICON(mondrian) ); |
1c005ff7 | 231 | |
6adaedf0 JS |
232 | wxMenu *file_menu = new wxMenu("", wxMENU_TEAROFF); |
233 | ||
6bc8a1c8 | 234 | file_menu->Append(MINIMAL_ABOUT, "&About\tF1"); |
87a1e308 | 235 | file_menu->AppendSeparator(); |
6bc8a1c8 | 236 | file_menu->Append(MINIMAL_QUIT, "E&xit\tAlt-X", "Quit controls sample"); |
16f6dfd8 | 237 | |
33caefb3 | 238 | wxMenuBar *menu_bar = new wxMenuBar; |
ec9f7884 | 239 | menu_bar->Append(file_menu, "&File"); |
16f6dfd8 VZ |
240 | |
241 | #if wxUSE_TOOLTIPS | |
ec9f7884 | 242 | wxMenu *tooltip_menu = new wxMenu; |
6bc8a1c8 | 243 | tooltip_menu->Append(MINIMAL_SET_TOOLTIP_DELAY, "Set &delay\tCtrl-D"); |
ec9f7884 | 244 | tooltip_menu->AppendSeparator(); |
185fa6bf | 245 | tooltip_menu->Append(MINIMAL_ENABLE_TOOLTIPS, "&Toggle tooltips\tCtrl-T", |
ec9f7884 VZ |
246 | "enable/disable tooltips", TRUE); |
247 | tooltip_menu->Check(MINIMAL_ENABLE_TOOLTIPS, TRUE); | |
248 | menu_bar->Append(tooltip_menu, "&Tooltips"); | |
16f6dfd8 VZ |
249 | #endif // wxUSE_TOOLTIPS |
250 | ||
87a1e308 VZ |
251 | wxMenu *panel_menu = new wxMenu; |
252 | panel_menu->Append(MINIMAL_ENABLE_ALL, "&Disable all\tCtrl-E", | |
253 | "Enable/disable all panel controls", TRUE); | |
254 | menu_bar->Append(panel_menu, "&Panel"); | |
255 | ||
ec9f7884 | 256 | frame->SetMenuBar(menu_bar); |
1c005ff7 | 257 | |
ec9f7884 | 258 | frame->Show(TRUE); |
9018abe3 | 259 | frame->SetCursor(wxCursor(wxCURSOR_HAND)); |
655822f3 | 260 | |
9d9b7755 | 261 | frame->GetPanel()->m_notebook->SetSelection(6); |
f048e32f | 262 | |
ec9f7884 | 263 | SetTopWindow(frame); |
1c005ff7 | 264 | |
ec9f7884 | 265 | return TRUE; |
1c005ff7 RR |
266 | } |
267 | ||
268 | //---------------------------------------------------------------------- | |
269 | // MyPanel | |
270 | //---------------------------------------------------------------------- | |
271 | ||
4fabb575 | 272 | const int ID_NOTEBOOK = 1000; |
1c005ff7 | 273 | |
4fabb575 JS |
274 | const int ID_LISTBOX = 130; |
275 | const int ID_LISTBOX_SEL_NUM = 131; | |
276 | const int ID_LISTBOX_SEL_STR = 132; | |
277 | const int ID_LISTBOX_CLEAR = 133; | |
278 | const int ID_LISTBOX_APPEND = 134; | |
279 | const int ID_LISTBOX_DELETE = 135; | |
280 | const int ID_LISTBOX_FONT = 136; | |
281 | const int ID_LISTBOX_ENABLE = 137; | |
6c8a980f | 282 | const int ID_LISTBOX_SORTED = 138; |
1c005ff7 | 283 | |
4fabb575 JS |
284 | const int ID_CHOICE = 120; |
285 | const int ID_CHOICE_SEL_NUM = 121; | |
286 | const int ID_CHOICE_SEL_STR = 122; | |
287 | const int ID_CHOICE_CLEAR = 123; | |
288 | const int ID_CHOICE_APPEND = 124; | |
289 | const int ID_CHOICE_DELETE = 125; | |
290 | const int ID_CHOICE_FONT = 126; | |
291 | const int ID_CHOICE_ENABLE = 127; | |
b56c2246 | 292 | const int ID_CHOICE_SORTED = 128; |
53010e52 | 293 | |
4fabb575 JS |
294 | const int ID_COMBO = 140; |
295 | const int ID_COMBO_SEL_NUM = 141; | |
296 | const int ID_COMBO_SEL_STR = 142; | |
297 | const int ID_COMBO_CLEAR = 143; | |
298 | const int ID_COMBO_APPEND = 144; | |
299 | const int ID_COMBO_DELETE = 145; | |
300 | const int ID_COMBO_FONT = 146; | |
301 | const int ID_COMBO_ENABLE = 147; | |
53010e52 | 302 | |
4fabb575 JS |
303 | const int ID_RADIOBOX = 160; |
304 | const int ID_RADIOBOX_SEL_NUM = 161; | |
305 | const int ID_RADIOBOX_SEL_STR = 162; | |
306 | const int ID_RADIOBOX_FONT = 163; | |
307 | const int ID_RADIOBOX_ENABLE = 164; | |
868a2826 | 308 | |
f5d29b39 RR |
309 | const int ID_RADIOBUTTON_1 = 166; |
310 | const int ID_RADIOBUTTON_2 = 167; | |
311 | ||
4fabb575 | 312 | const int ID_SET_FONT = 170; |
47908e25 | 313 | |
4fabb575 JS |
314 | const int ID_GAUGE = 180; |
315 | const int ID_SLIDER = 181; | |
58614078 | 316 | |
4fabb575 | 317 | const int ID_SPIN = 182; |
9726da4f | 318 | const int ID_BTNPROGRESS = 183; |
185fa6bf | 319 | const int ID_BUTTON_LABEL = 184; |
baccb514 | 320 | const int ID_SPINCTRL = 185; |
e380f72b | 321 | |
87a1e308 VZ |
322 | const int ID_CHANGE_COLOUR = 200; |
323 | ||
1c005ff7 | 324 | BEGIN_EVENT_TABLE(MyPanel, wxPanel) |
ec9f7884 | 325 | EVT_SIZE ( MyPanel::OnSize) |
4d0f3cd6 | 326 | EVT_NOTEBOOK_PAGE_CHANGING(ID_NOTEBOOK, MyPanel::OnPageChanging) |
ec9f7884 VZ |
327 | EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, MyPanel::OnPageChanged) |
328 | EVT_LISTBOX (ID_LISTBOX, MyPanel::OnListBox) | |
6c8a980f | 329 | EVT_LISTBOX (ID_LISTBOX_SORTED, MyPanel::OnListBox) |
ec9f7884 VZ |
330 | EVT_LISTBOX_DCLICK(ID_LISTBOX, MyPanel::OnListBoxDoubleClick) |
331 | EVT_BUTTON (ID_LISTBOX_SEL_NUM, MyPanel::OnListBoxButtons) | |
332 | EVT_BUTTON (ID_LISTBOX_SEL_STR, MyPanel::OnListBoxButtons) | |
333 | EVT_BUTTON (ID_LISTBOX_CLEAR, MyPanel::OnListBoxButtons) | |
334 | EVT_BUTTON (ID_LISTBOX_APPEND, MyPanel::OnListBoxButtons) | |
335 | EVT_BUTTON (ID_LISTBOX_DELETE, MyPanel::OnListBoxButtons) | |
336 | EVT_BUTTON (ID_LISTBOX_FONT, MyPanel::OnListBoxButtons) | |
337 | EVT_CHECKBOX (ID_LISTBOX_ENABLE, MyPanel::OnListBoxButtons) | |
338 | EVT_CHOICE (ID_CHOICE, MyPanel::OnChoice) | |
b56c2246 | 339 | EVT_CHOICE (ID_CHOICE_SORTED, MyPanel::OnChoice) |
ec9f7884 VZ |
340 | EVT_BUTTON (ID_CHOICE_SEL_NUM, MyPanel::OnChoiceButtons) |
341 | EVT_BUTTON (ID_CHOICE_SEL_STR, MyPanel::OnChoiceButtons) | |
342 | EVT_BUTTON (ID_CHOICE_CLEAR, MyPanel::OnChoiceButtons) | |
343 | EVT_BUTTON (ID_CHOICE_APPEND, MyPanel::OnChoiceButtons) | |
344 | EVT_BUTTON (ID_CHOICE_DELETE, MyPanel::OnChoiceButtons) | |
345 | EVT_BUTTON (ID_CHOICE_FONT, MyPanel::OnChoiceButtons) | |
346 | EVT_CHECKBOX (ID_CHOICE_ENABLE, MyPanel::OnChoiceButtons) | |
347 | EVT_COMBOBOX (ID_COMBO, MyPanel::OnCombo) | |
348 | EVT_BUTTON (ID_COMBO_SEL_NUM, MyPanel::OnComboButtons) | |
349 | EVT_BUTTON (ID_COMBO_SEL_STR, MyPanel::OnComboButtons) | |
350 | EVT_BUTTON (ID_COMBO_CLEAR, MyPanel::OnComboButtons) | |
351 | EVT_BUTTON (ID_COMBO_APPEND, MyPanel::OnComboButtons) | |
352 | EVT_BUTTON (ID_COMBO_DELETE, MyPanel::OnComboButtons) | |
353 | EVT_BUTTON (ID_COMBO_FONT, MyPanel::OnComboButtons) | |
354 | EVT_CHECKBOX (ID_COMBO_ENABLE, MyPanel::OnComboButtons) | |
355 | EVT_RADIOBOX (ID_RADIOBOX, MyPanel::OnRadio) | |
356 | EVT_BUTTON (ID_RADIOBOX_SEL_NUM, MyPanel::OnRadioButtons) | |
357 | EVT_BUTTON (ID_RADIOBOX_SEL_STR, MyPanel::OnRadioButtons) | |
358 | EVT_BUTTON (ID_RADIOBOX_FONT, MyPanel::OnRadioButtons) | |
359 | EVT_CHECKBOX (ID_RADIOBOX_ENABLE, MyPanel::OnRadioButtons) | |
360 | EVT_BUTTON (ID_SET_FONT, MyPanel::OnSetFont) | |
361 | EVT_SLIDER (ID_SLIDER, MyPanel::OnSliderUpdate) | |
0e528b99 | 362 | #if wxUSE_SPINBTN |
ec9f7884 | 363 | EVT_SPIN (ID_SPIN, MyPanel::OnSpinUpdate) |
8c3c31d4 VZ |
364 | EVT_SPIN_UP (ID_SPIN, MyPanel::OnSpinUp) |
365 | EVT_SPIN_DOWN (ID_SPIN, MyPanel::OnSpinDown) | |
9726da4f VZ |
366 | EVT_UPDATE_UI (ID_BTNPROGRESS, MyPanel::OnUpdateShowProgress) |
367 | EVT_BUTTON (ID_BTNPROGRESS, MyPanel::OnShowProgress) | |
0e528b99 | 368 | #endif // wxUSE_SPINBTN |
baccb514 | 369 | #if wxUSE_SPINCTRL |
57160afe | 370 | EVT_SPINCTRL (ID_SPINCTRL, MyPanel::OnSpinCtrl) |
baccb514 | 371 | #endif // wxUSE_SPINCTRL |
185fa6bf | 372 | EVT_BUTTON (ID_BUTTON_LABEL, MyPanel::OnUpdateLabel) |
87a1e308 | 373 | EVT_CHECKBOX (ID_CHANGE_COLOUR, MyPanel::OnChangeColour) |
1c005ff7 RR |
374 | END_EVENT_TABLE() |
375 | ||
5fb9fcfc | 376 | MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) |
0a772322 VZ |
377 | : wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) ), |
378 | m_text(NULL), m_notebook(NULL) | |
1c005ff7 | 379 | { |
9d9b7755 VZ |
380 | wxLayoutConstraints *c; |
381 | ||
ec9f7884 VZ |
382 | m_text = new wxTextCtrl( this, -1, "This is the log window.\n", wxPoint(0,50), wxSize(100,50), wxTE_MULTILINE ); |
383 | // m_text->SetBackgroundColour("wheat"); | |
655822f3 | 384 | |
57160afe | 385 | //delete wxLog::SetActiveTarget(new wxLogStderr); |
0a772322 | 386 | |
ec9f7884 | 387 | m_notebook = new wxNotebook( this, ID_NOTEBOOK, wxPoint(0,0), wxSize(200,150) ); |
655822f3 | 388 | |
ec9f7884 VZ |
389 | wxString choices[] = |
390 | { | |
391 | "This", | |
392 | "is one of my", | |
393 | "really", | |
394 | "wonderful", | |
395 | "examples." | |
396 | }; | |
655822f3 | 397 | |
4fabb575 | 398 | #ifdef USE_XPM |
ec9f7884 VZ |
399 | // image ids |
400 | enum | |
401 | { | |
402 | Image_List, Image_Choice, Image_Combo, Image_Text, Image_Radio, Image_Gauge, Image_Max | |
403 | }; | |
404 | ||
405 | // fill the image list | |
406 | wxImageList *imagelist = new wxImageList(32, 32); | |
407 | ||
408 | imagelist-> Add( wxBitmap( list_xpm )); | |
409 | imagelist-> Add( wxBitmap( choice_xpm )); | |
410 | imagelist-> Add( wxBitmap( combo_xpm )); | |
411 | imagelist-> Add( wxBitmap( text_xpm )); | |
412 | imagelist-> Add( wxBitmap( radio_xpm )); | |
413 | imagelist-> Add( wxBitmap( gauge_xpm )); | |
414 | m_notebook->SetImageList(imagelist); | |
73c700fd | 415 | #elif defined(__WXMSW__) |
ec9f7884 VZ |
416 | // load images from resources |
417 | enum | |
418 | { | |
419 | Image_List, Image_Choice, Image_Combo, Image_Text, Image_Radio, Image_Gauge, Image_Max | |
420 | }; | |
421 | wxImageList *imagelist = new wxImageList(16, 16, FALSE, Image_Max); | |
422 | ||
423 | static const char *s_iconNames[Image_Max] = | |
424 | { | |
425 | "list", "choice", "combo", "text", "radio", "gauge" | |
426 | }; | |
427 | ||
428 | for ( size_t n = 0; n < Image_Max; n++ ) | |
429 | { | |
430 | wxBitmap bmp(s_iconNames[n]); | |
431 | if ( !bmp.Ok() || (imagelist->Add(bmp) == -1) ) | |
432 | { | |
433 | wxLogWarning("Couldn't load the image '%s' for the notebook page %d.", | |
434 | s_iconNames[n], n); | |
435 | } | |
436 | } | |
437 | ||
438 | m_notebook->SetImageList(imagelist); | |
4fabb575 JS |
439 | #else |
440 | ||
ec9f7884 | 441 | // No images for now |
4fabb575 JS |
442 | #define Image_List -1 |
443 | #define Image_Choice -1 | |
444 | #define Image_Combo -1 | |
445 | #define Image_Text -1 | |
446 | #define Image_Radio -1 | |
447 | #define Image_Gauge -1 | |
448 | #define Image_Max -1 | |
449 | ||
fc54776e | 450 | #endif |
2cb21a45 | 451 | |
6c8a980f VZ |
452 | wxPanel *panel = new wxPanel(m_notebook); |
453 | m_listbox = new wxListBox( panel, ID_LISTBOX, | |
454 | wxPoint(10,10), wxSize(120,70), | |
354aa1e3 | 455 | 5, choices, wxLB_ALWAYS_SB ); |
6c8a980f VZ |
456 | m_listboxSorted = new wxListBox( panel, ID_LISTBOX_SORTED, |
457 | wxPoint(10,90), wxSize(120,70), | |
354aa1e3 | 458 | 5, choices, wxLB_SORT ); |
6c8a980f VZ |
459 | |
460 | SetControlClientData("listbox", m_listbox); | |
461 | SetControlClientData("listbox", m_listboxSorted); | |
9838df2c | 462 | |
ec9f7884 | 463 | m_listbox->SetCursor(*wxCROSS_CURSOR); |
b8653fbf | 464 | #if wxUSE_TOOLTIPS |
ec9f7884 | 465 | m_listbox->SetToolTip( "This is a list box" ); |
16f6dfd8 | 466 | #endif // wxUSE_TOOLTIPS |
9f3362c4 | 467 | |
85eb36c2 RR |
468 | m_lbSelectNum = new wxButton( panel, ID_LISTBOX_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) ); |
469 | m_lbSelectThis = new wxButton( panel, ID_LISTBOX_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) ); | |
ec9f7884 VZ |
470 | (void)new wxButton( panel, ID_LISTBOX_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) ); |
471 | (void)new wxButton( panel, ID_LISTBOX_APPEND, "Append 'Hi!'", wxPoint(340,80), wxSize(140,30) ); | |
472 | (void)new wxButton( panel, ID_LISTBOX_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) ); | |
6c8a980f | 473 | wxButton *button = new wxButton( panel, ID_LISTBOX_FONT, "Set &Italic font", wxPoint(340,130), wxSize(140,30) ); |
57160afe VZ |
474 | |
475 | button->SetDefault(); | |
476 | ||
477 | button->SetForegroundColour(*wxBLUE); | |
478 | ||
b8653fbf | 479 | #if wxUSE_TOOLTIPS |
ec9f7884 | 480 | button->SetToolTip( "Press here to set italic font" ); |
16f6dfd8 | 481 | #endif // wxUSE_TOOLTIPS |
b1170810 | 482 | |
6c8a980f | 483 | m_checkbox = new wxCheckBox( panel, ID_LISTBOX_ENABLE, "&Disable", wxPoint(20,170) ); |
ec9f7884 | 484 | m_checkbox->SetValue(FALSE); |
b8653fbf | 485 | #if wxUSE_TOOLTIPS |
ec9f7884 | 486 | m_checkbox->SetToolTip( "Click here to disable the listbox" ); |
16f6dfd8 | 487 | #endif // wxUSE_TOOLTIPS |
87a1e308 VZ |
488 | (void)new wxCheckBox( panel, ID_CHANGE_COLOUR, "&Toggle colour", |
489 | wxPoint(110,170) ); | |
ec9f7884 VZ |
490 | m_notebook->AddPage(panel, "wxListBox", TRUE, Image_List); |
491 | ||
492 | panel = new wxPanel(m_notebook); | |
493 | m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 5, choices ); | |
b56c2246 VZ |
494 | m_choiceSorted = new wxChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,-1), |
495 | 5, choices, wxCB_SORT ); | |
6c8a980f | 496 | |
6adaedf0 | 497 | #ifndef __WXMOTIF__ |
6c8a980f VZ |
498 | SetControlClientData("choice", m_choice); |
499 | SetControlClientData("choice", m_choiceSorted); | |
6adaedf0 | 500 | #endif |
6c8a980f | 501 | |
ddc8c2e3 | 502 | m_choice->SetSelection(2); |
2b07d713 | 503 | m_choice->SetBackgroundColour( "red" ); |
ec9f7884 VZ |
504 | (void)new wxButton( panel, ID_CHOICE_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) ); |
505 | (void)new wxButton( panel, ID_CHOICE_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) ); | |
506 | (void)new wxButton( panel, ID_CHOICE_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) ); | |
507 | (void)new wxButton( panel, ID_CHOICE_APPEND, "Append 'Hi!'", wxPoint(340,80), wxSize(140,30) ); | |
508 | (void)new wxButton( panel, ID_CHOICE_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) ); | |
509 | (void)new wxButton( panel, ID_CHOICE_FONT, "Set Italic font", wxPoint(340,130), wxSize(140,30) ); | |
510 | (void)new wxCheckBox( panel, ID_CHOICE_ENABLE, "Disable", wxPoint(20,130), wxSize(140,30) ); | |
1fad4c3e | 511 | |
ec9f7884 VZ |
512 | m_notebook->AddPage(panel, "wxChoice", FALSE, Image_Choice); |
513 | ||
514 | panel = new wxPanel(m_notebook); | |
f048e32f VZ |
515 | (void)new wxStaticBox( panel, -1, "Box around combobox", |
516 | wxPoint(5, 5), wxSize(150, 100)); | |
07f5b19a | 517 | m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(20,25), wxSize(120,-1), 5, choices, wxCB_READONLY ); |
ec9f7884 VZ |
518 | (void)new wxButton( panel, ID_COMBO_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) ); |
519 | (void)new wxButton( panel, ID_COMBO_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) ); | |
520 | (void)new wxButton( panel, ID_COMBO_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) ); | |
521 | (void)new wxButton( panel, ID_COMBO_APPEND, "Append 'Hi!'", wxPoint(340,80), wxSize(140,30) ); | |
522 | (void)new wxButton( panel, ID_COMBO_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) ); | |
523 | (void)new wxButton( panel, ID_COMBO_FONT, "Set Italic font", wxPoint(340,130), wxSize(140,30) ); | |
524 | (void)new wxCheckBox( panel, ID_COMBO_ENABLE, "Disable", wxPoint(20,130), wxSize(140,30) ); | |
525 | m_notebook->AddPage(panel, "wxComboBox", FALSE, Image_Combo); | |
526 | ||
ec9f7884 VZ |
527 | wxString choices2[] = |
528 | { | |
17867d61 | 529 | "First", "Second", |
0a772322 | 530 | /* "Third", |
17867d61 RR |
531 | "Fourth", "Fifth", "Sixth", |
532 | "Seventh", "Eighth", "Nineth", "Tenth" */ | |
ec9f7884 VZ |
533 | }; |
534 | ||
535 | panel = new wxPanel(m_notebook); | |
9018abe3 VZ |
536 | (void)new wxRadioBox( panel, ID_RADIOBOX, "That", wxPoint(10,160), wxSize(-1,-1), WXSIZEOF(choices2), choices2, 1, wxRA_SPECIFY_ROWS ); |
537 | m_radio = new wxRadioBox( panel, ID_RADIOBOX, "This", wxPoint(10,10), wxSize(-1,-1), WXSIZEOF(choices), choices, 1, wxRA_SPECIFY_COLS ); | |
f048e32f VZ |
538 | |
539 | #if wxUSE_TOOLTIPS | |
540 | m_radio->SetToolTip("Ever seen a radiobox?"); | |
541 | #endif // wxUSE_TOOLTIPS | |
542 | ||
ec9f7884 VZ |
543 | (void)new wxButton( panel, ID_RADIOBOX_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) ); |
544 | (void)new wxButton( panel, ID_RADIOBOX_SEL_STR, "Select 'This'", wxPoint(180,80), wxSize(140,30) ); | |
545 | m_fontButton = new wxButton( panel, ID_SET_FONT, "Set more Italic font", wxPoint(340,30), wxSize(140,30) ); | |
546 | (void)new wxButton( panel, ID_RADIOBOX_FONT, "Set Italic font", wxPoint(340,80), wxSize(140,30) ); | |
547 | (void)new wxCheckBox( panel, ID_RADIOBOX_ENABLE, "Disable", wxPoint(340,130), wxSize(140,30) ); | |
0544bc0a | 548 | wxRadioButton *rb = new wxRadioButton( panel, ID_RADIOBUTTON_1, "Radiobutton1", wxPoint(210,170), wxSize(110,30), wxRB_GROUP ); |
ec9f7884 VZ |
549 | rb->SetValue( FALSE ); |
550 | (void)new wxRadioButton( panel, ID_RADIOBUTTON_2, "Radiobutton2", wxPoint(340,170), wxSize(110,30) ); | |
551 | m_notebook->AddPage(panel, "wxRadioBox", FALSE, Image_Radio); | |
552 | ||
553 | panel = new wxPanel(m_notebook); | |
33961d59 | 554 | (void)new wxStaticBox( panel, -1, "wxGauge and wxSlider", wxPoint(10,10), wxSize(200,130) ); |
ec9f7884 | 555 | m_gauge = new wxGauge( panel, -1, 200, wxPoint(18,50), wxSize(155, 30) ); |
858b5bdd | 556 | m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1), wxSL_LABELS ); |
33961d59 | 557 | (void)new wxStaticBox( panel, -1, "Explanation", wxPoint(220,10), wxSize(270,130) ); |
9838df2c | 558 | #ifdef __WXMOTIF__ |
ec9f7884 VZ |
559 | // No wrapping text in wxStaticText yet :-( |
560 | (void)new wxStaticText( panel, -1, | |
561 | "Drag the slider!", | |
33961d59 | 562 | wxPoint(228,30), |
e65cc56a | 563 | wxSize(240, -1) |
ec9f7884 | 564 | ); |
9838df2c | 565 | #else |
ec9f7884 VZ |
566 | (void)new wxStaticText( panel, -1, |
567 | "In order see the gauge (aka progress bar)\n" | |
568 | "control do something you have to drag the\n" | |
569 | "handle of the slider to the right.\n" | |
570 | "\n" | |
571 | "This is also supposed to demonstrate how\n" | |
572 | "to use static controls.\n", | |
8c3c31d4 VZ |
573 | wxPoint(228,25), |
574 | wxSize(240, 110) | |
ec9f7884 | 575 | ); |
9838df2c | 576 | #endif |
8c3c31d4 VZ |
577 | int initialSpinValue = -5; |
578 | wxString s; | |
579 | s << initialSpinValue; | |
580 | m_spintext = new wxTextCtrl( panel, -1, s, wxPoint(20,160), wxSize(80,-1) ); | |
0e528b99 | 581 | #if wxUSE_SPINBTN |
738f9e5a | 582 | m_spinbutton = new wxSpinButton( panel, ID_SPIN, wxPoint(103,160), wxSize(80, -1) ); |
6380910c | 583 | m_spinbutton->SetRange(-10,30); |
8c3c31d4 | 584 | m_spinbutton->SetValue(initialSpinValue); |
9726da4f VZ |
585 | |
586 | m_btnProgress = new wxButton( panel, ID_BTNPROGRESS, "Show progress dialog", | |
738f9e5a | 587 | wxPoint(300, 160) ); |
0e528b99 | 588 | #endif // wxUSE_SPINBTN |
b782f2e0 VZ |
589 | |
590 | #if wxUSE_SPINCTRL | |
678cd6de | 591 | m_spinctrl = new wxSpinCtrl( panel, ID_SPINCTRL, "", wxPoint(200, 160), wxSize(80, -1) ); |
b782f2e0 VZ |
592 | m_spinctrl->SetRange(10,30); |
593 | m_spinctrl->SetValue(15); | |
594 | #endif // wxUSE_SPINCTRL | |
595 | ||
ec9f7884 | 596 | m_notebook->AddPage(panel, "wxGauge", FALSE, Image_Gauge); |
45e41c05 VZ |
597 | |
598 | panel = new wxPanel(m_notebook); | |
b782f2e0 | 599 | |
556921dc | 600 | #ifndef __WXMOTIF__ // wxStaticBitmap not working under Motif yet. MB |
45e41c05 | 601 | wxIcon icon = wxTheApp->GetStdIcon(wxICON_INFORMATION); |
f048e32f VZ |
602 | wxStaticBitmap *bmpStatic = new wxStaticBitmap(panel, -1, icon, |
603 | wxPoint(10, 10)); | |
45e41c05 VZ |
604 | |
605 | bmpStatic = new wxStaticBitmap(panel, -1, wxNullIcon, wxPoint(50, 10)); | |
606 | bmpStatic->SetIcon(wxTheApp->GetStdIcon(wxICON_QUESTION)); | |
b782f2e0 VZ |
607 | #endif // !Motif |
608 | ||
45e41c05 VZ |
609 | wxBitmap bitmap( 100, 100 ); |
610 | wxMemoryDC dc; | |
611 | dc.SelectObject( bitmap ); | |
612 | dc.SetPen(*wxGREEN_PEN); | |
f048e32f | 613 | dc.Clear(); |
45e41c05 | 614 | dc.DrawEllipse(5, 5, 90, 90); |
f048e32f | 615 | dc.DrawText("Bitmap", 30, 40); |
45e41c05 VZ |
616 | dc.SelectObject( wxNullBitmap ); |
617 | ||
185fa6bf | 618 | (void)new wxBitmapButton(panel, -1, bitmap, wxPoint(100, 20)); |
f048e32f | 619 | |
57160afe | 620 | #if 0 |
5ef2e633 VZ |
621 | bitmap = wxBitmap("../../utils/wxPython/tests/bitmaps/test2.bmp", |
622 | wxBITMAP_TYPE_BMP); | |
623 | bitmap.SetMask(new wxMask(bitmap, *wxBLUE)); | |
624 | (void)new wxBitmapButton(panel, -1, bitmap, wxPoint(300, 120)); | |
57160afe | 625 | #endif |
5ef2e633 | 626 | |
f048e32f VZ |
627 | wxBitmap bmp1(wxTheApp->GetStdIcon(wxICON_INFORMATION)), |
628 | bmp2(wxTheApp->GetStdIcon(wxICON_WARNING)), | |
629 | bmp3(wxTheApp->GetStdIcon(wxICON_QUESTION)); | |
630 | wxBitmapButton *bmpBtn = new wxBitmapButton | |
631 | ( | |
632 | panel, -1, | |
633 | bmp1, | |
634 | wxPoint(30, 50) | |
635 | ); | |
636 | bmpBtn->SetBitmapSelected(bmp2); | |
637 | bmpBtn->SetBitmapFocus(bmp3); | |
638 | ||
185fa6bf VZ |
639 | (void)new wxButton(panel, ID_BUTTON_LABEL, "Toggle label", wxPoint(250, 20)); |
640 | m_label = new wxStaticText(panel, -1, "Label with some long text", | |
641 | wxPoint(250, 60), wxDefaultSize, | |
642 | wxALIGN_RIGHT | wxST_NO_AUTORESIZE); | |
2ac1b69a | 643 | |
45e41c05 | 644 | m_notebook->AddPage(panel, "wxBitmapXXX"); |
dcc71398 | 645 | |
9d9b7755 | 646 | // layout constraints |
dcc71398 | 647 | |
9d9b7755 VZ |
648 | panel = new wxPanel(m_notebook); |
649 | panel->SetAutoLayout( TRUE ); | |
d7928388 | 650 | |
9d9b7755 VZ |
651 | c = new wxLayoutConstraints; |
652 | c->top.SameAs( panel, wxTop, 10 ); | |
653 | c->height.AsIs( ); | |
654 | c->left.SameAs( panel, wxLeft, 10 ); | |
655 | c->width.PercentOf( panel, wxWidth, 40 ); | |
d7928388 | 656 | |
9d9b7755 VZ |
657 | wxButton *pMyButton = new wxButton(panel, -1, "Test Button" ); |
658 | pMyButton->SetConstraints( c ); | |
d7928388 | 659 | |
9d9b7755 VZ |
660 | c = new wxLayoutConstraints; |
661 | c->top.SameAs( panel, wxTop, 10 ); | |
662 | c->bottom.SameAs( panel, wxBottom, 10 ); | |
663 | c->right.SameAs( panel, wxRight, 10 ); | |
664 | c->width.PercentOf( panel, wxWidth, 40 ); | |
185fa6bf | 665 | |
9d9b7755 VZ |
666 | wxButton *pMyButton2 = new wxButton(panel, -1, "Test Button 2" ); |
667 | pMyButton2->SetConstraints( c ); | |
185fa6bf | 668 | |
9d9b7755 | 669 | m_notebook->AddPage(panel, "wxLayoutConstraint"); |
d7928388 | 670 | |
9d9b7755 | 671 | // sizer |
dcc71398 | 672 | |
9d9b7755 VZ |
673 | panel = new wxPanel(m_notebook); |
674 | panel->SetAutoLayout( TRUE ); | |
dcc71398 | 675 | |
9d9b7755 VZ |
676 | wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL ); |
677 | ||
678 | sizer->Add( new wxButton(panel, -1, "Test Button" ), 3, wxALL, 10 ); | |
679 | sizer->Add( 20,20, 1 ); | |
680 | sizer->Add( new wxButton(panel, -1, "Test Button 2" ), 3, wxGROW|wxALL, 10 ); | |
681 | ||
682 | panel->SetSizer( sizer ); | |
683 | ||
684 | m_notebook->AddPage(panel, "wxSizer"); | |
1c005ff7 RR |
685 | } |
686 | ||
687 | void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) ) | |
688 | { | |
ec9f7884 VZ |
689 | int x = 0; |
690 | int y = 0; | |
691 | GetClientSize( &x, &y ); | |
655822f3 | 692 | |
ec9f7884 VZ |
693 | if (m_notebook) m_notebook->SetSize( 2, 2, x-4, y*2/3-4 ); |
694 | if (m_text) m_text->SetSize( 2, y*2/3+2, x-4, y/3-4 ); | |
1c005ff7 RR |
695 | } |
696 | ||
4d0f3cd6 VZ |
697 | void MyPanel::OnPageChanging( wxNotebookEvent &event ) |
698 | { | |
45e41c05 VZ |
699 | int selOld = event.GetOldSelection(); |
700 | if ( selOld == 2 ) | |
4d0f3cd6 | 701 | { |
65045edd RR |
702 | if ( wxMessageBox("This demonstrates how a program may prevent the\n" |
703 | "page change from taking place - if you select\n" | |
704 | "[No] the current page will stay the third one\n", | |
8c3c31d4 VZ |
705 | "Control sample", |
706 | wxICON_QUESTION | wxYES_NO) != wxYES ) | |
707 | { | |
708 | event.Veto(); | |
45e41c05 | 709 | |
8c3c31d4 VZ |
710 | return; |
711 | } | |
4d0f3cd6 | 712 | } |
45e41c05 VZ |
713 | |
714 | *m_text << "Notebook selection is being changed from " << selOld << "\n"; | |
4d0f3cd6 VZ |
715 | } |
716 | ||
cb43b372 RR |
717 | void MyPanel::OnPageChanged( wxNotebookEvent &event ) |
718 | { | |
ec9f7884 | 719 | *m_text << "Notebook selection is " << event.GetSelection() << "\n"; |
cb43b372 RR |
720 | } |
721 | ||
87a1e308 VZ |
722 | void MyPanel::OnChangeColour(wxCommandEvent& WXUNUSED(event)) |
723 | { | |
724 | static wxColour s_colOld; | |
725 | ||
726 | // test panel colour changing and propagation to the subcontrols | |
727 | if ( s_colOld.Ok() ) | |
728 | { | |
729 | SetBackgroundColour(s_colOld); | |
730 | s_colOld = wxNullColour; | |
731 | ||
57160afe | 732 | m_lbSelectThis->SetForegroundColour("yellow"); |
87a1e308 VZ |
733 | m_lbSelectThis->SetBackgroundColour("blue"); |
734 | } | |
735 | else | |
736 | { | |
737 | s_colOld = GetBackgroundColour(); | |
738 | SetBackgroundColour("green"); | |
739 | ||
57160afe | 740 | m_lbSelectThis->SetForegroundColour("white"); |
87a1e308 VZ |
741 | m_lbSelectThis->SetBackgroundColour("red"); |
742 | } | |
743 | ||
744 | m_lbSelectThis->Refresh(); | |
745 | Refresh(); | |
746 | } | |
747 | ||
1c005ff7 RR |
748 | void MyPanel::OnListBox( wxCommandEvent &event ) |
749 | { | |
2e0e025e | 750 | // GetParent()->Move(100, 100); |
e66ad5c6 | 751 | |
6c8a980f VZ |
752 | wxListBox *listbox = event.GetId() == ID_LISTBOX ? m_listbox |
753 | : m_listboxSorted; | |
754 | ||
755 | m_text->AppendText( "ListBox event selection string is: '" ); | |
ec9f7884 | 756 | m_text->AppendText( event.GetString() ); |
6c8a980f VZ |
757 | m_text->AppendText( "'\n" ); |
758 | m_text->AppendText( "ListBox control selection string is: '" ); | |
759 | m_text->AppendText( listbox->GetStringSelection() ); | |
760 | m_text->AppendText( "'\n" ); | |
761 | ||
762 | wxStringClientData *obj = ((wxStringClientData *)event.GetClientObject()); | |
763 | m_text->AppendText( "ListBox event client data string is: '" ); | |
6e47faf1 | 764 | if (obj) // BC++ doesn't like use of '? .. : .. ' in this context |
74a533f7 | 765 | m_text->AppendText( obj->GetData() ); |
6e47faf1 | 766 | else |
74a533f7 | 767 | m_text->AppendText( wxString("none") ); |
6e47faf1 | 768 | |
6c8a980f VZ |
769 | m_text->AppendText( "'\n" ); |
770 | m_text->AppendText( "ListBox control client data string is: '" ); | |
771 | obj = (wxStringClientData *)listbox->GetClientObject(listbox->GetSelection()); | |
6e47faf1 | 772 | if (obj) |
74a533f7 | 773 | m_text->AppendText( obj->GetData() ); |
6e47faf1 | 774 | else |
74a533f7 | 775 | m_text->AppendText( wxString("none") ); |
6c8a980f | 776 | m_text->AppendText( "'\n" ); |
1c005ff7 RR |
777 | } |
778 | ||
5b077d48 RR |
779 | void MyPanel::OnListBoxDoubleClick( wxCommandEvent &event ) |
780 | { | |
ec9f7884 VZ |
781 | m_text->AppendText( "ListBox double click string is: " ); |
782 | m_text->AppendText( event.GetString() ); | |
783 | m_text->AppendText( "\n" ); | |
5b077d48 RR |
784 | } |
785 | ||
47908e25 RR |
786 | void MyPanel::OnListBoxButtons( wxCommandEvent &event ) |
787 | { | |
ec9f7884 | 788 | switch (event.GetId()) |
d3904ceb | 789 | { |
ec9f7884 VZ |
790 | case ID_LISTBOX_ENABLE: |
791 | { | |
792 | m_text->AppendText("Checkbox clicked.\n"); | |
793 | wxCheckBox *cb = (wxCheckBox*)event.GetEventObject(); | |
b8653fbf | 794 | #if wxUSE_TOOLTIPS |
ec9f7884 VZ |
795 | if (event.GetInt()) |
796 | cb->SetToolTip( "Click to enable listbox" ); | |
797 | else | |
798 | cb->SetToolTip( "Click to disable listbox" ); | |
16f6dfd8 | 799 | #endif // wxUSE_TOOLTIPS |
ec9f7884 | 800 | m_listbox->Enable( event.GetInt() == 0 ); |
57160afe VZ |
801 | m_lbSelectThis->Enable( event.GetInt() == 0 ); |
802 | m_lbSelectNum->Enable( event.GetInt() == 0 ); | |
6c8a980f | 803 | m_listboxSorted->Enable( event.GetInt() == 0 ); |
ec9f7884 VZ |
804 | break; |
805 | } | |
806 | case ID_LISTBOX_SEL_NUM: | |
807 | { | |
808 | m_listbox->SetSelection( 2 ); | |
6c8a980f | 809 | m_listboxSorted->SetSelection( 2 ); |
8c3c31d4 | 810 | m_lbSelectThis->WarpPointer( 40, 14 ); |
ec9f7884 VZ |
811 | break; |
812 | } | |
813 | case ID_LISTBOX_SEL_STR: | |
814 | { | |
815 | m_listbox->SetStringSelection( "This" ); | |
6c8a980f | 816 | m_listboxSorted->SetStringSelection( "This" ); |
8c3c31d4 | 817 | m_lbSelectNum->WarpPointer( 40, 14 ); |
ec9f7884 VZ |
818 | break; |
819 | } | |
820 | case ID_LISTBOX_CLEAR: | |
821 | { | |
822 | m_listbox->Clear(); | |
6c8a980f | 823 | m_listboxSorted->Clear(); |
ec9f7884 VZ |
824 | break; |
825 | } | |
826 | case ID_LISTBOX_APPEND: | |
827 | { | |
828 | m_listbox->Append( "Hi!" ); | |
6c8a980f | 829 | m_listboxSorted->Append( "Hi!" ); |
ec9f7884 VZ |
830 | break; |
831 | } | |
832 | case ID_LISTBOX_DELETE: | |
833 | { | |
6c8a980f VZ |
834 | int idx; |
835 | idx = m_listbox->GetSelection(); | |
ec9f7884 | 836 | m_listbox->Delete( idx ); |
6c8a980f VZ |
837 | idx = m_listboxSorted->GetSelection(); |
838 | m_listboxSorted->Delete( idx ); | |
ec9f7884 VZ |
839 | break; |
840 | } | |
841 | case ID_LISTBOX_FONT: | |
842 | { | |
843 | m_listbox->SetFont( *wxITALIC_FONT ); | |
6c8a980f | 844 | m_listboxSorted->SetFont( *wxITALIC_FONT ); |
ec9f7884 VZ |
845 | m_checkbox->SetFont( *wxITALIC_FONT ); |
846 | break; | |
847 | } | |
868a2826 | 848 | } |
47908e25 RR |
849 | } |
850 | ||
851 | void MyPanel::OnChoice( wxCommandEvent &event ) | |
852 | { | |
6c8a980f VZ |
853 | wxChoice *choice = event.GetId() == ID_CHOICE ? m_choice |
854 | : m_choiceSorted; | |
855 | ||
856 | m_text->AppendText( "Choice event selection string is: '" ); | |
ec9f7884 | 857 | m_text->AppendText( event.GetString() ); |
6c8a980f | 858 | m_text->AppendText( "'\n" ); |
b56c2246 | 859 | m_text->AppendText( "Choice control selection string is: '" ); |
6c8a980f VZ |
860 | m_text->AppendText( choice->GetStringSelection() ); |
861 | m_text->AppendText( "'\n" ); | |
862 | ||
863 | wxStringClientData *obj = ((wxStringClientData *)event.GetClientObject()); | |
864 | m_text->AppendText( "Choice event client data string is: '" ); | |
6e47faf1 JS |
865 | |
866 | if (obj) | |
867 | m_text->AppendText( obj->GetData() ); | |
868 | else | |
869 | m_text->AppendText( wxString("none") ); | |
870 | ||
6c8a980f VZ |
871 | m_text->AppendText( "'\n" ); |
872 | m_text->AppendText( "Choice control client data string is: '" ); | |
873 | obj = (wxStringClientData *)choice->GetClientObject(choice->GetSelection()); | |
6e47faf1 JS |
874 | |
875 | if (obj) | |
876 | m_text->AppendText( obj->GetData() ); | |
877 | else | |
878 | m_text->AppendText( wxString("none") ); | |
6c8a980f | 879 | m_text->AppendText( "'\n" ); |
47908e25 RR |
880 | } |
881 | ||
882 | void MyPanel::OnChoiceButtons( wxCommandEvent &event ) | |
883 | { | |
ec9f7884 | 884 | switch (event.GetId()) |
47908e25 | 885 | { |
ec9f7884 VZ |
886 | case ID_CHOICE_ENABLE: |
887 | { | |
888 | m_choice->Enable( event.GetInt() == 0 ); | |
b56c2246 | 889 | m_choiceSorted->Enable( event.GetInt() == 0 ); |
ec9f7884 VZ |
890 | break; |
891 | } | |
892 | case ID_CHOICE_SEL_NUM: | |
893 | { | |
894 | m_choice->SetSelection( 2 ); | |
b56c2246 | 895 | m_choiceSorted->SetSelection( 2 ); |
ec9f7884 VZ |
896 | break; |
897 | } | |
898 | case ID_CHOICE_SEL_STR: | |
899 | { | |
900 | m_choice->SetStringSelection( "This" ); | |
b56c2246 | 901 | m_choiceSorted->SetStringSelection( "This" ); |
ec9f7884 VZ |
902 | break; |
903 | } | |
904 | case ID_CHOICE_CLEAR: | |
905 | { | |
906 | m_choice->Clear(); | |
b56c2246 | 907 | m_choiceSorted->Clear(); |
ec9f7884 VZ |
908 | break; |
909 | } | |
910 | case ID_CHOICE_APPEND: | |
911 | { | |
912 | m_choice->Append( "Hi!" ); | |
b56c2246 | 913 | m_choiceSorted->Append( "Hi!" ); |
ec9f7884 VZ |
914 | break; |
915 | } | |
916 | case ID_CHOICE_DELETE: | |
917 | { | |
918 | int idx = m_choice->GetSelection(); | |
919 | m_choice->Delete( idx ); | |
b56c2246 VZ |
920 | idx = m_choiceSorted->GetSelection(); |
921 | m_choiceSorted->Delete( idx ); | |
ec9f7884 VZ |
922 | break; |
923 | } | |
924 | case ID_CHOICE_FONT: | |
925 | { | |
926 | m_choice->SetFont( *wxITALIC_FONT ); | |
b56c2246 | 927 | m_choiceSorted->SetFont( *wxITALIC_FONT ); |
ec9f7884 VZ |
928 | break; |
929 | } | |
868a2826 | 930 | } |
47908e25 RR |
931 | } |
932 | ||
933 | void MyPanel::OnCombo( wxCommandEvent &event ) | |
934 | { | |
19da4326 | 935 | m_text->AppendText( "ComboBox event selection string is: " ); |
ec9f7884 VZ |
936 | m_text->AppendText( event.GetString() ); |
937 | m_text->AppendText( "\n" ); | |
19da4326 RR |
938 | m_text->AppendText( "ComboBox control selection string is: " ); |
939 | m_text->AppendText( m_combo->GetStringSelection() ); | |
940 | m_text->AppendText( "\n" ); | |
47908e25 RR |
941 | } |
942 | ||
943 | void MyPanel::OnComboButtons( wxCommandEvent &event ) | |
1c005ff7 | 944 | { |
ec9f7884 | 945 | switch (event.GetId()) |
2f6407b9 | 946 | { |
ec9f7884 VZ |
947 | case ID_COMBO_ENABLE: |
948 | { | |
949 | m_combo->Enable( event.GetInt() == 0 ); | |
950 | break; | |
951 | } | |
952 | case ID_COMBO_SEL_NUM: | |
953 | { | |
954 | m_combo->SetSelection( 2 ); | |
955 | break; | |
956 | } | |
957 | case ID_COMBO_SEL_STR: | |
958 | { | |
959 | m_combo->SetStringSelection( "This" ); | |
960 | break; | |
961 | } | |
962 | case ID_COMBO_CLEAR: | |
963 | { | |
964 | m_combo->Clear(); | |
965 | break; | |
966 | } | |
967 | case ID_COMBO_APPEND: | |
968 | { | |
969 | m_combo->Append( "Hi!" ); | |
970 | break; | |
971 | } | |
972 | case ID_COMBO_DELETE: | |
973 | { | |
974 | int idx = m_combo->GetSelection(); | |
975 | m_combo->Delete( idx ); | |
976 | break; | |
977 | } | |
978 | case ID_COMBO_FONT: | |
979 | { | |
980 | m_combo->SetFont( *wxITALIC_FONT ); | |
981 | break; | |
982 | } | |
868a2826 | 983 | } |
47908e25 RR |
984 | } |
985 | ||
986 | void MyPanel::OnRadio( wxCommandEvent &event ) | |
987 | { | |
ec9f7884 VZ |
988 | m_text->AppendText( "RadioBox selection string is: " ); |
989 | m_text->AppendText( event.GetString() ); | |
990 | m_text->AppendText( "\n" ); | |
47908e25 RR |
991 | } |
992 | ||
993 | void MyPanel::OnRadioButtons( wxCommandEvent &event ) | |
994 | { | |
ec9f7884 | 995 | switch (event.GetId()) |
d3904ceb | 996 | { |
ec9f7884 VZ |
997 | case ID_RADIOBOX_ENABLE: |
998 | { | |
999 | m_radio->Enable( event.GetInt() == 0 ); | |
1000 | break; | |
1001 | } | |
1002 | case ID_RADIOBOX_SEL_NUM: | |
1003 | { | |
1004 | m_radio->SetSelection( 2 ); | |
1005 | break; | |
1006 | } | |
1007 | case ID_RADIOBOX_SEL_STR: | |
1008 | { | |
1009 | m_radio->SetStringSelection( "This" ); | |
1010 | break; | |
1011 | } | |
1012 | case ID_RADIOBOX_FONT: | |
1013 | { | |
1014 | m_radio->SetFont( *wxITALIC_FONT ); | |
1015 | break; | |
1016 | } | |
868a2826 | 1017 | } |
1c005ff7 RR |
1018 | } |
1019 | ||
868a2826 RR |
1020 | void MyPanel::OnSetFont( wxCommandEvent &WXUNUSED(event) ) |
1021 | { | |
ec9f7884 VZ |
1022 | m_fontButton->SetFont( *wxITALIC_FONT ); |
1023 | m_text->SetFont( *wxITALIC_FONT ); | |
868a2826 RR |
1024 | } |
1025 | ||
185fa6bf VZ |
1026 | void MyPanel::OnUpdateLabel( wxCommandEvent &WXUNUSED(event) ) |
1027 | { | |
1028 | static bool s_long = TRUE; | |
1029 | ||
1030 | s_long = !s_long; | |
1031 | m_label->SetLabel(s_long ? "very very very long text" : "shorter text"); | |
1032 | } | |
1033 | ||
7bce6aec RR |
1034 | void MyPanel::OnSliderUpdate( wxCommandEvent &WXUNUSED(event) ) |
1035 | { | |
ec9f7884 | 1036 | m_gauge->SetValue( m_slider->GetValue() ); |
7bce6aec RR |
1037 | } |
1038 | ||
baccb514 VZ |
1039 | #if wxUSE_SPINCTRL |
1040 | ||
57160afe | 1041 | void MyPanel::OnSpinCtrl(wxCommandEvent& event) |
baccb514 VZ |
1042 | { |
1043 | wxString s; | |
57160afe VZ |
1044 | s.Printf(_T("Spin ctrl changed: now %d (from event: %d)\n"), |
1045 | m_spinctrl->GetValue(), event.GetInt()); | |
baccb514 VZ |
1046 | m_text->AppendText(s); |
1047 | } | |
1048 | ||
1049 | #endif // wxUSE_SPINCTRL | |
1050 | ||
0e528b99 | 1051 | #if wxUSE_SPINBTN |
8c3c31d4 VZ |
1052 | void MyPanel::OnSpinUp( wxSpinEvent &event ) |
1053 | { | |
1054 | wxString value; | |
1055 | value.Printf( _T("Spin control up: current = %d\n"), | |
1056 | m_spinbutton->GetValue()); | |
1057 | ||
1058 | if ( m_spinbutton->GetValue() > 17 ) | |
1059 | { | |
1060 | value += _T("Preventing the spin button from going above 17.\n"); | |
1061 | ||
1062 | event.Veto(); | |
1063 | } | |
1064 | ||
1065 | m_text->AppendText(value); | |
1066 | } | |
1067 | ||
1068 | void MyPanel::OnSpinDown( wxSpinEvent &event ) | |
1069 | { | |
1070 | wxString value; | |
1071 | value.Printf( _T("Spin control down: current = %d\n"), | |
1072 | m_spinbutton->GetValue()); | |
1073 | ||
1074 | if ( m_spinbutton->GetValue() < -17 ) | |
1075 | { | |
1076 | value += _T("Preventing the spin button from going below -17.\n"); | |
1077 | ||
1078 | event.Veto(); | |
1079 | } | |
1080 | ||
1081 | m_text->AppendText(value); | |
1082 | } | |
1083 | ||
e380f72b RR |
1084 | void MyPanel::OnSpinUpdate( wxSpinEvent &event ) |
1085 | { | |
ec9f7884 | 1086 | wxString value; |
f70d5829 | 1087 | value.Printf( _T("%d"), event.GetPosition() ); |
ec9f7884 | 1088 | m_spintext->SetValue( value ); |
6380910c | 1089 | |
f70d5829 | 1090 | value.Printf( _T("Spin control range: (%d, %d), current = %d\n"), |
6380910c VZ |
1091 | m_spinbutton->GetMin(), m_spinbutton->GetMax(), |
1092 | m_spinbutton->GetValue()); | |
1093 | ||
1094 | m_text->AppendText(value); | |
e380f72b | 1095 | } |
9726da4f VZ |
1096 | |
1097 | void MyPanel::OnUpdateShowProgress( wxUpdateUIEvent& event ) | |
1098 | { | |
1099 | event.Enable( m_spinbutton->GetValue() > 0 ); | |
1100 | } | |
1101 | ||
1102 | void MyPanel::OnShowProgress( wxCommandEvent& WXUNUSED(event) ) | |
1103 | { | |
1104 | int max = m_spinbutton->GetValue(); | |
1105 | wxProgressDialog dialog("Progress dialog example", | |
1106 | "An informative message", | |
1107 | max, // range | |
1108 | this, // parent | |
8c3c31d4 VZ |
1109 | wxPD_CAN_ABORT | |
1110 | wxPD_APP_MODAL | | |
1111 | wxPD_ELAPSED_TIME | | |
1112 | wxPD_ESTIMATED_TIME | | |
1113 | wxPD_REMAINING_TIME); | |
2ac1b69a | 1114 | |
9726da4f VZ |
1115 | |
1116 | bool cont = TRUE; | |
1117 | for ( int i = 0; i < max && cont; i++ ) | |
1118 | { | |
1119 | wxSleep(1); | |
be9abe3f VZ |
1120 | if ( i == max - 1 ) |
1121 | { | |
1122 | cont = dialog.Update(i, "That's all, folks!"); | |
1123 | } | |
1124 | else if ( i == max / 2 ) | |
9726da4f VZ |
1125 | { |
1126 | cont = dialog.Update(i, "Only a half left!"); | |
1127 | } | |
1128 | else | |
1129 | { | |
1130 | cont = dialog.Update(i); | |
1131 | } | |
1132 | } | |
1133 | ||
1134 | if ( !cont ) | |
1135 | { | |
1136 | *m_text << "Progress dialog aborted!\n"; | |
1137 | } | |
1138 | else | |
1139 | { | |
1140 | *m_text << "Countdown from " << max << " finished.\n"; | |
1141 | } | |
1142 | } | |
1143 | ||
0e528b99 | 1144 | #endif // wxUSE_SPINBTN |
e380f72b | 1145 | |
2cb21a45 VZ |
1146 | MyPanel::~MyPanel() |
1147 | { | |
ec9f7884 | 1148 | delete m_notebook->GetImageList(); |
2cb21a45 VZ |
1149 | } |
1150 | ||
1c005ff7 RR |
1151 | //---------------------------------------------------------------------- |
1152 | // MyFrame | |
1153 | //---------------------------------------------------------------------- | |
1154 | ||
1155 | BEGIN_EVENT_TABLE(MyFrame, wxFrame) | |
87a1e308 VZ |
1156 | EVT_MENU(MINIMAL_QUIT, MyFrame::OnQuit) |
1157 | EVT_MENU(MINIMAL_ABOUT, MyFrame::OnAbout) | |
16f6dfd8 | 1158 | #if wxUSE_TOOLTIPS |
87a1e308 VZ |
1159 | EVT_MENU(MINIMAL_SET_TOOLTIP_DELAY, MyFrame::OnSetTooltipDelay) |
1160 | EVT_MENU(MINIMAL_ENABLE_TOOLTIPS, MyFrame::OnToggleTooltips) | |
16f6dfd8 | 1161 | #endif // wxUSE_TOOLTIPS |
87a1e308 VZ |
1162 | |
1163 | EVT_MENU(MINIMAL_ENABLE_ALL, MyFrame::OnEnableAll) | |
1164 | ||
1165 | EVT_SIZE(MyFrame::OnSize) | |
97206645 VZ |
1166 | EVT_MOVE(MyFrame::OnMove) |
1167 | ||
87a1e308 | 1168 | EVT_IDLE(MyFrame::OnIdle) |
1c005ff7 RR |
1169 | END_EVENT_TABLE() |
1170 | ||
9f3362c4 | 1171 | MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h) |
ec9f7884 | 1172 | : wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)) |
1c005ff7 | 1173 | { |
5fb9fcfc | 1174 | CreateStatusBar(2); |
9f3362c4 | 1175 | |
87a1e308 | 1176 | m_panel = new MyPanel( this, 10, 10, 300, 100 ); |
1c005ff7 RR |
1177 | } |
1178 | ||
1179 | void MyFrame::OnQuit (wxCommandEvent& WXUNUSED(event) ) | |
1180 | { | |
ec9f7884 | 1181 | Close(TRUE); |
1c005ff7 RR |
1182 | } |
1183 | ||
1184 | void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) ) | |
1185 | { | |
ec9f7884 VZ |
1186 | wxBeginBusyCursor(); |
1187 | ||
1188 | wxMessageDialog dialog(this, "This is a control sample", "About Controls", wxOK ); | |
1189 | dialog.ShowModal(); | |
1190 | ||
1191 | wxEndBusyCursor(); | |
1c005ff7 | 1192 | } |
9f3362c4 | 1193 | |
16f6dfd8 VZ |
1194 | #if wxUSE_TOOLTIPS |
1195 | void MyFrame::OnSetTooltipDelay(wxCommandEvent& event) | |
1196 | { | |
1197 | static long s_delay = 5000; | |
1198 | ||
1199 | wxString delay; | |
f70d5829 | 1200 | delay.Printf( _T("%ld"), s_delay); |
16f6dfd8 VZ |
1201 | |
1202 | delay = wxGetTextFromUser("Enter delay (in milliseconds)", | |
ec9f7884 VZ |
1203 | "Set tooltip delay", |
1204 | delay, | |
1205 | this); | |
16f6dfd8 VZ |
1206 | if ( !delay ) |
1207 | return; // cancelled | |
1208 | ||
f70d5829 | 1209 | wxSscanf(delay, _T("%ld"), &s_delay); |
16f6dfd8 VZ |
1210 | |
1211 | wxToolTip::SetDelay(s_delay); | |
1212 | ||
f70d5829 | 1213 | wxLogStatus(this, _T("Tooltip delay set to %ld milliseconds"), s_delay); |
16f6dfd8 VZ |
1214 | } |
1215 | ||
1216 | void MyFrame::OnToggleTooltips(wxCommandEvent& event) | |
1217 | { | |
1218 | static bool s_enabled = TRUE; | |
1219 | ||
1220 | s_enabled = !s_enabled; | |
1221 | ||
1222 | wxToolTip::Enable(s_enabled); | |
1223 | ||
f70d5829 | 1224 | wxLogStatus(this, _T("Tooltips %sabled"), s_enabled ? _T("en") : _T("dis") ); |
16f6dfd8 VZ |
1225 | } |
1226 | #endif // tooltips | |
1227 | ||
87a1e308 VZ |
1228 | void MyFrame::OnEnableAll(wxCommandEvent& WXUNUSED(event)) |
1229 | { | |
1230 | static bool s_enable = TRUE; | |
1231 | ||
1232 | s_enable = !s_enable; | |
1233 | m_panel->Enable(s_enable); | |
1234 | } | |
1235 | ||
97206645 VZ |
1236 | void MyFrame::OnMove( wxMoveEvent& event ) |
1237 | { | |
1238 | UpdateStatusBar(event.GetPosition(), GetSize()); | |
1239 | ||
1240 | event.Skip(); | |
1241 | } | |
1242 | ||
5fb9fcfc VZ |
1243 | void MyFrame::OnSize( wxSizeEvent& event ) |
1244 | { | |
97206645 | 1245 | UpdateStatusBar(GetPosition(), event.GetSize()); |
5fb9fcfc VZ |
1246 | |
1247 | event.Skip(); | |
1248 | } | |
1249 | ||
9f3362c4 VZ |
1250 | void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) ) |
1251 | { | |
1252 | // track the window which has the focus in the status bar | |
1253 | static wxWindow *s_windowFocus = (wxWindow *)NULL; | |
1254 | wxWindow *focus = wxWindow::FindFocus(); | |
1255 | if ( focus && (focus != s_windowFocus) ) | |
1256 | { | |
1257 | s_windowFocus = focus; | |
1258 | ||
1259 | wxString msg; | |
f70d5829 | 1260 | msg.Printf( |
9f3362c4 | 1261 | #ifdef __WXMSW__ |
f70d5829 RR |
1262 | _T("Focus: wxWindow = %p, HWND = %08x"), |
1263 | #else | |
1264 | _T("Focus: wxWindow = %p"), | |
1265 | #endif | |
1266 | s_windowFocus | |
9f3362c4 | 1267 | #ifdef __WXMSW__ |
ec9f7884 | 1268 | , s_windowFocus->GetHWND() |
f70d5829 | 1269 | #endif |
9f3362c4 VZ |
1270 | ); |
1271 | ||
1272 | SetStatusText(msg); | |
1273 | } | |
341c92a8 | 1274 | } |
6c8a980f VZ |
1275 | |
1276 | static void SetControlClientData(const char *name, | |
1277 | wxControlWithItems *control) | |
1278 | { | |
1279 | size_t count = control->GetCount(); | |
1280 | for ( size_t n = 0; n < count; n++ ) | |
1281 | { | |
1282 | wxString s; | |
1283 | s.Printf("%s client data for '%s'", | |
1284 | name, control->GetString(n).c_str()); | |
1285 | ||
1286 | control->SetClientObject(n, new wxStringClientData(s)); | |
1287 | } | |
1288 | } |