]> git.saurik.com Git - wxWidgets.git/blame - samples/widgets/static.cpp
Add CombineURIs implementation for wxWebFileProtocolHandler. Update the IE backend...
[wxWidgets.git] / samples / widgets / static.cpp
CommitLineData
32b8ec41 1/////////////////////////////////////////////////////////////////////////////
be5a51fb 2// Program: wxWidgets Widgets Sample
32b8ec41
VZ
3// Name: static.cpp
4// Purpose: Part of the widgets sample showing various static controls
5// Author: Vadim Zeitlin
6// Created: 11.04.01
7// Id: $Id$
8// Copyright: (c) 2001 Vadim Zeitlin
526954c5 9// Licence: wxWindows licence
32b8ec41
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20// for compilers that support precompilation, includes "wx/wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
24 #pragma hdrstop
25#endif
26
27// for all others, include the necessary headers
28#ifndef WX_PRECOMP
29 #include "wx/log.h"
30
3bb70c40 31 #include "wx/bitmap.h"
32b8ec41
VZ
32 #include "wx/button.h"
33 #include "wx/checkbox.h"
34 #include "wx/radiobox.h"
35 #include "wx/statbox.h"
36 #include "wx/stattext.h"
37 #include "wx/textctrl.h"
38#endif
39
40#include "wx/sizer.h"
41
42#include "wx/statline.h"
916eabe6 43#include "wx/generic/stattextg.h"
32b8ec41
VZ
44
45#include "widgets.h"
32b8ec41
VZ
46#include "icons/statbox.xpm"
47
48// ----------------------------------------------------------------------------
49// constants
50// ----------------------------------------------------------------------------
51
52// control ids
53enum
54{
f0fa4312 55 StaticPage_Reset = wxID_HIGHEST,
32b8ec41 56 StaticPage_BoxText,
39bc0347
VZ
57 StaticPage_LabelText,
58 StaticPage_LabelTextWithMarkup
32b8ec41
VZ
59};
60
61// alignment radiobox values
62enum
63{
64 StaticHAlign_Left,
65 StaticHAlign_Centre,
66 StaticHAlign_Right,
67 StaticHAlign_Max
68};
69
70enum
71{
72 StaticVAlign_Top,
73 StaticVAlign_Centre,
74 StaticVAlign_Bottom,
75 StaticVAlign_Max
76};
77
39bc0347
VZ
78enum
79{
80 StaticEllipsize_Start,
81 StaticEllipsize_Middle,
82 StaticEllipsize_End
83};
84
a9d171bd 85
32b8ec41
VZ
86// ----------------------------------------------------------------------------
87// StaticWidgetsPage
88// ----------------------------------------------------------------------------
89
90class StaticWidgetsPage : public WidgetsPage
91{
92public:
f2fdc4d5 93 StaticWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
8f6eaec9 94 virtual ~StaticWidgetsPage(){};
32b8ec41 95
195df7a7 96 virtual wxControl *GetWidget() const { return m_statText; }
2af006eb
VZ
97 virtual Widgets GetWidgets() const
98 {
99 Widgets widgets;
100 widgets.push_back(m_sizerStatBox->GetStaticBox());
101 widgets.push_back(m_statText);
f5bdfc69 102#if wxUSE_MARKUP
2af006eb 103 widgets.push_back(m_statMarkup);
f5bdfc69 104#endif // wxUSE_MARKUP
2af006eb
VZ
105#if wxUSE_STATLINE
106 widgets.push_back(m_statLine);
107#endif // wxUSE_STATLINE
108
109 return widgets;
110 }
1301e228 111 virtual void RecreateWidget() { CreateStatic(); }
195df7a7 112
453535a7
WS
113 // lazy creation of the content
114 virtual void CreateContent();
115
32b8ec41
VZ
116protected:
117 // event handlers
118 void OnCheckOrRadioBox(wxCommandEvent& event);
119
120 void OnButtonReset(wxCommandEvent& event);
121 void OnButtonBoxText(wxCommandEvent& event);
122 void OnButtonLabelText(wxCommandEvent& event);
f5bdfc69 123#if wxUSE_MARKUP
39bc0347 124 void OnButtonLabelWithMarkupText(wxCommandEvent& event);
f5bdfc69 125#endif // wxUSE_MARKUP
916eabe6 126 void OnMouseEvent(wxMouseEvent& event);
32b8ec41
VZ
127
128 // reset all parameters
129 void Reset();
130
131 // (re)create all controls
132 void CreateStatic();
133
134 // the controls
135 // ------------
136
137 // the check/radio boxes for styles
138 wxCheckBox *m_chkVert,
916eabe6 139 *m_chkGeneric,
39bc0347 140 *m_chkAutoResize,
f5bdfc69
VZ
141 *m_chkEllipsize;
142
143#if wxUSE_MARKUP
144 wxCheckBox *m_chkMarkup,
916eabe6 145 *m_chkGreen;
f5bdfc69 146#endif // wxUSE_MARKUP
32b8ec41
VZ
147
148 wxRadioBox *m_radioHAlign,
39bc0347
VZ
149 *m_radioVAlign,
150 *m_radioEllipsize;
32b8ec41
VZ
151
152 // the controls and the sizer containing them
153 wxStaticBoxSizer *m_sizerStatBox;
f5bdfc69
VZ
154 wxStaticTextBase *m_statText;
155
156#if wxUSE_MARKUP
157 wxStaticTextBase *m_statMarkup;
158#endif // wxUSE_MARKUP
159
a56938e4 160#if wxUSE_STATLINE
32b8ec41 161 wxStaticLine *m_statLine;
a56938e4 162#endif // wxUSE_STATLINE
32b8ec41
VZ
163 wxSizer *m_sizerStatic;
164
165 // the text entries for command parameters
166 wxTextCtrl *m_textBox,
f5bdfc69
VZ
167 *m_textLabel;
168
169#if wxUSE_MARKUP
170 wxTextCtrl *m_textLabelWithMarkup;
171#endif // wxUSE_MARKUP
32b8ec41
VZ
172
173private:
5e173f35
GD
174 DECLARE_EVENT_TABLE()
175 DECLARE_WIDGETS_PAGE(StaticWidgetsPage)
32b8ec41
VZ
176};
177
178// ----------------------------------------------------------------------------
179// event tables
180// ----------------------------------------------------------------------------
181
182BEGIN_EVENT_TABLE(StaticWidgetsPage, WidgetsPage)
183 EVT_BUTTON(StaticPage_Reset, StaticWidgetsPage::OnButtonReset)
184 EVT_BUTTON(StaticPage_LabelText, StaticWidgetsPage::OnButtonLabelText)
f5bdfc69 185#if wxUSE_MARKUP
39bc0347 186 EVT_BUTTON(StaticPage_LabelTextWithMarkup, StaticWidgetsPage::OnButtonLabelWithMarkupText)
f5bdfc69 187#endif // wxUSE_MARKUP
32b8ec41
VZ
188 EVT_BUTTON(StaticPage_BoxText, StaticWidgetsPage::OnButtonBoxText)
189
206d3a16
JS
190 EVT_CHECKBOX(wxID_ANY, StaticWidgetsPage::OnCheckOrRadioBox)
191 EVT_RADIOBOX(wxID_ANY, StaticWidgetsPage::OnCheckOrRadioBox)
32b8ec41
VZ
192END_EVENT_TABLE()
193
194// ============================================================================
195// implementation
196// ============================================================================
197
9a83f860 198IMPLEMENT_WIDGETS_PAGE(StaticWidgetsPage, wxT("Static"),
cc65c5f9 199 (int)wxPlatform(GENERIC_CTRLS).If(wxOS_WINDOWS,NATIVE_CTRLS)
f2fdc4d5 200 );
32b8ec41 201
f2fdc4d5 202StaticWidgetsPage::StaticWidgetsPage(WidgetsBookCtrl *book,
61c083e7 203 wxImageList *imaglist)
261357eb 204 : WidgetsPage(book, imaglist, statbox_xpm)
32b8ec41 205{
32b8ec41
VZ
206 // init everything
207 m_chkVert =
f5bdfc69
VZ
208 m_chkAutoResize =
209 m_chkGeneric =
210#if wxUSE_MARKUP
211 m_chkGreen =
212#endif // wxUSE_MARKUP
213 NULL;
32b8ec41
VZ
214
215 m_radioHAlign =
216 m_radioVAlign = (wxRadioBox *)NULL;
217
a56938e4 218#if wxUSE_STATLINE
32b8ec41 219 m_statLine = (wxStaticLine *)NULL;
a56938e4 220#endif // wxUSE_STATLINE
f5bdfc69 221#if wxUSE_MARKUP
916eabe6 222 m_statText = m_statMarkup = NULL;
f5bdfc69 223#endif // wxUSE_MARKUP
32b8ec41
VZ
224
225 m_sizerStatBox = (wxStaticBoxSizer *)NULL;
226 m_sizerStatic = (wxSizer *)NULL;
39bc0347 227
f5bdfc69
VZ
228 m_textBox =
229 m_textLabel =
230#if wxUSE_MARKUP
231 m_textLabelWithMarkup =
232#endif // wxUSE_MARKUP
233 NULL;
453535a7 234}
32b8ec41 235
453535a7
WS
236void StaticWidgetsPage::CreateContent()
237{
32b8ec41
VZ
238 wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
239
240 // left pane
916eabe6 241 wxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
32b8ec41 242
916eabe6
VZ
243 m_chkGeneric = CreateCheckBoxAndAddToSizer(sizerLeft,
244 "&Generic wxStaticText");
916eabe6
VZ
245 m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, "&Vertical line");
246 m_chkAutoResize = CreateCheckBoxAndAddToSizer(sizerLeft, "&Fit to text");
32b8ec41
VZ
247 sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
248
249 static const wxString halign[] =
250 {
9a83f860
VZ
251 wxT("left"),
252 wxT("centre"),
253 wxT("right"),
32b8ec41
VZ
254 };
255
256 static const wxString valign[] =
257 {
9a83f860
VZ
258 wxT("top"),
259 wxT("centre"),
260 wxT("bottom"),
32b8ec41
VZ
261 };
262
9a83f860 263 m_radioHAlign = new wxRadioBox(this, wxID_ANY, wxT("&Horz alignment"),
32b8ec41 264 wxDefaultPosition, wxDefaultSize,
916eabe6 265 WXSIZEOF(halign), halign, 3);
9a83f860 266 m_radioVAlign = new wxRadioBox(this, wxID_ANY, wxT("&Vert alignment"),
32b8ec41 267 wxDefaultPosition, wxDefaultSize,
916eabe6 268 WXSIZEOF(valign), valign, 3);
32b8ec41
VZ
269
270 sizerLeft->Add(m_radioHAlign, 0, wxGROW | wxALL, 5);
271 sizerLeft->Add(m_radioVAlign, 0, wxGROW | wxALL, 5);
272
39bc0347
VZ
273
274 sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
275
9a83f860 276 m_chkEllipsize = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Ellipsize"));
39bc0347
VZ
277
278 static const wxString ellipsizeMode[] =
279 {
9a83f860
VZ
280 wxT("&start"),
281 wxT("&middle"),
282 wxT("&end"),
39bc0347
VZ
283 };
284
9a83f860 285 m_radioEllipsize = new wxRadioBox(this, wxID_ANY, wxT("&Ellipsize mode"),
39bc0347 286 wxDefaultPosition, wxDefaultSize,
916eabe6
VZ
287 WXSIZEOF(ellipsizeMode), ellipsizeMode,
288 3);
39bc0347
VZ
289
290 sizerLeft->Add(m_radioEllipsize, 0, wxGROW | wxALL, 5);
291
9a83f860 292 wxButton *btn = new wxButton(this, StaticPage_Reset, wxT("&Reset"));
32b8ec41
VZ
293 sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
294
295 // middle pane
916eabe6
VZ
296 wxSizer *sizerMiddle = new wxStaticBoxSizer(wxVERTICAL, this,
297 "&Change labels");
298
299 m_textBox = new wxTextCtrl(this, wxID_ANY, wxEmptyString);
300 wxButton *b1 = new wxButton(this, wxID_ANY, "Change &box label");
301 b1->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
302 wxCommandEventHandler(StaticWidgetsPage::OnButtonBoxText),
303 NULL, this);
304 sizerMiddle->Add(m_textBox, 0, wxEXPAND|wxALL, 5);
305 sizerMiddle->Add(b1, 0, wxLEFT|wxBOTTOM, 5);
306
307 m_textLabel = new wxTextCtrl(this, wxID_ANY, wxEmptyString,
308 wxDefaultPosition, wxDefaultSize,
309 wxTE_MULTILINE|wxHSCROLL);
310 wxButton *b2 = new wxButton(this, wxID_ANY, "Change &text label");
311 b2->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
312 wxCommandEventHandler(StaticWidgetsPage::OnButtonLabelText),
313 NULL, this);
314 sizerMiddle->Add(m_textLabel, 0, wxEXPAND|wxALL, 5);
315 sizerMiddle->Add(b2, 0, wxLEFT|wxBOTTOM, 5);
316
f5bdfc69 317#if wxUSE_MARKUP
916eabe6
VZ
318 m_textLabelWithMarkup = new wxTextCtrl(this, wxID_ANY, wxEmptyString,
319 wxDefaultPosition, wxDefaultSize,
320 wxTE_MULTILINE|wxHSCROLL);
321
322 wxButton *b3 = new wxButton(this, wxID_ANY, "Change decorated text label");
323 b3->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
324 wxCommandEventHandler(StaticWidgetsPage::OnButtonLabelWithMarkupText),
325 NULL, this);
326 sizerMiddle->Add(m_textLabelWithMarkup, 0, wxEXPAND|wxALL, 5);
327 sizerMiddle->Add(b3, 0, wxLEFT|wxBOTTOM, 5);
328
329 m_chkGreen = CreateCheckBoxAndAddToSizer(sizerLeft,
330 "Decorated label on g&reen");
f5bdfc69 331
916eabe6 332 sizerMiddle->Add(m_chkGreen, 0, wxALL, 5);
f5bdfc69 333#endif // wxUSE_MARKUP
39bc0347
VZ
334
335 // final initializations
336 // NB: must be done _before_ calling CreateStatic()
337 Reset();
338
b4607e89 339 m_textBox->SetValue(wxT("This is a &box"));
9a83f860
VZ
340 m_textLabel->SetValue(wxT("And this is a\n\tlabel inside the box with a &mnemonic.\n")
341 wxT("Only this text is affected by the ellipsize settings."));
f5bdfc69 342#if wxUSE_MARKUP
9a83f860
VZ
343 m_textLabelWithMarkup->SetValue(wxT("Another label, this time <b>decorated</b> ")
344 wxT("with <u>markup</u>; here you need entities ")
345 wxT("for the symbols: &lt; &gt; &amp; &apos; &quot; ")
346 wxT(" but you can still place &mnemonics..."));
f5bdfc69 347#endif // wxUSE_MARKUP
32b8ec41
VZ
348
349 // right pane
350 wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);
7b127900 351 sizerRight->SetMinSize(150, 0);
32b8ec41
VZ
352 m_sizerStatic = sizerRight;
353
354 CreateStatic();
355
356 // the 3 panes panes compose the window
357 sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
7b127900 358 sizerTop->Add(sizerMiddle, 0, wxGROW | wxALL, 10);
32b8ec41
VZ
359 sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
360
32b8ec41 361 SetSizer(sizerTop);
32b8ec41
VZ
362}
363
32b8ec41
VZ
364// ----------------------------------------------------------------------------
365// operations
366// ----------------------------------------------------------------------------
367
368void StaticWidgetsPage::Reset()
369{
916eabe6 370 m_chkGeneric->SetValue(false);
206d3a16
JS
371 m_chkVert->SetValue(false);
372 m_chkAutoResize->SetValue(true);
39bc0347 373 m_chkEllipsize->SetValue(true);
32b8ec41
VZ
374
375 m_radioHAlign->SetSelection(StaticHAlign_Left);
376 m_radioVAlign->SetSelection(StaticVAlign_Top);
377}
378
379void StaticWidgetsPage::CreateStatic()
380{
381 bool isVert = m_chkVert->GetValue();
382
383 if ( m_sizerStatBox )
384 {
32b8ec41 385 // delete m_sizerStatBox; -- deleted by Remove()
168954a1 386 m_sizerStatic->Remove(m_sizerStatBox);
32b8ec41 387 delete m_statText;
f5bdfc69 388#if wxUSE_MARKUP
916eabe6 389 delete m_statMarkup;
f5bdfc69 390#endif // wxUSE_MARKUP
a56938e4 391#if wxUSE_STATLINE
32b8ec41 392 delete m_statLine;
a56938e4 393#endif // wxUSE_STATLINE
32b8ec41
VZ
394 }
395
396 int flagsBox = 0,
39bc0347
VZ
397 flagsText = ms_defaultFlags,
398 flagsDummyText = ms_defaultFlags;
32b8ec41
VZ
399
400 if ( !m_chkAutoResize->GetValue() )
401 {
402 flagsText |= wxST_NO_AUTORESIZE;
39bc0347
VZ
403 flagsDummyText |= wxST_NO_AUTORESIZE;
404 }
405
32b8ec41
VZ
406 int align = 0;
407 switch ( m_radioHAlign->GetSelection() )
408 {
409 default:
9a83f860 410 wxFAIL_MSG(wxT("unexpected radiobox selection"));
32b8ec41
VZ
411 // fall through
412
413 case StaticHAlign_Left:
414 align |= wxALIGN_LEFT;
415 break;
416
417 case StaticHAlign_Centre:
418 align |= wxALIGN_CENTRE_HORIZONTAL;
419 break;
420
421 case StaticHAlign_Right:
422 align |= wxALIGN_RIGHT;
423 break;
424 }
425
426 switch ( m_radioVAlign->GetSelection() )
427 {
428 default:
9a83f860 429 wxFAIL_MSG(wxT("unexpected radiobox selection"));
32b8ec41
VZ
430 // fall through
431
432 case StaticVAlign_Top:
433 align |= wxALIGN_TOP;
434 break;
435
436 case StaticVAlign_Centre:
437 align |= wxALIGN_CENTRE_VERTICAL;
438 break;
439
440 case StaticVAlign_Bottom:
441 align |= wxALIGN_BOTTOM;
442 break;
443 }
444
39bc0347
VZ
445 if ( m_chkEllipsize->GetValue() )
446 {
447 switch ( m_radioEllipsize->GetSelection() )
448 {
449 default:
9a83f860 450 wxFAIL_MSG(wxT("unexpected radiobox selection"));
39bc0347
VZ
451 // fall through
452
453 case StaticEllipsize_Start:
454 flagsDummyText |= wxST_ELLIPSIZE_START;
455 break;
456
457 case StaticEllipsize_Middle:
458 flagsDummyText |= wxST_ELLIPSIZE_MIDDLE;
459 break;
460
461 case StaticEllipsize_End:
462 flagsDummyText |= wxST_ELLIPSIZE_END;
463 break;
464 }
465 }
466
467 flagsDummyText |= align;
32b8ec41
VZ
468 flagsText |= align;
469 flagsBox |= align;
470
916eabe6
VZ
471 wxStaticBox *staticBox = new wxStaticBox(this, wxID_ANY,
472 m_textBox->GetValue(),
473 wxDefaultPosition, wxDefaultSize,
474 flagsBox);
475 m_sizerStatBox = new wxStaticBoxSizer(staticBox, isVert ? wxHORIZONTAL
476 : wxVERTICAL);
32b8ec41 477
916eabe6
VZ
478 if ( m_chkGeneric->GetValue() )
479 {
480 m_statText = new wxGenericStaticText(this, wxID_ANY,
481 m_textLabel->GetValue(),
482 wxDefaultPosition, wxDefaultSize,
483 flagsDummyText);
f5bdfc69 484#if wxUSE_MARKUP
916eabe6 485 m_statMarkup = new wxGenericStaticText(this, wxID_ANY,
3da9cffc 486 wxString(),
916eabe6
VZ
487 wxDefaultPosition, wxDefaultSize,
488 flagsText);
f5bdfc69 489#endif // wxUSE_MARKUP
916eabe6
VZ
490 }
491 else // use native versions
492 {
493 m_statText = new wxStaticText(this, wxID_ANY,
494 m_textLabel->GetValue(),
495 wxDefaultPosition, wxDefaultSize,
496 flagsDummyText);
f5bdfc69 497#if wxUSE_MARKUP
916eabe6 498 m_statMarkup = new wxStaticText(this, wxID_ANY,
3da9cffc 499 wxString(),
916eabe6
VZ
500 wxDefaultPosition, wxDefaultSize,
501 flagsText);
f5bdfc69 502#endif // wxUSE_MARKUP
916eabe6 503 }
3da9cffc 504
f5bdfc69 505#if wxUSE_MARKUP
3da9cffc
VZ
506 m_statMarkup->SetLabelMarkup(m_textLabelWithMarkup->GetValue());
507
916eabe6
VZ
508 if ( m_chkGreen->GetValue() )
509 m_statMarkup->SetBackgroundColour(*wxGREEN);
f5bdfc69
VZ
510#endif // wxUSE_MARKUP
511
a56938e4 512#if wxUSE_STATLINE
206d3a16 513 m_statLine = new wxStaticLine(this, wxID_ANY,
32b8ec41
VZ
514 wxDefaultPosition, wxDefaultSize,
515 isVert ? wxLI_VERTICAL : wxLI_HORIZONTAL);
a56938e4 516#endif // wxUSE_STATLINE
32b8ec41
VZ
517
518 m_sizerStatBox->Add(m_statText, 1, wxGROW | wxALL, 5);
a56938e4 519#if wxUSE_STATLINE
32b8ec41 520 m_sizerStatBox->Add(m_statLine, 0, wxGROW | wxALL, 5);
a56938e4 521#endif // wxUSE_STATLINE
f5bdfc69 522#if wxUSE_MARKUP
916eabe6 523 m_sizerStatBox->Add(m_statMarkup, 1, wxGROW | wxALL, 5);
f5bdfc69 524#endif // wxUSE_MARKUP
32b8ec41
VZ
525
526 m_sizerStatic->Add(m_sizerStatBox, 1, wxGROW);
527
528 m_sizerStatic->Layout();
916eabe6
VZ
529
530 m_statText->Connect(wxEVT_LEFT_UP,
531 wxMouseEventHandler(StaticWidgetsPage::OnMouseEvent),
532 NULL, this);
533 staticBox->Connect(wxEVT_LEFT_UP,
534 wxMouseEventHandler(StaticWidgetsPage::OnMouseEvent),
535 NULL, this);
32b8ec41
VZ
536}
537
538// ----------------------------------------------------------------------------
539// event handlers
540// ----------------------------------------------------------------------------
541
542void StaticWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
543{
544 Reset();
545
546 CreateStatic();
547}
548
39bc0347 549void StaticWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
32b8ec41 550{
81d3348a 551 if (event.GetEventObject() == static_cast<wxObject*>(m_chkEllipsize))
39bc0347
VZ
552 {
553 m_radioEllipsize->Enable(event.IsChecked());
554 }
555
32b8ec41
VZ
556 CreateStatic();
557}
558
c02e5a31 559void StaticWidgetsPage::OnButtonBoxText(wxCommandEvent& WXUNUSED(event))
32b8ec41
VZ
560{
561 m_sizerStatBox->GetStaticBox()->SetLabel(m_textBox->GetValue());
562}
563
916eabe6 564void StaticWidgetsPage::OnButtonLabelText(wxCommandEvent& WXUNUSED(event))
39bc0347 565{
916eabe6 566 m_statText->SetLabel(m_textLabel->GetValue());
39bc0347
VZ
567
568 // test GetLabel() and GetLabelText(); the first should return the
569 // label as it is written in the relative text control; the second should
570 // return the label as it's shown in the wxStaticText
571 wxLogMessage(wxT("The original label should be '%s'"),
916eabe6 572 m_statText->GetLabel());
39bc0347 573 wxLogMessage(wxT("The label text is '%s'"),
916eabe6 574 m_statText->GetLabelText());
39bc0347
VZ
575}
576
f5bdfc69 577#if wxUSE_MARKUP
916eabe6 578void StaticWidgetsPage::OnButtonLabelWithMarkupText(wxCommandEvent& WXUNUSED(event))
32b8ec41 579{
3da9cffc 580 m_statMarkup->SetLabelMarkup(m_textLabelWithMarkup->GetValue());
39bc0347
VZ
581
582 // test GetLabel() and GetLabelText(); the first should return the
583 // label as it is written in the relative text control; the second should
584 // return the label as it's shown in the wxStaticText
585 wxLogMessage(wxT("The original label should be '%s'"),
916eabe6 586 m_statMarkup->GetLabel());
39bc0347 587 wxLogMessage(wxT("The label text is '%s'"),
916eabe6
VZ
588 m_statMarkup->GetLabelText());
589}
f5bdfc69 590#endif // wxUSE_MARKUP
916eabe6
VZ
591
592void StaticWidgetsPage::OnMouseEvent(wxMouseEvent& event)
593{
594 if ( event.GetEventObject() == m_statText )
43b2d5e7 595 {
916eabe6 596 wxLogMessage("Clicked on static text");
43b2d5e7 597 }
916eabe6 598 else
43b2d5e7 599 {
916eabe6 600 wxLogMessage("Clicked on static box");
43b2d5e7 601 }
32b8ec41
VZ
602}
603