+// ----------------------------------------------------------------------------
+// MyModalDialog
+// Demonstrates context-sensitive help
+// ----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(MyModalDialog, wxDialog)
+END_EVENT_TABLE()
+
+MyModalDialog::MyModalDialog(wxWindow *parent)
+ : wxDialog()
+{
+ // Add the context-sensitive help button on the caption for MSW
+#ifdef __WXMSW__
+ SetExtraStyle(wxDIALOG_EX_CONTEXTHELP);
+#endif
+
+ wxDialog::Create(parent, -1, wxString("Modal dialog"));
+
+ wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
+ wxBoxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
+
+ wxButton* btnOK = new wxButton(this, wxID_OK, "&OK");
+ btnOK->SetHelpText(_("The OK button confirms the dialog choices."));
+
+ wxButton* btnCancel = new wxButton(this, wxID_CANCEL, "&Cancel");
+ btnCancel->SetHelpText(_("The Cancel button cancels the dialog."));
+
+ sizerRow->Add(btnOK, 0, wxALIGN_CENTER | wxALL, 5);
+ sizerRow->Add(btnCancel, 0, wxALIGN_CENTER | wxALL, 5);
+
+ // Add explicit context-sensitive help button for non-MSW
+#ifndef __WXMSW__
+ sizerRow->Add(new wxContextHelpButton(this), 0, wxALIGN_CENTER | wxALL, 5);
+#endif
+
+ wxTextCtrl *text = new wxTextCtrl(this, -1, wxT("A demo text control"),
+ wxDefaultPosition, wxSize(300, 100),
+ wxTE_MULTILINE);
+ text->SetHelpText(_("Type text here if you have got nothing more "
+ "interesting to do"));
+ sizerTop->Add(text, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+ sizerTop->Add(sizerRow, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+
+ SetAutoLayout(TRUE);
+ SetSizer(sizerTop);
+
+ sizerTop->SetSizeHints(this);
+ sizerTop->Fit(this);
+
+ btnOK->SetFocus();
+ btnOK->SetDefault();
+}
+