From 00b2d272244b303652b32b2de89f5507bad50e1f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 4 Mar 2023 16:47:08 +0100 Subject: [PATCH] Switch to using wxUILocale in the calendar sample No real changes, just follow our own recommendation to use wxUILocale::UseDefault() instead of wxLocale with wxLANGUAGE_DEFAULT. --- samples/calendar/calendar.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/samples/calendar/calendar.cpp b/samples/calendar/calendar.cpp index 951aee7c60..5459356385 100644 --- a/samples/calendar/calendar.cpp +++ b/samples/calendar/calendar.cpp @@ -39,6 +39,7 @@ #include "wx/calctrl.h" #include "wx/splitter.h" +#include "wx/uilocale.h" #if wxUSE_DATEPICKCTRL #include "wx/datectrl.h" @@ -68,7 +69,6 @@ class MyApp : public wxApp { public: - MyApp(); // override base class virtuals // ---------------------------- @@ -76,9 +76,6 @@ public: // initialization (doing it here and not in the ctor allows to have an error // return: if OnInit() returns false, the application terminates) virtual bool OnInit() override; - -private: - wxLocale m_locale; }; class MyPanel : public wxPanel @@ -382,19 +379,16 @@ wxIMPLEMENT_APP(MyApp); // the application class // ---------------------------------------------------------------------------- -MyApp::MyApp() : - // Locale affects on the language used in the calendar, and may affect - // on the first day of the week. - m_locale(wxLANGUAGE_DEFAULT) -{ -} - // `Main program' equivalent: the program execution "starts" here bool MyApp::OnInit() { if ( !wxApp::OnInit() ) return false; + // Locale affects on the language used in the calendar, and may affect + // the first day of the week, so set it before creating the controls. + wxUILocale::UseDefault(); + // Create the main application window MyFrame *frame = new MyFrame("Calendar wxWidgets sample" ,wxPoint(50, 50), wxSize(460, 340)