X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/289532452089421ddadbd4726a8469511a19ab76..6f026b5b63fe7ccb025e84509886f74772b9df13:/src/generic/calctrlg.cpp diff --git a/src/generic/calctrlg.cpp b/src/generic/calctrlg.cpp index 3bb4170e5f..40a549fbf4 100644 --- a/src/generic/calctrlg.cpp +++ b/src/generic/calctrlg.cpp @@ -4,7 +4,6 @@ // Author: Vadim Zeitlin // Modified by: // Created: 29.12.99 -// RCS-ID: $Id$ // Copyright: (c) 1999 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -47,6 +46,12 @@ // wxWin macros // ---------------------------------------------------------------------------- +#ifdef wxHAS_NATIVE_CALENDARCTRL + +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGenericCalendarCtrl, wxControl,"wx/calctrl.h") + +#endif + BEGIN_EVENT_TABLE(wxGenericCalendarCtrl, wxControl) EVT_PAINT(wxGenericCalendarCtrl::OnPaint) @@ -268,7 +273,7 @@ void wxGenericCalendarCtrl::CreateMonthComboBox() wxDefaultCoord, wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT); - m_comboMonth->Connect(m_comboMonth->GetId(), wxEVT_COMMAND_COMBOBOX_SELECTED, + m_comboMonth->Connect(m_comboMonth->GetId(), wxEVT_COMBOBOX, wxCommandEventHandler(wxGenericCalendarCtrl::OnMonthChange), NULL, this); } @@ -281,15 +286,12 @@ void wxGenericCalendarCtrl::CreateYearSpinCtrl() wxDefaultSize, wxSP_ARROW_KEYS | wxCLIP_SIBLINGS, -4300, 10000, GetDate().GetYear()); -#ifdef __WXMAC__ - m_spinYear->SetSize( 90, -1 ); -#endif - m_spinYear->Connect(m_spinYear->GetId(), wxEVT_COMMAND_TEXT_UPDATED, + m_spinYear->Connect(m_spinYear->GetId(), wxEVT_TEXT, wxCommandEventHandler(wxGenericCalendarCtrl::OnYearTextChange), NULL, this); - m_spinYear->Connect(m_spinYear->GetId(), wxEVT_COMMAND_SPINCTRL_UPDATED, + m_spinYear->Connect(m_spinYear->GetId(), wxEVT_SPINCTRL, wxSpinEventHandler(wxGenericCalendarCtrl::OnYearChange), NULL, this); } @@ -694,12 +696,8 @@ wxSize wxGenericCalendarCtrl::DoGetBestSize() const height += wxMax(bestSizeCombo.y, m_spinYear->GetBestSize().y) + VERT_MARGIN; -#ifdef __WXMAC__ - // the spin control get clipped otherwise - width += 25; -#endif - wxCoord w2 = bestSizeCombo.x + HORZ_MARGIN + GetCharWidth()*6; + wxCoord w2 = bestSizeCombo.x + HORZ_MARGIN + GetCharWidth()*8; if ( width < w2 ) width = w2; } @@ -727,12 +725,8 @@ void wxGenericCalendarCtrl::DoMoveWindow(int x, int y, int width, int height) int maxHeight = wxMax(sizeSpin.y, sizeCombo.y); int dy = (maxHeight - sizeStatic.y) / 2; -#ifdef __WXMAC__ - m_comboMonth->Move(x, y + (maxHeight - sizeCombo.y)/2 + 2); // FIXME, something is reporting the wrong size.. -#else m_comboMonth->Move(x, y + (maxHeight - sizeCombo.y)/2); -#endif - m_staticMonth->SetSize(x, y + dy, sizeCombo.x, -1, sizeStatic.y); + m_staticMonth->SetSize(x, y + dy, sizeCombo.x, -1); int xDiff = sizeCombo.x + HORZ_MARGIN; @@ -751,20 +745,7 @@ void wxGenericCalendarCtrl::DoMoveWindow(int x, int y, int width, int height) void wxGenericCalendarCtrl::DoGetSize(int *width, int *height) const { -#ifdef __WXMAC__ - wxControl::DoGetSize( width, height ); - - if ( !HasFlag(wxCAL_SEQUENTIAL_MONTH_SELECTION) && m_staticMonth && height ) - { - wxSize sizeCombo = m_comboMonth->GetEffectiveMinSize(); - wxSize sizeSpin = m_spinYear->GetSize(); - - int maxHeight = wxMax(sizeSpin.y, sizeCombo.y); - *height += maxHeight + VERT_MARGIN; - } -#else wxControl::DoGetSize( width, height ); -#endif } void wxGenericCalendarCtrl::RecalcGeometry() @@ -1020,13 +1001,13 @@ void wxGenericCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) colBg = attr->GetBackgroundColour(); } - if ( colFg.Ok() ) + if ( colFg.IsOk() ) { dc.SetTextForeground(colFg); changedColours = true; } - if ( colBg.Ok() ) + if ( colBg.IsOk() ) { dc.SetTextBackground(colBg); changedColours = true;