]> git.saurik.com Git - wxWidgets.git/blob - samples/help/demo.cpp
d1bc2f6f7ab345977fbf522861381f7d9c205141
[wxWidgets.git] / samples / help / demo.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: demo.cpp
3 // Purpose: wxHelpController demo
4 // Author: Karsten Ballueder
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Karsten Ballueder, Julian Smart
9 // Licence: wxWindows licence
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 (this file is usually all you
28 // need because it includes almost all "standard" wxWindows headers
29 #ifndef WX_PRECOMP
30 # include "wx/wx.h"
31 #endif
32
33 # include "wx/image.h"
34 # include "wx/help.h"
35 # include "wx/cshelp.h"
36
37 #if wxUSE_TOOLTIPS
38 # include "wx/tooltip.h"
39 #endif
40
41 // define this to 1 to use HTML help even under Windows (by default, Windows
42 // version will use WinHelp).
43 // Please also see samples/html/helpview.
44
45 #define USE_HTML_HELP 1
46
47 // Use old-style HTML help if 1
48 #define USE_OLD_HTML_HELP 0
49
50 #if !wxUSE_HTML
51 #undef USE_HTML_HELP
52 #define USE_HTML_HELP 0
53 #endif
54
55 #if USE_HTML_HELP
56 #include <wx/filesys.h>
57 #include <wx/fs_zip.h>
58
59 #if USE_OLD_HTML_HELP
60 #include "wx/generic/helpwxht.h"
61 #endif
62
63 #include "wx/html/helpctrl.h"
64 #endif
65
66 #if wxUSE_MS_HTML_HELP
67 #include "wx/msw/helpchm.h"
68 #endif
69
70 // ----------------------------------------------------------------------------
71 // ressources
72 // ----------------------------------------------------------------------------
73 // the application icon
74 #if defined(__WXGTK__) || defined(__WXMOTIF__)
75 #include "mondrian.xpm"
76 #endif
77
78 // ----------------------------------------------------------------------------
79 // private classes
80 // ----------------------------------------------------------------------------
81
82 // Define a new application type, each program should derive a class from wxApp
83 class MyApp : public wxApp
84 {
85 public:
86 // override base class virtuals
87 // ----------------------------
88
89 // this one is called on application startup and is a good place for the app
90 // initialization (doing it here and not in the ctor allows to have an error
91 // return: if OnInit() returns false, the application terminates)
92 virtual bool OnInit();
93
94 // do some clean up here
95 virtual int OnExit();
96 };
97
98 // Define a new frame type: this is going to be our main frame
99 class MyFrame : public wxFrame
100 {
101 public:
102 // ctor(s)
103 MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
104
105 wxHelpController& GetHelpController() { return m_help; }
106
107 #if USE_HTML_HELP
108 #if USE_OLD_HTML_HELP
109 wxHelpControllerHtml& GetHtmlHelpController() { return m_htmlHelp; }
110 #endif
111 wxHtmlHelpController& GetAdvancedHtmlHelpController() { return m_advancedHtmlHelp; }
112 #endif
113 #if wxUSE_MS_HTML_HELP
114 wxCHMHelpController& GetMSHtmlHelpController() { return m_msHtmlHelp; }
115 #endif
116
117 // event handlers (these functions should _not_ be virtual)
118 void OnQuit(wxCommandEvent& event);
119 void OnHelp(wxCommandEvent& event);
120 void OnHtmlHelp(wxCommandEvent& event);
121 void OnAdvancedHtmlHelp(wxCommandEvent& event);
122 void OnMSHtmlHelp(wxCommandEvent& event);
123
124 void OnShowContextHelp(wxCommandEvent& event);
125 void OnShowDialogContextHelp(wxCommandEvent& event);
126
127 void ShowHelp(int commandId, wxHelpControllerBase& helpController);
128
129 private:
130 wxHelpController m_help;
131
132 #if USE_HTML_HELP
133 #if USE_OLD_HTML_HELP
134 wxHelpControllerHtml m_htmlHelp;
135 #endif
136 wxHtmlHelpController m_advancedHtmlHelp;
137 #endif
138
139 #if wxUSE_MS_HTML_HELP
140 wxCHMHelpController m_msHtmlHelp;
141 #endif
142
143 // any class wishing to process wxWindows events must use this macro
144 DECLARE_EVENT_TABLE()
145 };
146
147 // A custom modal dialog
148 class MyModalDialog : public wxDialog
149 {
150 public:
151 MyModalDialog(wxWindow *parent);
152
153 private:
154
155 DECLARE_EVENT_TABLE()
156 };
157
158 // ----------------------------------------------------------------------------
159 // constants
160 // ----------------------------------------------------------------------------
161
162 // IDs for the controls and the menu commands
163 enum
164 {
165 // menu items
166 HelpDemo_Quit = 100,
167 HelpDemo_Help_Index,
168 HelpDemo_Help_Classes,
169 HelpDemo_Help_Functions,
170 HelpDemo_Help_Help,
171 HelpDemo_Help_Search,
172 HelpDemo_Help_ContextHelp,
173 HelpDemo_Help_DialogContextHelp,
174
175 HelpDemo_Html_Help_Index,
176 HelpDemo_Html_Help_Classes,
177 HelpDemo_Html_Help_Functions,
178 HelpDemo_Html_Help_Help,
179 HelpDemo_Html_Help_Search,
180
181 HelpDemo_Advanced_Html_Help_Index,
182 HelpDemo_Advanced_Html_Help_Classes,
183 HelpDemo_Advanced_Html_Help_Functions,
184 HelpDemo_Advanced_Html_Help_Help,
185 HelpDemo_Advanced_Html_Help_Search,
186
187 HelpDemo_MS_Html_Help_Index,
188 HelpDemo_MS_Html_Help_Classes,
189 HelpDemo_MS_Html_Help_Functions,
190 HelpDemo_MS_Html_Help_Help,
191 HelpDemo_MS_Html_Help_Search,
192
193 HelpDemo_Help_KDE,
194 HelpDemo_Help_GNOME,
195 HelpDemo_Help_Netscape,
196 // controls start here (the numbers are, of course, arbitrary)
197 HelpDemo_Text = 1000,
198 };
199
200 // ----------------------------------------------------------------------------
201 // event tables and other macros for wxWindows
202 // ----------------------------------------------------------------------------
203
204 // the event tables connect the wxWindows events with the functions (event
205 // handlers) which process them. It can be also done at run-time, but for the
206 // simple menu events like this the static method is much simpler.
207 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
208 EVT_MENU(HelpDemo_Quit, MyFrame::OnQuit)
209 EVT_MENU(HelpDemo_Help_Index, MyFrame::OnHelp)
210 EVT_MENU(HelpDemo_Help_Classes, MyFrame::OnHelp)
211 EVT_MENU(HelpDemo_Help_Functions, MyFrame::OnHelp)
212 EVT_MENU(HelpDemo_Help_Help, MyFrame::OnHelp)
213 EVT_MENU(HelpDemo_Help_Search, MyFrame::OnHelp)
214 EVT_MENU(HelpDemo_Help_ContextHelp, MyFrame::OnShowContextHelp)
215 EVT_MENU(HelpDemo_Help_DialogContextHelp, MyFrame::OnShowDialogContextHelp)
216
217 EVT_MENU(HelpDemo_Html_Help_Index, MyFrame::OnHtmlHelp)
218 EVT_MENU(HelpDemo_Html_Help_Classes, MyFrame::OnHtmlHelp)
219 EVT_MENU(HelpDemo_Html_Help_Functions, MyFrame::OnHtmlHelp)
220 EVT_MENU(HelpDemo_Html_Help_Help, MyFrame::OnHtmlHelp)
221 EVT_MENU(HelpDemo_Html_Help_Search, MyFrame::OnHtmlHelp)
222
223 EVT_MENU(HelpDemo_Advanced_Html_Help_Index, MyFrame::OnAdvancedHtmlHelp)
224 EVT_MENU(HelpDemo_Advanced_Html_Help_Classes, MyFrame::OnAdvancedHtmlHelp)
225 EVT_MENU(HelpDemo_Advanced_Html_Help_Functions, MyFrame::OnAdvancedHtmlHelp)
226 EVT_MENU(HelpDemo_Advanced_Html_Help_Help, MyFrame::OnAdvancedHtmlHelp)
227 EVT_MENU(HelpDemo_Advanced_Html_Help_Search, MyFrame::OnAdvancedHtmlHelp)
228
229 EVT_MENU(HelpDemo_MS_Html_Help_Index, MyFrame::OnMSHtmlHelp)
230 EVT_MENU(HelpDemo_MS_Html_Help_Classes, MyFrame::OnMSHtmlHelp)
231 EVT_MENU(HelpDemo_MS_Html_Help_Functions, MyFrame::OnMSHtmlHelp)
232 EVT_MENU(HelpDemo_MS_Html_Help_Help, MyFrame::OnMSHtmlHelp)
233 EVT_MENU(HelpDemo_MS_Html_Help_Search, MyFrame::OnMSHtmlHelp)
234
235 EVT_MENU(HelpDemo_Help_KDE, MyFrame::OnHelp)
236 EVT_MENU(HelpDemo_Help_GNOME, MyFrame::OnHelp)
237 EVT_MENU(HelpDemo_Help_Netscape, MyFrame::OnHelp)
238 END_EVENT_TABLE()
239
240 // Create a new application object: this macro will allow wxWindows to create
241 // the application object during program execution (it's better than using a
242 // static object for many reasons) and also declares the accessor function
243 // wxGetApp() which will return the reference of the right type (i.e. MyApp and
244 // not wxApp)
245 IMPLEMENT_APP(MyApp)
246
247 // ============================================================================
248 // implementation
249 // ============================================================================
250
251 // ----------------------------------------------------------------------------
252 // the application class
253 // ----------------------------------------------------------------------------
254
255 // `Main program' equivalent: the program execution "starts" here
256 bool MyApp::OnInit()
257 {
258 // Create a simple help provider to make SetHelpText() do something.
259 // Note that this must be set before any SetHelpText() calls are made.
260 //wxHelpProvider::Set(new wxSimpleHelpProvider);
261 wxHelpControllerHelpProvider* provider = new wxHelpControllerHelpProvider;
262 wxHelpProvider::Set(provider);
263
264 #if wxUSE_HTML
265 #if wxUSE_GIF
266 // Required for images in the online documentation
267 wxImage::AddHandler(new wxGIFHandler);
268
269 // Required for advanced HTML help
270 #if wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB
271 wxFileSystem::AddHandler(new wxZipFSHandler);
272 #endif
273
274 #endif
275 #endif
276
277 // Create the main application window
278 MyFrame *frame = new MyFrame("HelpDemo wxWindows App",
279 wxPoint(50, 50), wxSize(450, 340));
280
281 #if wxUSE_MS_HTML_HELP
282 provider->SetHelpController(& frame->GetMSHtmlHelpController());
283 #else
284 provider->SetHelpController(& frame->GetHelpController());
285 #endif
286
287 frame->Show(TRUE);
288 SetTopWindow(frame);
289
290 // initialise the help system: this means that we'll use doc.hlp file under
291 // Windows and that the HTML docs are in the subdirectory doc for platforms
292 // using HTML help
293 if ( !frame->GetHelpController().Initialize("doc") )
294 {
295 wxLogError("Cannot initialize the help system, aborting.");
296
297 return FALSE;
298 }
299
300 #if USE_HTML_HELP
301 // initialise the standard HTML help system: this means that the HTML docs are in the
302 // subdirectory doc for platforms using HTML help
303 #if USE_OLD_HTML_HELP
304 if ( !frame->GetHtmlHelpController().Initialize("doc") )
305 {
306 wxLogError("Cannot initialize the HTML help system, aborting.");
307
308 return FALSE;
309 }
310 #endif
311
312 // initialise the advanced HTML help system: this means that the HTML docs are in .htb
313 // (zipped) form
314 if ( !frame->GetAdvancedHtmlHelpController().Initialize("doc") )
315 {
316 wxLogError("Cannot initialize the advanced HTML help system, aborting.");
317
318 return FALSE;
319 }
320 #endif
321
322 #if wxUSE_MS_HTML_HELP
323 if ( !frame->GetMSHtmlHelpController().Initialize("doc") )
324 {
325 wxLogError("Cannot initialize the MS HTML help system, aborting.");
326
327 return FALSE;
328 }
329 #endif
330
331 return TRUE;
332 }
333
334 int MyApp::OnExit()
335 {
336 // clean up
337 delete wxHelpProvider::Set(NULL);
338
339 return 0;
340 }
341
342 // ----------------------------------------------------------------------------
343 // main frame
344 // ----------------------------------------------------------------------------
345
346 // frame constructor
347 MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
348 : wxFrame((wxFrame *)NULL, 300, title, pos, size)
349 {
350 // set the frame icon
351 SetIcon(wxICON(mondrian));
352
353 // create a menu bar
354 wxMenu *menuFile = new wxMenu;
355
356 menuFile->Append(HelpDemo_Help_Index, "&Help Index...");
357 menuFile->Append(HelpDemo_Help_Classes, "&Help on Classes...");
358 menuFile->Append(HelpDemo_Help_Functions, "&Help on Functions...");
359 menuFile->Append(HelpDemo_Help_ContextHelp, "&Context Help...");
360 menuFile->Append(HelpDemo_Help_DialogContextHelp, "&Dialog Context Help...\tCtrl-H");
361 menuFile->Append(HelpDemo_Help_Help, "&About Help Demo...");
362 menuFile->Append(HelpDemo_Help_Search, "&Search help...");
363 #if USE_HTML_HELP
364 #if USE_OLD_HTML_HELP
365 menuFile->AppendSeparator();
366 menuFile->Append(HelpDemo_Html_Help_Index, "HTML &Help Index...");
367 menuFile->Append(HelpDemo_Html_Help_Classes, "HTML &Help on Classes...");
368 menuFile->Append(HelpDemo_Html_Help_Functions, "HTML &Help on Functions...");
369 menuFile->Append(HelpDemo_Html_Help_Help, "HTML &About Help Demo...");
370 menuFile->Append(HelpDemo_Html_Help_Search, "HTML &Search help...");
371 #endif
372 menuFile->AppendSeparator();
373 menuFile->Append(HelpDemo_Advanced_Html_Help_Index, "Advanced HTML &Help Index...");
374 menuFile->Append(HelpDemo_Advanced_Html_Help_Classes, "Advanced HTML &Help on Classes...");
375 menuFile->Append(HelpDemo_Advanced_Html_Help_Functions, "Advanced HTML &Help on Functions...");
376 menuFile->Append(HelpDemo_Advanced_Html_Help_Help, "Advanced HTML &About Help Demo...");
377 menuFile->Append(HelpDemo_Advanced_Html_Help_Search, "Advanced HTML &Search help...");
378 #endif
379
380 #if wxUSE_MS_HTML_HELP
381 menuFile->AppendSeparator();
382 menuFile->Append(HelpDemo_MS_Html_Help_Index, "MS HTML &Help Index...");
383 menuFile->Append(HelpDemo_MS_Html_Help_Classes, "MS HTML &Help on Classes...");
384 menuFile->Append(HelpDemo_MS_Html_Help_Functions, "MS HTML &Help on Functions...");
385 menuFile->Append(HelpDemo_MS_Html_Help_Help, "MS HTML &About Help Demo...");
386 menuFile->Append(HelpDemo_MS_Html_Help_Search, "MS HTML &Search help...");
387 #endif
388
389 #ifndef __WXMSW__
390 #if !wxUSE_HTML
391 menuFile->AppendSeparator();
392 menuFile->Append(HelpDemo_Help_KDE, "Use &KDE");
393 menuFile->Append(HelpDemo_Help_GNOME, "Use &GNOME");
394 menuFile->Append(HelpDemo_Help_Netscape, "Use &Netscape");
395 #endif
396 #endif
397 menuFile->AppendSeparator();
398 menuFile->Append(HelpDemo_Quit, "E&xit");
399
400 // now append the freshly created menu to the menu bar...
401 wxMenuBar *menuBar = new wxMenuBar;
402 menuBar->Append(menuFile, "&File");
403
404 // ... and attach this menu bar to the frame
405 SetMenuBar(menuBar);
406
407 // create a status bar just for fun (by default with 1 pane only)
408 CreateStatusBar();
409 SetStatusText("Welcome to wxWindows!");
410
411 // now create some controls
412
413 // a panel first - if there were several controls, it would allow us to
414 // navigate between them from the keyboard
415 wxPanel *panel = new wxPanel(this, 301, wxPoint(0, 0), wxSize(400, 200));
416 //panel->SetHelpText(_("This panel just holds a static text control."));
417 panel->SetHelpText(wxContextId(300));
418
419 // and a static control whose parent is the panel
420 wxStaticText* staticText = new wxStaticText(panel, 302, "Hello, world!", wxPoint(10, 10));
421 staticText->SetHelpText(_("This static text control isn't doing a lot right now."));
422 }
423
424
425 // event handlers
426
427 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
428 {
429 // TRUE is to force the frame to close
430 Close(TRUE);
431 }
432
433 void MyFrame::OnHelp(wxCommandEvent& event)
434 {
435 ShowHelp(event.GetId(), m_help);
436 }
437
438 void MyFrame::OnShowContextHelp(wxCommandEvent& event)
439 {
440 // This starts context help mode, then the user
441 // clicks on a window to send a help message
442 wxContextHelp contextHelp(this);
443 }
444
445 void MyFrame::OnShowDialogContextHelp(wxCommandEvent& event)
446 {
447 MyModalDialog dialog(this);
448 dialog.ShowModal();
449 }
450
451 void MyFrame::OnHtmlHelp(wxCommandEvent& event)
452 {
453 #if USE_HTML_HELP && USE_OLD_HTML_HELP
454 ShowHelp(event.GetId(), m_htmlHelp);
455 #endif
456 }
457
458 void MyFrame::OnAdvancedHtmlHelp(wxCommandEvent& event)
459 {
460 #if USE_HTML_HELP
461 ShowHelp(event.GetId(), m_advancedHtmlHelp);
462 #endif
463 }
464
465 void MyFrame::OnMSHtmlHelp(wxCommandEvent& event)
466 {
467 #if wxUSE_MS_HTML_HELP
468 ShowHelp(event.GetId(), m_msHtmlHelp);
469 #endif
470 }
471
472 /*
473 Notes: ShowHelp uses section ids for displaying particular topics,
474 but you might want to use a unique keyword to display a topic, instead.
475
476 Section ids are specified as follows for the different formats.
477
478 WinHelp
479
480 The [MAP] section specifies the topic to integer id mapping, e.g.
481
482 [MAP]
483 #define intro 100
484 #define functions 1
485 #define classes 2
486 #define about 3
487
488 The identifier name corresponds to the label used for that topic.
489 You could also put these in a .h file and #include it in both the MAP
490 section and your C++ source.
491
492 Note that Tex2RTF doesn't currently generate the MAP section automatically.
493
494 MS HTML Help
495
496 The [MAP] section specifies the HTML filename root to integer id mapping, e.g.
497
498 [MAP]
499 #define doc1 100
500 #define doc3 1
501 #define doc2 2
502 #define doc4 3
503
504 The identifier name corresponds to the HTML filename used for that topic.
505 You could also put these in a .h file and #include it in both the MAP
506 section and your C++ source.
507
508 Note that Tex2RTF doesn't currently generate the MAP section automatically.
509
510 Simple wxHTML Help and External HTML Help
511
512 A wxhelp.map file is used, for example:
513
514 0 wx.htm ; wxWindows: Help index; additional keywords like overview
515 1 wx204.htm ; wxWindows Function Reference
516 2 wx34.htm ; wxWindows Class Reference
517
518 Note that Tex2RTF doesn't currently generate the MAP section automatically.
519
520 Advanced HTML Help
521
522 An extension to the .hhc file format is used, specifying a new parameter
523 with name="ID":
524
525 <OBJECT type="text/sitemap">
526 <param name="Local" value="doc2.htm#classes">
527 <param name="Name" value="Classes">
528 <param name="ID" value=2>
529 </OBJECT>
530
531 Again, this is not generated automatically by Tex2RTF, though it could
532 be added quite easily.
533
534 Unfortunately adding the ID parameters appears to interfere with MS HTML Help,
535 so you should not try to compile a .chm file from a .hhc file with
536 this extension, or the contents will be messed up.
537 */
538
539 void MyFrame::ShowHelp(int commandId, wxHelpControllerBase& helpController)
540 {
541 switch(commandId)
542 {
543 case HelpDemo_Help_Classes:
544 case HelpDemo_Html_Help_Classes:
545 case HelpDemo_Advanced_Html_Help_Classes:
546 case HelpDemo_MS_Html_Help_Classes:
547 helpController.DisplaySection(2);
548 //helpController.DisplaySection("Classes"); // An alternative form for most controllers
549
550 break;
551 case HelpDemo_Help_Functions:
552 case HelpDemo_Html_Help_Functions:
553 case HelpDemo_Advanced_Html_Help_Functions:
554 case HelpDemo_MS_Html_Help_Functions:
555 helpController.DisplaySection(1);
556 //helpController.DisplaySection("Functions"); // An alternative form for most controllers
557 break;
558 case HelpDemo_Help_Help:
559 case HelpDemo_Html_Help_Help:
560 case HelpDemo_Advanced_Html_Help_Help:
561 case HelpDemo_MS_Html_Help_Help:
562 helpController.DisplaySection(3);
563 //helpController.DisplaySection("About"); // An alternative form for most controllers
564 break;
565
566 case HelpDemo_Help_Search:
567 case HelpDemo_Html_Help_Search:
568 case HelpDemo_Advanced_Html_Help_Search:
569 case HelpDemo_MS_Html_Help_Search:
570 {
571 wxString key = wxGetTextFromUser("Search for?",
572 "Search help for keyword",
573 "",
574 this);
575 if(! key.IsEmpty())
576 helpController.KeywordSearch(key);
577 }
578 break;
579
580 case HelpDemo_Help_Index:
581 case HelpDemo_Html_Help_Index:
582 case HelpDemo_Advanced_Html_Help_Index:
583 case HelpDemo_MS_Html_Help_Index:
584 helpController.DisplayContents();
585 break;
586
587 // These three calls are only used by wxExtHelpController
588
589 case HelpDemo_Help_KDE:
590 helpController.SetViewer("kdehelp");
591 break;
592 case HelpDemo_Help_GNOME:
593 helpController.SetViewer("gnome-help-browser");
594 break;
595 case HelpDemo_Help_Netscape:
596 helpController.SetViewer("netscape", wxHELP_NETSCAPE);
597 break;
598 default:
599 break;
600 }
601 }
602
603 // ----------------------------------------------------------------------------
604 // MyModalDialog
605 // Demonstrates context-sensitive help
606 // ----------------------------------------------------------------------------
607
608 BEGIN_EVENT_TABLE(MyModalDialog, wxDialog)
609 END_EVENT_TABLE()
610
611 MyModalDialog::MyModalDialog(wxWindow *parent)
612 : wxDialog()
613 {
614 // Add the context-sensitive help button on the caption for MSW
615 #ifdef __WXMSW__
616 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP);
617 #endif
618
619 wxDialog::Create(parent, -1, wxString("Modal dialog"));
620
621 wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
622 wxBoxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
623
624 wxButton* btnOK = new wxButton(this, wxID_OK, "&OK");
625 btnOK->SetHelpText(_("The OK button confirms the dialog choices."));
626
627 wxButton* btnCancel = new wxButton(this, wxID_CANCEL, "&Cancel");
628 btnCancel->SetHelpText(_("The Cancel button cancels the dialog."));
629
630 sizerRow->Add(btnOK, 0, wxALIGN_CENTER | wxALL, 5);
631 sizerRow->Add(btnCancel, 0, wxALIGN_CENTER | wxALL, 5);
632
633 // Add explicit context-sensitive help button for non-MSW
634 #ifndef __WXMSW__
635 sizerRow->Add(new wxContextHelpButton(this), 0, wxALIGN_CENTER | wxALL, 5);
636 #endif
637
638 wxTextCtrl *text = new wxTextCtrl(this, -1, wxT("A demo text control"),
639 wxDefaultPosition, wxSize(300, 100),
640 wxTE_MULTILINE);
641 text->SetHelpText(_("Type text here if you have got nothing more "
642 "interesting to do"));
643 sizerTop->Add(text, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
644 sizerTop->Add(sizerRow, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
645
646 SetAutoLayout(TRUE);
647 SetSizer(sizerTop);
648
649 sizerTop->SetSizeHints(this);
650 sizerTop->Fit(this);
651
652 btnOK->SetFocus();
653 btnOK->SetDefault();
654 }
655