]>
Commit | Line | Data |
---|---|---|
1c005ff7 | 1 | ///////////////////////////////////////////////////////////////////////////// |
dfad0599 | 2 | // Name: controls.cpp |
be5a51fb | 3 | // Purpose: Controls wxWidgets sample |
1c005ff7 RR |
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 | ||
1c005ff7 RR |
11 | // For compilers that support precompilation, includes "wx/wx.h". |
12 | #include "wx/wxprec.h" | |
13 | ||
14 | #ifdef __BORLANDC__ | |
9f3362c4 | 15 | #pragma hdrstop |
1c005ff7 RR |
16 | #endif |
17 | ||
18 | #ifndef WX_PRECOMP | |
9f3362c4 | 19 | #include "wx/wx.h" |
1c005ff7 RR |
20 | #endif |
21 | ||
4fabb575 | 22 | #include "wx/spinbutt.h" |
1db8dc4a | 23 | #include "wx/tglbtn.h" |
61c083e7 | 24 | #include "wx/bookctrl.h" |
2cb21a45 | 25 | #include "wx/imaglist.h" |
389d906b | 26 | #include "wx/artprov.h" |
1a8b677e | 27 | #include "wx/cshelp.h" |
b8653fbf VZ |
28 | |
29 | #if wxUSE_TOOLTIPS | |
30 | #include "wx/tooltip.h" | |
be8b4385 VZ |
31 | #ifdef __WXMSW__ |
32 | #include "wx/numdlg.h" | |
33 | #endif // __WXMSW__ | |
34 | #endif // wxUSE_TOOLTIPS | |
1c005ff7 | 35 | |
a5e635be | 36 | #if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__) |
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 | ||
3a5bcc4d | 50 | #ifndef wxUSE_SPINBTN |
ad556aa9 | 51 | #define wxUSE_SPINBTN 1 |
3a5bcc4d | 52 | #endif |
9726da4f VZ |
53 | |
54 | #include "wx/progdlg.h" | |
55 | ||
b782f2e0 VZ |
56 | #if wxUSE_SPINCTRL |
57 | #include "wx/spinctrl.h" | |
58 | #endif // wxUSE_SPINCTRL | |
59 | ||
bebc503c VZ |
60 | #if !wxUSE_TOGGLEBTN |
61 | #define wxToggleButton wxCheckBox | |
62 | #define EVT_TOGGLEBUTTON EVT_CHECKBOX | |
63 | #endif | |
64 | ||
1c005ff7 RR |
65 | //---------------------------------------------------------------------- |
66 | // class definitions | |
67 | //---------------------------------------------------------------------- | |
68 | ||
69 | class MyApp: public wxApp | |
655822f3 | 70 | { |
b8653fbf VZ |
71 | public: |
72 | bool OnInit(); | |
1c005ff7 RR |
73 | }; |
74 | ||
75 | class MyPanel: public wxPanel | |
76 | { | |
b8653fbf | 77 | public: |
1c005ff7 | 78 | MyPanel(wxFrame *frame, int x, int y, int w, int h); |
2cb21a45 | 79 | virtual ~MyPanel(); |
16f6dfd8 | 80 | |
be8b4385 VZ |
81 | #if wxUSE_TOOLTIPS |
82 | void SetAllToolTips(); | |
83 | #endif // wxUSE_TOOLTIPS | |
84 | ||
f226be17 | 85 | void OnIdle( wxIdleEvent &event ); |
1c005ff7 | 86 | void OnListBox( wxCommandEvent &event ); |
5b077d48 | 87 | void OnListBoxDoubleClick( wxCommandEvent &event ); |
1c005ff7 | 88 | void OnListBoxButtons( wxCommandEvent &event ); |
1ccd23f5 | 89 | #if wxUSE_CHOICE |
47908e25 RR |
90 | void OnChoice( wxCommandEvent &event ); |
91 | void OnChoiceButtons( wxCommandEvent &event ); | |
1ccd23f5 | 92 | #endif |
47908e25 | 93 | void OnCombo( wxCommandEvent &event ); |
f6bcfd97 BP |
94 | void OnComboTextChanged( wxCommandEvent &event ); |
95 | void OnComboTextEnter( wxCommandEvent &event ); | |
47908e25 RR |
96 | void OnComboButtons( wxCommandEvent &event ); |
97 | void OnRadio( wxCommandEvent &event ); | |
98 | void OnRadioButtons( wxCommandEvent &event ); | |
a48b9bfb VZ |
99 | void OnRadioButton1( wxCommandEvent &event ); |
100 | void OnRadioButton2( wxCommandEvent &event ); | |
868a2826 | 101 | void OnSetFont( wxCommandEvent &event ); |
61c083e7 WS |
102 | void OnPageChanged( wxBookCtrlEvent &event ); |
103 | void OnPageChanging( wxBookCtrlEvent &event ); | |
7bce6aec | 104 | void OnSliderUpdate( wxCommandEvent &event ); |
185fa6bf | 105 | void OnUpdateLabel( wxCommandEvent &event ); |
0e528b99 | 106 | #if wxUSE_SPINBTN |
8c3c31d4 VZ |
107 | void OnSpinUp( wxSpinEvent &event ); |
108 | void OnSpinDown( wxSpinEvent &event ); | |
e380f72b | 109 | void OnSpinUpdate( wxSpinEvent &event ); |
516ab399 | 110 | #if wxUSE_PROGRESSDLG |
9726da4f VZ |
111 | void OnUpdateShowProgress( wxUpdateUIEvent& event ); |
112 | void OnShowProgress( wxCommandEvent &event ); | |
516ab399 | 113 | #endif // wxUSE_PROGRESSDLG |
0e528b99 | 114 | #endif // wxUSE_SPINBTN |
1dd815f3 | 115 | void OnNewText( wxCommandEvent &event ); |
baccb514 | 116 | #if wxUSE_SPINCTRL |
457e6c54 | 117 | void OnSpinCtrl(wxSpinEvent& event); |
76106901 VZ |
118 | void OnSpinCtrlUp(wxSpinEvent& event); |
119 | void OnSpinCtrlDown(wxSpinEvent& event); | |
120 | void OnSpinCtrlText(wxCommandEvent& event); | |
baccb514 VZ |
121 | #endif // wxUSE_SPINCTRL |
122 | ||
87a1e308 VZ |
123 | void OnEnableAll(wxCommandEvent& event); |
124 | void OnChangeColour(wxCommandEvent& event); | |
3e2dd3db | 125 | void OnTestButton(wxCommandEvent& event); |
9121bed2 | 126 | void OnBmpButton(wxCommandEvent& event); |
bebc503c | 127 | void OnBmpButtonToggle(wxCommandEvent& event); |
87a1e308 | 128 | |
2b5f62a0 VZ |
129 | void OnSizerCheck (wxCommandEvent &event); |
130 | ||
6c8a980f VZ |
131 | wxListBox *m_listbox, |
132 | *m_listboxSorted; | |
1ccd23f5 | 133 | #if wxUSE_CHOICE |
b56c2246 VZ |
134 | wxChoice *m_choice, |
135 | *m_choiceSorted; | |
2b5f62a0 VZ |
136 | #endif // wxUSE_CHOICE |
137 | ||
e380f72b RR |
138 | wxComboBox *m_combo; |
139 | wxRadioBox *m_radio; | |
516ab399 | 140 | #if wxUSE_GAUGE |
37ed3ae3 VZ |
141 | wxGauge *m_gauge, |
142 | *m_gaugeVert; | |
516ab399 | 143 | #endif // wxUSE_GAUGE |
6bb44116 | 144 | #if wxUSE_SLIDER |
e380f72b | 145 | wxSlider *m_slider; |
6bb44116 | 146 | #endif // wxUSE_SLIDER |
e380f72b | 147 | wxButton *m_fontButton; |
85eb36c2 RR |
148 | wxButton *m_lbSelectNum; |
149 | wxButton *m_lbSelectThis; | |
0e528b99 | 150 | #if wxUSE_SPINBTN |
e380f72b | 151 | wxSpinButton *m_spinbutton; |
516ab399 | 152 | #if wxUSE_PROGRESSDLG |
9726da4f | 153 | wxButton *m_btnProgress; |
516ab399 | 154 | #endif // wxUSE_PROGRESSDLG |
0e528b99 | 155 | #endif // wxUSE_SPINBTN |
1dd815f3 RR |
156 | wxStaticText *m_wrappingText; |
157 | wxStaticText *m_nonWrappingText; | |
b782f2e0 VZ |
158 | |
159 | #if wxUSE_SPINCTRL | |
160 | wxSpinCtrl *m_spinctrl; | |
161 | #endif // wxUSE_SPINCTRL | |
162 | ||
e380f72b | 163 | wxTextCtrl *m_spintext; |
ae0bdb01 | 164 | wxCheckBox *m_checkbox; |
16f6dfd8 | 165 | |
e380f72b | 166 | wxTextCtrl *m_text; |
61c083e7 | 167 | wxBookCtrl *m_book; |
655822f3 | 168 | |
185fa6bf VZ |
169 | wxStaticText *m_label; |
170 | ||
2b5f62a0 VZ |
171 | wxBoxSizer *m_buttonSizer; |
172 | wxButton *m_sizerBtn1; | |
173 | wxButton *m_sizerBtn2; | |
174 | wxButton *m_sizerBtn3; | |
175 | wxButton *m_sizerBtn4; | |
176 | wxBoxSizer *m_hsizer; | |
177 | wxButton *m_bigBtn; | |
178 | ||
b8653fbf | 179 | private: |
29e7e51a VZ |
180 | wxLog *m_logTargetOld; |
181 | ||
b8653fbf | 182 | DECLARE_EVENT_TABLE() |
1c005ff7 RR |
183 | }; |
184 | ||
185 | class MyFrame: public wxFrame | |
186 | { | |
b8653fbf | 187 | public: |
9f84eccd | 188 | MyFrame(const wxChar *title, int x, int y); |
655822f3 | 189 | |
1c005ff7 RR |
190 | void OnQuit(wxCommandEvent& event); |
191 | void OnAbout(wxCommandEvent& event); | |
3e2dd3db | 192 | void OnClearLog(wxCommandEvent& event); |
87a1e308 | 193 | |
16f6dfd8 VZ |
194 | #if wxUSE_TOOLTIPS |
195 | void OnSetTooltipDelay(wxCommandEvent& event); | |
196 | void OnToggleTooltips(wxCommandEvent& event); | |
be8b4385 VZ |
197 | #ifdef __WXMSW__ |
198 | void OnSetMaxTooltipWidth(wxCommandEvent& event); | |
199 | #endif // __WXMSW__ | |
16f6dfd8 | 200 | #endif // wxUSE_TOOLTIPS |
87a1e308 VZ |
201 | |
202 | void OnEnableAll(wxCommandEvent& event); | |
47a8a4d5 VZ |
203 | void OnHideAll(wxCommandEvent& event); |
204 | void OnHideList(wxCommandEvent& event); | |
1a8b677e | 205 | void OnContextHelp(wxCommandEvent& event); |
87a1e308 | 206 | |
9f3362c4 | 207 | void OnIdle( wxIdleEvent& event ); |
35960bbf VZ |
208 | void OnIconized( wxIconizeEvent& event ); |
209 | void OnMaximized( wxMaximizeEvent& event ); | |
5fb9fcfc | 210 | void OnSize( wxSizeEvent& event ); |
97206645 | 211 | void OnMove( wxMoveEvent& event ); |
655822f3 | 212 | |
f048e32f VZ |
213 | MyPanel *GetPanel() const { return m_panel; } |
214 | ||
b8653fbf | 215 | private: |
960a83cc | 216 | #if wxUSE_STATUSBAR |
97206645 VZ |
217 | void UpdateStatusBar(const wxPoint& pos, const wxSize& size) |
218 | { | |
7bfc22f6 VZ |
219 | if ( m_frameStatusBar ) |
220 | { | |
221 | wxString msg; | |
0545d965 VZ |
222 | wxSize sizeAll = GetSize(), |
223 | sizeCl = GetClientSize(); | |
224 | msg.Printf(_("pos=(%d, %d), size=%dx%d or %dx%d (client=%dx%d)"), | |
7bfc22f6 VZ |
225 | pos.x, pos.y, |
226 | size.x, size.y, | |
0545d965 | 227 | sizeAll.x, sizeAll.y, |
7bfc22f6 VZ |
228 | sizeCl.x, sizeCl.y); |
229 | SetStatusText(msg, 1); | |
230 | } | |
97206645 | 231 | } |
960a83cc | 232 | #endif // wxUSE_STATUSBAR |
97206645 | 233 | |
f048e32f | 234 | MyPanel *m_panel; |
87a1e308 | 235 | |
b8653fbf | 236 | DECLARE_EVENT_TABLE() |
1c005ff7 RR |
237 | }; |
238 | ||
f6bcfd97 BP |
239 | // a button which intercepts double clicks (for testing...) |
240 | class MyButton : public wxButton | |
241 | { | |
242 | public: | |
243 | MyButton(wxWindow *parent, | |
244 | wxWindowID id, | |
245 | const wxString& label = wxEmptyString, | |
246 | const wxPoint& pos = wxDefaultPosition, | |
247 | const wxSize& size = wxDefaultSize) | |
248 | : wxButton(parent, id, label, pos, size) | |
249 | { | |
250 | } | |
251 | ||
252 | void OnDClick(wxMouseEvent& event) | |
253 | { | |
254 | wxLogMessage(_T("MyButton::OnDClick")); | |
255 | ||
256 | event.Skip(); | |
257 | } | |
258 | ||
259 | private: | |
260 | DECLARE_EVENT_TABLE() | |
261 | }; | |
262 | ||
263 | // a combo which intercepts chars (to test Windows behaviour) | |
264 | class MyComboBox : public wxComboBox | |
265 | { | |
266 | public: | |
267 | MyComboBox(wxWindow *parent, wxWindowID id, | |
268 | const wxString& value = wxEmptyString, | |
269 | const wxPoint& pos = wxDefaultPosition, | |
270 | const wxSize& size = wxDefaultSize, | |
271 | int n = 0, const wxString choices[] = NULL, | |
272 | long style = 0, | |
273 | const wxValidator& validator = wxDefaultValidator, | |
274 | const wxString& name = wxComboBoxNameStr) | |
275 | : wxComboBox(parent, id, value, pos, size, n, choices, style, | |
276 | validator, name) { } | |
277 | ||
278 | protected: | |
279 | void OnChar(wxKeyEvent& event); | |
280 | void OnKeyDown(wxKeyEvent& event); | |
281 | void OnKeyUp(wxKeyEvent& event); | |
282 | void OnFocusGot(wxFocusEvent& event) | |
283 | { | |
284 | wxLogMessage(_T("MyComboBox::OnFocusGot")); | |
285 | ||
286 | event.Skip(); | |
287 | } | |
288 | ||
289 | private: | |
290 | DECLARE_EVENT_TABLE() | |
291 | }; | |
292 | ||
293 | // a radiobox which handles focus set/kill (for testing) | |
294 | class MyRadioBox : public wxRadioBox | |
295 | { | |
296 | public: | |
297 | MyRadioBox(wxWindow *parent, | |
298 | wxWindowID id, | |
299 | const wxString& title = wxEmptyString, | |
300 | const wxPoint& pos = wxDefaultPosition, | |
301 | const wxSize& size = wxDefaultSize, | |
302 | int n = 0, const wxString choices[] = NULL, | |
303 | int majorDim = 1, | |
3998c74b | 304 | long style = wxRA_SPECIFY_COLS, |
f6bcfd97 | 305 | const wxValidator& validator = wxDefaultValidator, |
0bb62421 | 306 | const wxString& name = wxRadioBoxNameStr) |
f6bcfd97 | 307 | : wxRadioBox(parent, id, title, pos, size, n, choices, majorDim, |
7891b4d4 VZ |
308 | style, validator, name) |
309 | { | |
310 | } | |
f6bcfd97 BP |
311 | |
312 | protected: | |
313 | void OnFocusGot(wxFocusEvent& event) | |
314 | { | |
315 | wxLogMessage(_T("MyRadioBox::OnFocusGot")); | |
316 | ||
317 | event.Skip(); | |
318 | } | |
319 | ||
320 | void OnFocusLost(wxFocusEvent& event) | |
321 | { | |
322 | wxLogMessage(_T("MyRadioBox::OnFocusLost")); | |
323 | ||
324 | event.Skip(); | |
325 | } | |
326 | ||
327 | private: | |
328 | DECLARE_EVENT_TABLE() | |
329 | }; | |
330 | ||
1a84e759 RR |
331 | // a choice which handles focus set/kill (for testing) |
332 | class MyChoice : public wxChoice | |
333 | { | |
334 | public: | |
335 | MyChoice(wxWindow *parent, | |
336 | wxWindowID id, | |
337 | const wxPoint& pos = wxDefaultPosition, | |
338 | const wxSize& size = wxDefaultSize, | |
339 | int n = 0, const wxString choices[] = NULL, | |
340 | long style = 0, | |
341 | const wxValidator& validator = wxDefaultValidator, | |
342 | const wxString& name = wxChoiceNameStr ) | |
0d29fecd | 343 | : wxChoice(parent, id, pos, size, n, choices, |
1a84e759 RR |
344 | style, validator, name) { } |
345 | ||
346 | protected: | |
347 | void OnFocusGot(wxFocusEvent& event) | |
348 | { | |
349 | wxLogMessage(_T("MyChoice::OnFocusGot")); | |
350 | ||
351 | event.Skip(); | |
352 | } | |
353 | ||
354 | void OnFocusLost(wxFocusEvent& event) | |
355 | { | |
356 | wxLogMessage(_T("MyChoice::OnFocusLost")); | |
357 | ||
358 | event.Skip(); | |
359 | } | |
360 | ||
361 | private: | |
362 | DECLARE_EVENT_TABLE() | |
363 | }; | |
364 | ||
365 | ||
366 | ||
1c005ff7 | 367 | //---------------------------------------------------------------------- |
6c8a980f | 368 | // other |
1c005ff7 RR |
369 | //---------------------------------------------------------------------- |
370 | ||
8b81a824 | 371 | static void SetListboxClientData(const wxChar *name, wxListBox *control); |
2b5f62a0 VZ |
372 | |
373 | #if wxUSE_CHOICE | |
8b81a824 | 374 | static void SetChoiceClientData(const wxChar *name, wxChoice *control); |
2b5f62a0 | 375 | #endif // wxUSE_CHOICE |
6c8a980f | 376 | |
d59051dd | 377 | IMPLEMENT_APP(MyApp) |
1c005ff7 RR |
378 | |
379 | //---------------------------------------------------------------------- | |
380 | // MyApp | |
381 | //---------------------------------------------------------------------- | |
382 | ||
16f6dfd8 VZ |
383 | enum |
384 | { | |
91b07357 JS |
385 | CONTROLS_QUIT = wxID_EXIT, |
386 | CONTROLS_ABOUT = wxID_ABOUT, | |
387 | CONTROLS_TEXT = 100, | |
3e2dd3db | 388 | CONTROLS_CLEAR_LOG, |
16f6dfd8 VZ |
389 | |
390 | // tooltip menu | |
3e2dd3db VZ |
391 | CONTROLS_SET_TOOLTIP_DELAY = 200, |
392 | CONTROLS_ENABLE_TOOLTIPS, | |
be8b4385 | 393 | CONTROLS_SET_TOOLTIPS_MAX_WIDTH, |
87a1e308 VZ |
394 | |
395 | // panel menu | |
1a8b677e | 396 | CONTROLS_ENABLE_ALL, |
47a8a4d5 VZ |
397 | CONTROLS_HIDE_ALL, |
398 | CONTROLS_HIDE_LIST, | |
1a8b677e | 399 | CONTROLS_CONTEXT_HELP |
16f6dfd8 | 400 | }; |
1c005ff7 | 401 | |
b8653fbf | 402 | bool MyApp::OnInit() |
1c005ff7 | 403 | { |
41b66be9 VS |
404 | // use standard command line handling: |
405 | if ( !wxApp::OnInit() ) | |
9230b621 | 406 | return false; |
41b66be9 | 407 | |
e66ad5c6 VZ |
408 | // parse the cmd line |
409 | int x = 50, | |
410 | y = 50; | |
3ca6a5f0 | 411 | if ( argc == 3 ) |
e66ad5c6 | 412 | { |
a60b1f5d MB |
413 | wxSscanf(wxString(argv[1]), wxT("%d"), &x); |
414 | wxSscanf(wxString(argv[2]), wxT("%d"), &y); | |
e66ad5c6 VZ |
415 | } |
416 | ||
1a8b677e VZ |
417 | #if wxUSE_HELP |
418 | wxHelpProvider::Set( new wxSimpleHelpProvider ); | |
419 | #endif // wxUSE_HELP | |
420 | ||
ec9f7884 | 421 | // Create the main frame window |
be5a51fb | 422 | MyFrame *frame = new MyFrame(_T("Controls wxWidgets App"), x, y); |
9230b621 | 423 | frame->Show(true); |
655822f3 | 424 | |
9230b621 | 425 | return true; |
1c005ff7 RR |
426 | } |
427 | ||
428 | //---------------------------------------------------------------------- | |
429 | // MyPanel | |
430 | //---------------------------------------------------------------------- | |
431 | ||
61c083e7 | 432 | const int ID_BOOK = 1000; |
1c005ff7 | 433 | |
4fabb575 JS |
434 | const int ID_LISTBOX = 130; |
435 | const int ID_LISTBOX_SEL_NUM = 131; | |
436 | const int ID_LISTBOX_SEL_STR = 132; | |
437 | const int ID_LISTBOX_CLEAR = 133; | |
438 | const int ID_LISTBOX_APPEND = 134; | |
439 | const int ID_LISTBOX_DELETE = 135; | |
440 | const int ID_LISTBOX_FONT = 136; | |
441 | const int ID_LISTBOX_ENABLE = 137; | |
6c8a980f | 442 | const int ID_LISTBOX_SORTED = 138; |
1c005ff7 | 443 | |
4fabb575 JS |
444 | const int ID_CHOICE = 120; |
445 | const int ID_CHOICE_SEL_NUM = 121; | |
446 | const int ID_CHOICE_SEL_STR = 122; | |
447 | const int ID_CHOICE_CLEAR = 123; | |
448 | const int ID_CHOICE_APPEND = 124; | |
449 | const int ID_CHOICE_DELETE = 125; | |
450 | const int ID_CHOICE_FONT = 126; | |
451 | const int ID_CHOICE_ENABLE = 127; | |
b56c2246 | 452 | const int ID_CHOICE_SORTED = 128; |
53010e52 | 453 | |
4fabb575 JS |
454 | const int ID_COMBO = 140; |
455 | const int ID_COMBO_SEL_NUM = 141; | |
456 | const int ID_COMBO_SEL_STR = 142; | |
457 | const int ID_COMBO_CLEAR = 143; | |
458 | const int ID_COMBO_APPEND = 144; | |
459 | const int ID_COMBO_DELETE = 145; | |
460 | const int ID_COMBO_FONT = 146; | |
461 | const int ID_COMBO_ENABLE = 147; | |
cc7e9e20 | 462 | const int ID_COMBO_SET_TEXT = 148; |
53010e52 | 463 | |
4fabb575 JS |
464 | const int ID_RADIOBOX = 160; |
465 | const int ID_RADIOBOX_SEL_NUM = 161; | |
466 | const int ID_RADIOBOX_SEL_STR = 162; | |
467 | const int ID_RADIOBOX_FONT = 163; | |
468 | const int ID_RADIOBOX_ENABLE = 164; | |
be8b4385 | 469 | const int ID_RADIOBOX2 = 165; |
f5d29b39 RR |
470 | const int ID_RADIOBUTTON_1 = 166; |
471 | const int ID_RADIOBUTTON_2 = 167; | |
472 | ||
4fabb575 | 473 | const int ID_SET_FONT = 170; |
47908e25 | 474 | |
516ab399 | 475 | #if wxUSE_GAUGE |
4fabb575 | 476 | const int ID_GAUGE = 180; |
516ab399 WS |
477 | #endif // wxUSE_GAUGE |
478 | ||
6bb44116 | 479 | #if wxUSE_SLIDER |
4fabb575 | 480 | const int ID_SLIDER = 181; |
6bb44116 | 481 | #endif // wxUSE_SLIDER |
58614078 | 482 | |
4fabb575 | 483 | const int ID_SPIN = 182; |
516ab399 | 484 | #if wxUSE_PROGRESSDLG |
9726da4f | 485 | const int ID_BTNPROGRESS = 183; |
516ab399 | 486 | #endif // wxUSE_PROGRESSDLG |
185fa6bf | 487 | const int ID_BUTTON_LABEL = 184; |
baccb514 | 488 | const int ID_SPINCTRL = 185; |
1dd815f3 | 489 | const int ID_BTNNEWTEXT = 186; |
e380f72b | 490 | |
3e2dd3db VZ |
491 | const int ID_BUTTON_TEST1 = 190; |
492 | const int ID_BUTTON_TEST2 = 191; | |
9121bed2 | 493 | const int ID_BITMAP_BTN = 192; |
bebc503c | 494 | const int ID_BITMAP_BTN_ENABLE = 193; |
3e2dd3db | 495 | |
87a1e308 VZ |
496 | const int ID_CHANGE_COLOUR = 200; |
497 | ||
2b5f62a0 VZ |
498 | const int ID_SIZER_CHECK1 = 201; |
499 | const int ID_SIZER_CHECK2 = 202; | |
500 | const int ID_SIZER_CHECK3 = 203; | |
501 | const int ID_SIZER_CHECK4 = 204; | |
502 | const int ID_SIZER_CHECK14 = 205; | |
503 | const int ID_SIZER_CHECKBIG = 206; | |
504 | ||
1a8b677e VZ |
505 | const int ID_HYPERLINK = 300; |
506 | ||
1c005ff7 | 507 | BEGIN_EVENT_TABLE(MyPanel, wxPanel) |
f226be17 | 508 | EVT_IDLE ( MyPanel::OnIdle) |
61c083e7 WS |
509 | EVT_BOOKCTRL_PAGE_CHANGING(ID_BOOK, MyPanel::OnPageChanging) |
510 | EVT_BOOKCTRL_PAGE_CHANGED(ID_BOOK, MyPanel::OnPageChanged) | |
ec9f7884 | 511 | EVT_LISTBOX (ID_LISTBOX, MyPanel::OnListBox) |
6c8a980f | 512 | EVT_LISTBOX (ID_LISTBOX_SORTED, MyPanel::OnListBox) |
ec9f7884 VZ |
513 | EVT_LISTBOX_DCLICK(ID_LISTBOX, MyPanel::OnListBoxDoubleClick) |
514 | EVT_BUTTON (ID_LISTBOX_SEL_NUM, MyPanel::OnListBoxButtons) | |
515 | EVT_BUTTON (ID_LISTBOX_SEL_STR, MyPanel::OnListBoxButtons) | |
516 | EVT_BUTTON (ID_LISTBOX_CLEAR, MyPanel::OnListBoxButtons) | |
517 | EVT_BUTTON (ID_LISTBOX_APPEND, MyPanel::OnListBoxButtons) | |
518 | EVT_BUTTON (ID_LISTBOX_DELETE, MyPanel::OnListBoxButtons) | |
519 | EVT_BUTTON (ID_LISTBOX_FONT, MyPanel::OnListBoxButtons) | |
520 | EVT_CHECKBOX (ID_LISTBOX_ENABLE, MyPanel::OnListBoxButtons) | |
1ccd23f5 | 521 | #if wxUSE_CHOICE |
ec9f7884 | 522 | EVT_CHOICE (ID_CHOICE, MyPanel::OnChoice) |
b56c2246 | 523 | EVT_CHOICE (ID_CHOICE_SORTED, MyPanel::OnChoice) |
ec9f7884 VZ |
524 | EVT_BUTTON (ID_CHOICE_SEL_NUM, MyPanel::OnChoiceButtons) |
525 | EVT_BUTTON (ID_CHOICE_SEL_STR, MyPanel::OnChoiceButtons) | |
526 | EVT_BUTTON (ID_CHOICE_CLEAR, MyPanel::OnChoiceButtons) | |
527 | EVT_BUTTON (ID_CHOICE_APPEND, MyPanel::OnChoiceButtons) | |
528 | EVT_BUTTON (ID_CHOICE_DELETE, MyPanel::OnChoiceButtons) | |
529 | EVT_BUTTON (ID_CHOICE_FONT, MyPanel::OnChoiceButtons) | |
530 | EVT_CHECKBOX (ID_CHOICE_ENABLE, MyPanel::OnChoiceButtons) | |
1ccd23f5 | 531 | #endif |
ec9f7884 | 532 | EVT_COMBOBOX (ID_COMBO, MyPanel::OnCombo) |
f6bcfd97 BP |
533 | EVT_TEXT (ID_COMBO, MyPanel::OnComboTextChanged) |
534 | EVT_TEXT_ENTER(ID_COMBO, MyPanel::OnComboTextEnter) | |
ec9f7884 VZ |
535 | EVT_BUTTON (ID_COMBO_SEL_NUM, MyPanel::OnComboButtons) |
536 | EVT_BUTTON (ID_COMBO_SEL_STR, MyPanel::OnComboButtons) | |
537 | EVT_BUTTON (ID_COMBO_CLEAR, MyPanel::OnComboButtons) | |
538 | EVT_BUTTON (ID_COMBO_APPEND, MyPanel::OnComboButtons) | |
539 | EVT_BUTTON (ID_COMBO_DELETE, MyPanel::OnComboButtons) | |
540 | EVT_BUTTON (ID_COMBO_FONT, MyPanel::OnComboButtons) | |
cc7e9e20 | 541 | EVT_BUTTON (ID_COMBO_SET_TEXT, MyPanel::OnComboButtons) |
ec9f7884 VZ |
542 | EVT_CHECKBOX (ID_COMBO_ENABLE, MyPanel::OnComboButtons) |
543 | EVT_RADIOBOX (ID_RADIOBOX, MyPanel::OnRadio) | |
be8b4385 | 544 | EVT_RADIOBOX (ID_RADIOBOX2, MyPanel::OnRadio) |
ec9f7884 VZ |
545 | EVT_BUTTON (ID_RADIOBOX_SEL_NUM, MyPanel::OnRadioButtons) |
546 | EVT_BUTTON (ID_RADIOBOX_SEL_STR, MyPanel::OnRadioButtons) | |
547 | EVT_BUTTON (ID_RADIOBOX_FONT, MyPanel::OnRadioButtons) | |
548 | EVT_CHECKBOX (ID_RADIOBOX_ENABLE, MyPanel::OnRadioButtons) | |
a48b9bfb VZ |
549 | EVT_RADIOBUTTON(ID_RADIOBUTTON_1, MyPanel::OnRadioButton1) |
550 | EVT_RADIOBUTTON(ID_RADIOBUTTON_2, MyPanel::OnRadioButton2) | |
ec9f7884 | 551 | EVT_BUTTON (ID_SET_FONT, MyPanel::OnSetFont) |
6bb44116 | 552 | #if wxUSE_SLIDER |
ec9f7884 | 553 | EVT_SLIDER (ID_SLIDER, MyPanel::OnSliderUpdate) |
6bb44116 | 554 | #endif // wxUSE_SLIDER |
0e528b99 | 555 | #if wxUSE_SPINBTN |
ec9f7884 | 556 | EVT_SPIN (ID_SPIN, MyPanel::OnSpinUpdate) |
8c3c31d4 VZ |
557 | EVT_SPIN_UP (ID_SPIN, MyPanel::OnSpinUp) |
558 | EVT_SPIN_DOWN (ID_SPIN, MyPanel::OnSpinDown) | |
516ab399 | 559 | #if wxUSE_PROGRESSDLG |
9726da4f VZ |
560 | EVT_UPDATE_UI (ID_BTNPROGRESS, MyPanel::OnUpdateShowProgress) |
561 | EVT_BUTTON (ID_BTNPROGRESS, MyPanel::OnShowProgress) | |
516ab399 | 562 | #endif // wxUSE_PROGRESSDLG |
0e528b99 | 563 | #endif // wxUSE_SPINBTN |
baccb514 | 564 | #if wxUSE_SPINCTRL |
57160afe | 565 | EVT_SPINCTRL (ID_SPINCTRL, MyPanel::OnSpinCtrl) |
76106901 VZ |
566 | EVT_SPIN_UP (ID_SPINCTRL, MyPanel::OnSpinCtrlUp) |
567 | EVT_SPIN_DOWN (ID_SPINCTRL, MyPanel::OnSpinCtrlDown) | |
568 | EVT_TEXT (ID_SPINCTRL, MyPanel::OnSpinCtrlText) | |
baccb514 | 569 | #endif // wxUSE_SPINCTRL |
1dd815f3 | 570 | EVT_BUTTON (ID_BTNNEWTEXT, MyPanel::OnNewText) |
1db8dc4a | 571 | EVT_TOGGLEBUTTON(ID_BUTTON_LABEL, MyPanel::OnUpdateLabel) |
87a1e308 | 572 | EVT_CHECKBOX (ID_CHANGE_COLOUR, MyPanel::OnChangeColour) |
3e2dd3db VZ |
573 | EVT_BUTTON (ID_BUTTON_TEST1, MyPanel::OnTestButton) |
574 | EVT_BUTTON (ID_BUTTON_TEST2, MyPanel::OnTestButton) | |
9121bed2 | 575 | EVT_BUTTON (ID_BITMAP_BTN, MyPanel::OnBmpButton) |
bebc503c | 576 | EVT_TOGGLEBUTTON(ID_BITMAP_BTN_ENABLE, MyPanel::OnBmpButtonToggle) |
2b5f62a0 VZ |
577 | |
578 | EVT_CHECKBOX (ID_SIZER_CHECK1, MyPanel::OnSizerCheck) | |
579 | EVT_CHECKBOX (ID_SIZER_CHECK2, MyPanel::OnSizerCheck) | |
580 | EVT_CHECKBOX (ID_SIZER_CHECK3, MyPanel::OnSizerCheck) | |
581 | EVT_CHECKBOX (ID_SIZER_CHECK4, MyPanel::OnSizerCheck) | |
582 | EVT_CHECKBOX (ID_SIZER_CHECK14, MyPanel::OnSizerCheck) | |
583 | EVT_CHECKBOX (ID_SIZER_CHECKBIG, MyPanel::OnSizerCheck) | |
584 | ||
1c005ff7 RR |
585 | END_EVENT_TABLE() |
586 | ||
f6bcfd97 BP |
587 | BEGIN_EVENT_TABLE(MyButton, wxButton) |
588 | EVT_LEFT_DCLICK(MyButton::OnDClick) | |
589 | END_EVENT_TABLE() | |
590 | ||
591 | BEGIN_EVENT_TABLE(MyComboBox, wxComboBox) | |
592 | EVT_CHAR(MyComboBox::OnChar) | |
593 | EVT_KEY_DOWN(MyComboBox::OnKeyDown) | |
594 | EVT_KEY_UP(MyComboBox::OnKeyUp) | |
595 | ||
596 | EVT_SET_FOCUS(MyComboBox::OnFocusGot) | |
597 | END_EVENT_TABLE() | |
598 | ||
599 | BEGIN_EVENT_TABLE(MyRadioBox, wxRadioBox) | |
600 | EVT_SET_FOCUS(MyRadioBox::OnFocusGot) | |
601 | EVT_KILL_FOCUS(MyRadioBox::OnFocusLost) | |
602 | END_EVENT_TABLE() | |
603 | ||
1a84e759 RR |
604 | BEGIN_EVENT_TABLE(MyChoice, wxChoice) |
605 | EVT_SET_FOCUS(MyChoice::OnFocusGot) | |
606 | EVT_KILL_FOCUS(MyChoice::OnFocusLost) | |
607 | END_EVENT_TABLE() | |
608 | ||
f6bcfd97 BP |
609 | // ============================================================================ |
610 | // implementation | |
611 | // ============================================================================ | |
612 | ||
5fb9fcfc | 613 | MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) |
9230b621 | 614 | : wxPanel( frame, wxID_ANY, wxPoint(x, y), wxSize(w, h) ) |
1c005ff7 | 615 | { |
946fb2b9 JS |
616 | m_listbox = NULL; |
617 | m_listboxSorted = NULL; | |
618 | #if wxUSE_CHOICE | |
619 | m_choice = NULL; | |
620 | m_choiceSorted = NULL; | |
6bb44116 | 621 | #endif // wxUSE_CHOICE |
946fb2b9 JS |
622 | m_combo = NULL; |
623 | m_radio = NULL; | |
516ab399 | 624 | #if wxUSE_GAUGE |
946fb2b9 JS |
625 | m_gauge = NULL; |
626 | m_gaugeVert = NULL; | |
516ab399 | 627 | #endif // wxUSE_GAUGE |
6bb44116 | 628 | #if wxUSE_SLIDER |
946fb2b9 | 629 | m_slider = NULL; |
6bb44116 | 630 | #endif // wxUSE_SLIDER |
946fb2b9 JS |
631 | m_fontButton = NULL; |
632 | m_lbSelectNum = NULL; | |
633 | m_lbSelectThis = NULL; | |
634 | #if wxUSE_SPINBTN | |
635 | m_spinbutton = NULL; | |
516ab399 | 636 | #if wxUSE_PROGRESSDLG |
946fb2b9 | 637 | m_btnProgress = NULL; |
516ab399 | 638 | #endif // wxUSE_PROGRESSDLG |
946fb2b9 JS |
639 | #endif // wxUSE_SPINBTN |
640 | #if wxUSE_SPINCTRL | |
641 | m_spinctrl = NULL; | |
642 | #endif // wxUSE_SPINCTRL | |
643 | m_spintext = NULL; | |
644 | m_checkbox = NULL; | |
645 | m_text = NULL; | |
61c083e7 | 646 | m_book = NULL; |
946fb2b9 JS |
647 | m_label = NULL; |
648 | ||
9230b621 | 649 | m_text = new wxTextCtrl(this, wxID_ANY, _T("This is the log window.\n"), |
3e2dd3db | 650 | wxPoint(0, 250), wxSize(100, 50), wxTE_MULTILINE); |
655822f3 | 651 | |
29e7e51a | 652 | m_logTargetOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_text)); |
0a772322 | 653 | |
61c083e7 | 654 | m_book = new wxBookCtrl(this, ID_BOOK); |
655822f3 | 655 | |
ec9f7884 VZ |
656 | wxString choices[] = |
657 | { | |
9f84eccd | 658 | _T("This"), |
6695f8f8 RR |
659 | _T("is"), |
660 | _T("one of my long and"), | |
9f84eccd MB |
661 | _T("wonderful"), |
662 | _T("examples.") | |
ec9f7884 | 663 | }; |
655822f3 | 664 | |
4fabb575 | 665 | #ifdef USE_XPM |
ec9f7884 VZ |
666 | // image ids |
667 | enum | |
668 | { | |
516ab399 WS |
669 | Image_List, |
670 | Image_Choice, | |
671 | Image_Combo, | |
672 | Image_Text, | |
673 | Image_Radio, | |
674 | #if wxUSE_GAUGE | |
675 | Image_Gauge, | |
676 | #endif // wxUSE_GAUGE | |
677 | Image_Max | |
ec9f7884 VZ |
678 | }; |
679 | ||
680 | // fill the image list | |
a374426f | 681 | wxBitmap bmp(list_xpm); |
ec9f7884 | 682 | |
a374426f VZ |
683 | wxImageList *imagelist = new wxImageList(bmp.GetWidth(), bmp.GetHeight()); |
684 | ||
685 | imagelist-> Add( bmp ); | |
ec9f7884 VZ |
686 | imagelist-> Add( wxBitmap( choice_xpm )); |
687 | imagelist-> Add( wxBitmap( combo_xpm )); | |
688 | imagelist-> Add( wxBitmap( text_xpm )); | |
689 | imagelist-> Add( wxBitmap( radio_xpm )); | |
516ab399 | 690 | #if wxUSE_GAUGE |
ec9f7884 | 691 | imagelist-> Add( wxBitmap( gauge_xpm )); |
516ab399 | 692 | #endif // wxUSE_GAUGE |
61c083e7 | 693 | m_book->SetImageList(imagelist); |
73c700fd | 694 | #elif defined(__WXMSW__) |
ec9f7884 VZ |
695 | // load images from resources |
696 | enum | |
697 | { | |
516ab399 WS |
698 | Image_List, |
699 | Image_Choice, | |
700 | Image_Combo, | |
701 | Image_Text, | |
702 | Image_Radio, | |
703 | #if wxUSE_GAUGE | |
704 | Image_Gauge, | |
705 | #endif // wxUSE_GAUGE | |
706 | Image_Max | |
ec9f7884 | 707 | }; |
9230b621 | 708 | wxImageList *imagelist = new wxImageList(16, 16, false, Image_Max); |
ec9f7884 | 709 | |
9f84eccd | 710 | static const wxChar *s_iconNames[Image_Max] = |
ec9f7884 | 711 | { |
516ab399 WS |
712 | _T("list") |
713 | , _T("choice") | |
714 | , _T("combo") | |
715 | , _T("text") | |
716 | , _T("radio") | |
717 | #if wxUSE_GAUGE | |
718 | , _T("gauge") | |
719 | #endif // wxUSE_GAUGE | |
ec9f7884 VZ |
720 | }; |
721 | ||
722 | for ( size_t n = 0; n < Image_Max; n++ ) | |
723 | { | |
724 | wxBitmap bmp(s_iconNames[n]); | |
725 | if ( !bmp.Ok() || (imagelist->Add(bmp) == -1) ) | |
726 | { | |
61c083e7 | 727 | wxLogWarning(wxT("Couldn't load the image '%s' for the book control page %d."), |
ec9f7884 VZ |
728 | s_iconNames[n], n); |
729 | } | |
730 | } | |
731 | ||
61c083e7 | 732 | m_book->SetImageList(imagelist); |
4fabb575 JS |
733 | #else |
734 | ||
ec9f7884 | 735 | // No images for now |
4fabb575 JS |
736 | #define Image_List -1 |
737 | #define Image_Choice -1 | |
738 | #define Image_Combo -1 | |
739 | #define Image_Text -1 | |
740 | #define Image_Radio -1 | |
516ab399 | 741 | #if wxUSE_GAUGE |
4fabb575 | 742 | #define Image_Gauge -1 |
516ab399 | 743 | #endif // wxUSE_GAUGE |
4fabb575 JS |
744 | #define Image_Max -1 |
745 | ||
fc54776e | 746 | #endif |
2cb21a45 | 747 | |
61c083e7 | 748 | wxPanel *panel = new wxPanel(m_book); |
6c8a980f VZ |
749 | m_listbox = new wxListBox( panel, ID_LISTBOX, |
750 | wxPoint(10,10), wxSize(120,70), | |
6695f8f8 | 751 | 5, choices, wxLB_MULTIPLE | wxLB_ALWAYS_SB | wxHSCROLL ); |
6c8a980f VZ |
752 | m_listboxSorted = new wxListBox( panel, ID_LISTBOX_SORTED, |
753 | wxPoint(10,90), wxSize(120,70), | |
6695f8f8 | 754 | 3, choices, wxLB_SORT ); |
6c8a980f | 755 | |
8b81a824 VS |
756 | SetListboxClientData(wxT("listbox"), m_listbox); |
757 | SetListboxClientData(wxT("listbox"), m_listboxSorted); | |
9838df2c | 758 | |
ec9f7884 | 759 | m_listbox->SetCursor(*wxCROSS_CURSOR); |
9f3362c4 | 760 | |
9f84eccd MB |
761 | m_lbSelectNum = new wxButton( panel, ID_LISTBOX_SEL_NUM, _T("Select #&2"), wxPoint(180,30), wxSize(140,30) ); |
762 | m_lbSelectThis = new wxButton( panel, ID_LISTBOX_SEL_STR, _T("&Select 'This'"), wxPoint(340,30), wxSize(140,30) ); | |
763 | (void)new wxButton( panel, ID_LISTBOX_CLEAR, _T("&Clear"), wxPoint(180,80), wxSize(140,30) ); | |
764 | (void)new MyButton( panel, ID_LISTBOX_APPEND, _T("&Append 'Hi!'"), wxPoint(340,80), wxSize(140,30) ); | |
765 | (void)new wxButton( panel, ID_LISTBOX_DELETE, _T("D&elete selected item"), wxPoint(180,130), wxSize(140,30) ); | |
766 | wxButton *button = new MyButton( panel, ID_LISTBOX_FONT, _T("Set &Italic font"), wxPoint(340,130), wxSize(140,30) ); | |
57160afe VZ |
767 | |
768 | button->SetDefault(); | |
57160afe | 769 | |
9f84eccd | 770 | m_checkbox = new wxCheckBox( panel, ID_LISTBOX_ENABLE, _T("&Disable"), wxPoint(20,170) ); |
9230b621 | 771 | m_checkbox->SetValue(false); |
35960bbf | 772 | button->MoveAfterInTabOrder(m_checkbox); |
9f84eccd | 773 | (void)new wxCheckBox( panel, ID_CHANGE_COLOUR, _T("&Toggle colour"), |
87a1e308 | 774 | wxPoint(110,170) ); |
9121bed2 | 775 | panel->SetCursor(wxCursor(wxCURSOR_HAND)); |
61c083e7 | 776 | m_book->AddPage(panel, _T("wxListBox"), true, Image_List); |
ec9f7884 | 777 | |
1ccd23f5 | 778 | #if wxUSE_CHOICE |
61c083e7 | 779 | panel = new wxPanel(m_book); |
1a84e759 RR |
780 | m_choice = new MyChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,wxDefaultCoord), 5, choices ); |
781 | m_choiceSorted = new MyChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,wxDefaultCoord), | |
b56c2246 | 782 | 5, choices, wxCB_SORT ); |
6c8a980f | 783 | |
8b81a824 VS |
784 | SetChoiceClientData(wxT("choice"), m_choice); |
785 | SetChoiceClientData(wxT("choice"), m_choiceSorted); | |
6c8a980f | 786 | |
ddc8c2e3 | 787 | m_choice->SetSelection(2); |
9f84eccd MB |
788 | (void)new wxButton( panel, ID_CHOICE_SEL_NUM, _T("Select #&2"), wxPoint(180,30), wxSize(140,30) ); |
789 | (void)new wxButton( panel, ID_CHOICE_SEL_STR, _T("&Select 'This'"), wxPoint(340,30), wxSize(140,30) ); | |
790 | (void)new wxButton( panel, ID_CHOICE_CLEAR, _T("&Clear"), wxPoint(180,80), wxSize(140,30) ); | |
791 | (void)new wxButton( panel, ID_CHOICE_APPEND, _T("&Append 'Hi!'"), wxPoint(340,80), wxSize(140,30) ); | |
792 | (void)new wxButton( panel, ID_CHOICE_DELETE, _T("D&elete selected item"), wxPoint(180,130), wxSize(140,30) ); | |
793 | (void)new wxButton( panel, ID_CHOICE_FONT, _T("Set &Italic font"), wxPoint(340,130), wxSize(140,30) ); | |
794 | (void)new wxCheckBox( panel, ID_CHOICE_ENABLE, _T("&Disable"), wxPoint(20,130), wxSize(140,30) ); | |
795 | ||
61c083e7 | 796 | m_book->AddPage(panel, _T("wxChoice"), false, Image_Choice); |
1ccd23f5 | 797 | #endif // wxUSE_CHOICE |
ec9f7884 | 798 | |
61c083e7 | 799 | panel = new wxPanel(m_book); |
9230b621 | 800 | (void)new wxStaticBox( panel, wxID_ANY, _T("&Box around combobox"), |
f048e32f | 801 | wxPoint(5, 5), wxSize(150, 100)); |
9f84eccd | 802 | m_combo = new MyComboBox( panel, ID_COMBO, _T("This"), |
422d0ff0 | 803 | wxPoint(20,25), wxSize(120, wxDefaultCoord), |
f6bcfd97 | 804 | 5, choices, |
8e13c1ec | 805 | wxTE_PROCESS_ENTER); |
f6bcfd97 | 806 | |
9f84eccd MB |
807 | (void)new wxButton( panel, ID_COMBO_SEL_NUM, _T("Select #&2"), wxPoint(180,30), wxSize(140,30) ); |
808 | (void)new wxButton( panel, ID_COMBO_SEL_STR, _T("&Select 'This'"), wxPoint(340,30), wxSize(140,30) ); | |
809 | (void)new wxButton( panel, ID_COMBO_CLEAR, _T("&Clear"), wxPoint(180,80), wxSize(140,30) ); | |
810 | (void)new wxButton( panel, ID_COMBO_APPEND, _T("&Append 'Hi!'"), wxPoint(340,80), wxSize(140,30) ); | |
811 | (void)new wxButton( panel, ID_COMBO_DELETE, _T("D&elete selected item"), wxPoint(180,130), wxSize(140,30) ); | |
812 | (void)new wxButton( panel, ID_COMBO_FONT, _T("Set &Italic font"), wxPoint(340,130), wxSize(140,30) ); | |
cc7e9e20 | 813 | (void)new wxButton( panel, ID_COMBO_SET_TEXT, _T("Set 'Hi!' at #2"), wxPoint(340,180), wxSize(140,30) ); |
9f84eccd | 814 | (void)new wxCheckBox( panel, ID_COMBO_ENABLE, _T("&Disable"), wxPoint(20,130), wxSize(140,30) ); |
61c083e7 | 815 | m_book->AddPage(panel, _T("wxComboBox"), false, Image_Combo); |
ec9f7884 | 816 | |
ec9f7884 VZ |
817 | wxString choices2[] = |
818 | { | |
9f84eccd | 819 | _T("First"), _T("Second"), |
0a772322 | 820 | /* "Third", |
17867d61 RR |
821 | "Fourth", "Fifth", "Sixth", |
822 | "Seventh", "Eighth", "Nineth", "Tenth" */ | |
ec9f7884 VZ |
823 | }; |
824 | ||
61c083e7 | 825 | panel = new wxPanel(m_book); |
be8b4385 VZ |
826 | new MyRadioBox(panel, ID_RADIOBOX2, _T("&That"), |
827 | wxPoint(10,160), wxDefaultSize, | |
828 | WXSIZEOF(choices2), choices2, | |
829 | 1, wxRA_SPECIFY_ROWS ); | |
830 | m_radio = new wxRadioBox(panel, ID_RADIOBOX, _T("T&his"), | |
831 | wxPoint(10,10), wxDefaultSize, | |
832 | WXSIZEOF(choices), choices, | |
833 | 1, wxRA_SPECIFY_COLS ); | |
f048e32f | 834 | |
1a8b677e VZ |
835 | #if wxUSE_HELP |
836 | for( unsigned int item = 0; item < WXSIZEOF(choices); ++item ) | |
837 | m_radio->SetItemHelpText( item, wxString::Format( _T("Help text for \"%s\""), choices[item].c_str() ) ); | |
838 | ||
839 | // erase help text for the second item | |
840 | m_radio->SetItemHelpText( 1, _T("") ); | |
841 | // set default help text for control | |
842 | m_radio->SetHelpText( _T("Default helptext for wxRadioBox") ); | |
843 | #endif // wxUSE_HELP | |
844 | ||
9f84eccd MB |
845 | (void)new wxButton( panel, ID_RADIOBOX_SEL_NUM, _T("Select #&2"), wxPoint(180,30), wxSize(140,30) ); |
846 | (void)new wxButton( panel, ID_RADIOBOX_SEL_STR, _T("&Select 'This'"), wxPoint(180,80), wxSize(140,30) ); | |
847 | m_fontButton = new wxButton( panel, ID_SET_FONT, _T("Set &more Italic font"), wxPoint(340,30), wxSize(140,30) ); | |
848 | (void)new wxButton( panel, ID_RADIOBOX_FONT, _T("Set &Italic font"), wxPoint(340,80), wxSize(140,30) ); | |
849 | (void)new wxCheckBox( panel, ID_RADIOBOX_ENABLE, _T("&Disable"), wxPoint(340,130), wxDefaultSize ); | |
bc50a2ae | 850 | |
9f84eccd | 851 | wxRadioButton *rb = new wxRadioButton( panel, ID_RADIOBUTTON_1, _T("Radiobutton1"), wxPoint(210,170), wxDefaultSize, wxRB_GROUP ); |
9230b621 | 852 | rb->SetValue( false ); |
9f84eccd | 853 | (void)new wxRadioButton( panel, ID_RADIOBUTTON_2, _T("&Radiobutton2"), wxPoint(340,170), wxDefaultSize ); |
61c083e7 | 854 | m_book->AddPage(panel, _T("wxRadioBox"), false, Image_Radio); |
ec9f7884 | 855 | |
1dd815f3 | 856 | |
6bb44116 | 857 | #if wxUSE_SLIDER && wxUSE_GAUGE |
61c083e7 | 858 | panel = new wxPanel(m_book); |
0d29fecd | 859 | |
1dd815f3 RR |
860 | wxBoxSizer *main_sizer = new wxBoxSizer( wxHORIZONTAL ); |
861 | panel->SetSizer( main_sizer ); | |
0d29fecd | 862 | |
1dd815f3 RR |
863 | wxStaticBoxSizer *gauge_sizer = new wxStaticBoxSizer( wxHORIZONTAL, panel, _T("&wxGauge and wxSlider") ); |
864 | main_sizer->Add( gauge_sizer, 0, wxALL, 5 ); | |
865 | wxBoxSizer *sz = new wxBoxSizer( wxVERTICAL ); | |
866 | gauge_sizer->Add( sz ); | |
867 | m_gauge = new wxGauge( panel, wxID_ANY, 200, wxDefaultPosition, wxSize(155, 30), wxGA_HORIZONTAL|wxNO_BORDER ); | |
1dd815f3 | 868 | sz->Add( m_gauge, 0, wxALL, 10 ); |
bebc503c | 869 | m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, |
1dd815f3 | 870 | wxDefaultPosition, wxSize(155,wxDefaultCoord), |
bebc503c | 871 | wxSL_AUTOTICKS | wxSL_LABELS); |
7ba4fbeb | 872 | m_slider->SetTickFreq(40, 0); |
1dd815f3 | 873 | sz->Add( m_slider, 0, wxALL, 10 ); |
0d29fecd | 874 | |
1dd815f3 RR |
875 | m_gaugeVert = new wxGauge( panel, wxID_ANY, 100, |
876 | wxDefaultPosition, wxSize(wxDefaultCoord, 90), | |
877 | wxGA_VERTICAL | wxGA_SMOOTH | wxNO_BORDER ); | |
878 | gauge_sizer->Add( m_gaugeVert, 0, wxALL, 10 ); | |
879 | ||
8b1d8f36 | 880 | |
1dd815f3 RR |
881 | |
882 | wxStaticBox *sb = new wxStaticBox( panel, wxID_ANY, _T("&Explanation"), | |
883 | wxDefaultPosition, wxDefaultSize ); //, wxALIGN_CENTER ); | |
884 | wxStaticBoxSizer *wrapping_sizer = new wxStaticBoxSizer( sb, wxVERTICAL ); | |
885 | main_sizer->Add( wrapping_sizer, 0, wxALL, 5 ); | |
4d23a4bf | 886 | |
9838df2c | 887 | #ifdef __WXMOTIF__ |
ec9f7884 | 888 | // No wrapping text in wxStaticText yet :-( |
1dd815f3 | 889 | m_wrappingText = new wxStaticText( panel, wxID_ANY, |
9f84eccd | 890 | _T("Drag the slider!"), |
37ed3ae3 | 891 | wxPoint(250,30), |
422d0ff0 | 892 | wxSize(240, wxDefaultCoord) |
ec9f7884 | 893 | ); |
9838df2c | 894 | #else |
1dd815f3 RR |
895 | m_wrappingText = new wxStaticText( panel, wxID_ANY, |
896 | _T("In order see the gauge (aka progress bar) ") | |
897 | _T("control do something you have to drag the ") | |
898 | _T("handle of the slider to the right.") | |
899 | _T("\n\n") | |
900 | _T("This is also supposed to demonstrate how ") | |
901 | _T("to use static controls with line wrapping."), | |
902 | wxDefaultPosition, | |
a71d815b | 903 | wxSize(240, wxDefaultCoord) |
ec9f7884 | 904 | ); |
9838df2c | 905 | #endif |
1dd815f3 RR |
906 | wrapping_sizer->Add( m_wrappingText ); |
907 | ||
908 | wxStaticBoxSizer *non_wrapping_sizer = new wxStaticBoxSizer( wxVERTICAL, panel, wxT("Non-wrapping") ); | |
909 | main_sizer->Add( non_wrapping_sizer, 0, wxALL, 5 ); | |
910 | ||
911 | m_nonWrappingText = new wxStaticText( panel, wxID_ANY, | |
912 | _T("This static text has two lines.\nThey do not wrap."), | |
913 | wxDefaultPosition, | |
914 | wxDefaultSize | |
915 | ); | |
916 | non_wrapping_sizer->Add( m_nonWrappingText ); | |
917 | ||
918 | (void)new wxButton( panel, ID_BTNNEWTEXT, wxT("New text"), wxPoint(450, 160) ); | |
919 | ||
8c3c31d4 VZ |
920 | int initialSpinValue = -5; |
921 | wxString s; | |
922 | s << initialSpinValue; | |
422d0ff0 | 923 | m_spintext = new wxTextCtrl( panel, wxID_ANY, s, wxPoint(20,160), wxSize(80,wxDefaultCoord) ); |
0e528b99 | 924 | #if wxUSE_SPINBTN |
6695f8f8 | 925 | m_spinbutton = new wxSpinButton( panel, ID_SPIN, wxPoint(103,160), wxSize(-1, m_spintext->GetSize().y) ); |
e94ff4cb | 926 | m_spinbutton->SetRange(-40,30); |
8c3c31d4 | 927 | m_spinbutton->SetValue(initialSpinValue); |
9726da4f | 928 | |
516ab399 | 929 | #if wxUSE_PROGRESSDLG |
9f84eccd | 930 | m_btnProgress = new wxButton( panel, ID_BTNPROGRESS, _T("&Show progress dialog"), |
738f9e5a | 931 | wxPoint(300, 160) ); |
516ab399 | 932 | #endif // wxUSE_PROGRESSDLG |
0e528b99 | 933 | #endif // wxUSE_SPINBTN |
b782f2e0 VZ |
934 | |
935 | #if wxUSE_SPINCTRL | |
a71d815b | 936 | m_spinctrl = new wxSpinCtrl( panel, ID_SPINCTRL, wxEmptyString, wxPoint(200, 160), wxSize(80, wxDefaultCoord) ); |
69199aad | 937 | m_spinctrl->SetRange(-10,30); |
b782f2e0 VZ |
938 | m_spinctrl->SetValue(15); |
939 | #endif // wxUSE_SPINCTRL | |
940 | ||
61c083e7 | 941 | m_book->AddPage(panel, _T("wxGauge"), false, Image_Gauge); |
6bb44116 | 942 | #endif // wxUSE_SLIDER && wxUSE_GAUGE |
45e41c05 | 943 | |
1dd815f3 | 944 | |
61c083e7 | 945 | panel = new wxPanel(m_book); |
b782f2e0 | 946 | |
3a5bcc4d | 947 | #if !defined(__WXMOTIF__) // wxStaticBitmap not working under Motif yet. |
389d906b | 948 | wxIcon icon = wxArtProvider::GetIcon(wxART_INFORMATION); |
9230b621 | 949 | (void) new wxStaticBitmap( panel, wxID_ANY, icon, wxPoint(10, 10) ); |
45e41c05 | 950 | |
bebe1443 | 951 | // VZ: don't leak memory |
9230b621 | 952 | // bmpStatic = new wxStaticBitmap(panel, wxID_ANY, wxNullIcon, wxPoint(50, 10)); |
bebe1443 | 953 | // bmpStatic->SetIcon(wxArtProvider::GetIcon(wxART_QUESTION)); |
b782f2e0 VZ |
954 | #endif // !Motif |
955 | ||
45e41c05 VZ |
956 | wxBitmap bitmap( 100, 100 ); |
957 | wxMemoryDC dc; | |
958 | dc.SelectObject( bitmap ); | |
90d05e9b JG |
959 | dc.SetBackground(*wxGREEN); |
960 | dc.SetPen(*wxRED_PEN); | |
f048e32f | 961 | dc.Clear(); |
45e41c05 | 962 | dc.DrawEllipse(5, 5, 90, 90); |
9f84eccd | 963 | dc.DrawText(_T("Bitmap"), 30, 40); |
45e41c05 VZ |
964 | dc.SelectObject( wxNullBitmap ); |
965 | ||
9121bed2 | 966 | (void)new wxBitmapButton(panel, ID_BITMAP_BTN, bitmap, wxPoint(100, 20)); |
bebc503c VZ |
967 | (void)new wxToggleButton(panel, ID_BITMAP_BTN_ENABLE, |
968 | _T("Enable/disable &bitmap"), wxPoint(100, 140)); | |
f048e32f | 969 | |
aae0472b | 970 | #if defined(__WXMSW__) || defined(__WXMOTIF__) |
3e2dd3db | 971 | // test for masked bitmap display |
9f84eccd | 972 | bitmap = wxBitmap(_T("test2.bmp"), wxBITMAP_TYPE_BMP); |
9bb3479c JS |
973 | if (bitmap.Ok()) |
974 | { | |
975 | bitmap.SetMask(new wxMask(bitmap, *wxBLUE)); | |
669f7a11 | 976 | |
bebc503c | 977 | (void)new wxStaticBitmap(panel, wxID_ANY, bitmap, wxPoint(300, 120)); |
9bb3479c | 978 | } |
57160afe | 979 | #endif |
5ef2e633 | 980 | |
389d906b VS |
981 | wxBitmap bmp1(wxArtProvider::GetBitmap(wxART_INFORMATION)), |
982 | bmp2(wxArtProvider::GetBitmap(wxART_WARNING)), | |
983 | bmp3(wxArtProvider::GetBitmap(wxART_QUESTION)); | |
f048e32f VZ |
984 | wxBitmapButton *bmpBtn = new wxBitmapButton |
985 | ( | |
9230b621 | 986 | panel, wxID_ANY, |
f048e32f | 987 | bmp1, |
1db8dc4a | 988 | wxPoint(30, 70) |
f048e32f | 989 | ); |
76fcf0f2 | 990 | |
f048e32f VZ |
991 | bmpBtn->SetBitmapSelected(bmp2); |
992 | bmpBtn->SetBitmapFocus(bmp3); | |
993 | ||
1db8dc4a | 994 | (void)new wxToggleButton(panel, ID_BUTTON_LABEL, |
9f84eccd | 995 | _T("&Toggle label"), wxPoint(250, 20)); |
bedaf53e | 996 | |
9230b621 | 997 | m_label = new wxStaticText(panel, wxID_ANY, _T("Label with some long text"), |
185fa6bf | 998 | wxPoint(250, 60), wxDefaultSize, |
f6bcfd97 | 999 | wxALIGN_RIGHT /*| wxST_NO_AUTORESIZE*/); |
103aab26 | 1000 | m_label->SetForegroundColour( *wxBLUE ); |
2ac1b69a | 1001 | |
61c083e7 | 1002 | m_book->AddPage(panel, _T("wxBitmapXXX")); |
dcc71398 | 1003 | |
9d9b7755 | 1004 | // sizer |
61c083e7 | 1005 | panel = new wxPanel(m_book); |
dcc71398 | 1006 | |
2b5f62a0 VZ |
1007 | wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL ); |
1008 | ||
1009 | wxStaticBoxSizer *csizer = | |
5014bb3a | 1010 | new wxStaticBoxSizer (new wxStaticBox (panel, wxID_ANY, _T("Show Buttons")), wxHORIZONTAL ); |
61c083e7 | 1011 | |
2b5f62a0 | 1012 | wxCheckBox *check1, *check2, *check3, *check4, *check14, *checkBig; |
9f84eccd | 1013 | check1 = new wxCheckBox (panel, ID_SIZER_CHECK1, _T("1")); |
9230b621 | 1014 | check1->SetValue (true); |
2b5f62a0 | 1015 | csizer->Add (check1); |
9f84eccd | 1016 | check2 = new wxCheckBox (panel, ID_SIZER_CHECK2, _T("2")); |
9230b621 | 1017 | check2->SetValue (true); |
2b5f62a0 | 1018 | csizer->Add (check2); |
9f84eccd | 1019 | check3 = new wxCheckBox (panel, ID_SIZER_CHECK3, _T("3")); |
9230b621 | 1020 | check3->SetValue (true); |
2b5f62a0 | 1021 | csizer->Add (check3); |
9f84eccd | 1022 | check4 = new wxCheckBox (panel, ID_SIZER_CHECK4, _T("4")); |
9230b621 | 1023 | check4->SetValue (true); |
2b5f62a0 | 1024 | csizer->Add (check4); |
9f84eccd | 1025 | check14 = new wxCheckBox (panel, ID_SIZER_CHECK14, _T("1-4")); |
9230b621 | 1026 | check14->SetValue (true); |
2b5f62a0 | 1027 | csizer->Add (check14); |
9f84eccd | 1028 | checkBig = new wxCheckBox (panel, ID_SIZER_CHECKBIG, _T("Big")); |
9230b621 | 1029 | checkBig->SetValue (true); |
2b5f62a0 | 1030 | csizer->Add (checkBig); |
61c083e7 | 1031 | |
2b5f62a0 VZ |
1032 | sizer->Add (csizer); |
1033 | ||
1034 | m_hsizer = new wxBoxSizer( wxHORIZONTAL ); | |
9d9b7755 | 1035 | |
2b5f62a0 | 1036 | m_buttonSizer = new wxBoxSizer (wxVERTICAL); |
61c083e7 | 1037 | |
3f93f659 | 1038 | m_sizerBtn1 = new wxButton(panel, wxID_ANY, _T("Test Button &1 (tab order 1)") ); |
2b5f62a0 | 1039 | m_buttonSizer->Add( m_sizerBtn1, 0, wxALL, 10 ); |
3f93f659 | 1040 | m_sizerBtn2 = new wxButton(panel, wxID_ANY, _T("Test Button &2 (tab order 3)") ); |
2b5f62a0 | 1041 | m_buttonSizer->Add( m_sizerBtn2, 0, wxALL, 10 ); |
3f93f659 | 1042 | m_sizerBtn3 = new wxButton(panel, wxID_ANY, _T("Test Button &3 (tab order 2)") ); |
2b5f62a0 | 1043 | m_buttonSizer->Add( m_sizerBtn3, 0, wxALL, 10 ); |
3f93f659 | 1044 | m_sizerBtn4 = new wxButton(panel, wxID_ANY, _T("Test Button &4 (tab order 4)") ); |
2b5f62a0 VZ |
1045 | m_buttonSizer->Add( m_sizerBtn4, 0, wxALL, 10 ); |
1046 | ||
3f93f659 VS |
1047 | m_sizerBtn3->MoveBeforeInTabOrder(m_sizerBtn2); |
1048 | ||
2b5f62a0 VZ |
1049 | m_hsizer->Add (m_buttonSizer); |
1050 | m_hsizer->Add( 20,20, 1 ); | |
9230b621 | 1051 | m_bigBtn = new wxButton(panel, wxID_ANY, _T("Multiline\nbutton") ); |
2b5f62a0 VZ |
1052 | m_hsizer->Add( m_bigBtn , 3, wxGROW|wxALL, 10 ); |
1053 | ||
1054 | sizer->Add (m_hsizer, 1, wxGROW); | |
9d9b7755 VZ |
1055 | |
1056 | panel->SetSizer( sizer ); | |
1057 | ||
61c083e7 | 1058 | m_book->AddPage(panel, _T("wxSizer")); |
655822f3 | 1059 | |
9ae19599 VZ |
1060 | // set the sizer for the panel itself |
1061 | sizer = new wxBoxSizer(wxVERTICAL); | |
1062 | sizer->Add(m_book, wxSizerFlags().Border().Expand()); | |
1063 | sizer->Add(m_text, wxSizerFlags(1).Border().Expand()); | |
1064 | SetSizer(sizer); | |
be8b4385 VZ |
1065 | |
1066 | #if wxUSE_TOOLTIPS | |
1067 | SetAllToolTips(); | |
1068 | #endif // wxUSE_TOOLTIPS | |
1c005ff7 RR |
1069 | } |
1070 | ||
be8b4385 VZ |
1071 | #if wxUSE_TOOLTIPS |
1072 | ||
1073 | namespace | |
1074 | { | |
1075 | ||
1076 | void ResetToolTip(wxWindow *win, const char *tip) | |
1077 | { | |
1078 | wxCHECK_RET( win, "NULL window?" ); | |
1079 | ||
1080 | win->UnsetToolTip(); | |
1081 | win->SetToolTip(tip); | |
1082 | } | |
1083 | ||
1084 | } | |
1085 | ||
1086 | void MyPanel::SetAllToolTips() | |
1087 | { | |
1088 | ResetToolTip(FindWindow(ID_LISTBOX_FONT), "Press here to set italic font"); | |
1089 | ResetToolTip(m_checkbox, "Click here to disable the listbox"); | |
1090 | ResetToolTip(m_listbox, "This is a list box"); | |
1091 | ResetToolTip(m_combo, "This is a natural\ncombobox - can you believe me?"); | |
1092 | ResetToolTip(m_slider, "This is a sliding slider"); | |
1093 | ResetToolTip(FindWindow(ID_RADIOBOX2), "Ever seen a radiobox?"); | |
1094 | ||
1095 | //ResetToolTip(m_radio, "Tooltip for the entire radiobox"); | |
1096 | for ( unsigned int nb = 0; nb < m_radio->GetCount(); nb++ ) | |
1097 | { | |
1098 | m_radio->SetItemToolTip(nb, ""); | |
1099 | m_radio->SetItemToolTip(nb, "tooltip for\n" + m_radio->GetString(nb)); | |
1100 | } | |
1101 | ||
1102 | // remove the tooltip for one of the items | |
1103 | m_radio->SetItemToolTip(2, ""); | |
1104 | } | |
1105 | #endif // wxUSE_TOOLTIPS | |
1106 | ||
f226be17 VZ |
1107 | void MyPanel::OnIdle(wxIdleEvent& event) |
1108 | { | |
1109 | static const int INVALID_SELECTION = -2; | |
1110 | ||
1111 | static int s_selCombo = INVALID_SELECTION; | |
25e19bdf JS |
1112 | |
1113 | if (!m_combo || !m_choice) | |
1114 | { | |
1115 | event.Skip(); | |
1116 | return; | |
1117 | } | |
1118 | ||
f226be17 VZ |
1119 | int sel = m_combo->GetSelection(); |
1120 | if ( sel != s_selCombo ) | |
1121 | { | |
1122 | if ( s_selCombo != INVALID_SELECTION ) | |
1123 | { | |
1124 | wxLogMessage(_T("EVT_IDLE: combobox selection changed from %d to %d"), | |
1125 | s_selCombo, sel); | |
1126 | } | |
1127 | ||
1128 | s_selCombo = sel; | |
1129 | } | |
1130 | ||
d6bbc10c VZ |
1131 | static int s_selChoice = INVALID_SELECTION; |
1132 | sel = m_choice->GetSelection(); | |
1133 | if ( sel != s_selChoice ) | |
1134 | { | |
1135 | if ( s_selChoice != INVALID_SELECTION ) | |
1136 | { | |
1137 | wxLogMessage(_T("EVT_IDLE: choice selection changed from %d to %d"), | |
1138 | s_selChoice, sel); | |
1139 | } | |
1140 | ||
1141 | s_selChoice = sel; | |
1142 | } | |
1143 | ||
f226be17 VZ |
1144 | event.Skip(); |
1145 | } | |
1146 | ||
61c083e7 | 1147 | void MyPanel::OnPageChanging( wxBookCtrlEvent &event ) |
4d0f3cd6 | 1148 | { |
45e41c05 VZ |
1149 | int selOld = event.GetOldSelection(); |
1150 | if ( selOld == 2 ) | |
4d0f3cd6 | 1151 | { |
9f84eccd MB |
1152 | if ( wxMessageBox(_T("This demonstrates how a program may prevent the\n") |
1153 | _T("page change from taking place - if you select\n") | |
1154 | _T("[No] the current page will stay the third one\n"), | |
1155 | _T("Control sample"), | |
f6bcfd97 | 1156 | wxICON_QUESTION | wxYES_NO, this) != wxYES ) |
8c3c31d4 VZ |
1157 | { |
1158 | event.Veto(); | |
45e41c05 | 1159 | |
8c3c31d4 VZ |
1160 | return; |
1161 | } | |
4d0f3cd6 | 1162 | } |
45e41c05 | 1163 | |
61c083e7 | 1164 | *m_text << _T("Book selection is being changed from ") << selOld |
9f84eccd | 1165 | << _T(" to ") << event.GetSelection() |
61c083e7 WS |
1166 | << _T(" (current page from book is ") |
1167 | << m_book->GetSelection() << _T(")\n"); | |
4d0f3cd6 VZ |
1168 | } |
1169 | ||
61c083e7 | 1170 | void MyPanel::OnPageChanged( wxBookCtrlEvent &event ) |
cb43b372 | 1171 | { |
61c083e7 WS |
1172 | *m_text << _T("Book selection is now ") << event.GetSelection() |
1173 | << _T(" (from book: ") << m_book->GetSelection() | |
9f84eccd | 1174 | << _T(")\n"); |
cb43b372 RR |
1175 | } |
1176 | ||
3e2dd3db VZ |
1177 | void MyPanel::OnTestButton(wxCommandEvent& event) |
1178 | { | |
1179 | wxLogMessage(_T("Button %c clicked."), | |
1180 | event.GetId() == ID_BUTTON_TEST1 ? _T('1') : _T('2')); | |
1181 | } | |
1182 | ||
87728739 | 1183 | void MyPanel::OnBmpButton(wxCommandEvent& WXUNUSED(event)) |
9121bed2 VZ |
1184 | { |
1185 | wxLogMessage(_T("Bitmap button clicked.")); | |
1186 | } | |
1187 | ||
bebc503c VZ |
1188 | void MyPanel::OnBmpButtonToggle(wxCommandEvent& event) |
1189 | { | |
1190 | FindWindow(ID_BITMAP_BTN)->Enable(!event.IsChecked()); | |
1191 | } | |
1192 | ||
87a1e308 VZ |
1193 | void MyPanel::OnChangeColour(wxCommandEvent& WXUNUSED(event)) |
1194 | { | |
1195 | static wxColour s_colOld; | |
1196 | ||
29c749b8 | 1197 | SetThemeEnabled(false); |
87a1e308 VZ |
1198 | // test panel colour changing and propagation to the subcontrols |
1199 | if ( s_colOld.Ok() ) | |
1200 | { | |
1201 | SetBackgroundColour(s_colOld); | |
1202 | s_colOld = wxNullColour; | |
1203 | ||
29c749b8 VS |
1204 | m_lbSelectThis->SetForegroundColour(wxNullColour); |
1205 | m_lbSelectThis->SetBackgroundColour(wxNullColour); | |
87a1e308 VZ |
1206 | } |
1207 | else | |
1208 | { | |
a60b1f5d MB |
1209 | s_colOld = wxColour(wxT("red")); |
1210 | SetBackgroundColour(wxT("white")); | |
87a1e308 | 1211 | |
a60b1f5d MB |
1212 | m_lbSelectThis->SetForegroundColour(wxT("white")); |
1213 | m_lbSelectThis->SetBackgroundColour(wxT("red")); | |
87a1e308 VZ |
1214 | } |
1215 | ||
1216 | m_lbSelectThis->Refresh(); | |
1217 | Refresh(); | |
1218 | } | |
1219 | ||
1c005ff7 RR |
1220 | void MyPanel::OnListBox( wxCommandEvent &event ) |
1221 | { | |
6c8a980f VZ |
1222 | wxListBox *listbox = event.GetId() == ID_LISTBOX ? m_listbox |
1223 | : m_listboxSorted; | |
1224 | ||
0f252d11 RR |
1225 | bool deselect = false; |
1226 | if (listbox->HasFlag(wxLB_MULTIPLE) || listbox->HasFlag(wxLB_EXTENDED)) | |
1227 | { | |
1228 | deselect = !event.IsSelection(); | |
1229 | if (deselect) | |
1230 | m_text->AppendText( _T("ListBox deselection event\n") ); | |
1231 | } | |
1232 | ||
9f84eccd | 1233 | m_text->AppendText( _T("ListBox event selection string is: '") ); |
ec9f7884 | 1234 | m_text->AppendText( event.GetString() ); |
9f84eccd | 1235 | m_text->AppendText( _T("'\n") ); |
45262a34 VZ |
1236 | |
1237 | // can't use GetStringSelection() with multiple selections, there could be | |
1238 | // more than one of them | |
0f252d11 | 1239 | if ( !listbox->HasFlag(wxLB_MULTIPLE) && !listbox->HasFlag(wxLB_EXTENDED) ) |
45262a34 VZ |
1240 | { |
1241 | m_text->AppendText( _T("ListBox control selection string is: '") ); | |
1242 | m_text->AppendText( listbox->GetStringSelection() ); | |
1243 | m_text->AppendText( _T("'\n") ); | |
1244 | } | |
6c8a980f VZ |
1245 | |
1246 | wxStringClientData *obj = ((wxStringClientData *)event.GetClientObject()); | |
9f84eccd | 1247 | m_text->AppendText( _T("ListBox event client data string is: '") ); |
6e47faf1 | 1248 | if (obj) // BC++ doesn't like use of '? .. : .. ' in this context |
74a533f7 | 1249 | m_text->AppendText( obj->GetData() ); |
6e47faf1 | 1250 | else |
9f84eccd | 1251 | m_text->AppendText( wxString(_T("none")) ); |
6e47faf1 | 1252 | |
9f84eccd MB |
1253 | m_text->AppendText( _T("'\n") ); |
1254 | m_text->AppendText( _T("ListBox control client data string is: '") ); | |
45262a34 | 1255 | obj = (wxStringClientData *)listbox->GetClientObject(event.GetInt()); |
6e47faf1 | 1256 | if (obj) |
74a533f7 | 1257 | m_text->AppendText( obj->GetData() ); |
6e47faf1 | 1258 | else |
9f84eccd MB |
1259 | m_text->AppendText( wxString(_T("none")) ); |
1260 | m_text->AppendText( _T("'\n") ); | |
1c005ff7 RR |
1261 | } |
1262 | ||
5b077d48 RR |
1263 | void MyPanel::OnListBoxDoubleClick( wxCommandEvent &event ) |
1264 | { | |
9f84eccd | 1265 | m_text->AppendText( _T("ListBox double click string is: ") ); |
ec9f7884 | 1266 | m_text->AppendText( event.GetString() ); |
9f84eccd | 1267 | m_text->AppendText( _T("\n") ); |
5b077d48 RR |
1268 | } |
1269 | ||
47908e25 RR |
1270 | void MyPanel::OnListBoxButtons( wxCommandEvent &event ) |
1271 | { | |
ec9f7884 | 1272 | switch (event.GetId()) |
d3904ceb | 1273 | { |
ec9f7884 VZ |
1274 | case ID_LISTBOX_ENABLE: |
1275 | { | |
9f84eccd | 1276 | m_text->AppendText(_T("Checkbox clicked.\n")); |
b8653fbf | 1277 | #if wxUSE_TOOLTIPS |
0ae0226b | 1278 | wxCheckBox *cb = (wxCheckBox*)event.GetEventObject(); |
ec9f7884 | 1279 | if (event.GetInt()) |
9f84eccd | 1280 | cb->SetToolTip( _T("Click to enable listbox") ); |
ec9f7884 | 1281 | else |
9f84eccd | 1282 | cb->SetToolTip( _T("Click to disable listbox") ); |
16f6dfd8 | 1283 | #endif // wxUSE_TOOLTIPS |
ec9f7884 | 1284 | m_listbox->Enable( event.GetInt() == 0 ); |
57160afe VZ |
1285 | m_lbSelectThis->Enable( event.GetInt() == 0 ); |
1286 | m_lbSelectNum->Enable( event.GetInt() == 0 ); | |
6c8a980f | 1287 | m_listboxSorted->Enable( event.GetInt() == 0 ); |
ee6e1b1d | 1288 | FindWindow(ID_CHANGE_COLOUR)->Enable( event.GetInt() == 0 ); |
ec9f7884 VZ |
1289 | break; |
1290 | } | |
1291 | case ID_LISTBOX_SEL_NUM: | |
1292 | { | |
91f2c154 JS |
1293 | if (m_listbox->GetCount() > 2) |
1294 | m_listbox->SetSelection( 2 ); | |
1295 | if (m_listboxSorted->GetCount() > 2) | |
1296 | m_listboxSorted->SetSelection( 2 ); | |
8c3c31d4 | 1297 | m_lbSelectThis->WarpPointer( 40, 14 ); |
ec9f7884 VZ |
1298 | break; |
1299 | } | |
1300 | case ID_LISTBOX_SEL_STR: | |
1301 | { | |
5014bb3a | 1302 | if (m_listbox->FindString(_T("This")) != wxNOT_FOUND) |
91f2c154 | 1303 | m_listbox->SetStringSelection( _T("This") ); |
5014bb3a | 1304 | if (m_listboxSorted->FindString(_T("This")) != wxNOT_FOUND) |
91f2c154 | 1305 | m_listboxSorted->SetStringSelection( _T("This") ); |
8c3c31d4 | 1306 | m_lbSelectNum->WarpPointer( 40, 14 ); |
ec9f7884 VZ |
1307 | break; |
1308 | } | |
1309 | case ID_LISTBOX_CLEAR: | |
1310 | { | |
1311 | m_listbox->Clear(); | |
6c8a980f | 1312 | m_listboxSorted->Clear(); |
ec9f7884 VZ |
1313 | break; |
1314 | } | |
1315 | case ID_LISTBOX_APPEND: | |
1316 | { | |
6695f8f8 RR |
1317 | m_listbox->Append( _T("Hi kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk!") ); |
1318 | m_listboxSorted->Append( _T("Hi hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!") ); | |
ec9f7884 VZ |
1319 | break; |
1320 | } | |
1321 | case ID_LISTBOX_DELETE: | |
1322 | { | |
6c8a980f VZ |
1323 | int idx; |
1324 | idx = m_listbox->GetSelection(); | |
f6bcfd97 BP |
1325 | if ( idx != wxNOT_FOUND ) |
1326 | m_listbox->Delete( idx ); | |
6c8a980f | 1327 | idx = m_listboxSorted->GetSelection(); |
f6bcfd97 BP |
1328 | if ( idx != wxNOT_FOUND ) |
1329 | m_listboxSorted->Delete( idx ); | |
ec9f7884 VZ |
1330 | break; |
1331 | } | |
1332 | case ID_LISTBOX_FONT: | |
1333 | { | |
1334 | m_listbox->SetFont( *wxITALIC_FONT ); | |
6c8a980f | 1335 | m_listboxSorted->SetFont( *wxITALIC_FONT ); |
ec9f7884 VZ |
1336 | m_checkbox->SetFont( *wxITALIC_FONT ); |
1337 | break; | |
1338 | } | |
868a2826 | 1339 | } |
47908e25 RR |
1340 | } |
1341 | ||
1ccd23f5 | 1342 | #if wxUSE_CHOICE |
bc50a2ae | 1343 | |
da603a67 | 1344 | static wxString GetDataString(wxClientData *data) |
bc50a2ae | 1345 | { |
81d3348a | 1346 | return data ? static_cast<wxStringClientData *>(data)->GetData() |
da603a67 | 1347 | : wxString("none"); |
bc50a2ae VZ |
1348 | } |
1349 | ||
47908e25 RR |
1350 | void MyPanel::OnChoice( wxCommandEvent &event ) |
1351 | { | |
6c8a980f VZ |
1352 | wxChoice *choice = event.GetId() == ID_CHOICE ? m_choice |
1353 | : m_choiceSorted; | |
1354 | ||
bc50a2ae | 1355 | const int sel = choice->GetSelection(); |
6c8a980f | 1356 | |
bc50a2ae VZ |
1357 | wxClientData *dataEvt = event.GetClientObject(), |
1358 | *dataCtrl = choice->GetClientObject(sel); | |
6e47faf1 | 1359 | |
bc50a2ae VZ |
1360 | wxLogMessage(_T("EVT_CHOICE: item %d/%d (event/control), ") |
1361 | _T("string \"%s\"/\"%s\", ") | |
1362 | _T("data \"%s\"/\"%s\""), | |
1363 | (int)event.GetInt(), | |
1364 | sel, | |
da603a67 VZ |
1365 | event.GetString(), |
1366 | choice->GetStringSelection(), | |
bc50a2ae VZ |
1367 | GetDataString(dataEvt), |
1368 | GetDataString(dataCtrl)); | |
47908e25 RR |
1369 | } |
1370 | ||
1371 | void MyPanel::OnChoiceButtons( wxCommandEvent &event ) | |
1372 | { | |
ec9f7884 | 1373 | switch (event.GetId()) |
47908e25 | 1374 | { |
ec9f7884 VZ |
1375 | case ID_CHOICE_ENABLE: |
1376 | { | |
1377 | m_choice->Enable( event.GetInt() == 0 ); | |
b56c2246 | 1378 | m_choiceSorted->Enable( event.GetInt() == 0 ); |
ec9f7884 VZ |
1379 | break; |
1380 | } | |
1381 | case ID_CHOICE_SEL_NUM: | |
1382 | { | |
1383 | m_choice->SetSelection( 2 ); | |
b56c2246 | 1384 | m_choiceSorted->SetSelection( 2 ); |
ec9f7884 VZ |
1385 | break; |
1386 | } | |
1387 | case ID_CHOICE_SEL_STR: | |
1388 | { | |
9f84eccd MB |
1389 | m_choice->SetStringSelection( _T("This") ); |
1390 | m_choiceSorted->SetStringSelection( _T("This") ); | |
ec9f7884 VZ |
1391 | break; |
1392 | } | |
1393 | case ID_CHOICE_CLEAR: | |
1394 | { | |
1395 | m_choice->Clear(); | |
b56c2246 | 1396 | m_choiceSorted->Clear(); |
ec9f7884 VZ |
1397 | break; |
1398 | } | |
1399 | case ID_CHOICE_APPEND: | |
1400 | { | |
9f84eccd MB |
1401 | m_choice->Append( _T("Hi!") ); |
1402 | m_choiceSorted->Append( _T("Hi!") ); | |
ec9f7884 VZ |
1403 | break; |
1404 | } | |
1405 | case ID_CHOICE_DELETE: | |
1406 | { | |
1407 | int idx = m_choice->GetSelection(); | |
f6bcfd97 BP |
1408 | if ( idx != wxNOT_FOUND ) |
1409 | m_choice->Delete( idx ); | |
b56c2246 | 1410 | idx = m_choiceSorted->GetSelection(); |
f6bcfd97 BP |
1411 | if ( idx != wxNOT_FOUND ) |
1412 | m_choiceSorted->Delete( idx ); | |
ec9f7884 VZ |
1413 | break; |
1414 | } | |
1415 | case ID_CHOICE_FONT: | |
1416 | { | |
1417 | m_choice->SetFont( *wxITALIC_FONT ); | |
b56c2246 | 1418 | m_choiceSorted->SetFont( *wxITALIC_FONT ); |
ec9f7884 VZ |
1419 | break; |
1420 | } | |
868a2826 | 1421 | } |
47908e25 | 1422 | } |
1ccd23f5 | 1423 | #endif // wxUSE_CHOICE |
47908e25 RR |
1424 | |
1425 | void MyPanel::OnCombo( wxCommandEvent &event ) | |
1426 | { | |
00dff4d2 JS |
1427 | if (!m_combo) |
1428 | return; | |
1429 | ||
f226be17 | 1430 | wxLogMessage(_T("EVT_COMBOBOX: item %d/%d (event/control), string \"%s\"/\"%s\""), |
0d29fecd | 1431 | (int)event.GetInt(), |
f226be17 VZ |
1432 | m_combo->GetSelection(), |
1433 | event.GetString().c_str(), | |
1434 | m_combo->GetStringSelection().c_str()); | |
47908e25 RR |
1435 | } |
1436 | ||
27ff87da | 1437 | void MyPanel::OnComboTextChanged(wxCommandEvent& event) |
f6bcfd97 | 1438 | { |
7c2151fa SN |
1439 | if (m_combo) |
1440 | wxLogMessage(wxT("EVT_TEXT for the combobox: \"%s\" (event) or \"%s\" (control)."), | |
1441 | event.GetString().c_str(), | |
1442 | m_combo->GetValue().c_str()); | |
f6bcfd97 BP |
1443 | } |
1444 | ||
1445 | void MyPanel::OnComboTextEnter(wxCommandEvent& WXUNUSED(event)) | |
1446 | { | |
7c2151fa SN |
1447 | if (m_combo) |
1448 | wxLogMessage(_T("Enter pressed in the combobox: value is '%s'."), | |
1449 | m_combo->GetValue().c_str()); | |
f6bcfd97 BP |
1450 | } |
1451 | ||
47908e25 | 1452 | void MyPanel::OnComboButtons( wxCommandEvent &event ) |
1c005ff7 | 1453 | { |
ec9f7884 | 1454 | switch (event.GetId()) |
2f6407b9 | 1455 | { |
ec9f7884 VZ |
1456 | case ID_COMBO_ENABLE: |
1457 | { | |
1458 | m_combo->Enable( event.GetInt() == 0 ); | |
1459 | break; | |
1460 | } | |
1461 | case ID_COMBO_SEL_NUM: | |
1462 | { | |
1463 | m_combo->SetSelection( 2 ); | |
1464 | break; | |
1465 | } | |
1466 | case ID_COMBO_SEL_STR: | |
1467 | { | |
9f84eccd | 1468 | m_combo->SetStringSelection( _T("This") ); |
ec9f7884 VZ |
1469 | break; |
1470 | } | |
1471 | case ID_COMBO_CLEAR: | |
1472 | { | |
1473 | m_combo->Clear(); | |
1474 | break; | |
1475 | } | |
1476 | case ID_COMBO_APPEND: | |
1477 | { | |
9f84eccd | 1478 | m_combo->Append( _T("Hi!") ); |
ec9f7884 VZ |
1479 | break; |
1480 | } | |
1481 | case ID_COMBO_DELETE: | |
1482 | { | |
1483 | int idx = m_combo->GetSelection(); | |
1484 | m_combo->Delete( idx ); | |
1485 | break; | |
1486 | } | |
1487 | case ID_COMBO_FONT: | |
1488 | { | |
1489 | m_combo->SetFont( *wxITALIC_FONT ); | |
1490 | break; | |
1491 | } | |
cc7e9e20 RR |
1492 | case ID_COMBO_SET_TEXT: |
1493 | { | |
1494 | m_combo->SetString( 2, wxT("Hi!") ); | |
1495 | break; | |
1496 | } | |
868a2826 | 1497 | } |
47908e25 RR |
1498 | } |
1499 | ||
1500 | void MyPanel::OnRadio( wxCommandEvent &event ) | |
1501 | { | |
9f84eccd | 1502 | m_text->AppendText( _T("RadioBox selection string is: ") ); |
ec9f7884 | 1503 | m_text->AppendText( event.GetString() ); |
9f84eccd | 1504 | m_text->AppendText( _T("\n") ); |
47908e25 RR |
1505 | } |
1506 | ||
a48b9bfb VZ |
1507 | void MyPanel::OnRadioButton1( wxCommandEvent & WXUNUSED(event) ) |
1508 | { | |
1509 | wxMessageBox(_T("First wxRadioButton selected."), _T("wxControl sample")); | |
1510 | } | |
1511 | ||
1512 | void MyPanel::OnRadioButton2( wxCommandEvent & WXUNUSED(event) ) | |
1513 | { | |
1514 | m_text->AppendText(_T("Second wxRadioButton selected.\n")); | |
1515 | } | |
1516 | ||
47908e25 RR |
1517 | void MyPanel::OnRadioButtons( wxCommandEvent &event ) |
1518 | { | |
ec9f7884 | 1519 | switch (event.GetId()) |
d3904ceb | 1520 | { |
ec9f7884 | 1521 | case ID_RADIOBOX_ENABLE: |
7891b4d4 VZ |
1522 | m_radio->Enable( event.GetInt() == 0 ); |
1523 | break; | |
1524 | ||
ec9f7884 | 1525 | case ID_RADIOBOX_SEL_NUM: |
7891b4d4 VZ |
1526 | m_radio->SetSelection( 2 ); |
1527 | break; | |
1528 | ||
ec9f7884 | 1529 | case ID_RADIOBOX_SEL_STR: |
7891b4d4 VZ |
1530 | m_radio->SetStringSelection( _T("This") ); |
1531 | break; | |
8b1d8f36 | 1532 | |
7891b4d4 VZ |
1533 | case ID_RADIOBOX_FONT: |
1534 | m_radio->SetFont( *wxITALIC_FONT ); | |
1535 | break; | |
868a2826 | 1536 | } |
1c005ff7 RR |
1537 | } |
1538 | ||
868a2826 RR |
1539 | void MyPanel::OnSetFont( wxCommandEvent &WXUNUSED(event) ) |
1540 | { | |
ec9f7884 VZ |
1541 | m_fontButton->SetFont( *wxITALIC_FONT ); |
1542 | m_text->SetFont( *wxITALIC_FONT ); | |
868a2826 RR |
1543 | } |
1544 | ||
1db8dc4a | 1545 | void MyPanel::OnUpdateLabel( wxCommandEvent &event ) |
185fa6bf | 1546 | { |
9f84eccd MB |
1547 | m_label->SetLabel(event.GetInt() ? _T("Very very very very very long text.") |
1548 | : _T("Shorter text.")); | |
185fa6bf VZ |
1549 | } |
1550 | ||
6bb44116 WS |
1551 | #if wxUSE_SLIDER |
1552 | ||
7bce6aec RR |
1553 | void MyPanel::OnSliderUpdate( wxCommandEvent &WXUNUSED(event) ) |
1554 | { | |
516ab399 | 1555 | #if wxUSE_GAUGE |
ec9f7884 | 1556 | m_gauge->SetValue( m_slider->GetValue() ); |
37ed3ae3 | 1557 | m_gaugeVert->SetValue( m_slider->GetValue() / 2 ); |
516ab399 | 1558 | #endif // wxUSE_GAUGE |
7bce6aec RR |
1559 | } |
1560 | ||
6bb44116 WS |
1561 | #endif // wxUSE_SLIDER |
1562 | ||
baccb514 VZ |
1563 | #if wxUSE_SPINCTRL |
1564 | ||
76106901 VZ |
1565 | void MyPanel::OnSpinCtrlText(wxCommandEvent& event) |
1566 | { | |
1567 | if ( m_spinctrl ) | |
1568 | { | |
1569 | wxString s; | |
508d586e MB |
1570 | s.Printf( _T("Spin ctrl text changed: now %d (from event: %s)\n"), |
1571 | m_spinctrl->GetValue(), event.GetString().c_str() ); | |
76106901 VZ |
1572 | m_text->AppendText(s); |
1573 | } | |
1574 | } | |
1575 | ||
457e6c54 | 1576 | void MyPanel::OnSpinCtrl(wxSpinEvent& event) |
baccb514 | 1577 | { |
76106901 VZ |
1578 | if ( m_spinctrl ) |
1579 | { | |
1580 | wxString s; | |
33cf9a19 | 1581 | s.Printf( _T("Spin ctrl changed: now %d (from event: %d)\n"), |
508d586e | 1582 | m_spinctrl->GetValue(), event.GetInt() ); |
76106901 VZ |
1583 | m_text->AppendText(s); |
1584 | } | |
1585 | } | |
1586 | ||
1587 | void MyPanel::OnSpinCtrlUp(wxSpinEvent& event) | |
1588 | { | |
1589 | if ( m_spinctrl ) | |
1590 | { | |
508d586e | 1591 | m_text->AppendText( wxString::Format( |
33cf9a19 | 1592 | _T("Spin up: %d (from event: %d)\n"), |
508d586e | 1593 | m_spinctrl->GetValue(), event.GetInt() ) ); |
76106901 VZ |
1594 | } |
1595 | } | |
1596 | ||
1597 | void MyPanel::OnSpinCtrlDown(wxSpinEvent& event) | |
1598 | { | |
1599 | if ( m_spinctrl ) | |
1600 | { | |
508d586e | 1601 | m_text->AppendText( wxString::Format( |
33cf9a19 | 1602 | _T("Spin down: %d (from event: %d)\n"), |
508d586e | 1603 | m_spinctrl->GetValue(), event.GetInt() ) ); |
76106901 | 1604 | } |
baccb514 VZ |
1605 | } |
1606 | ||
1607 | #endif // wxUSE_SPINCTRL | |
1608 | ||
0e528b99 | 1609 | #if wxUSE_SPINBTN |
8c3c31d4 VZ |
1610 | void MyPanel::OnSpinUp( wxSpinEvent &event ) |
1611 | { | |
1612 | wxString value; | |
1613 | value.Printf( _T("Spin control up: current = %d\n"), | |
1614 | m_spinbutton->GetValue()); | |
1615 | ||
e94ff4cb | 1616 | if ( event.GetPosition() > 17 ) |
8c3c31d4 VZ |
1617 | { |
1618 | value += _T("Preventing the spin button from going above 17.\n"); | |
1619 | ||
1620 | event.Veto(); | |
1621 | } | |
1622 | ||
1623 | m_text->AppendText(value); | |
1624 | } | |
1625 | ||
1626 | void MyPanel::OnSpinDown( wxSpinEvent &event ) | |
1627 | { | |
1628 | wxString value; | |
1629 | value.Printf( _T("Spin control down: current = %d\n"), | |
1630 | m_spinbutton->GetValue()); | |
1631 | ||
e94ff4cb | 1632 | if ( event.GetPosition() < -17 ) |
8c3c31d4 VZ |
1633 | { |
1634 | value += _T("Preventing the spin button from going below -17.\n"); | |
1635 | ||
1636 | event.Veto(); | |
1637 | } | |
1638 | ||
1639 | m_text->AppendText(value); | |
1640 | } | |
1641 | ||
e380f72b RR |
1642 | void MyPanel::OnSpinUpdate( wxSpinEvent &event ) |
1643 | { | |
ec9f7884 | 1644 | wxString value; |
f70d5829 | 1645 | value.Printf( _T("%d"), event.GetPosition() ); |
ec9f7884 | 1646 | m_spintext->SetValue( value ); |
6380910c | 1647 | |
f70d5829 | 1648 | value.Printf( _T("Spin control range: (%d, %d), current = %d\n"), |
6380910c VZ |
1649 | m_spinbutton->GetMin(), m_spinbutton->GetMax(), |
1650 | m_spinbutton->GetValue()); | |
1651 | ||
1652 | m_text->AppendText(value); | |
e380f72b | 1653 | } |
9726da4f | 1654 | |
fe1bc285 | 1655 | void MyPanel::OnNewText( wxCommandEvent& /* event */) |
1dd815f3 RR |
1656 | { |
1657 | m_nonWrappingText->SetLabel( wxT("This text is short\nbut still spans\nover three lines.") ); | |
1658 | m_wrappingText->SetLabel( wxT("This text is short but will still be wrapped if it is too long.") ); | |
1659 | m_wrappingText->GetParent()->Layout(); | |
1660 | } | |
1661 | ||
516ab399 WS |
1662 | #if wxUSE_PROGRESSDLG |
1663 | ||
9726da4f VZ |
1664 | void MyPanel::OnUpdateShowProgress( wxUpdateUIEvent& event ) |
1665 | { | |
1666 | event.Enable( m_spinbutton->GetValue() > 0 ); | |
1667 | } | |
1668 | ||
1669 | void MyPanel::OnShowProgress( wxCommandEvent& WXUNUSED(event) ) | |
1670 | { | |
1671 | int max = m_spinbutton->GetValue(); | |
61c083e7 | 1672 | |
601964ff VS |
1673 | if ( max <= 0 ) |
1674 | { | |
1675 | wxLogError(_T("You must set positive range!")); | |
1676 | return; | |
1677 | } | |
61c083e7 | 1678 | |
9f84eccd MB |
1679 | wxProgressDialog dialog(_T("Progress dialog example"), |
1680 | _T("An informative message"), | |
9726da4f VZ |
1681 | max, // range |
1682 | this, // parent | |
8c3c31d4 | 1683 | wxPD_CAN_ABORT | |
2c8e4738 | 1684 | wxPD_AUTO_HIDE | |
8c3c31d4 VZ |
1685 | wxPD_APP_MODAL | |
1686 | wxPD_ELAPSED_TIME | | |
1687 | wxPD_ESTIMATED_TIME | | |
1688 | wxPD_REMAINING_TIME); | |
2ac1b69a | 1689 | |
9726da4f | 1690 | |
9230b621 | 1691 | bool cont = true; |
abceee76 | 1692 | for ( int i = 0; i <= max && cont; i++ ) |
9726da4f VZ |
1693 | { |
1694 | wxSleep(1); | |
abceee76 | 1695 | if ( i == max ) |
be9abe3f | 1696 | { |
9f84eccd | 1697 | cont = dialog.Update(i, _T("That's all, folks!")); |
be9abe3f VZ |
1698 | } |
1699 | else if ( i == max / 2 ) | |
9726da4f | 1700 | { |
9f84eccd | 1701 | cont = dialog.Update(i, _T("Only a half left (very long message)!")); |
9726da4f VZ |
1702 | } |
1703 | else | |
1704 | { | |
1705 | cont = dialog.Update(i); | |
1706 | } | |
1707 | } | |
1708 | ||
1709 | if ( !cont ) | |
1710 | { | |
9f84eccd | 1711 | *m_text << _T("Progress dialog aborted!\n"); |
9726da4f VZ |
1712 | } |
1713 | else | |
1714 | { | |
9f84eccd | 1715 | *m_text << _T("Countdown from ") << max << _T(" finished.\n"); |
9726da4f VZ |
1716 | } |
1717 | } | |
1718 | ||
516ab399 | 1719 | #endif // wxUSE_PROGRESSDLG |
0e528b99 | 1720 | #endif // wxUSE_SPINBTN |
e380f72b | 1721 | |
2b5f62a0 VZ |
1722 | void MyPanel::OnSizerCheck( wxCommandEvent &event) |
1723 | { | |
1724 | switch (event.GetId ()) { | |
1725 | case ID_SIZER_CHECK1: | |
1726 | m_buttonSizer->Show (m_sizerBtn1, event.IsChecked ()); | |
1727 | m_buttonSizer->Layout (); | |
1728 | break; | |
1729 | case ID_SIZER_CHECK2: | |
1730 | m_buttonSizer->Show (m_sizerBtn2, event.IsChecked ()); | |
1731 | m_buttonSizer->Layout (); | |
1732 | break; | |
1733 | case ID_SIZER_CHECK3: | |
1734 | m_buttonSizer->Show (m_sizerBtn3, event.IsChecked ()); | |
1735 | m_buttonSizer->Layout (); | |
1736 | break; | |
1737 | case ID_SIZER_CHECK4: | |
1738 | m_buttonSizer->Show (m_sizerBtn4, event.IsChecked ()); | |
1739 | m_buttonSizer->Layout (); | |
1740 | break; | |
1741 | case ID_SIZER_CHECK14: | |
1742 | m_hsizer->Show (m_buttonSizer, event.IsChecked ()); | |
1743 | m_hsizer->Layout (); | |
1744 | break; | |
1745 | case ID_SIZER_CHECKBIG: | |
1746 | m_hsizer->Show (m_bigBtn, event.IsChecked ()); | |
1747 | m_hsizer->Layout (); | |
1748 | break; | |
1749 | } | |
1750 | ||
1751 | } | |
1752 | ||
2cb21a45 VZ |
1753 | MyPanel::~MyPanel() |
1754 | { | |
29e7e51a VZ |
1755 | //wxLog::RemoveTraceMask(_T("focus")); |
1756 | delete wxLog::SetActiveTarget(m_logTargetOld); | |
1757 | ||
61c083e7 | 1758 | delete m_book->GetImageList(); |
2cb21a45 VZ |
1759 | } |
1760 | ||
1c005ff7 RR |
1761 | //---------------------------------------------------------------------- |
1762 | // MyFrame | |
1763 | //---------------------------------------------------------------------- | |
1764 | ||
1765 | BEGIN_EVENT_TABLE(MyFrame, wxFrame) | |
3e2dd3db VZ |
1766 | EVT_MENU(CONTROLS_QUIT, MyFrame::OnQuit) |
1767 | EVT_MENU(CONTROLS_ABOUT, MyFrame::OnAbout) | |
1768 | EVT_MENU(CONTROLS_CLEAR_LOG, MyFrame::OnClearLog) | |
16f6dfd8 | 1769 | #if wxUSE_TOOLTIPS |
3e2dd3db VZ |
1770 | EVT_MENU(CONTROLS_SET_TOOLTIP_DELAY, MyFrame::OnSetTooltipDelay) |
1771 | EVT_MENU(CONTROLS_ENABLE_TOOLTIPS, MyFrame::OnToggleTooltips) | |
be8b4385 VZ |
1772 | #ifdef __WXMSW__ |
1773 | EVT_MENU(CONTROLS_SET_TOOLTIPS_MAX_WIDTH, MyFrame::OnSetMaxTooltipWidth) | |
1774 | #endif // __WXMSW__ | |
16f6dfd8 | 1775 | #endif // wxUSE_TOOLTIPS |
87a1e308 | 1776 | |
3e2dd3db | 1777 | EVT_MENU(CONTROLS_ENABLE_ALL, MyFrame::OnEnableAll) |
47a8a4d5 VZ |
1778 | EVT_MENU(CONTROLS_HIDE_ALL, MyFrame::OnHideAll) |
1779 | EVT_MENU(CONTROLS_HIDE_LIST, MyFrame::OnHideList) | |
1a8b677e | 1780 | EVT_MENU(CONTROLS_CONTEXT_HELP, MyFrame::OnContextHelp) |
87a1e308 | 1781 | |
35960bbf VZ |
1782 | EVT_ICONIZE(MyFrame::OnIconized) |
1783 | EVT_MAXIMIZE(MyFrame::OnMaximized) | |
87a1e308 | 1784 | EVT_SIZE(MyFrame::OnSize) |
97206645 VZ |
1785 | EVT_MOVE(MyFrame::OnMove) |
1786 | ||
87a1e308 | 1787 | EVT_IDLE(MyFrame::OnIdle) |
1c005ff7 RR |
1788 | END_EVENT_TABLE() |
1789 | ||
9f84eccd | 1790 | MyFrame::MyFrame(const wxChar *title, int x, int y) |
c4ef14c2 | 1791 | : wxFrame(NULL, wxID_ANY, title, wxPoint(x, y), wxSize(700, 450)) |
1c005ff7 | 1792 | { |
1a8b677e VZ |
1793 | SetHelpText( _T("Controls sample demonstrating various widgets") ); |
1794 | ||
7bfc22f6 VZ |
1795 | // Give it an icon |
1796 | // The wxICON() macros loads an icon from a resource under Windows | |
1797 | // and uses an #included XPM image under GTK+ and Motif | |
1798 | ||
cbf3565d | 1799 | #ifdef USE_XPM |
7bfc22f6 | 1800 | SetIcon( wxICON(mondrian) ); |
cbf3565d | 1801 | #endif |
7bfc22f6 VZ |
1802 | |
1803 | wxMenu *file_menu = new wxMenu; | |
1804 | ||
9f84eccd | 1805 | file_menu->Append(CONTROLS_CLEAR_LOG, _T("&Clear log\tCtrl-L")); |
7bfc22f6 | 1806 | file_menu->AppendSeparator(); |
9f84eccd | 1807 | file_menu->Append(CONTROLS_ABOUT, _T("&About\tF1")); |
7bfc22f6 | 1808 | file_menu->AppendSeparator(); |
9f84eccd | 1809 | file_menu->Append(CONTROLS_QUIT, _T("E&xit\tAlt-X"), _T("Quit controls sample")); |
7bfc22f6 VZ |
1810 | |
1811 | wxMenuBar *menu_bar = new wxMenuBar; | |
9f84eccd | 1812 | menu_bar->Append(file_menu, _T("&File")); |
7bfc22f6 VZ |
1813 | |
1814 | #if wxUSE_TOOLTIPS | |
1815 | wxMenu *tooltip_menu = new wxMenu; | |
9f84eccd | 1816 | tooltip_menu->Append(CONTROLS_SET_TOOLTIP_DELAY, _T("Set &delay\tCtrl-D")); |
7bfc22f6 | 1817 | tooltip_menu->AppendSeparator(); |
9f84eccd | 1818 | tooltip_menu->Append(CONTROLS_ENABLE_TOOLTIPS, _T("&Toggle tooltips\tCtrl-T"), |
9230b621 VS |
1819 | _T("enable/disable tooltips"), true); |
1820 | tooltip_menu->Check(CONTROLS_ENABLE_TOOLTIPS, true); | |
be8b4385 VZ |
1821 | #ifdef __WXMSW__ |
1822 | tooltip_menu->Append(CONTROLS_SET_TOOLTIPS_MAX_WIDTH, "Set maximal &width"); | |
1823 | #endif // __WXMSW__ | |
9f84eccd | 1824 | menu_bar->Append(tooltip_menu, _T("&Tooltips")); |
7bfc22f6 VZ |
1825 | #endif // wxUSE_TOOLTIPS |
1826 | ||
1827 | wxMenu *panel_menu = new wxMenu; | |
9f84eccd | 1828 | panel_menu->Append(CONTROLS_ENABLE_ALL, _T("&Disable all\tCtrl-E"), |
9230b621 | 1829 | _T("Enable/disable all panel controls"), true); |
47a8a4d5 VZ |
1830 | panel_menu->Append(CONTROLS_HIDE_ALL, _T("&Hide all\tCtrl-I"), |
1831 | _T("Show/hide thoe whole panel controls"), true); | |
1832 | panel_menu->Append(CONTROLS_HIDE_LIST, _T("Hide &list ctrl\tCtrl-S"), | |
1833 | _T("Enable/disable all panel controls"), true); | |
1a8b677e VZ |
1834 | panel_menu->Append(CONTROLS_CONTEXT_HELP, _T("&Context help...\tCtrl-H"), |
1835 | _T("Get context help for a control")); | |
9f84eccd | 1836 | menu_bar->Append(panel_menu, _T("&Panel")); |
7bfc22f6 VZ |
1837 | |
1838 | SetMenuBar(menu_bar); | |
1839 | ||
960a83cc | 1840 | #if wxUSE_STATUSBAR |
5fb9fcfc | 1841 | CreateStatusBar(2); |
960a83cc | 1842 | #endif // wxUSE_STATUSBAR |
9f3362c4 | 1843 | |
87a1e308 | 1844 | m_panel = new MyPanel( this, 10, 10, 300, 100 ); |
1c005ff7 RR |
1845 | } |
1846 | ||
1847 | void MyFrame::OnQuit (wxCommandEvent& WXUNUSED(event) ) | |
1848 | { | |
9230b621 | 1849 | Close(true); |
1c005ff7 RR |
1850 | } |
1851 | ||
1852 | void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) ) | |
1853 | { | |
abceee76 VZ |
1854 | wxBusyCursor bc; |
1855 | ||
9f84eccd | 1856 | wxMessageDialog dialog(this, _T("This is a control sample"), _T("About Controls"), wxOK ); |
ec9f7884 | 1857 | dialog.ShowModal(); |
1c005ff7 | 1858 | } |
9f3362c4 | 1859 | |
3e2dd3db VZ |
1860 | void MyFrame::OnClearLog(wxCommandEvent& WXUNUSED(event)) |
1861 | { | |
1862 | m_panel->m_text->Clear(); | |
1863 | } | |
1864 | ||
16f6dfd8 | 1865 | #if wxUSE_TOOLTIPS |
87728739 | 1866 | void MyFrame::OnSetTooltipDelay(wxCommandEvent& WXUNUSED(event)) |
16f6dfd8 VZ |
1867 | { |
1868 | static long s_delay = 5000; | |
1869 | ||
1870 | wxString delay; | |
f70d5829 | 1871 | delay.Printf( _T("%ld"), s_delay); |
16f6dfd8 | 1872 | |
9f84eccd MB |
1873 | delay = wxGetTextFromUser(_T("Enter delay (in milliseconds)"), |
1874 | _T("Set tooltip delay"), | |
ec9f7884 VZ |
1875 | delay, |
1876 | this); | |
16f6dfd8 VZ |
1877 | if ( !delay ) |
1878 | return; // cancelled | |
1879 | ||
f70d5829 | 1880 | wxSscanf(delay, _T("%ld"), &s_delay); |
16f6dfd8 VZ |
1881 | |
1882 | wxToolTip::SetDelay(s_delay); | |
1883 | ||
f70d5829 | 1884 | wxLogStatus(this, _T("Tooltip delay set to %ld milliseconds"), s_delay); |
16f6dfd8 VZ |
1885 | } |
1886 | ||
87728739 | 1887 | void MyFrame::OnToggleTooltips(wxCommandEvent& WXUNUSED(event)) |
16f6dfd8 | 1888 | { |
9230b621 | 1889 | static bool s_enabled = true; |
16f6dfd8 VZ |
1890 | |
1891 | s_enabled = !s_enabled; | |
1892 | ||
1893 | wxToolTip::Enable(s_enabled); | |
1894 | ||
f70d5829 | 1895 | wxLogStatus(this, _T("Tooltips %sabled"), s_enabled ? _T("en") : _T("dis") ); |
16f6dfd8 | 1896 | } |
be8b4385 VZ |
1897 | |
1898 | #ifdef __WXMSW__ | |
1899 | ||
1900 | void MyFrame::OnSetMaxTooltipWidth(wxCommandEvent& WXUNUSED(event)) | |
1901 | { | |
1902 | static int s_maxWidth = 0; | |
1903 | ||
1904 | wxNumberEntryDialog dlg | |
1905 | ( | |
1906 | this, | |
1907 | "Change maximal tooltip width", | |
1908 | "&Width in pixels:", | |
1909 | GetTitle(), | |
1910 | s_maxWidth, | |
1911 | -1, | |
1912 | 600 | |
1913 | ); | |
1914 | if ( dlg.ShowModal() == wxID_CANCEL ) | |
1915 | return; | |
1916 | ||
1917 | s_maxWidth = dlg.GetValue(); | |
1918 | wxToolTip::SetMaxWidth(s_maxWidth); | |
1919 | ||
1920 | // we need to set the tooltip again to test the new width | |
1921 | m_panel->SetAllToolTips(); | |
1922 | } | |
1923 | ||
1924 | #endif // __WXMSW__ | |
1925 | ||
1926 | #endif // wxUSE_TOOLTIPS | |
16f6dfd8 | 1927 | |
87a1e308 VZ |
1928 | void MyFrame::OnEnableAll(wxCommandEvent& WXUNUSED(event)) |
1929 | { | |
9230b621 | 1930 | static bool s_enable = true; |
87a1e308 VZ |
1931 | |
1932 | s_enable = !s_enable; | |
1933 | m_panel->Enable(s_enable); | |
47a8a4d5 VZ |
1934 | static bool s_enableCheckbox = true; |
1935 | if ( !s_enable ) | |
1936 | { | |
1937 | // this is a test for correct behaviour of either enabling or disabling | |
1938 | // a child when its parent is disabled: the checkbox should have the | |
1939 | // correct state when the parent is enabled back | |
1940 | m_panel->m_checkbox->Enable(s_enableCheckbox); | |
1941 | s_enableCheckbox = !s_enableCheckbox; | |
1942 | } | |
1943 | } | |
1944 | ||
1945 | void MyFrame::OnHideAll(wxCommandEvent& WXUNUSED(event)) | |
1946 | { | |
1947 | static bool s_show = true; | |
1948 | ||
1949 | s_show = !s_show; | |
1950 | m_panel->Show(s_show); | |
1951 | } | |
1952 | ||
1953 | void MyFrame::OnHideList(wxCommandEvent& WXUNUSED(event)) | |
1954 | { | |
1955 | static bool s_show = true; | |
1956 | ||
1957 | s_show = !s_show; | |
1958 | m_panel->m_listbox->Show(s_show); | |
87a1e308 VZ |
1959 | } |
1960 | ||
1a8b677e VZ |
1961 | void MyFrame::OnContextHelp(wxCommandEvent& WXUNUSED(event)) |
1962 | { | |
1963 | // starts a local event loop | |
1964 | wxContextHelp chelp(this); | |
1965 | } | |
1966 | ||
97206645 VZ |
1967 | void MyFrame::OnMove( wxMoveEvent& event ) |
1968 | { | |
960a83cc | 1969 | #if wxUSE_STATUSBAR |
97206645 | 1970 | UpdateStatusBar(event.GetPosition(), GetSize()); |
960a83cc | 1971 | #endif // wxUSE_STATUSBAR |
97206645 VZ |
1972 | |
1973 | event.Skip(); | |
1974 | } | |
1975 | ||
35960bbf VZ |
1976 | void MyFrame::OnIconized( wxIconizeEvent& event ) |
1977 | { | |
837b01e2 VZ |
1978 | wxLogMessage(_T("Frame %s"), event.IsIconized() ? _T("iconized") |
1979 | : _T("restored")); | |
35960bbf VZ |
1980 | event.Skip(); |
1981 | } | |
1982 | ||
1983 | void MyFrame::OnMaximized( wxMaximizeEvent& WXUNUSED(event) ) | |
1984 | { | |
1985 | wxLogMessage(_T("Frame maximized")); | |
1986 | } | |
1987 | ||
5fb9fcfc VZ |
1988 | void MyFrame::OnSize( wxSizeEvent& event ) |
1989 | { | |
960a83cc | 1990 | #if wxUSE_STATUSBAR |
97206645 | 1991 | UpdateStatusBar(GetPosition(), event.GetSize()); |
960a83cc | 1992 | #endif // wxUSE_STATUSBAR |
5fb9fcfc VZ |
1993 | |
1994 | event.Skip(); | |
1995 | } | |
1996 | ||
9f3362c4 VZ |
1997 | void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) ) |
1998 | { | |
1999 | // track the window which has the focus in the status bar | |
2dd8d2d7 | 2000 | static wxWindow *s_windowFocus = NULL; |
9f3362c4 | 2001 | wxWindow *focus = wxWindow::FindFocus(); |
2dd8d2d7 | 2002 | if ( focus != s_windowFocus ) |
9f3362c4 VZ |
2003 | { |
2004 | s_windowFocus = focus; | |
2005 | ||
2006 | wxString msg; | |
2dd8d2d7 VZ |
2007 | if ( focus ) |
2008 | { | |
2009 | msg.Printf( | |
2010 | _T("Focus: %s") | |
9f3362c4 | 2011 | #ifdef __WXMSW__ |
5cb83740 | 2012 | , _T(", HWND = %08x") |
f70d5829 | 2013 | #endif |
2dd8d2d7 | 2014 | , s_windowFocus->GetName().c_str() |
9f3362c4 | 2015 | #ifdef __WXMSW__ |
2dd8d2d7 | 2016 | , (unsigned int) s_windowFocus->GetHWND() |
f70d5829 | 2017 | #endif |
2dd8d2d7 VZ |
2018 | ); |
2019 | } | |
2020 | else | |
2021 | { | |
2022 | msg = _T("No focus"); | |
2023 | } | |
9f3362c4 | 2024 | |
960a83cc | 2025 | #if wxUSE_STATUSBAR |
9f3362c4 | 2026 | SetStatusText(msg); |
960a83cc | 2027 | #endif // wxUSE_STATUSBAR |
9f3362c4 | 2028 | } |
341c92a8 | 2029 | } |
6c8a980f | 2030 | |
f6bcfd97 BP |
2031 | void MyComboBox::OnChar(wxKeyEvent& event) |
2032 | { | |
2033 | wxLogMessage(_T("MyComboBox::OnChar")); | |
2034 | ||
b1d4dd7a | 2035 | if ( event.GetKeyCode() == 'w' ) |
f6bcfd97 BP |
2036 | wxLogMessage(_T("MyComboBox: 'w' will be ignored.")); |
2037 | else | |
2038 | event.Skip(); | |
2039 | } | |
2040 | ||
2041 | void MyComboBox::OnKeyDown(wxKeyEvent& event) | |
2042 | { | |
2043 | wxLogMessage(_T("MyComboBox::OnKeyDown")); | |
2044 | ||
b1d4dd7a | 2045 | if ( event.GetKeyCode() == 'w' ) |
f6bcfd97 BP |
2046 | wxLogMessage(_T("MyComboBox: 'w' will be ignored.")); |
2047 | else | |
2048 | event.Skip(); | |
2049 | } | |
2050 | ||
2051 | void MyComboBox::OnKeyUp(wxKeyEvent& event) | |
2052 | { | |
2053 | wxLogMessage(_T("MyComboBox::OnKeyUp")); | |
2054 | ||
2055 | event.Skip(); | |
2056 | } | |
2057 | ||
8b81a824 VS |
2058 | static void SetListboxClientData(const wxChar *name, wxListBox *control) |
2059 | { | |
2060 | size_t count = control->GetCount(); | |
2061 | for ( size_t n = 0; n < count; n++ ) | |
2062 | { | |
2063 | wxString s; | |
2064 | s.Printf(wxT("%s client data for '%s'"), | |
2065 | name, control->GetString(n).c_str()); | |
2066 | ||
2067 | control->SetClientObject(n, new wxStringClientData(s)); | |
2068 | } | |
2069 | } | |
2070 | ||
2b5f62a0 VZ |
2071 | #if wxUSE_CHOICE |
2072 | ||
8b81a824 | 2073 | static void SetChoiceClientData(const wxChar *name, wxChoice *control) |
6c8a980f VZ |
2074 | { |
2075 | size_t count = control->GetCount(); | |
2076 | for ( size_t n = 0; n < count; n++ ) | |
2077 | { | |
2078 | wxString s; | |
4acb6ca6 | 2079 | s.Printf(wxT("%s client data for '%s'"), |
6c8a980f VZ |
2080 | name, control->GetString(n).c_str()); |
2081 | ||
2082 | control->SetClientObject(n, new wxStringClientData(s)); | |
2083 | } | |
2084 | } | |
2b5f62a0 VZ |
2085 | |
2086 | #endif // wxUSE_CHOICE |