// Author: Vadim Zeitlin
// Modified by:
// Created: 29.12.99
-// RCS-ID: $Id$
// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// 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)
EVT_SYS_COLOUR_CHANGED(wxGenericCalendarCtrl::OnSysColourChanged)
END_EVENT_TABLE()
-#if wxUSE_EXTENDED_RTTI
-WX_DEFINE_FLAGS( wxCalendarCtrlStyle )
-
-wxBEGIN_FLAGS( wxCalendarCtrlStyle )
- // new style border flags, we put them first to
- // use them for streaming out
- wxFLAGS_MEMBER(wxBORDER_SIMPLE)
- wxFLAGS_MEMBER(wxBORDER_SUNKEN)
- wxFLAGS_MEMBER(wxBORDER_DOUBLE)
- wxFLAGS_MEMBER(wxBORDER_RAISED)
- wxFLAGS_MEMBER(wxBORDER_STATIC)
- wxFLAGS_MEMBER(wxBORDER_NONE)
-
- // old style border flags
- wxFLAGS_MEMBER(wxSIMPLE_BORDER)
- wxFLAGS_MEMBER(wxSUNKEN_BORDER)
- wxFLAGS_MEMBER(wxDOUBLE_BORDER)
- wxFLAGS_MEMBER(wxRAISED_BORDER)
- wxFLAGS_MEMBER(wxSTATIC_BORDER)
- wxFLAGS_MEMBER(wxBORDER)
-
- // standard window styles
- wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
- wxFLAGS_MEMBER(wxCLIP_CHILDREN)
- wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
- wxFLAGS_MEMBER(wxWANTS_CHARS)
- wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
- wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
- wxFLAGS_MEMBER(wxVSCROLL)
- wxFLAGS_MEMBER(wxHSCROLL)
-
- wxFLAGS_MEMBER(wxCAL_SUNDAY_FIRST)
- wxFLAGS_MEMBER(wxCAL_MONDAY_FIRST)
- wxFLAGS_MEMBER(wxCAL_SHOW_HOLIDAYS)
- wxFLAGS_MEMBER(wxCAL_NO_YEAR_CHANGE)
- wxFLAGS_MEMBER(wxCAL_NO_MONTH_CHANGE)
- wxFLAGS_MEMBER(wxCAL_SEQUENTIAL_MONTH_SELECTION)
- wxFLAGS_MEMBER(wxCAL_SHOW_SURROUNDING_WEEKS)
- wxFLAGS_MEMBER(wxCAL_SHOW_WEEK_NUMBERS)
-
-wxEND_FLAGS( wxCalendarCtrlStyle )
-
-IMPLEMENT_DYNAMIC_CLASS_XTI(wxGenericCalendarCtrl, wxControl,"wx/calctrl.h")
-
-wxBEGIN_PROPERTIES_TABLE(wxGenericCalendarCtrl)
- wxEVENT_RANGE_PROPERTY( Updated , wxEVT_CALENDAR_SEL_CHANGED , wxEVT_CALENDAR_WEEK_CLICKED , wxCalendarEvent )
- wxHIDE_PROPERTY( Children )
- wxPROPERTY( Date,wxDateTime, SetDate , GetDate, , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- wxPROPERTY_FLAGS( WindowStyle , wxCalendarCtrlStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
-wxEND_PROPERTIES_TABLE()
-
-wxBEGIN_HANDLERS_TABLE(wxGenericCalendarCtrl)
-wxEND_HANDLERS_TABLE()
-
-wxCONSTRUCTOR_6( wxGenericCalendarCtrl , wxWindow* , Parent , wxWindowID , Id , wxDateTime , Date , wxPoint , Position , wxSize , Size , long , WindowStyle )
-#else
-IMPLEMENT_DYNAMIC_CLASS(wxGenericCalendarCtrl, wxControl)
-#endif
-
// ============================================================================
// implementation
// ============================================================================
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);
}
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);
}
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;
}
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;
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()
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;