WxExtLib - WxExtLibTest.cpp
00001: //-------------------------------------------------------------------------
00002: // Licence: wxWidgets licence
00003: //-------------------------------------------------------------------------
00004:
00005: //-------------------------------------------------------------------------
00006:
00007: /*
00008: //-------------------------------------------------------------------------
00009:
00010: === WxExtLibTest Configuration
00011:
00012: == Test use of notebook pages
00013:
00014: - notes:
00015: - automatic sizing for notebook pages doesn't seem to work
00016: - well (for whatever reason)
00017: - settings:
00018: #define M_WxExtLibTest_IsNotebookPanelTest 0/1
00019:
00020: //-------------------------------------------------------------------------
00021: */
00022:
00023: #define M_IsTestHtmlController
00024:
00025: #include "WxExtLibConfig.h"
00026: #include "WxExtLibConfig_Version.h"
00027:
00028: // For compilers that support precompilation, includes "wx/wx.h".
00029: #include "wx/wxprec.h"
00030:
00031: #ifdef __BORLANDC__
00032: #pragma hdrstop
00033: #endif
00034:
00035: #include <wx/defs.h>
00036:
00037: #ifndef WX_PRECOMP
00038: #include "wx/wx.h"
00039: #endif
00040:
00041: #include <wx/list.h>
00042: #include <wx/statline.h>
00043: #include <wx/notebook.h>
00044:
00045: // the application icon (under Windows and OS/2 it is in resources)
00046: #if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__)
00047: #include "WxExtLibTest.xpm"
00048: #endif
00049:
00050: #include "WxExtDialog.h"
00051: #include "MessageExtDialog.h"
00052: #include "WxMisc.h"
00053:
00054: //-------------------------------------------------------------------------
00055:
00056: #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
00057: # define M_IsUseChmHelpController
00058: # include "wx/msw/helpchm.h"
00059: #else
00060: # include "wx/filesys.h"
00061: # include "wx/fs_zip.h"
00062: # include "wx/html/helpctrl.h"
00063: #endif
00064:
00065: //-------------------------------------------------------------------------
00066:
00067: #include "ConfigEntry.h"
00068: #include <wx/fileconf.h>
00069: // #if defined(__WXMSW__)
00070: // # include <wx/msw/regconf.h>
00071: // # include <wx/msw/iniconf.h>
00072: // #endif
00073:
00074: #include <accessor_macros.h>
00075:
00076: //-------------------------------------------------------------------------
00077:
00078: #if defined(__WXMSW__)
00079: const char * ConfigFilenameString = ".\\WxExtLibTest.ini";
00080: #else
00081: const char * ConfigFilenameString = "./WxExtLibTest.ini";
00082: #endif
00083:
00084: //=========================================================================
00085:
00086: double BorderCompressionValue = 1.;
00087:
00088: class WxExtLibTestFrame;
00089:
00090: //-------------------------------------------------------------------------
00091:
00092: class WxExtLibTestApp : public wxApp
00093: {
00094: public:
00095: virtual bool OnInit();
00096:
00097: void updateLanguageSettings ();
00098:
00099: #if (M_WxExtLib_IsUseAppRootFrame == 1)
00100: // TEST AppRootFrame
00101: wxAppRootFrame & getAppRootFrame () { return * wxGetGlobalAppRootFrame(); }
00102: #endif // M_WxExtLib_IsUseAppRootFrame
00103:
00104: WxExtLibTestFrame & getFrame () { return *m_WxExtLibTestFrame; }
00105:
00106: virtual void SetActive (bool IsActive, wxWindow * LastFocus);
00107:
00108: private:
00109: bool m_IsAppInitialized;
00110:
00111: wxLocale * m_Locale;
00112:
00113: // TEST DummyMain
00114: WxExtLibTestFrame * m_WxExtLibTestFrame;
00115:
00116: #if (M_WxExtLib_IsUseStxLogging == 1)
00117: stxAutoInitExit m_SontaiaAutoInitExit;
00118: #endif
00119: };
00120:
00121: //-------------------------------------------------------------------------
00122:
00123: inline WxExtLibTestApp & getApp()
00124: {
00125: return * ((WxExtLibTestApp *) wxTheApp);
00126: }
00127:
00128: //-------------------------------------------------------------------------
00129:
00130: class WxExtLibTestNonModalDialogManag : public wxNonModalDialogManag
00131: {
00132: public:
00133: virtual wxWindow * createWindow (long CommandIdent);
00134:
00135: M_DeclarePtrProperty (wxWindow, ParentWindow);
00136: };
00137:
00138: //-------------------------------------------------------------------------
00139:
00140: // TEST wxDialog as base class, but this doesn't support menus
00141: // in wxWidgets, apparently
00142: typedef wxFrame WxExtLibTestBase;
00143:
00144: class WxExtLibTestFrame : public WxExtLibTestBase
00145: {
00146: public:
00147: WxExtLibTestFrame (wxWindow * ParentWindow,
00148: const wxString& title, const wxPoint& pos, const wxSize& size,
00149: long style = wxDEFAULT_FRAME_STYLE);
00150:
00151: void OnCloseEvent (wxCloseEvent & CloseEvent);
00152: void OnQuit (wxCommandEvent & Event);
00153:
00154: void OnMessageExtDialogTest (wxCommandEvent & Event);
00155: void OnStatusValidatorTestDialog (wxCommandEvent & Event);
00156: void OnMessageFormatterTest (wxCommandEvent & Event);
00157: void OnConfigEntryManagerTestDialog (wxCommandEvent & Event);
00158: void OnTextCtrlSliderPairTestDialog (wxCommandEvent & Event);
00159: void OnDialogZoomTestDialog (wxCommandEvent & Event);
00160:
00161: void OnNonModalDialog1 (wxCommandEvent & Event);
00162: void OnNonModalDialog2 (wxCommandEvent & Event);
00163: void OnNonModalDialog3 (wxCommandEvent & Event);
00164:
00165: void OnHelp (wxCommandEvent & Event);
00166: void OnAbout (wxCommandEvent & Event);
00167:
00168: // wxHelpController m_HelpController;
00169: #ifdef M_IsUseChmHelpController
00170: wxCHMHelpController m_ChmHelpController;
00171: #else
00172: wxHtmlHelpController m_HtmlHelpController;
00173: #endif
00174:
00175: public:
00176: M_DeclarePropertyWithoutSet (WxExtLibTestNonModalDialogManag, NonModalDialogManag);
00177:
00178: private:
00179: DECLARE_EVENT_TABLE()
00180: };
00181:
00182: //-------------------------------------------------------------------------
00183:
00184: class wxStatusValidatorTestExtDialog: public wxExtDialog
00185: {
00186: public:
00187: wxStatusValidatorTestExtDialog (wxWindow * ParentWindow);
00188:
00189: void createValidatorTestControls (wxWindowAdder & WA);
00190:
00191: virtual void OnOK(wxCommandEvent& Event);
00192: virtual void OnCancel(wxCommandEvent& Event);
00193:
00194: virtual void handleWatchedControlChange(wxCommandEvent& Event);
00195:
00196: private:
00197:
00198: wxMultiLineText m_DescriptionMultiLineText;
00199: wxNotebook * m_Notebook;
00200:
00201: wxTextCtrl * m_IntegerTextCtrl;
00202: wxTextCtrl * m_DoubleTextCtrl;
00203: wxTextCtrl * m_AnotherDoubleTextCtrl;
00204: wxTextCtrl * m_GroupTestDoubleTextCtrl;
00205: wxTextCtrl * m_DateTimeTextCtrl;
00206: wxTextCtrl * m_StringTextCtrl;
00207: wxComboBox * m_AnotherStringComboBox;
00208: wxTextCtrl * m_SomeFilenameTextCtrl;
00209:
00210: int m_Integer;
00211: double m_Double;
00212: double m_AnotherDouble;
00213: double m_GroupTestDouble;
00214: wxDateTime m_DateTime;
00215: wxString m_String;
00216: wxString m_AnotherString;
00217: wxString m_SomeFilenameString;
00218:
00219: DECLARE_EVENT_TABLE()
00220: };
00221:
00222: //-------------------------------------------------------------------------
00223:
00224: class wxFormatMessageTestExtDialog: public wxExtDialog
00225: {
00226: public:
00227: wxFormatMessageTestExtDialog (wxWindow * ParentWindow);
00228:
00229: virtual void OnOK(wxCommandEvent& Event);
00230: virtual void OnEvaluate14(wxCommandEvent& Event);
00231: virtual void OnCancel(wxCommandEvent& Event);
00232:
00233: private:
00234:
00235: wxMultiLineText m_DescriptionMultiLineText;
00236:
00237: wxTextCtrl * m_Parameter1IntegerTextCtrl;
00238: wxTextCtrl * m_Parameter2StringTextCtrl;
00239: wxTextCtrl * m_Parameter3TextCtrl;
00240: wxTextCtrl * m_Parameter4TextCtrl;
00241:
00242: wxTextCtrl * m_FormatStringTextCtrl;
00243:
00244: int m_Parameter1Integer;
00245: wxString m_Parameter2String;
00246: int m_Parameter3Integer;
00247: int m_Parameter4Integer;
00248:
00249: wxString m_FormatString;
00250:
00251: DECLARE_EVENT_TABLE()
00252: };
00253:
00254: //-------------------------------------------------------------------------
00255:
00256: class wxExtLibTestConfigEntryManager : public wxConfigEntryManager
00257: {
00258: public:
00259: wxExtLibTestConfigEntryManager ();
00260: void init ();
00261:
00262: public:
00263: wxStringConfigEntry m_SomePathString;
00264: wxBooleanConfigEntry m_IsSomeValueEnabled;
00265: wxBooleanConfigEntry m_IsSomeOtherValueEnabled;
00266: wxIntegerConfigEntry m_Integer1;
00267: wxDoubleConfigEntry m_Double1;
00268:
00269: // it is possible to put wxConfigEntry objects in a sub-structure to
00270: // avoid very long variable identifiers or to re-use the same
00271: // identifier
00272: struct tag_Struct1
00273: {
00274: wxIntegerConfigEntry m_Integer1;
00275: wxIntegerConfigEntry m_Integer2;
00276: wxBooleanConfigEntry m_IsSomeValueEnabled;
00277: } m_Struct1;
00278:
00279: private:
00280: bool m_IsInitialized;
00281: };
00282:
00283: extern wxExtLibTestConfigEntryManager WxExtLibTestConfigEntryManager;
00284:
00285: //-------------------------------------------------------------------------
00286:
00287: class wxConfigEntryManagerTestExtDialog: public wxExtDialog
00288: {
00289: public:
00290: wxConfigEntryManagerTestExtDialog (wxWindow * ParentWindow);
00291:
00292: virtual void OnRead (wxCommandEvent& Event);
00293: virtual void OnWriteModified (wxCommandEvent& Event);
00294: virtual void OnSetToDefaults (wxCommandEvent& Event);
00295: virtual void OnCancel (wxCommandEvent& Event);
00296:
00297: void setValuesToDialog();
00298: void setValuesToConfig();
00299:
00300: private:
00301: wxMultiLineText m_DescriptionMultiLineText;
00302:
00303: wxTextCtrl * m_SomePathStringTextCtrl;
00304: wxCheckBox * m_IsSomeValueEnabledCheckBox;
00305: wxCheckBox * m_IsSomeOtherValueEnabledCheckBox;
00306: wxTextCtrl * m_Integer1TextCtrl;
00307: wxTextCtrl * m_Double1TextCtrl;
00308: wxTextCtrl * m_Struct1_Integer1TextCtrl;
00309: wxTextCtrl * m_Struct1_Integer2TextCtrl;
00310: wxCheckBox * m_Struct1_IsSomeValueEnabledCheckBox;
00311:
00312: wxString m_SomePathString;
00313: bool m_IsSomeValueEnabled;
00314: bool m_IsSomeOtherValueEnabled;
00315: int m_Integer1;
00316: double m_Double1;
00317: int m_Struct1_Integer1;
00318: int m_Struct1_Integer2;
00319: bool m_Struct1_IsSomeValueEnabled;
00320:
00321: DECLARE_EVENT_TABLE()
00322: };
00323:
00324: //-------------------------------------------------------------------------
00325:
00326: class wxTextCtrlSliderPairTestExtDialog: public wxExtDialog
00327: {
00328: public:
00329: wxTextCtrlSliderPairTestExtDialog (wxWindow * ParentWindow);
00330:
00331: virtual void OnOK(wxCommandEvent& Event);
00332: virtual void OnCancel(wxCommandEvent& Event);
00333:
00334: private:
00335:
00336: wxMultiLineText m_DescriptionMultiLineText;
00337:
00338: wxTextCtrl * m_RedModificationTextCtrl;
00339: wxSlider * m_RedModificationSliderCtrl;
00340: wxTextCtrl * m_GreenModificationTextCtrl;
00341: wxSlider * m_GreenModificationSliderCtrl;
00342: wxTextCtrl * m_BlueModificationTextCtrl;
00343: wxSlider * m_BlueModificationSliderCtrl;
00344:
00345: long m_RedModificationLong;
00346: long m_GreenModificationLong;
00347: long m_BlueModificationLong;
00348:
00349: DECLARE_EVENT_TABLE()
00350: };
00351:
00352: //-------------------------------------------------------------------------
00353:
00354: class wxDialogZoomTestExtDialog: public wxExtDialog
00355: {
00356: public:
00357: wxDialogZoomTestExtDialog (wxWindow * ParentWindow);
00358:
00359: virtual void OnOK (wxCommandEvent& Event);
00360:
00361: private:
00362: wxMultiLineText m_DescriptionMultiLineText;
00363:
00364: double m_DialogZoom;
00365:
00366: wxTextCtrl * m_DialogZoomTextCtrl;
00367: wxTextCtrl * m_BorderCompressionTextCtrl;
00368:
00369: DECLARE_EVENT_TABLE()
00370: };
00371:
00372: //=========================================================================
00373:
00374: // IDs for the controls and the menu commands
00375: enum
00376: {
00377: // menu items
00378: ID_Quit = 1,
00379:
00380: // special id for about menu entry:
00381: ID_About = wxID_ABOUT,
00382:
00383: ID_MessageExtDialogTest = 33000,
00384: ID_StatusValidatorTestDialog,
00385: ID_FormatMessageTestDialog,
00386: ID_ConfigEntryManagerTestDialog,
00387: ID_TextCtrlSliderPairTestDialog,
00388: ID_DialogZoomTestDialog,
00389:
00390: ID_NonModalDialog1,
00391: ID_NonModalDialog2,
00392: ID_NonModalDialog3,
00393:
00394: ID_Help
00395: };
00396:
00397: //-------------------------------------------------------------------------
00398:
00399: wxWindow * WxExtLibTestNonModalDialogManag::createWindow (long CommandIdent)
00400: {
00401: wxWindow * Window = NULL;
00402: if (CommandIdent == ID_NonModalDialog1)
00403: {
00404: Window = new wxStatusValidatorTestExtDialog (getParentWindow());
00405: }
00406: else if (CommandIdent == ID_NonModalDialog2)
00407: {
00408: Window = new wxStatusValidatorTestExtDialog (getParentWindow());
00409: }
00410: else if (CommandIdent == ID_NonModalDialog3)
00411: {
00412: Window = new wxStatusValidatorTestExtDialog (getParentWindow());
00413: }
00414: else
00415: {
00416: wxASSERT_MSG (false, "createWindow(): unhandled CommandIdent");
00417: return NULL;
00418: }
00419:
00420: #if (M_WxExtLib_IsUseAppRootFrame == 1)
00421: if (Window != NULL)
00422: {
00423: if (wxGetGlobalAppRootFrame() != NULL)
00424: wxGetGlobalAppRootFrame() -> connectTLWEventHandlers (Window);
00425: }
00426: #endif // M_WxExtLib_IsUseAppRootFrame
00427:
00428: return Window;
00429: }
00430:
00431: //----------------------------------------------------------------------------
00432: // wxStatusValidatorTestExtDialog
00433:
00434: BEGIN_EVENT_TABLE (wxStatusValidatorTestExtDialog, wxExtDialog)
00435: // EVT_MENU (wxID_HELP, wxStatusValidatorTestExtDialog::OnHelp)
00436: END_EVENT_TABLE()
00437:
00438: //-------------------------------------------------------------------------
00439:
00440: extern const char * StatusValidatorsDescriptionHtmlString;
00441:
00442: int WxExtLibTest_Integer = 42;
00443: double WxExtLibTest_Double = 8.12;
00444: double WxExtLibTest_AnotherDouble = 14.01;
00445: double WxExtLibTest_GroupTestDouble = 14902.01;
00446: wxDateTime WxExtLibTest_DateTime;
00447: wxString WxExtLibTest_String = "abcd";
00448: wxString WxExtLibTest_AnotherString = "ab 01";
00449: wxString WxExtLibTest_SomeFilenameString = "~/.profile";
00450:
00451: //-------------------------------------------------------------------------
00452:
00453: wxStatusValidatorTestExtDialog::wxStatusValidatorTestExtDialog (wxWindow * ParentWindow)
00454: : wxExtDialog (ParentWindow,
00455: -1,
00456: _("StatusValidators test dialog"),
00457: wxDefaultPosition,
00458: wxDefaultSize,
00459: wxCAPTION | wxRESIZE_BORDER)
00460: {
00461: setBorderCompression (BorderCompressionValue);
00462:
00463: //-------------------------------------------------------------------------
00464: // initialize values
00465: m_Integer = WxExtLibTest_Integer;
00466: m_Double = WxExtLibTest_Double;
00467: m_AnotherDouble = WxExtLibTest_AnotherDouble;
00468: m_GroupTestDouble = WxExtLibTest_GroupTestDouble;
00469: m_DateTime = WxExtLibTest_DateTime;
00470: m_String = WxExtLibTest_String;
00471: m_AnotherString = WxExtLibTest_AnotherString;
00472: m_SomeFilenameString = WxExtLibTest_SomeFilenameString;
00473:
00474: //-------------------------------------------------------------------------
00475: m_StatusMessageTarget = new wxStatusMessageTarget (createErrorMessageCtrl (& m_ErrorMessageMultiLineText), "");
00476: m_StatusMessageTarget -> enableShowMessageBox (FALSE);
00477:
00478: //-------------------------------------------------------------------------
00479: wxBoxSizer *PanelSizer = new wxBoxSizer (wxVERTICAL);
00480: wxSizerAdder PanelSizerAdder (PanelSizer);
00481:
00482: //-------------------------------------------------------------------------
00483: // use new wxWindowAdder class:
00484:
00485: wxWindowAdder WA;
00486: WA.setDialog (this);
00487:
00488: this -> SetExtraStyle (this -> GetExtraStyle()
00489: | wxWS_EX_VALIDATE_RECURSIVELY);
00490:
00491: WA.pushSizer (/* new wxBoxSizer (wxVERTICAL) */ PanelSizer);
00492:
00493: #if (M_WxExtLibTest_IsNotebookPanelTest == 1)
00494:
00495: // automatic sizing for notebook pages doesn't seem to work
00496: // well (for whatever reason)
00497:
00498: wxColourBarWindow * ColourBarWindow2 = new wxColourBarWindow (WA.getAddParentWindow(), -1, wxColour (255, 192, 255),
00499: wxDefaultPosition, /* wxSize (500, 120) */ wxDefaultSize,
00500: wxTAB_TRAVERSAL | wxNO_BORDER);
00501: WA.pushOverlay (ColourBarWindow2, wxOverlayAdder::IsAddOnPop);
00502:
00503: #endif
00504:
00505: // WA.accessDefaults().setLabelFontColour (*wxRED);
00506:
00507: #if (M_WxExtLibTest_IsNotebookPanelTest == 1)
00508:
00509: {
00510:
00511: long NotebookFlags = wxNB_TOP | wxNB_MULTILINE;
00512:
00513: // wxNotebook::DoGetBestSize was implemented from wx-version >= 2.5.0
00514: // so need to manually set size when using older wx-versions than 2.5.0
00515: // for wxNotebook
00516: m_Notebook = new wxNotebook (WA.getAddParentWindow(), wxID_AUTO,
00517: wxDefaultPosition, /*wxDefaultSize*/ wxSize (100, 400),
00518: NotebookFlags);
00519: WA.addWindow (m_Notebook);
00520:
00521: // use wxColourBarWindow instead of default wxPanel or wxWindow
00522: wxColourBarWindow * ColourBarWindow2 = new wxColourBarWindow (m_Notebook, -1, wxColour (192, 192, 255),
00523: wxDefaultPosition, /* wxSize (500, 120) */ wxDefaultSize,
00524: wxTAB_TRAVERSAL | wxNO_BORDER);
00525: wxWindow * NotebookPagePanel = ColourBarWindow2;
00526:
00527: m_Notebook -> AddPage (NotebookPagePanel, _("nb-page1"));
00528:
00529: WA.pushOverlay (NotebookPagePanel, wxOverlayAdder::ZeroModeBits);
00530:
00531: createValidatorTestControls (WA);
00532:
00533: WA.popSizer();
00534:
00535: WA.popOverlay();
00536:
00537: //-------------------------------------------------------------------------
00538: wxColourBarWindow * ColourBarWindow3 = new wxColourBarWindow (m_Notebook, -1, wxColour (255, 255, 192),
00539: wxDefaultPosition, /* wxSize (500, 120) */ wxDefaultSize,
00540: wxTAB_TRAVERSAL | wxNO_BORDER);
00541: NotebookPagePanel = ColourBarWindow3;
00542: m_Notebook -> AddPage (NotebookPagePanel, _("nb-page2"));
00543:
00544: WA.pushOverlay (NotebookPagePanel, wxOverlayAdder::ZeroModeBits);
00545: {
00546: {
00547: WA.addLabel (NULL, _("2nd page contents"));
00548: WA.next();
00549: }
00550:
00551: {
00552: #if (M_WxExtLib_IsUseGraphicsHelper == 1)
00553: // WARN hardcoded relative path
00554: wxImage Image ("../../image/ice-gradient-01.png");
00555: wxScaledImageWindow * ScaledImageWindow
00556: = new wxScaledImageWindow (WA.getAddParentWindow(), -1, Image,
00557: wxDefaultPosition, wxSize (50, 400) /* wxDefaultSize */,
00558: wxTAB_TRAVERSAL | wxNO_BORDER);
00559:
00560: // WA.pushOverlay (ScaledImageWindow, wxOverlayAdder::IsAddOnPop);
00561: WA.addWindow (ScaledImageWindow);
00562: #else
00563: wxColourBarWindow * ColourBarWindow4
00564: = new wxColourBarWindow (m_Notebook, -1, wxColour (255, 255, 192),
00565: wxDefaultPosition, /* wxSize (500, 120) */ wxDefaultSize,
00566: wxTAB_TRAVERSAL | wxNO_BORDER);
00567: WA.addWindow (ColourBarWindow4);
00568: #endif
00569: }
00570: }
00571: WA.popOverlay();
00572:
00573: }
00574:
00575: #else
00576:
00577: createValidatorTestControls (WA);
00578:
00579: #endif
00580:
00581: {
00582: WA.addSpace (_B(10), _B(10));
00583: WA.addAndPushFlexGridSizer (4);
00584: {
00585: WA.addButton (_("&OK"),
00586: NULL, wxID_OK,
00587: (wxCommandEventFunction) (& wxStatusValidatorTestExtDialog::OnOK));
00588: WA.setDefaultButton ();
00589:
00590: WA.addButton (_("Cancel"),
00591: NULL, wxID_CANCEL,
00592: (wxCommandEventFunction) (& wxStatusValidatorTestExtDialog::OnCancel));
00593: }
00594: WA.popSizer();
00595: WA.addSpace (_B(10), _B(10));
00596: }
00597:
00598: #if (M_WxExtLibTest_IsNotebookPanelTest == 1)
00599: WA.popOverlay();
00600: #endif
00601:
00602: WA.popSizer();
00603:
00604: //-------------------------------------------------------------------------
00605: PanelSizer -> Add (m_ErrorMessageMultiLineText.getWindow(),
00606: 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxEXPAND, _B(5));
00607:
00608: SetSizerAndFit (PanelSizer);
00609: Layout();
00610: Fit ();
00611:
00612: initializeDialog ();
00613: enableWatchedControlChangeNotification (true);
00614: }
00615:
00616: void wxStatusValidatorTestExtDialog::createValidatorTestControls (wxWindowAdder & WA)
00617: {
00618: WA.setSize (getAdjustedTextCtrlWidth (400),
00619: getAdjustedTextCtrlHeight (1, true));
00620: WA.addMultiLineText (& m_DescriptionMultiLineText,
00621: 0,
00622: wxMultiLineText::wxHTML_MODE,
00623: StatusValidatorsDescriptionHtmlString,
00624: 4, 8,
00625: _B(10));
00626: m_DescriptionMultiLineText.getWindow() -> SetBackgroundColour (wxColour (224, 224, 192));
00627:
00628: wxSize StringTextCtrlSize (getAdjustedTextCtrlWidth (150),
00629: getAdjustedTextCtrlHeight (1, true));
00630:
00631: WA.addAndPushFlexGridSizer (1, true);
00632: {
00633: wxColourBarWindow * ColourBarWindow2 = new wxColourBarWindow (WA.getAddParentWindow(), -1, wxColour (192, 255, 192),
00634: wxDefaultPosition, /* wxSize (500, 120) */ wxDefaultSize,
00635: wxTAB_TRAVERSAL | wxNO_BORDER);
00636: ColourBarWindow2 -> setRoundedCornerRadius (5.);
00637: ColourBarWindow2 -> setPen (wxPen (wxColour (128, 128, 128), 1, wxSOLID));
00638: WA.pushOverlay (ColourBarWindow2, wxOverlayAdder::IsAddOnPop);
00639: WA.addAndPushFlexGridSizer (1, true);
00640:
00641: WA.addAndPushFlexGridSizer (2);
00642: {
00643: {
00644: WA.setLabel (_("Some &integer number"));
00645: WA.setSize (StringTextCtrlSize);
00646: WA.addTextCtrl (& m_IntegerTextCtrl, 0);
00647: WA.setValidator (wxNumberValidator (& m_Integer, 10, 99,
00648: m_StatusMessageTarget,
00649: WA.getFullName()));
00650: }
00651: {
00652: WA.setLabel (_("Some &double number"));
00653: WA.setSize (StringTextCtrlSize);
00654: WA.addTextCtrl (& m_DoubleTextCtrl, 0);
00655: WA.setValidator (wxNumberValidator (& m_Double, 4.4, 55.2327,
00656: m_StatusMessageTarget,
00657: WA.getFullName(),
00658: wxNumberValidator::IsEmptyAllowed,
00659: "%.2f"));
00660: }
00661: {
00662: WA.setLabel (_("Another do&uble number"));
00663: WA.setSize (StringTextCtrlSize);
00664: WA.addTextCtrl (& m_AnotherDoubleTextCtrl, 0);
00665: WA.setValidator (wxNumberValidator (& m_AnotherDouble,
00666: 10., 20.,
00667: m_StatusMessageTarget, _("another double number"),
00668: wxNumberValidator::IsEmptyAllowed
00669: | wxNumberValidator::IsIgnoreMinimum
00670: /* | wxNumberValidator::IsIgnoreMaximum */,
00671: "%.3f"));
00672: }
00673: #if 0
00674: {
00675: WA.setLabel (_("Grouping test double"));
00676: WA.setSize (StringTextCtrlSize);
00677: WA.addTextCtrl (& m_GroupTestDoubleTextCtrl, 0);
00678: WA.setValidator (wxNumberValidator (& m_GroupTestDouble, -1E100, 1E100,
00679: m_StatusMessageTarget,
00680: WA.getFullName(),
00681: wxNumberValidator::IsEmptyAllowed,
00682: "%f"));
00683: WA.watchControl();
00684: }
00685: #endif
00686: }
00687: WA.popSizer();
00688:
00689: // TEST overlay a few controls onto a wxColourBarWindow
00690: wxColourBarWindow * ColourBarWindow = new wxColourBarWindow (WA.getAddParentWindow(), -1, wxColour (255, 192, 192),
00691: wxDefaultPosition, /* wxSize (500, 120) */ wxDefaultSize,
00692: wxTAB_TRAVERSAL | wxNO_BORDER);
00693: ColourBarWindow -> setRoundedCornerRadius (5.);
00694: ColourBarWindow -> setPen (wxPen (wxColour (128, 128, 128), 1, wxSOLID));
00695:
00696: WA.pushOverlay (ColourBarWindow, wxOverlayAdder::IsAddOnPop);
00697:
00698: // WA.addAndPushSizer (new wxBoxSizer(wxVERTICAL), wxEXPAND, _B(10));
00699: WA.accessDefaults().setSizerBorder (_B(6));
00700: WA.addAndPushFlexGridSizer (1, true, true);
00701: // // WA.addSpace (_B(10), _B(10));
00702:
00703: {
00704: WA.addHeadline (_("headline for group"));
00705: WA.next();
00706: }
00707:
00708: WA.addAndPushFlexGridSizer (2);
00709: {
00710: WA.pushDefaults();
00711: WA.accessDefaults().setLabelFontColour (wxColour (32, 32, 128));
00712: WA.accessDefaults().setLabelBackgroundColour (*wxWHITE);
00713:
00714: {
00715: WA.setLabel (_("Some d&ate"));
00716: WA.setSize (getAdjustedTextCtrlWidth (240),
00717: getAdjustedTextCtrlHeight (1, true));
00718: WA.addTextCtrl (& m_DateTimeTextCtrl, 0);
00719: WA.setValidator (wxDateTimeValidator (& m_DateTime,
00720: m_StatusMessageTarget, _("some date"),
00721: 0));
00722: }
00723: {
00724: WA.setLabel (_("Some &text"));
00725: WA.setSize (StringTextCtrlSize);
00726: WA.addTextCtrl (& m_StringTextCtrl, 0);
00727: WA.setValidator (wxStringValidator (& m_String,
00728: m_StatusMessageTarget, _("some text"),
00729: 4,
00730: 0 /*wxStringValidator::IsEmptyAllowed*/));
00731: }
00732: WA.popDefaults();
00733:
00734: // WA.skipCell();
00735: WA.setLabel (_("some text"));
00736: WA.addAndPushFlexGridSizer (2, false, false);
00737: {
00738: // TEST: use string validator based on wxBasictypeValidatorTrait_wxString
00739:
00740: wxString ComboStringArray[3] = { "red", "magenta", "cyan" };
00741: WA.setLabel (_("Some other te&xt"));
00742: WA.setSize (getAdjustedComboBoxWidth (180), -1);
00743: WA.addComboBox (& m_AnotherStringComboBox,
00744: 3, ComboStringArray);
00745: WA.setValidator (wxTraitedStringValidator (& m_AnotherString,
00746: m_StatusMessageTarget,
00747: wxString (_("some other text")),
00748: 5 /* MaxStringLength */,
00749: 0 /* wxTraitedStringValidator::IsEmptyAllowed */
00750: | wxTraitedStringValidator::IsIgnoreMinimum
00751: | wxTraitedStringValidator::IsIgnoreMaximum,
00752: wxString(wxEmptyString)));
00753: }
00754: {
00755: WA.setLabel (_("Some &filename"));
00756: WA.setSize (StringTextCtrlSize);
00757: WA.addTextCtrl (& m_SomeFilenameTextCtrl, 0);
00758: WA.setValidator (wxFilenameValidator (& m_SomeFilenameString,
00759: m_StatusMessageTarget,
00760: WA.getFullName(),
00761: 0,
00762: wxFilenameValidatorTrait::IsErrorIfInvalid
00763: | wxFilenameValidatorTrait::IsErrorIfNotFile
00764: | wxFilenameValidatorTrait::IsNormalize,
00765: wxString("/bin"),
00766: wxPATH_NORM_ENV_VARS | wxPATH_NORM_DOTS
00767: /*| wxPATH_NORM_ABSOLUTE */ | wxPATH_NORM_TILDE));
00768: }
00769: WA.popSizer();
00770: }
00771: WA.popSizer();
00772: WA.popSizer();
00773:
00774: WA.popOverlay ();
00775:
00776: WA.popSizer();
00777: WA.popOverlay();
00778: }
00779: }
00780:
00781: void wxStatusValidatorTestExtDialog::OnOK(wxCommandEvent & WXUNUSED(Event))
00782: {
00783: if (ValidateWithMessageBox (wxID_OK))
00784: {
00785: WxExtLibTest_Integer = m_Integer;
00786: WxExtLibTest_Double = m_Double;
00787: WxExtLibTest_AnotherDouble = m_AnotherDouble;
00788: WxExtLibTest_DateTime = m_DateTime;
00789: WxExtLibTest_String = m_String;
00790: WxExtLibTest_AnotherString = m_AnotherString;
00791: WxExtLibTest_SomeFilenameString = m_SomeFilenameString;
00792: }
00793: }
00794:
00795: void wxStatusValidatorTestExtDialog::OnCancel(wxCommandEvent& WXUNUSED (Event))
00796: {
00797: // wxExtDialog::OnCancel (Event);
00798: EndDialog (wxID_CANCEL);
00799: }
00800:
00801: void wxStatusValidatorTestExtDialog::handleWatchedControlChange(wxCommandEvent& Event)
00802: {
00803: if (Event.GetEventObject() == m_GroupTestDoubleTextCtrl)
00804: {
00805: // TEST
00806: #if 0
00807: testNumberFormat();
00808:
00809: transferDataFromControl (m_GroupTestDoubleTextCtrl);
00810:
00811: wxNumberFormatOptions NumberFormatOptions (2, '.', ';');
00812: wxString String;
00813: formatDouble ("%.f", NumberFormatOptions, m_GroupTestDouble, String);
00814:
00815: m_StatusMessageTarget -> setMessage (String, false);
00816: m_StatusMessageTarget -> display (this);
00817: #endif
00818: }
00819: }
00820:
00821: //=========================================================================
00822: // wxFormatMessageTestExtDialog
00823:
00824: BEGIN_EVENT_TABLE (wxFormatMessageTestExtDialog, wxExtDialog)
00825: // EVT_MENU (wxID_HELP, wxFormatMessageTestExtDialog::OnHelp)
00826: END_EVENT_TABLE()
00827:
00828: //-------------------------------------------------------------------------
00829:
00830: extern const char * FormatMessageDescriptionHtmlString;
00831:
00832: wxFormatMessageTestExtDialog::wxFormatMessageTestExtDialog (wxWindow * ParentWindow)
00833: : wxExtDialog (ParentWindow,
00834: -1,
00835: _("wxFormatMessage test dialog"),
00836: wxDefaultPosition,
00837: wxDefaultSize)
00838: {
00839: setBorderCompression (BorderCompressionValue);
00840:
00841: //-------------------------------------------------------------------------
00842: m_Parameter1Integer = 42;
00843: m_Parameter2String = "./some-file.dat";
00844: m_Parameter3Integer = 2756;
00845: m_Parameter4Integer = 4096;
00846:
00847: m_FormatString = _T(
00848: "While reading from file \"%{2}\", an error happened (error "
00849: "code \"%1\") - (%3 of %+ Byte read successfully before error \"%1\" "
00850: "was encountered.\n\nAll 14 arguments: %1\n%+\n%+\n%+\n%+\n%+\n%+\n%+\n%+\n%+\n%+\n%+\n%+\n%+");
00851:
00852: //-------------------------------------------------------------------------
00853: m_StatusMessageTarget = new wxStatusMessageTarget (createErrorMessageCtrl (& m_ErrorMessageMultiLineText), "");
00854: m_StatusMessageTarget -> enableShowMessageBox (FALSE);
00855:
00856: //-------------------------------------------------------------------------
00857:
00858: wxBoxSizer *PanelSizer = new wxBoxSizer (wxVERTICAL);
00859: wxSizerAdder PanelSizerAdder (PanelSizer);
00860:
00861: wxFlexGridSizer * FlexGridSizer = NULL;
00862:
00863: //-------------------------------------------------------------------------
00864: wxSize DescriptionCtrlSize (getAdjustedTextCtrlWidth (400),
00865: getAdjustedTextCtrlHeight (1, true));
00866: addMultiLineText (& m_DescriptionMultiLineText,
00867: 0,
00868: DescriptionCtrlSize,
00869: wxMultiLineText::wxHTML_MODE,
00870: & PanelSizerAdder,
00871: FormatMessageDescriptionHtmlString,
00872: 4, 8, _B(10));
00873: m_DescriptionMultiLineText.getWindow() -> SetBackgroundColour (wxColour (224, 224, 192));
00874:
00875: //-------------------------------------------------------------------------
00876: addFlexGridSizer (& FlexGridSizer, 3, _B(5), _B(5),
00877: PanelSizer, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, _B(14));
00878: wxSizerAdder FlexGridSizerAdder (FlexGridSizer);
00879:
00880: addTextCtrlWithTwoLabels (& m_Parameter1IntegerTextCtrl, _("Parameter &1"), _("(int)"),
00881: wxNumberValidator (& m_Parameter1Integer,
00882: 10, 99,
00883: m_StatusMessageTarget, _("parameter 1")),
00884: 0,
00885: wxDefaultSize,
00886: & FlexGridSizerAdder);
00887:
00888: wxSize StringTextCtrlSize (getAdjustedTextCtrlWidth (100),
00889: getAdjustedTextCtrlHeight (1, true));
00890: addTextCtrlWithTwoLabels (& m_Parameter2StringTextCtrl, _("Parameter &2"), _("(path string)"),
00891: wxStringValidator (& m_Parameter2String,
00892: m_StatusMessageTarget, _("parameter 2"),
00893: 80,
00894: wxStringValidator::IsEmptyAllowed),
00895: 0,
00896: StringTextCtrlSize,
00897: & FlexGridSizerAdder);
00898: addTextCtrlWithTwoLabels (& m_Parameter3TextCtrl, _("Parameter &3"), _("(int)"),
00899: wxNumberValidator (& m_Parameter3Integer,
00900: 0, 1048576,
00901: m_StatusMessageTarget, _("parameter 3")),
00902: 0,
00903: wxDefaultSize,
00904: & FlexGridSizerAdder);
00905: addTextCtrlWithTwoLabels (& m_Parameter4TextCtrl, _("Parameter &4"), _("(int)"),
00906: wxNumberValidator (& m_Parameter4Integer,
00907: 0, 1048576,
00908: m_StatusMessageTarget, _("parameter 4")),
00909: 0,
00910: wxDefaultSize,
00911: & FlexGridSizerAdder);
00912:
00913:
00914: //-------------------------------------------------------------------------
00915: PanelSizer -> Add (new wxStaticLine (this, -1), 0,
00916: wxLEFT|wxRIGHT|wxTOP|wxEXPAND, _B(14));
00917:
00918: addFlexGridSizer (& FlexGridSizer, 3, _B(5), _B(5),
00919: PanelSizer, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, _B(14));
00920: wxSizerAdder FlexGridSizerAdder2 (FlexGridSizer);
00921:
00922: wxSize FormatStringTextCtrlSize (getAdjustedTextCtrlWidth (300),
00923: getAdjustedTextCtrlHeight (5, true));
00924: addTextCtrlWithTwoLabels (& m_Parameter2StringTextCtrl, _("&Format string"), "",
00925: wxStringValidator (& m_FormatString,
00926: m_StatusMessageTarget, _("format string"),
00927: -1,
00928: wxStringValidator::IsEmptyAllowed),
00929: wxTE_MULTILINE,
00930: FormatStringTextCtrlSize,
00931: & FlexGridSizerAdder2);
00932:
00933: //-------------------------------------------------------------------------
00934: addFlexGridSizer (& FlexGridSizer, 4, _B(0), _B(10),
00935: PanelSizer, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxEXPAND, _B(14));
00936: wxSizerAdder FlexGridSizerAdder3 (FlexGridSizer);
00937:
00938: wxButton * Button;
00939: addButton (& Button, wxID_OK, (wxCommandEventFunction) (& wxFormatMessageTestExtDialog::OnOK),
00940: _("&Evaluate"), & FlexGridSizerAdder3);
00941: Button->SetDefault();
00942: addButton (& Button, -1, (wxCommandEventFunction) (& wxFormatMessageTestExtDialog::OnEvaluate14),
00943: _("&Eval. w/14 args"), & FlexGridSizerAdder3);
00944: addButton (NULL, wxID_CANCEL, (wxCommandEventFunction) (& wxFormatMessageTestExtDialog::OnCancel),
00945: _("Cancel"), & FlexGridSizerAdder3);
00946:
00947: //-------------------------------------------------------------------------
00948: PanelSizer->Add (m_ErrorMessageMultiLineText.getWindow(),
00949: 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxEXPAND, _B(5));
00950:
00951: SetSizerAndFit (PanelSizer);
00952:
00953: initializeDialog ();
00954: enableWatchedControlChangeNotification (true);
00955: }
00956:
00957: void wxFormatMessageTestExtDialog::OnEvaluate14(wxCommandEvent & WXUNUSED(Event))
00958: {
00959: if (ValidateWithMessageBox ()) // use e.g. wxID_OK to close the dialog
00960: {
00961: wxString ResultString = "The result of the evaluated string:\n\n";
00962:
00963: wxMessageFormatter MessageFormatter (m_FormatString);
00964: // set up lot's of parameters to be able to test %{N} syntax
00965: // here, operator% is used to add parameters, and appendTo()
00966: // will implicitly call format()
00967: MessageFormatter
00968: % m_Parameter1Integer
00969: % m_Parameter2String
00970: % m_Parameter3Integer
00971: % m_Parameter4Integer
00972: % "ain't"
00973: % "it"
00974: % "nice?"
00975: % 111
00976: % 222
00977: % 333
00978: % 444.4
00979: % wxFormat ("%.2f", 555.5)
00980: % 666
00981: % 777;
00982: MessageFormatter.appendTo (ResultString);
00983: MessageExtDialog (ResultString,
00984: wxMessageExtDialog::InformationStyle);
00985: }
00986: }
00987:
00988: void wxFormatMessageTestExtDialog::OnOK(wxCommandEvent & WXUNUSED(Event))
00989: {
00990: if (ValidateWithMessageBox ())
00991: {
00992: wxString ResultString = "The result of the evaluated string:\n\n";
00993:
00994: // use wxFormatMessage which is overloaded for (currently) up
00995: // to five parameters
00996: ResultString
00997: += wxFormatMessage (m_FormatString,
00998: m_Parameter1Integer,
00999: m_Parameter2String,
01000: m_Parameter3Integer,
01001: m_Parameter4Integer);
01002:
01003: MessageExtDialog (ResultString,
01004: wxMessageExtDialog::InformationStyle);
01005: }
01006: }
01007:
01008: void wxFormatMessageTestExtDialog::OnCancel(wxCommandEvent & Event)
01009: {
01010: wxExtDialog::OnCancel (Event);
01011: }
01012:
01013: //=========================================================================
01014:
01015:
01016: wxExtLibTestConfigEntryManager WxExtLibTestConfigEntryManager;
01017:
01018: wxExtLibTestConfigEntryManager::wxExtLibTestConfigEntryManager()
01019: {
01020: m_IsInitialized = FALSE;
01021: }
01022:
01023: #define M_AddConfigEntry(Variable,ParameterList) \
01024: { \
01025: Variable.init ParameterList; \
01026: addConfigEntry (& Variable); \
01027: } \
01028:
01029: void wxExtLibTestConfigEntryManager::init ()
01030: {
01031: if (! m_IsInitialized)
01032: {
01033: // wxIniConfig * Config = new wxIniConfig("WxExtLibTest", "WxExtLibTest", ConfigFilenameString);
01034: wxFileConfig * Config
01035: = new wxFileConfig ("WxExtLibTest", "WxExtLibTest",
01036: ConfigFilenameString, "",
01037: wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH);
01038:
01039: wxConfigBase::Set (Config); // ::Set() not really necessary
01040: setAssociatedConfig (Config);
01041:
01042: //-------------------------------------------------------------------------
01043: // setup of mapping of config entry objects to keys in the wxConfig is done
01044: // here, centralized. Default values and other restrictions (e.g. minmum and
01045: // maxium of valid integers) are centralized here too.
01046:
01047: #if defined(__WXMSW__)
01048: const char * DefaultSomePath = "C:\\WxExtLibTest\\SomePath";
01049: #else
01050: const char * DefaultSomePath = "/WxExtLibTest/SomePath";
01051: #endif
01052: M_AddConfigEntry (m_SomePathString,
01053: ("/General/SomePath", DefaultSomePath));
01054: M_AddConfigEntry (m_IsSomeValueEnabled,
01055: ("/Setup/IsSomeValueEnabled", true));
01056: M_AddConfigEntry (m_IsSomeOtherValueEnabled,
01057: ("/Setup/IsSomeOtherValueEnabled", FALSE));
01058: M_AddConfigEntry (m_Integer1,
01059: ("/Mape/Integer1", 1, 9, 3));
01060: M_AddConfigEntry (m_Double1,
01061: ("/Mape/Double1", 0., 1., 0.5));
01062:
01063: // the sub-structure:
01064: M_AddConfigEntry (m_Struct1.m_Integer1,
01065: ("/Mape/Integer1", 10, 99, 30));
01066: M_AddConfigEntry (m_Struct1.m_Integer2,
01067: ("/Mape/Integer2", 20, 77, 40));
01068: M_AddConfigEntry (m_Struct1.m_IsSomeValueEnabled,
01069: ("/ADifferentKey/SomeKey", FALSE));
01070:
01071: m_IsInitialized = true;
01072: }
01073: }
01074:
01075: // being gentlemen :)
01076: #undef M_AddConfigEntry
01077:
01078:
01079: //=========================================================================
01080: // wxConfigEntryManagerTestExtDialog
01081:
01082: BEGIN_EVENT_TABLE (wxConfigEntryManagerTestExtDialog, wxExtDialog)
01083: // EVT_MENU (wxID_HELP, wxConfigEntryManagerTestExtDialog::OnHelp)
01084: END_EVENT_TABLE()
01085:
01086: //-------------------------------------------------------------------------
01087:
01088: extern const char * ConfigEntryManagerDescriptionHtmlString;
01089:
01090: wxConfigEntryManagerTestExtDialog::wxConfigEntryManagerTestExtDialog (wxWindow * ParentWindow)
01091: : wxExtDialog (ParentWindow,
01092: -1,
01093: _("wxConfigEntryManager test dialog"),
01094: wxDefaultPosition,
01095: wxDefaultSize)
01096: {
01097: setBorderCompression (BorderCompressionValue);
01098:
01099: //-------------------------------------------------------------------------
01100:
01101: // set up config entry objects
01102: WxExtLibTestConfigEntryManager.init ();
01103:
01104: // obtain values (usually from wxConfig)
01105: // easy and typesafe:
01106: setValuesToDialog ();
01107:
01108: //-------------------------------------------------------------------------
01109: m_StatusMessageTarget = new wxStatusMessageTarget (createErrorMessageCtrl (& m_ErrorMessageMultiLineText), "");
01110: m_StatusMessageTarget -> enableShowMessageBox (FALSE);
01111:
01112: //-------------------------------------------------------------------------
01113:
01114: wxBoxSizer *PanelSizer = new wxBoxSizer (wxVERTICAL);
01115: wxSizerAdder PanelSizerAdder (PanelSizer);
01116:
01117: wxFlexGridSizer * FlexGridSizer = NULL;
01118:
01119: //-------------------------------------------------------------------------
01120: wxSize DescriptionCtrlSize (getAdjustedTextCtrlWidth (400),
01121: getAdjustedTextCtrlHeight (1, true));
01122: wxString DescriptionString;
01123: DescriptionString += "used config path: \""
01124: + convertAsciiToHtml(ConfigFilenameString) + "\"<br><br>";
01125: DescriptionString += ConfigEntryManagerDescriptionHtmlString;
01126: addMultiLineText (& m_DescriptionMultiLineText,
01127: 0,
01128: DescriptionCtrlSize,
01129: wxMultiLineText::wxHTML_MODE,
01130: & PanelSizerAdder,
01131: DescriptionString,
01132: 4, 8, _B(10));
01133: m_DescriptionMultiLineText.getHtmlWindow() -> SetBorders (5);
01134: m_DescriptionMultiLineText.getWindow() -> SetBackgroundColour (wxColour (224, 224, 192));
01135:
01136: //-------------------------------------------------------------------------
01137: addFlexGridSizer (& FlexGridSizer, 2, _B(5), _B(5),
01138: PanelSizer, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, _B(14));
01139: wxSizerAdder FlexGridSizerAdder (FlexGridSizer);
01140:
01141: wxSize StringTextCtrlSize (getAdjustedTextCtrlWidth (150),
01142: getAdjustedTextCtrlHeight (1, true));
01143: addTextCtrlWithLabel (& m_SomePathStringTextCtrl, _("some &path string"),
01144: wxStringValidator (& m_SomePathString,
01145: m_StatusMessageTarget, _("some path string")),
01146: 0,
01147: StringTextCtrlSize,
01148: & FlexGridSizerAdder);
01149: addCheckBoxWithLabel (& m_IsSomeValueEnabledCheckBox, _("is some value enabled"),
01150: wxGenericValidator (& m_IsSomeValueEnabled),
01151: 0,
01152: & FlexGridSizerAdder);
01153: addCheckBoxWithLabel (& m_IsSomeOtherValueEnabledCheckBox, _("is some other value enabled"),
01154: wxGenericValidator (& m_IsSomeOtherValueEnabled),
01155: 0,
01156: & FlexGridSizerAdder);
01157: addTextCtrlWithLabel (& m_Integer1TextCtrl, _("Integer &1"),
01158: wxNumberValidator (& m_Integer1,
01159: 1, 9,
01160: m_StatusMessageTarget, _("integer 1")),
01161: 0,
01162: wxDefaultSize,
01163: & FlexGridSizerAdder);
01164: addTextCtrlWithLabel (& m_Double1TextCtrl, _("Double &1"),
01165: wxNumberValidator (& m_Double1,
01166: 0., 1.,
01167: m_StatusMessageTarget, _("double 1")),
01168: 0,
01169: wxDefaultSize,
01170: & FlexGridSizerAdder);
01171: addTextCtrlWithLabel (& m_Struct1_Integer1TextCtrl, _("Struct1-Integer &1"),
01172: wxNumberValidator (& m_Struct1_Integer1,
01173: 10, 99,
01174: m_StatusMessageTarget, _("struct1-integer 1")),
01175: 0,
01176: wxDefaultSize,
01177: & FlexGridSizerAdder);
01178: addTextCtrlWithLabel (& m_Struct1_Integer1TextCtrl, _("Struct1-Integer &2"),
01179: wxNumberValidator (& m_Struct1_Integer2,
01180: 20, 77,
01181: m_StatusMessageTarget, _("struct2-integer 1")),
01182: 0,
01183: wxDefaultSize,
01184: & FlexGridSizerAdder);
01185: addCheckBoxWithLabel (& m_Struct1_IsSomeValueEnabledCheckBox, _("struct1-is some value enabled"),
01186: wxGenericValidator (& m_Struct1_IsSomeValueEnabled),
01187: 0,
01188: & FlexGridSizerAdder);
01189:
01190: //-------------------------------------------------------------------------
01191: addFlexGridSizer (& FlexGridSizer, 4, _B(0), _B(10),
01192: PanelSizer, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxEXPAND, _B(14));
01193: wxSizerAdder FlexGridSizerAdder2 (FlexGridSizer);
01194:
01195: wxButton * Button;
01196: addButton (& Button, -1, (wxCommandEventFunction) (& wxConfigEntryManagerTestExtDialog::OnRead),
01197: _("&Read"), & FlexGridSizerAdder2);
01198: addButton (& Button, -1, (wxCommandEventFunction) (& wxConfigEntryManagerTestExtDialog::OnWriteModified),
01199: _("&Write mod."), & FlexGridSizerAdder2);
01200: Button->SetDefault();
01201: addButton (& Button, -1, (wxCommandEventFunction) (& wxConfigEntryManagerTestExtDialog::OnSetToDefaults),
01202: _("&Set defaults"), & FlexGridSizerAdder2);
01203: addButton (NULL, wxID_CANCEL, (wxCommandEventFunction) (& wxConfigEntryManagerTestExtDialog::OnCancel),
01204: _("Close"), & FlexGridSizerAdder2);
01205:
01206: //-------------------------------------------------------------------------
01207: PanelSizer->Add (m_ErrorMessageMultiLineText.getWindow(),
01208: 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxEXPAND, _B(5));
01209:
01210: SetSizerAndFit (PanelSizer);
01211:
01212: initializeDialog ();
01213: enableWatchedControlChangeNotification (true);
01214: }
01215:
01216: //-------------------------------------------------------------------------
01217:
01218: void wxConfigEntryManagerTestExtDialog::setValuesToDialog()
01219: {
01220: WxExtLibTestConfigEntryManager.m_SomePathString.get (m_SomePathString);
01221: WxExtLibTestConfigEntryManager.m_IsSomeValueEnabled.get (m_IsSomeValueEnabled);
01222: WxExtLibTestConfigEntryManager.m_IsSomeOtherValueEnabled.get (m_IsSomeOtherValueEnabled);
01223: WxExtLibTestConfigEntryManager.m_Integer1.get (m_Integer1);
01224: WxExtLibTestConfigEntryManager.m_Double1.get (m_Double1);
01225: WxExtLibTestConfigEntryManager.m_Struct1.m_Integer1.get (m_Struct1_Integer1);
01226: WxExtLibTestConfigEntryManager.m_Struct1.m_Integer2.get (m_Struct1_Integer2);
01227: WxExtLibTestConfigEntryManager.m_Struct1.m_IsSomeValueEnabled.get (m_Struct1_IsSomeValueEnabled);
01228: }
01229:
01230: void wxConfigEntryManagerTestExtDialog::setValuesToConfig()
01231: {
01232: WxExtLibTestConfigEntryManager.m_SomePathString.set (m_SomePathString);
01233: WxExtLibTestConfigEntryManager.m_IsSomeValueEnabled.set (m_IsSomeValueEnabled);
01234: WxExtLibTestConfigEntryManager.m_IsSomeOtherValueEnabled.set (m_IsSomeOtherValueEnabled);
01235: WxExtLibTestConfigEntryManager.m_Integer1.set (m_Integer1);
01236: WxExtLibTestConfigEntryManager.m_Double1.set (m_Double1);
01237: WxExtLibTestConfigEntryManager.m_Struct1.m_Integer1.set (m_Struct1_Integer1);
01238: WxExtLibTestConfigEntryManager.m_Struct1.m_Integer2.set (m_Struct1_Integer2);
01239: WxExtLibTestConfigEntryManager.m_Struct1.m_IsSomeValueEnabled.set (m_Struct1_IsSomeValueEnabled);
01240: }
01241:
01242: //-------------------------------------------------------------------------
01243:
01244: void wxConfigEntryManagerTestExtDialog::OnRead(wxCommandEvent & WXUNUSED(Event))
01245: {
01246: WxExtLibTestConfigEntryManager.readAllConfigEntries ();
01247: setValuesToDialog ();
01248: TransferDataToWindow ();
01249: }
01250:
01251: void wxConfigEntryManagerTestExtDialog::OnWriteModified(wxCommandEvent & WXUNUSED(Event))
01252: {
01253: if (ValidateWithMessageBox (-1))
01254: {
01255: setValuesToConfig ();
01256: WxExtLibTestConfigEntryManager.writeAllConfigEntries ();
01257: }
01258: }
01259:
01260: void wxConfigEntryManagerTestExtDialog::OnSetToDefaults(wxCommandEvent & WXUNUSED(Event))
01261: {
01262: WxExtLibTestConfigEntryManager.setDefaultValues ();
01263: setValuesToDialog ();
01264: TransferDataToWindow ();
01265: }
01266:
01267: void wxConfigEntryManagerTestExtDialog::OnCancel(wxCommandEvent & Event)
01268: {
01269: wxExtDialog::OnCancel (Event);
01270: }
01271:
01272: //=========================================================================
01273: // wxTextCtrlSliderPairTestExtDialog
01274:
01275: BEGIN_EVENT_TABLE (wxTextCtrlSliderPairTestExtDialog, wxExtDialog)
01276: // EVT_MENU (wxID_HELP, wxTextCtrlSliderPairTestExtDialog::OnHelp)
01277: END_EVENT_TABLE()
01278:
01279: //-------------------------------------------------------------------------
01280:
01281: extern const char * TextCtrlSliderPairValidatorsDescriptionHtmlString;
01282:
01283: long TextCtrlSliderPairTestExtDialog_RedModificationLong = 30;
01284: long TextCtrlSliderPairTestExtDialog_GreenModificationLong = 0;
01285: long TextCtrlSliderPairTestExtDialog_BlueModificationLong = -10;
01286:
01287: //-------------------------------------------------------------------------
01288:
01289: wxTextCtrlSliderPairTestExtDialog::wxTextCtrlSliderPairTestExtDialog (wxWindow * ParentWindow)
01290: : wxExtDialog (ParentWindow,
01291: -1,
01292: _("wxTextCtrlSliderPair test dialog"),
01293: wxDefaultPosition,
01294: wxDefaultSize)
01295: {
01296: setBorderCompression (BorderCompressionValue);
01297:
01298: //-------------------------------------------------------------------------
01299: m_RedModificationLong = TextCtrlSliderPairTestExtDialog_RedModificationLong;
01300: m_GreenModificationLong = TextCtrlSliderPairTestExtDialog_GreenModificationLong;
01301: m_BlueModificationLong = TextCtrlSliderPairTestExtDialog_BlueModificationLong;
01302:
01303: //-------------------------------------------------------------------------
01304: m_StatusMessageTarget = new wxStatusMessageTarget (createErrorMessageCtrl (& m_ErrorMessageMultiLineText), "");
01305: m_StatusMessageTarget -> enableShowMessageBox (FALSE);
01306:
01307: //-------------------------------------------------------------------------
01308:
01309: wxBoxSizer *PanelSizer = new wxBoxSizer (wxVERTICAL);
01310: wxSizerAdder PanelSizerAdder (PanelSizer);
01311:
01312: wxFlexGridSizer * FlexGridSizer = NULL;
01313:
01314: //-------------------------------------------------------------------------
01315: wxSize DescriptionCtrlSize (getAdjustedTextCtrlWidth (400),
01316: getAdjustedTextCtrlHeight (1, true));
01317: addMultiLineText (& m_DescriptionMultiLineText,
01318: 0,
01319: DescriptionCtrlSize,
01320: wxMultiLineText::wxHTML_MODE,
01321: & PanelSizerAdder,
01322: TextCtrlSliderPairValidatorsDescriptionHtmlString,
01323: 4, 8, _B(10));
01324: m_DescriptionMultiLineText.getHtmlWindow() -> SetBorders (5);
01325: m_DescriptionMultiLineText.getWindow() -> SetBackgroundColour (wxColour (224, 224, 192));
01326:
01327: //-------------------------------------------------------------------------
01328: addFlexGridSizer (& FlexGridSizer, 3, _B(5), _B(5),
01329: PanelSizer, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, _B(14));
01330: wxSizerAdder FlexGridSizerAdder (FlexGridSizer);
01331:
01332: addTextCtrlSliderPairWithLabel (& m_RedModificationTextCtrl,
01333: & m_RedModificationSliderCtrl, _("&Red"),
01334: & m_RedModificationLong, -100, +100,
01335: m_StatusMessageTarget, & FlexGridSizerAdder,
01336: _("red"));
01337: addTextCtrlSliderPairWithLabel (& m_GreenModificationTextCtrl,
01338: & m_GreenModificationSliderCtrl, _("&Green"),
01339: & m_GreenModificationLong, -100, +100,
01340: m_StatusMessageTarget, & FlexGridSizerAdder,
01341: _("green"));
01342: addTextCtrlSliderPairWithLabel (& m_BlueModificationTextCtrl,
01343: & m_BlueModificationSliderCtrl, _("&Blue"),
01344: & m_BlueModificationLong, -100, +100,
01345: m_StatusMessageTarget, & FlexGridSizerAdder,
01346: _("blue"));
01347:
01348: addWatchedControl (m_RedModificationTextCtrl);
01349: addWatchedControl (m_GreenModificationTextCtrl);
01350: addWatchedControl (m_BlueModificationTextCtrl);
01351:
01352: //-------------------------------------------------------------------------
01353: addFlexGridSizer (& FlexGridSizer, 4, _B(0), _B(10),
01354: PanelSizer, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxEXPAND, _B(14));
01355: wxSizerAdder ButtonSizerAdder (FlexGridSizer);
01356:
01357: wxButton * Button;
01358: addButton (& Button, wxID_OK, (wxCommandEventFunction) (& wxTextCtrlSliderPairTestExtDialog::OnOK),
01359: _("&OK"), & ButtonSizerAdder);
01360: Button->SetDefault();
01361: addButton (NULL, wxID_CANCEL, (wxCommandEventFunction) (& wxTextCtrlSliderPairTestExtDialog::OnCancel),
01362: _("Cancel"), & ButtonSizerAdder);
01363:
01364: //-------------------------------------------------------------------------
01365: PanelSizer->Add (m_ErrorMessageMultiLineText.getWindow(),
01366: 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxEXPAND, _B(5));
01367:
01368: SetSizerAndFit (PanelSizer);
01369:
01370: initializeDialog ();
01371: enableWatchedControlChangeNotification (true);
01372: }
01373:
01374: void wxTextCtrlSliderPairTestExtDialog::OnOK(wxCommandEvent & WXUNUSED(Event))
01375: {
01376: if (ValidateWithMessageBox (wxID_OK))
01377: {
01378: TextCtrlSliderPairTestExtDialog_RedModificationLong = m_RedModificationLong;
01379: TextCtrlSliderPairTestExtDialog_GreenModificationLong = m_GreenModificationLong;
01380: TextCtrlSliderPairTestExtDialog_BlueModificationLong = m_BlueModificationLong;
01381: }
01382: }
01383:
01384: void wxTextCtrlSliderPairTestExtDialog::OnCancel(wxCommandEvent& Event)
01385: {
01386: wxExtDialog::OnCancel (Event);
01387: }
01388:
01389: //=========================================================================
01390: // wxDialogZoomTestExtDialog
01391:
01392: BEGIN_EVENT_TABLE (wxDialogZoomTestExtDialog, wxExtDialog)
01393: // EVT_MENU (wxID_HELP, wxDialogZoomTestExtDialog::OnHelp)
01394: END_EVENT_TABLE()
01395:
01396: //-------------------------------------------------------------------------
01397:
01398: wxDialogZoomTestExtDialog::wxDialogZoomTestExtDialog (wxWindow * ParentWindow)
01399: : wxExtDialog (ParentWindow,
01400: -1,
01401: _("wxExtDialog dialog zoom test"),
01402: wxDefaultPosition,
01403: wxDefaultSize)
01404: {
01405: m_DialogZoom = wxExtDialog::getGlobalDialogZoom ();
01406:
01407: setBorderCompression (BorderCompressionValue);
01408:
01409: //-------------------------------------------------------------------------
01410: m_StatusMessageTarget = new wxStatusMessageTarget (createErrorMessageCtrl (& m_ErrorMessageMultiLineText), "");
01411: m_StatusMessageTarget -> enableShowMessageBox (FALSE);
01412:
01413: //-------------------------------------------------------------------------
01414:
01415: wxBoxSizer *PanelSizer = new wxBoxSizer (wxVERTICAL);
01416: wxSizerAdder PanelSizerAdder (PanelSizer);
01417:
01418: wxFlexGridSizer * FlexGridSizer = NULL;
01419:
01420: //-------------------------------------------------------------------------
01421: wxSize DescriptionCtrlSize (getAdjustedTextCtrlWidth (400),
01422: getAdjustedTextCtrlHeight (1, true));
01423: wxString DescriptionString =
01424: (_T("<b>dialog zoom support:</b><br><br>\n\n"
01425: "Specify a zooming factor of 2 if your display's resolution "
01426: "is 2560 x 1920 pixel ;-) "));
01427: addMultiLineText (& m_DescriptionMultiLineText,
01428: 0,
01429: DescriptionCtrlSize,
01430: wxMultiLineText::wxHTML_MODE,
01431: & PanelSizerAdder,
01432: DescriptionString,
01433: 4, 8, _B(10));
01434: m_DescriptionMultiLineText.getHtmlWindow() -> SetBorders (5);
01435: m_DescriptionMultiLineText.getWindow() -> SetBackgroundColour (wxColour (224, 224, 192));
01436:
01437: //-------------------------------------------------------------------------
01438: addFlexGridSizer (& FlexGridSizer, 2, _B(5), _B(5),
01439: PanelSizer, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, _B(14));
01440: wxSizerAdder FlexGridSizerAdder (FlexGridSizer);
01441:
01442: addTextCtrlWithLabel (& m_DialogZoomTextCtrl, _("Dialog &zoom"),
01443: wxNumberValidator (& m_DialogZoom,
01444: 0.25, 2.0,
01445: m_StatusMessageTarget, _("dialog zoom"),
01446: 0, "%.2f"),
01447: 0,
01448: wxDefaultSize,
01449: & FlexGridSizerAdder);
01450: addTextCtrlWithLabel (& m_BorderCompressionTextCtrl, _("Border &compression"),
01451: wxNumberValidator (& BorderCompressionValue,
01452: 0.25, 1.,
01453: m_StatusMessageTarget, _("border compression"),
01454: 0, "%.2f"),
01455: 0,
01456: wxDefaultSize,
01457: & FlexGridSizerAdder);
01458:
01459: //-------------------------------------------------------------------------
01460: addFlexGridSizer (& FlexGridSizer, 4, _B(0), _B(10),
01461: PanelSizer, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxEXPAND, _B(14));
01462: wxSizerAdder ButtonSizerAdder (FlexGridSizer);
01463:
01464: wxButton * Button;
01465: addButton (& Button, wxID_OK, (wxCommandEventFunction) (& wxDialogZoomTestExtDialog::OnOK),
01466: _("&Set"), & ButtonSizerAdder);
01467: Button->SetDefault();
01468: addButton (& Button, wxID_CANCEL, NULL, //(wxCommandEventFunction) (& wxDialogZoomTestExtDialog::OnCancel),
01469: _("Close"), & ButtonSizerAdder);
01470:
01471: //-------------------------------------------------------------------------
01472: PanelSizer->Add (m_ErrorMessageMultiLineText.getWindow(),
01473: 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxEXPAND, _B(5));
01474:
01475: SetSizerAndFit (PanelSizer);
01476:
01477: initializeDialog ();
01478: enableWatchedControlChangeNotification (true);
01479: }
01480:
01481: //-------------------------------------------------------------------------
01482:
01483: void wxDialogZoomTestExtDialog::OnOK(wxCommandEvent & WXUNUSED(Event))
01484: {
01485: if (ValidateWithMessageBox (wxID_OK))
01486: {
01487: wxExtDialog::setGlobalDialogZoom (m_DialogZoom);
01488: }
01489: }
01490:
01491: //=========================================================================
01492: // WxExtLibTestApp
01493:
01494: IMPLEMENT_APP(WxExtLibTestApp)
01495:
01496: bool WxExtLibTestApp::OnInit()
01497: {
01498: m_IsAppInitialized = false;
01499: m_WxExtLibTestFrame = NULL;
01500:
01501: wxMessageExtDialog::setGlobalTitlePostfix ("WxExtLibTest");
01502: wxMessageExtDialog::setGlobalFlags (wxMessageExtDialog::DisplayImage);
01503:
01504: m_Locale = NULL;
01505: ((WxExtLibTestApp *) wxTheApp) -> updateLanguageSettings ();
01506:
01507: #if (M_WxExtLib_IsUseStxLogging == 1)
01508: // TEST
01509: stxSetupLogging ("WxExtLibTest.log");
01510: stxSetupLogFlush (true);
01511: #endif
01512:
01513: wxImage::AddHandler(new wxPNGHandler);
01514:
01515: #ifndef M_IsUseChmHelpController
01516: #if wxUSE_HTML
01517: #if wxUSE_GIF
01518: // Required for images in the online documentation
01519: wxImage::AddHandler(new wxGIFHandler);
01520: #endif
01521: // Required for advanced HTML help
01522: #if wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB
01523: wxFileSystem::AddHandler(new wxZipFSHandler);
01524: #endif
01525: #endif
01526: #endif
01527:
01528: wxAppRootFrame * AppRootFrame = NULL;
01529: #if (M_WxExtLib_IsUseAppRootFrame == 1)
01530: AppRootFrame = wxAppRootFrame::create (wxICON (::WxExtLibTest));
01531: #endif
01532: WxExtLibTestFrame * FrameWindow = new WxExtLibTestFrame(AppRootFrame,
01533: _T("WxExtLibTest Application"),
01534: wxPoint(50, 50), wxSize(450, 340),
01535: wxDEFAULT_FRAME_STYLE);
01536:
01537: #if (M_WxExtLib_IsUseAppRootFrame == 1)
01538: wxAppRootFrame::setup (FrameWindow);
01539: #endif
01540:
01541: if (AppRootFrame != NULL)
01542: {
01543: FrameWindow -> accessNonModalDialogManag().setParentWindow (AppRootFrame);
01544: }
01545: else
01546: {
01547: FrameWindow -> accessNonModalDialogManag().setParentWindow (FrameWindow);
01548: }
01549:
01550: FrameWindow -> Show (true);
01551: m_WxExtLibTestFrame = FrameWindow;
01552:
01553: #ifdef M_IsUseChmHelpController
01554: if (!FrameWindow -> m_ChmHelpController.Initialize (_T("MyTestDoc")))
01555: {
01556: wxLogError (wxT("Cannot initialize chm help controller."));
01557: }
01558: #else
01559: if (!FrameWindow -> m_HtmlHelpController.Initialize (_T("MyTestDoc")))
01560: {
01561: wxLogError (wxT("Cannot initialize html help controller."));
01562: }
01563: #endif
01564:
01565: m_IsAppInitialized = true;
01566: return true;
01567: }
01568:
01569: void WxExtLibTestApp::updateLanguageSettings ()
01570: {
01571: delete m_Locale;
01572: m_Locale = NULL;
01573:
01574: m_Locale = new wxLocale;
01575:
01576: int LanguageIndex = 3;
01577: switch (LanguageIndex)
01578: {
01579: case 1:
01580: m_Locale -> Init (wxLANGUAGE_FRENCH);
01581: break;
01582: case 2:
01583: m_Locale -> Init (wxLANGUAGE_GERMAN);
01584: break;
01585: case 3:
01586: m_Locale -> Init (wxLANGUAGE_DEFAULT);
01587: break;
01588: case 0:
01589: default:
01590: m_Locale -> Init (wxLANGUAGE_ENGLISH_UK);
01591: }
01592:
01593: wxCatalogAddManag CatalogAddManag;
01594: CatalogAddManag.setLocale (m_Locale);
01595: CatalogAddManag.addCatalogWithVersionCheck ("WxExtLib",
01596: M_WxExtLib_VersionIdentString /* "0.82.0003" */);
01597: // CatalogAddManag.addCatalogWithVersionCheck ("WxExtLibTest", "0.82.0003");
01598: CatalogAddManag.addCatalogWithVersionCheck ("WxExtLibTest",
01599: M_WxExtLib_VersionIdentString /* "0.82.0008" */);
01600: CatalogAddManag.addCatalogWithVersionCheck ("NotFoundCatalog", "0.82.0005");
01601: wxString MessageString;
01602: if (CatalogAddManag.getMessage (MessageString))
01603: {
01604: MessageExtDialog (MessageString, wxMessageExtDialog::WarningStyle);
01605: }
01606: }
01607:
01608: void WxExtLibTestApp::SetActive (bool IsActive, wxWindow * LastFocus)
01609: {
01610: wxApp::SetActive (IsActive, LastFocus);
01611: if (wxGetGlobalAppRootFrame() != NULL)
01612: {
01613: #if (M_WxExtLib_IsUseAppRootFrame == 1)
01614: wxGetGlobalAppRootFrame() -> notifyActivateAppEvent (IsActive, LastFocus);
01615: #endif
01616: }
01617: }
01618:
01619: //=========================================================================
01620: // WxExtLibTestFrame
01621:
01622: BEGIN_EVENT_TABLE(WxExtLibTestFrame, WxExtLibTestBase)
01623: EVT_QUERY_END_SESSION (WxExtLibTestFrame::OnCloseEvent)
01624: EVT_END_SESSION (WxExtLibTestFrame::OnCloseEvent)
01625: EVT_CLOSE (WxExtLibTestFrame::OnCloseEvent)
01626:
01627: EVT_MENU(ID_Quit, WxExtLibTestFrame::OnQuit)
01628:
01629: EVT_MENU(ID_MessageExtDialogTest, WxExtLibTestFrame::OnMessageExtDialogTest)
01630: EVT_MENU(ID_StatusValidatorTestDialog, WxExtLibTestFrame::OnStatusValidatorTestDialog)
01631: EVT_MENU(ID_FormatMessageTestDialog, WxExtLibTestFrame::OnMessageFormatterTest)
01632: EVT_MENU(ID_ConfigEntryManagerTestDialog, WxExtLibTestFrame::OnConfigEntryManagerTestDialog)
01633: EVT_MENU(ID_TextCtrlSliderPairTestDialog, WxExtLibTestFrame::OnTextCtrlSliderPairTestDialog)
01634: EVT_MENU(ID_DialogZoomTestDialog, WxExtLibTestFrame::OnDialogZoomTestDialog)
01635:
01636: EVT_MENU(ID_NonModalDialog1, WxExtLibTestFrame::OnNonModalDialog1)
01637: EVT_MENU(ID_NonModalDialog2, WxExtLibTestFrame::OnNonModalDialog2)
01638: EVT_MENU(ID_NonModalDialog3, WxExtLibTestFrame::OnNonModalDialog3)
01639:
01640: EVT_MENU(ID_Help, WxExtLibTestFrame::OnHelp)
01641: EVT_MENU(ID_About, WxExtLibTestFrame::OnAbout)
01642: END_EVENT_TABLE()
01643:
01644: //-------------------------------------------------------------------------
01645:
01646: WxExtLibTestFrame::WxExtLibTestFrame(wxWindow * ParentWindow,
01647: const wxString& title, const wxPoint& pos, const wxSize& size, long style)
01648: : WxExtLibTestBase(ParentWindow, -1, title, pos, size, style)
01649: {
01650: // set the frame icon
01651: SetIcon (wxICON (::WxExtLibTest));
01652:
01653: // m_NonModalDialogManag.setFrame (this);
01654:
01655: // create the menu bar
01656: wxMenu *FileMenu = new wxMenu;
01657: FileMenu->Append(ID_MessageExtDialogTest, _T("&wxMessageExtDialog test..."));
01658: FileMenu->Append(ID_StatusValidatorTestDialog, _T("S&tatusValidators test dialog..."));
01659: FileMenu->Append(ID_FormatMessageTestDialog, _T("wx&FormatMessage test dialog..."));
01660: FileMenu->Append(ID_ConfigEntryManagerTestDialog, _T("wx&ConfigEntryManager test dialog..."));
01661: FileMenu->Append(ID_TextCtrlSliderPairTestDialog, _T("wxTextCtrl/wx&Slider pair test dialog..."));
01662: FileMenu->Append(ID_DialogZoomTestDialog, _T("Dialog &zoom test..."));
01663: FileMenu->AppendSeparator ();
01664: FileMenu->Append(ID_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));
01665:
01666: // create the menu bar
01667: wxMenu *NonModalTestMenu = new wxMenu;
01668: NonModalTestMenu->Append(ID_NonModalDialog1, _T("Non-modal dialog &1..."));
01669: NonModalTestMenu->Append(ID_NonModalDialog2, _T("Non-modal dialog &2..."));
01670: NonModalTestMenu->Append(ID_NonModalDialog3, _T("Non-modal dialog &3..."));
01671:
01672: wxMenu *HelpMenu = new wxMenu;
01673: HelpMenu->Append(ID_Help, _T("&Help...\tF1"), _T("Show help"));
01674: HelpMenu->Append(ID_About, _T("&About..."), _T("Show about dialog"));
01675:
01676: wxMenuBar *MenuBar = new wxMenuBar();
01677: MenuBar->Append(FileMenu, _T("&File"));
01678: MenuBar->Append(NonModalTestMenu, _T("&Non-Modal Test"));
01679: MenuBar->Append(HelpMenu, _T("&Help"));
01680:
01681: SetMenuBar(MenuBar);
01682:
01683: CreateStatusBar(2);
01684:
01685: // wxExtDialog::setGlobalDesktopReferenceSize (wxSize (900, 700));
01686:
01687: WxExtLibTest_DateTime.SetToCurrent();
01688: }
01689:
01690: //-------------------------------------------------------------------------
01691:
01692: extern const char * MessageExtDialogDescription;
01693:
01694: void WxExtLibTestFrame::OnMessageExtDialogTest(wxCommandEvent& WXUNUSED(Event))
01695: {
01696: // WARN don't know if _T must be around each of the string parts
01697: wxMessageExtDialog SomeMessageExtDialog (NULL,
01698: MessageExtDialogDescription,
01699: _T("extended message box test"));
01700: SomeMessageExtDialog.setStyle (wxMessageExtDialog::QuestionStyle);
01701: const int NoNoButtonIdent = SomeMessageExtDialog.addButton ("&No no");
01702: /* const int JumpButtonIdent = */ SomeMessageExtDialog.addButton ("&Jump");
01703: SomeMessageExtDialog.makeLastAddedButtonDefault ();
01704: SomeMessageExtDialog.addButton ("&Cancel", wxID_CANCEL);
01705: int ReturnedButtonIdent = SomeMessageExtDialog.ShowModal ();
01706: if (ReturnedButtonIdent == NoNoButtonIdent)
01707: {
01708: // easiest case: a message box with only an 'OK' button can
01709: // be created and displayed with a single function call:
01710: MessageExtDialog (_T("An <b>error</b> message is hanging around!"),
01711: wxMessageExtDialog::ErrorStyle | wxMessageExtDialog::IsHtmlMode);
01712:
01713: wxMessageExtDialog OtherMessageExtDialog (NULL,
01714: _T("Please decide"),
01715: _T(""));
01716: OtherMessageExtDialog.setStyle (wxMessageExtDialog::CriticalErrorStyle);
01717: const int FirstButtonIdent = OtherMessageExtDialog.addButton ("&Fast");
01718: const int SecondButtonIdent = OtherMessageExtDialog.addButton ("&Small");
01719: const int ThirdButtonIdent = OtherMessageExtDialog.addButton ("&Fast'n'small");
01720: OtherMessageExtDialog.makeLastAddedButtonDefault ();
01721: int OtherReturnedButtonIdent = OtherMessageExtDialog.ShowModal ();
01722:
01723: #if wxCHECK_VERSION(2,5,3)
01724: // at some point before 2.5.3 wxUnusedVar was added
01725: wxUnusedVar (FirstButtonIdent);
01726: wxUnusedVar (SecondButtonIdent);
01727: wxUnusedVar (ThirdButtonIdent);
01728: wxUnusedVar (OtherReturnedButtonIdent);
01729: #endif
01730: }
01731:
01732: }
01733:
01734: void WxExtLibTestFrame::OnStatusValidatorTestDialog(wxCommandEvent& WXUNUSED(Event))
01735: {
01736: wxStatusValidatorTestExtDialog StatusValidatorTestExtDialog (this);
01737: StatusValidatorTestExtDialog.ShowModal ();
01738: }
01739:
01740: void WxExtLibTestFrame::OnMessageFormatterTest (wxCommandEvent& WXUNUSED(Event))
01741: {
01742: wxFormatMessageTestExtDialog FormatMessageTestExtDialog (this);
01743: FormatMessageTestExtDialog.ShowModal ();
01744: }
01745:
01746: void WxExtLibTestFrame::OnConfigEntryManagerTestDialog (wxCommandEvent& WXUNUSED(Event))
01747: {
01748: wxConfigEntryManagerTestExtDialog ConfigEntryManagerTestExtDialog (this);
01749: ConfigEntryManagerTestExtDialog.ShowModal ();
01750: }
01751:
01752: void WxExtLibTestFrame::OnTextCtrlSliderPairTestDialog(wxCommandEvent& WXUNUSED(Event))
01753: {
01754: wxTextCtrlSliderPairTestExtDialog TextCtrlSliderPairTestExtDialog (this);
01755: TextCtrlSliderPairTestExtDialog.ShowModal ();
01756: }
01757:
01758: void WxExtLibTestFrame::OnDialogZoomTestDialog (wxCommandEvent& WXUNUSED(Event))
01759: {
01760: int ResultCode = wxID_CANCEL;
01761: do
01762: {
01763: wxDialogZoomTestExtDialog DialogZoomTestExtDialog (this);
01764: ResultCode = DialogZoomTestExtDialog.ShowModal ();
01765: }
01766: while (ResultCode == wxID_OK);
01767: }
01768:
01769: //-------------------------------------------------------------------------
01770:
01771: void WxExtLibTestFrame::OnQuit(wxCommandEvent& WXUNUSED(Event))
01772: {
01773: Close (true);
01774: }
01775:
01776: //-------------------------------------------------------------------------
01777:
01778: void WxExtLibTestFrame::OnCloseEvent (wxCloseEvent & CloseEvent)
01779: {
01780: // handleCloseEvent (CloseEvent);
01781: m_NonModalDialogManag.closeAll();
01782:
01783: if (CloseEvent.GetVeto())
01784: return;
01785:
01786: if (wxGetGlobalAppRootFrame() != NULL)
01787: wxGetGlobalAppRootFrame() -> Close();
01788:
01789: CloseEvent.Skip();
01790: }
01791:
01792: //-------------------------------------------------------------------------
01793:
01794: void WxExtLibTestFrame::OnNonModalDialog1 (wxCommandEvent & WXUNUSED(Event))
01795: {
01796: m_NonModalDialogManag.handleMenuCommand (ID_NonModalDialog1);
01797: }
01798:
01799: void WxExtLibTestFrame::OnNonModalDialog2 (wxCommandEvent & WXUNUSED(Event))
01800: {
01801: m_NonModalDialogManag.handleMenuCommand (ID_NonModalDialog2);
01802: }
01803:
01804: void WxExtLibTestFrame::OnNonModalDialog3 (wxCommandEvent & WXUNUSED(Event))
01805: {
01806: m_NonModalDialogManag.handleMenuCommand (ID_NonModalDialog3);
01807: }
01808:
01809: void WxExtLibTestFrame::OnAbout(wxCommandEvent& WXUNUSED(Event))
01810: {
01811: MessageExtDialog (& getApp().getFrame(),
01812: _T("<font size=\"+2\"><b>WxExtLibTest</b></font><br><br>\n\n"
01813: "<i>Sample program to demonstrate some features of the WxWidgetsExtensions "
01814: "(WxExtLib) library and how to use them.</i>"
01815: "<br><br>"
01816: "Version: " M_WxExtLib_VersionIdentString " (" M_WxExtLib_DateIdentString "), "
01817: "config: " M_WxExtLib_ConfigTagString
01818: "<br><br>"
01819: "Copyright (C) 2004-2007 by Daniel Käps.<br>\n"
01820: "WxExtLib is distributed under a Zlib-like open source license."
01821: ),
01822: wxEmptyString,
01823: wxMessageExtDialog::InformationStyle | wxMessageExtDialog::IsHtmlMode);
01824:
01825:
01826: }
01827:
01828: void WxExtLibTestFrame::OnHelp(wxCommandEvent& WXUNUSED(Event))
01829: {
01830: #ifdef M_IsUseChmHelpController
01831: // m_ChmHelpController.DisplayContents ();
01832: m_ChmHelpController.DisplaySection ("Classes");
01833: #else
01834: // m_HtmlHelpController.DisplayContents ();
01835: m_HtmlHelpController.DisplaySection ("Classes");
01836: #endif
01837: }
01838:
01839: //=========================================================================
01840: