From bc385ba9ebd0185d5bc3dcbf9fb3f35e3eac4d7a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 3 Jan 2000 17:51:24 +0000 Subject: [PATCH] 1. corrections for compilation of the wxBase apps with wxApp 2. wxCAL_NO_MONTH/YEAR_CHANGE styles implemented, cosmetic corrections 3. attempt at BC++ compilation fix git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5203 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/app.h | 2 +- include/wx/defs.h | 2 + include/wx/generic/calctrl.h | 43 +++++++++-- samples/calendar/calendar.cpp | 63 ++++++++++++---- samples/console/console.cpp | 4 +- src/common/init.cpp | 121 ++++++++++++++++++++++++++++--- src/common/intl.cpp | 32 +++++---- src/common/utilscmn.cpp | 34 +++++++++ src/generic/calctrl.cpp | 131 +++++++++++++++++++++++++++++++--- 9 files changed, 379 insertions(+), 53 deletions(-) diff --git a/include/wx/app.h b/include/wx/app.h index 5341e7d2b1..559fdebc4f 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -362,7 +362,7 @@ public: // be in your main program (e.g. hello.cpp). Now IMPLEMENT_APP should add this // code if required. -#if defined(__AIX__) || defined(__HPUX__) || defined( __VMS__ ) || defined(__WXPM__) +#if !wxUSE_GUI || defined(__AIX__) || defined(__HPUX__) || defined( __VMS__ ) || defined(__WXPM__) #define IMPLEMENT_WXWIN_MAIN \ extern int wxEntry( int argc, char *argv[] ); \ int main(int argc, char *argv[]) { return wxEntry(argc, argv); } diff --git a/include/wx/defs.h b/include/wx/defs.h index 8f7b1ffa9d..9d7dcf0338 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -1117,6 +1117,8 @@ enum wxStretch #define wxCAL_SUNDAY_FIRST 0x0000 #define wxCAL_MONDAY_FIRST 0x0001 #define wxCAL_SHOW_HOLIDAYS 0x0002 +#define wxCAL_NO_YEAR_CHANGE 0x0004 +#define wxCAL_NO_MONTH_CHANGE 0x000c // no month change => no year change /* * extended dialog specifiers. these values are stored in a different diff --git a/include/wx/generic/calctrl.h b/include/wx/generic/calctrl.h index 78a9385d3b..073767fa58 100644 --- a/include/wx/generic/calctrl.h +++ b/include/wx/generic/calctrl.h @@ -21,6 +21,7 @@ #include "wx/spinctrl.h" // for wxSpinEvent class WXDLLEXPORT wxComboBox; +class WXDLLEXPORT wxStaticText; #define wxCalendarNameStr _T("CalendarCtrl") @@ -67,6 +68,22 @@ public: void SetDate(const wxDateTime& date); const wxDateTime& GetDate() const { return m_date; } + // calendar mode + // ------------- + + // some calendar styles can't be changed after the control creation by + // just using SetWindowStyle() and Refresh() and the functions below + // should be used instead for them + + // corresponds to wxCAL_NO_YEAR_CHANGE bit + void EnableYearChange(bool enable = TRUE); + + // corresponds to wxCAL_NO_MONTH_CHANGE bit + void EnableMonthChange(bool enable = TRUE); + + // corresponds to wxCAL_SHOW_HOLIDAYS bit + void EnableHolidayDisplay(bool display = TRUE); + // customization // ------------- @@ -100,11 +117,6 @@ public: const wxColour& GetHolidayColourFg() const { return m_colHolidayFg; } const wxColour& GetHolidayColourBg() const { return m_colHolidayBg; } - // this function should be called instead of directly changing the - // wxCAL_SHOW_HOLIDAYS bit in the control style after the control creation - // (this won't work) - void EnableHolidayDisplay(bool display = TRUE); - // an item without custom attributes is drawn with the default colours and // font and without border, setting custom attributes allows to modify this // @@ -205,8 +217,29 @@ private: GenerateEvent(type2); } + // do we allow changing the month/year? + bool AllowMonthChange() const + { + return (GetWindowStyle() & wxCAL_NO_MONTH_CHANGE) + != wxCAL_NO_MONTH_CHANGE; + } + bool AllowYearChange() const + { + return !(GetWindowStyle() & wxCAL_NO_YEAR_CHANGE); + } + + // show the correct controls + void ShowCurrentControls(); + + // get the currently shown control for month/year + wxControl *GetMonthControl() const; + wxControl *GetYearControl() const; + // the subcontrols + wxStaticText *m_staticMonth; wxComboBox *m_comboMonth; + + wxStaticText *m_staticYear; wxSpinCtrl *m_spinYear; // the current selection diff --git a/samples/calendar/calendar.cpp b/samples/calendar/calendar.cpp index 88d1c08284..31c28a57a7 100644 --- a/samples/calendar/calendar.cpp +++ b/samples/calendar/calendar.cpp @@ -68,8 +68,9 @@ public: void OnCalendarWeekDayClick(wxCalendarEvent& event); void OnCalendarChange(wxCalendarEvent& event); + wxCalendarCtrl *GetCal() const { return m_calendar; } + void StartWithMonday(bool on); - void ShowHolidays(bool on); void HighlightSpecial(bool on); private: @@ -94,6 +95,11 @@ public: void OnCalHolidays(wxCommandEvent& event); void OnCalSpecial(wxCommandEvent& event); + void OnCalAllowMonth(wxCommandEvent& event); + void OnCalAllowYear(wxCommandEvent& event); + + void OnAllowYearUpdate(wxUpdateUIEvent& event); + private: MyPanel *m_panel; @@ -114,6 +120,8 @@ enum Calendar_Cal_Monday = 200, Calendar_Cal_Holidays, Calendar_Cal_Special, + Calendar_Cal_Month, + Calendar_Cal_Year, Calendar_CalCtrl = 1000, }; @@ -131,6 +139,11 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(Calendar_Cal_Monday, MyFrame::OnCalMonday) EVT_MENU(Calendar_Cal_Holidays, MyFrame::OnCalHolidays) EVT_MENU(Calendar_Cal_Special, MyFrame::OnCalSpecial) + + EVT_MENU(Calendar_Cal_Month, MyFrame::OnCalAllowMonth) + EVT_MENU(Calendar_Cal_Year, MyFrame::OnCalAllowYear) + + EVT_UPDATE_UI(Calendar_Cal_Year, MyFrame::OnAllowYearUpdate) END_EVENT_TABLE() BEGIN_EVENT_TABLE(MyPanel, wxPanel) @@ -158,7 +171,7 @@ IMPLEMENT_APP(MyApp) bool MyApp::OnInit() { // Create the main application window - MyFrame *frame = new MyFrame("Minimal wxWindows App", + MyFrame *frame = new MyFrame("Calendar wxWindows sample", wxPoint(50, 50), wxSize(450, 340)); // Show it and tell the application that it's our main window @@ -189,7 +202,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) wxMenu *menuCal = new wxMenu; menuCal->Append(Calendar_Cal_Monday, - "&Monday first weekday\tCtrl-M", + "Monday &first weekday\tCtrl-F", "Toggle between Mon and Sun as the first week day", TRUE); menuCal->Append(Calendar_Cal_Holidays, "Show &holidays\tCtrl-H", @@ -198,6 +211,13 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) menuCal->Append(Calendar_Cal_Special, "Highlight &special dates\tCtrl-S", "Test custom highlighting", TRUE); + menuCal->AppendSeparator(); + menuCal->Append(Calendar_Cal_Month, "&Month can be changed\tCtrl-M", + "Allow changing the month in the calendar", + TRUE); + menuCal->Append(Calendar_Cal_Year, "&Year can be changed\tCtrl-Y", + "Allow changing the year in the calendar", + TRUE); // now append the freshly created menu to the menu bar... wxMenuBar *menuBar = new wxMenuBar; @@ -206,6 +226,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) menuBar->Check(Calendar_Cal_Monday, TRUE); menuBar->Check(Calendar_Cal_Holidays, TRUE); + menuBar->Check(Calendar_Cal_Month, TRUE); + menuBar->Check(Calendar_Cal_Year, TRUE); // ... and attach this menu bar to the frame SetMenuBar(menuBar); @@ -233,17 +255,37 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnCalMonday(wxCommandEvent& event) { - m_panel->StartWithMonday(GetMenuBar()->IsChecked(event.GetInt()) != 0); + m_panel->StartWithMonday(GetMenuBar()->IsChecked(event.GetInt())); } void MyFrame::OnCalHolidays(wxCommandEvent& event) { - m_panel->ShowHolidays(GetMenuBar()->IsChecked(event.GetInt()) != 0); + bool enable = GetMenuBar()->IsChecked(event.GetInt()); + m_panel->GetCal()->EnableHolidayDisplay(enable); } void MyFrame::OnCalSpecial(wxCommandEvent& event) { - m_panel->HighlightSpecial(GetMenuBar()->IsChecked(event.GetInt()) != 0); + m_panel->HighlightSpecial(GetMenuBar()->IsChecked(event.GetInt())); +} + +void MyFrame::OnCalAllowMonth(wxCommandEvent& event) +{ + bool allow = GetMenuBar()->IsChecked(event.GetInt()); + + m_panel->GetCal()->EnableMonthChange(allow); +} + +void MyFrame::OnCalAllowYear(wxCommandEvent& event) +{ + bool allow = GetMenuBar()->IsChecked(event.GetInt()); + + m_panel->GetCal()->EnableYearChange(allow); +} + +void MyFrame::OnAllowYearUpdate(wxUpdateUIEvent& event) +{ + event.Enable( GetMenuBar()->IsChecked(Calendar_Cal_Month)); } // ---------------------------------------------------------------------------- @@ -263,7 +305,9 @@ MyPanel::MyPanel(wxFrame *frame) wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, - wxCAL_MONDAY_FIRST | wxCAL_SHOW_HOLIDAYS); + wxCAL_MONDAY_FIRST | + wxCAL_SHOW_HOLIDAYS | + wxRAISED_BORDER); wxLayoutConstraints *c = new wxLayoutConstraints; c->left.SameAs(this, wxLeft, 10); @@ -315,11 +359,6 @@ void MyPanel::StartWithMonday(bool on) m_calendar->Refresh(); } -void MyPanel::ShowHolidays(bool on) -{ - m_calendar->EnableHolidayDisplay(on); -} - void MyPanel::HighlightSpecial(bool on) { if ( on ) diff --git a/samples/console/console.cpp b/samples/console/console.cpp index cd100faafb..66584979ea 100644 --- a/samples/console/console.cpp +++ b/samples/console/console.cpp @@ -35,8 +35,8 @@ //#define TEST_LONGLONG //#define TEST_MIME //#define TEST_STRINGS -//#define TEST_THREADS -#define TEST_TIME +#define TEST_THREADS +//#define TEST_TIME // ============================================================================ // implementation diff --git a/src/common/init.cpp b/src/common/init.cpp index 0fa42d7d8f..78576fb3c5 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -26,6 +26,7 @@ #ifndef WX_PRECOMP #include "wx/app.h" #include "wx/debug.h" + #include "wx/filefn.h" #endif #include "wx/module.h" @@ -49,6 +50,13 @@ public: virtual int OnRun() { wxFAIL_MSG(wxT("unreachable")); return 0; } }; +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +static bool DoInit(); +static void DoCleanUp(); + // ---------------------------------------------------------------------------- // private vars // ---------------------------------------------------------------------------- @@ -96,10 +104,7 @@ bool WXDLLEXPORT wxInitialize() wxASSERT_MSG( !wxTheApp, wxT("either call wxInitialize or create app, not both!") ); - wxClassInfo::InitializeClasses(); - - wxModule::RegisterModules(); - if ( !wxModule::InitializeModules() ) + if ( !DoInit() ) { return FALSE; } @@ -120,12 +125,110 @@ void WXDLLEXPORT wxUninitialize() { if ( !--gs_nInitCount ) { - wxModule::CleanUpModules(); + DoCleanUp(); + } +} + +int wxEntry(int argc, char **argv) +{ + // library initialization + if ( !DoInit() ) + { + return -1; + } + + // create the app + if ( !wxTheApp ) + { + wxCHECK_MSG( wxApp::GetInitializerFunction(), -1, + wxT("No application object: use IMPLEMENT_APP macro.") ); + + wxAppInitializerFunction fnCreate = wxApp::GetInitializerFunction(); + + wxTheApp = (wxApp *)fnCreate(); + } + + wxCHECK_MSG( wxTheApp, -1, wxT("wxWindows error: no application object") ); + + // app preinitialization + wxTheApp->argc = argc; + +#if wxUSE_UNICODE + wxTheApp->argv = new wxChar*[argc+1]; + int mb_argc = 0; + while (mb_argc < argc) + { + wxTheApp->argv[mb_argc] = wxStrdup(wxConvLibc.cMB2WX(argv[mb_argc])); + mb_argc++; + } + wxTheApp->argv[mb_argc] = (wxChar *)NULL; +#else + wxTheApp->argv = argv; +#endif + + wxString name = wxFileNameFromPath(argv[0]); + wxStripExtension(name); + wxTheApp->SetAppName(name); + + int retValue = 0; + + // app initialization + if ( !wxTheApp->OnInit() ) + retValue = -1; + + // app execution + if ( retValue == 0 ) + { + retValue = wxTheApp->OnRun(); - wxClassInfo::CleanUpClasses(); + // app clean up + wxTheApp->OnExit(); + } + + // library clean up + DoCleanUp(); + + return retValue; +} + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- - // delete the application object - delete wxTheApp; - wxTheApp = (wxApp *)NULL; +static bool DoInit() +{ + wxClassInfo::InitializeClasses(); + + wxModule::RegisterModules(); + if ( !wxModule::InitializeModules() ) + { + return FALSE; } + + return TRUE; +} + +static void DoCleanUp() +{ +#if wxUSE_LOG + // flush the logged messages if any + wxLog *log = wxLog::GetActiveTarget(); + if (log != NULL && log->HasPendingMessages()) + log->Flush(); + + // continuing to use user defined log target is unsafe from now on because + // some resources may be already unavailable, so replace it by something + // more safe + wxLog *oldlog = wxLog::SetActiveTarget(new wxLogStderr); + if ( oldlog ) + delete oldlog; +#endif // wxUSE_LOG + + wxModule::CleanUpModules(); + + wxClassInfo::CleanUpClasses(); + + // delete the application object + delete wxTheApp; + wxTheApp = (wxApp *)NULL; } diff --git a/src/common/intl.cpp b/src/common/intl.cpp index b34f248d27..caab4f25bd 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -178,7 +178,7 @@ private: const char *StringAtOfs(wxMsgTableEntry *pTable, size_t32 index) const { return (const char *)(m_pData + Swap(pTable[index].ofsString)); } - + // convert encoding to platform native one, if neccessary void ConvertEncoding(); @@ -478,27 +478,33 @@ void wxMsgCatalog::ConvertEncoding() const char *hdr = StringAtOfs(m_pOrigTable, 0); if (hdr == NULL) return; // not supported by this catalog, does not have non-fuzzy header if (hdr[0] != 0) return; // ditto - + /* we support catalogs with header (msgid "") that is _not_ marked as "#, fuzzy" (otherwise the string would not be included into compiled catalog) */ wxString header(StringAtOfs(m_pTransTable, 0)); wxString charset; int pos = header.Find("Content-Type: text/plain; charset="); - if (pos == -1) return; // incorrectly filled Content-Type header - pos += 34 ; /*strlen("Content-Type: text/plain; charset=")*/ - while (header[pos] != '\n') charset << header[pos++]; - - if ((enc = wxTheFontMapper -> CharsetToEncoding(charset, FALSE)) == wxFONTENCODING_SYSTEM) return; + if (pos == wxNOT_FOUND) + return; // incorrectly filled Content-Type header + size_t n = pos + 34; /*strlen("Content-Type: text/plain; charset=")*/ + while (header[n] != '\n') + charset << header[n++]; + + enc = wxTheFontMapper->CharsetToEncoding(charset, FALSE); + if ( enc == wxFONTENCODING_SYSTEM ) + return; // unknown encoding wxFontEncodingArray a = wxEncodingConverter::GetPlatformEquivalents(enc); - if (a[0] == enc) return; // no conversion needed, locale uses native encoding - - if (a.GetCount() == 0) return; // we don't know common equiv. under this platform - + if (a[0] == enc) + return; // no conversion needed, locale uses native encoding + + if (a.GetCount() == 0) + return; // we don't know common equiv. under this platform + wxEncodingConverter converter; - + converter.Init(enc, a[0]); - for (unsigned i = 0; i < m_numStrings; i++) + for (size_t i = 0; i < m_numStrings; i++) converter.Convert((char*)StringAtOfs(m_pTransTable, i)); #endif } diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 6a63712481..a9fda2f4ac 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -1040,3 +1040,37 @@ wxString wxGetHomeDir() return home; } + +#if 0 + +wxString wxGetCurrentDir() +{ + wxString dir; + size_t len = 1024; + bool ok; + do + { + ok = getcwd(dir.GetWriteBuf(len + 1), len) != NULL; + dir.UngetWriteBuf(); + + if ( !ok ) + { + if ( errno != ERANGE ) + { + wxLogSysError(_T("Failed to get current directory")); + + return wxEmptyString; + } + else + { + // buffer was too small, retry with a larger one + len *= 2; + } + } + //else: ok + } while ( !ok ); + + return dir; +} + +#endif // 0 diff --git a/src/generic/calctrl.cpp b/src/generic/calctrl.cpp index 73f74042c9..dca2a4e76d 100644 --- a/src/generic/calctrl.cpp +++ b/src/generic/calctrl.cpp @@ -33,6 +33,7 @@ #include "wx/settings.h" #include "wx/brush.h" #include "wx/combobox.h" + #include "wx/stattext.h" #endif //WX_PRECOMP #include "wx/calctrl.h" @@ -175,12 +176,22 @@ bool wxCalendarCtrl::Create(wxWindow * WXUNUSED(parent), long style, const wxString& WXUNUSED(name)) { - SetWindowStyle(style | (wxRAISED_BORDER | wxWANTS_CHARS)); + // needed to get the arrow keys normally used for the dialog navigation + SetWindowStyle(style | wxWANTS_CHARS); m_date = date.IsValid() ? date : wxDateTime::Today(); - m_comboMonth = new wxMonthComboBox(this); m_spinYear = new wxYearSpinCtrl(this); + m_staticYear = new wxStaticText(GetParent(), -1, m_date.Format(_T("%Y")), + wxDefaultPosition, wxDefaultSize, + wxALIGN_CENTRE); + + m_comboMonth = new wxMonthComboBox(this); + m_staticMonth = new wxStaticText(GetParent(), -1, m_date.Format(_T("%B")), + wxDefaultPosition, wxDefaultSize, + wxALIGN_CENTRE); + + ShowCurrentControls(); wxSize sizeReal; if ( size.x == -1 || size.y == -1 ) @@ -225,8 +236,8 @@ bool wxCalendarCtrl::Show(bool show) return FALSE; } - m_comboMonth->Show(show); - m_spinYear->Show(show); + GetMonthControl()->Show(show); + GetYearControl()->Show(show); return TRUE; } @@ -238,32 +249,115 @@ bool wxCalendarCtrl::Enable(bool enable) return FALSE; } - m_comboMonth->Enable(enable); - m_spinYear->Enable(enable); + GetMonthControl()->Enable(enable); + GetYearControl()->Enable(enable); return TRUE; } +// ---------------------------------------------------------------------------- +// enable/disable month/year controls +// ---------------------------------------------------------------------------- + +void wxCalendarCtrl::ShowCurrentControls() +{ + if ( AllowMonthChange() ) + { + m_comboMonth->Show(); + m_staticMonth->Hide(); + + if ( AllowYearChange() ) + { + m_spinYear->Show(); + m_staticYear->Hide(); + + // skip the rest + return; + } + } + else + { + m_comboMonth->Hide(); + m_staticMonth->Show(); + } + + // year change not allowed here + m_spinYear->Hide(); + m_staticYear->Show(); +} + +wxControl *wxCalendarCtrl::GetMonthControl() const +{ + return AllowMonthChange() ? m_comboMonth : m_staticMonth; +} + +wxControl *wxCalendarCtrl::GetYearControl() const +{ + return AllowYearChange() ? m_spinYear : m_staticYear; +} + +void wxCalendarCtrl::EnableYearChange(bool enable) +{ + if ( enable != AllowYearChange() ) + { + long style = GetWindowStyle(); + if ( enable ) + style &= ~wxCAL_NO_YEAR_CHANGE; + else + style |= wxCAL_NO_YEAR_CHANGE; + SetWindowStyle(style); + + ShowCurrentControls(); + } +} + +void wxCalendarCtrl::EnableMonthChange(bool enable) +{ + if ( enable != AllowMonthChange() ) + { + long style = GetWindowStyle(); + if ( enable ) + style &= ~wxCAL_NO_MONTH_CHANGE; + else + style |= wxCAL_NO_MONTH_CHANGE; + SetWindowStyle(style); + + ShowCurrentControls(); + } +} + // ---------------------------------------------------------------------------- // changing date // ---------------------------------------------------------------------------- void wxCalendarCtrl::SetDate(const wxDateTime& date) { - if ( m_date.GetMonth() == date.GetMonth() && - m_date.GetYear() == date.GetYear() ) + bool sameMonth = m_date.GetMonth() == date.GetMonth(), + sameYear = m_date.GetYear() == date.GetYear(); + + if ( sameMonth && sameYear ) { // just change the day ChangeDay(date); } else { + if ( !AllowMonthChange() || (!AllowYearChange() && !sameYear) ) + { + // forbidden + return; + } + // change everything m_date = date; // update the controls m_comboMonth->SetSelection(m_date.GetMonth()); - m_spinYear->SetValue(m_date.Format(_T("%Y"))); + + if ( AllowYearChange() ) + { + m_spinYear->SetValue(m_date.Format(_T("%Y"))); + } // update the calendar Refresh(); @@ -346,6 +440,10 @@ size_t wxCalendarCtrl::GetWeek(const wxDateTime& date) const // size or position changes: the combobox and spinctrl are along the top of // the available area and the calendar takes up therest of the space +// the static controls are supposed to be always smaller than combo/spin so we +// always use the latter for size calculations and position the static to take +// the same space + // the constants used for the layout #define VERT_MARGIN 5 // distance between combo and calendar #define HORZ_MARGIN 15 // spin @@ -363,6 +461,12 @@ wxSize wxCalendarCtrl::DoGetBestSize() const height += VERT_MARGIN + wxMax(sizeCombo.y, sizeSpin.y); + if ( GetWindowStyle() & (wxRAISED_BORDER | wxSUNKEN_BORDER) ) + { + // the border would clip the last line otherwise + height += 4; + } + return wxSize(width, height); } @@ -376,10 +480,15 @@ void wxCalendarCtrl::DoSetSize(int x, int y, void wxCalendarCtrl::DoMoveWindow(int x, int y, int width, int height) { wxSize sizeCombo = m_comboMonth->GetSize(); + wxSize sizeStatic = m_staticMonth->GetSize(); + + int dy = (sizeCombo.y - sizeStatic.y) / 2; m_comboMonth->Move(x, y); + m_staticMonth->SetSize(x, y + dy, sizeCombo.x, sizeStatic.y); int xDiff = sizeCombo.x + HORZ_MARGIN; m_spinYear->SetSize(x + xDiff, y, width - xDiff, sizeCombo.y); + m_staticYear->SetSize(x + xDiff, y + dy, width - xDiff, sizeStatic.y); wxSize sizeSpin = m_spinYear->GetSize(); int yDiff = wxMax(sizeSpin.y, sizeCombo.y) + VERT_MARGIN; @@ -394,7 +503,7 @@ void wxCalendarCtrl::DoGetPosition(int *x, int *y) const // our real top corner is not in this position if ( y ) { - *y -= m_comboMonth->GetSize().y + VERT_MARGIN; + *y -= GetMonthControl()->GetSize().y + VERT_MARGIN; } } @@ -405,7 +514,7 @@ void wxCalendarCtrl::DoGetSize(int *width, int *height) const // our real height is bigger if ( height ) { - *height += m_comboMonth->GetSize().y + VERT_MARGIN; + *height += GetMonthControl()->GetSize().y + VERT_MARGIN; } } -- 2.45.2