- EVT_TEXT(-1, wxYearSpinCtrl::OnYearTextChange)
- EVT_SPINCTRL(-1, wxYearSpinCtrl::OnYearChange)
+ EVT_TEXT(wxID_ANY, wxYearSpinCtrl::OnYearTextChange)
+ EVT_SPINCTRL(wxID_ANY, wxYearSpinCtrl::OnYearChange)
wxFLAGS_MEMBER(wxBORDER_RAISED)
wxFLAGS_MEMBER(wxBORDER_STATIC)
wxFLAGS_MEMBER(wxBORDER_NONE)
wxFLAGS_MEMBER(wxBORDER_RAISED)
wxFLAGS_MEMBER(wxBORDER_STATIC)
wxFLAGS_MEMBER(wxBORDER_NONE)
// old style border flags
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
// old style border flags
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
wxBEGIN_PROPERTIES_TABLE(wxCalendarCtrl)
wxEVENT_RANGE_PROPERTY( Updated , wxEVT_CALENDAR_SEL_CHANGED , wxEVT_CALENDAR_WEEKDAY_CLICKED , wxCalendarEvent )
wxHIDE_PROPERTY( Children )
wxBEGIN_PROPERTIES_TABLE(wxCalendarCtrl)
wxEVENT_RANGE_PROPERTY( Updated , wxEVT_CALENDAR_SEL_CHANGED , wxEVT_CALENDAR_WEEKDAY_CLICKED , wxCalendarEvent )
wxHIDE_PROPERTY( Children )
- wxPROPERTY( Date,wxDateTime, SetDate , GetDate, , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ 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(wxCalendarCtrl)
wxEND_HANDLERS_TABLE()
wxPROPERTY_FLAGS( WindowStyle , wxCalendarCtrlStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
wxEND_PROPERTIES_TABLE()
wxBEGIN_HANDLERS_TABLE(wxCalendarCtrl)
wxEND_HANDLERS_TABLE()
-wxCONSTRUCTOR_6( wxCalendarCtrl , wxWindow* , Parent , wxWindowID , Id , wxDateTime , Date , wxPoint , Position , wxSize , Size , long , WindowStyle )
+wxCONSTRUCTOR_6( wxCalendarCtrl , wxWindow* , Parent , wxWindowID , Id , wxDateTime , Date , wxPoint , Position , wxSize , Size , long , WindowStyle )
// ----------------------------------------------------------------------------
wxMonthComboBox::wxMonthComboBox(wxCalendarCtrl *cal)
// ----------------------------------------------------------------------------
wxMonthComboBox::wxMonthComboBox(wxCalendarCtrl *cal)
- SetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT);
+ SetSize(wxDefaultCoord,
+ wxDefaultCoord,
+ wxDefaultCoord,
+ wxDefaultCoord,
+ wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT);
(void)Create(parent, id, date, pos, size, style, name);
}
(void)Create(parent, id, date, pos, size, style, name);
}
style | wxCLIP_CHILDREN | wxWANTS_CHARS,
wxDefaultValidator, name) )
{
style | wxCLIP_CHILDREN | wxWANTS_CHARS,
wxDefaultValidator, name) )
{
- m_staticYear = new wxStaticText(GetParent(), -1, m_date.Format(_T("%Y")),
+ m_staticYear = new wxStaticText(GetParent(), wxID_ANY, m_date.Format(_T("%Y")),
wxDefaultPosition, wxDefaultSize,
wxALIGN_CENTRE);
m_comboMonth = new wxMonthComboBox(this);
wxDefaultPosition, wxDefaultSize,
wxALIGN_CENTRE);
m_comboMonth = new wxMonthComboBox(this);
- m_staticMonth = new wxStaticText(GetParent(), -1, m_date.Format(_T("%B")),
+ m_staticMonth = new wxStaticText(GetParent(), wxID_ANY, m_date.Format(_T("%B")),
// we need to set the position as well because the main control position
// is not the same as the one specified in pos if we have the controls
// above it
// we need to set the position as well because the main control position
// is not the same as the one specified in pos if we have the controls
// above it
- SetForegroundColour(*wxBLACK);
- SetBackgroundColour(*wxWHITE);
- SetFont(*wxSWISS_FONT);
+ // Since we don't paint the whole background make sure that the platform
+ // will use the right one.
+ SetBackgroundColour(GetBackgroundColour());
bool sameMonth = m_date.GetMonth() == date.GetMonth(),
sameYear = m_date.GetYear() == date.GetYear();
bool sameMonth = m_date.GetMonth() == date.GetMonth(),
sameYear = m_date.GetYear() == date.GetYear();
- ( !( lowerdate.IsValid() ) || ( ( upperdate.IsValid() ) ? ( lowerdate <= upperdate ) : TRUE ) ) &&
- ( !( upperdate.IsValid() ) || ( ( lowerdate.IsValid() ) ? ( upperdate >= lowerdate ) : TRUE ) ) )
+ ( !( lowerdate.IsValid() ) || ( ( upperdate.IsValid() ) ? ( lowerdate <= upperdate ) : true ) ) &&
+ ( !( upperdate.IsValid() ) || ( ( lowerdate.IsValid() ) ? ( upperdate >= lowerdate ) : true ) ) )
}
}
bool wxCalendarCtrl::IsDateInRange(const wxDateTime& date) const
{
// Check if the given date is in the range specified
}
}
bool wxCalendarCtrl::IsDateInRange(const wxDateTime& date) const
{
// Check if the given date is in the range specified
- return ( ( ( m_lowdate.IsValid() ) ? ( date >= m_lowdate ) : TRUE )
- && ( ( m_highdate.IsValid() ) ? ( date <= m_highdate ) : TRUE ) );
+ return ( ( ( m_lowdate.IsValid() ) ? ( date >= m_lowdate ) : true )
+ && ( ( m_highdate.IsValid() ) ? ( date <= m_highdate ) : true ) );
-In the calender the size of the combobox for the year
-is just defined by a margin from the month combobox to
-the left border. While in wxUniv the year control can't
-show all 4 digits, in wxMsw it show almost twice as
-much. Instead the year should use it's best size and be
-left aligned to the calendar. Just in case the month in
-any language is longer than it has space in the
-calendar it is shortend.This way the year always can
-show the 4 digits.
-
-This patch relies on the fact that a combobox has a
-good best size implementation. This is not the case
+In the calender the size of the combobox for the year
+is just defined by a margin from the month combobox to
+the left border. While in wxUniv the year control can't
+show all 4 digits, in wxMsw it show almost twice as
+much. Instead the year should use it's best size and be
+left aligned to the calendar. Just in case the month in
+any language is longer than it has space in the
+calendar it is shortend.This way the year always can
+show the 4 digits.
+
+This patch relies on the fact that a combobox has a
+good best size implementation. This is not the case
// determine the column width (we assume that the weekday names are always
// wider (in any language) than the numbers)
// determine the column width (we assume that the weekday names are always
// wider (in any language) than the numbers)
leftarrow[1] = wxPoint(arrowheight / 2, 0);
leftarrow[2] = wxPoint(arrowheight / 2, arrowheight - 1);
leftarrow[1] = wxPoint(arrowheight / 2, 0);
leftarrow[2] = wxPoint(arrowheight / 2, arrowheight - 1);
rightarrow[1] = wxPoint(arrowheight / 2, arrowheight / 2);
rightarrow[2] = wxPoint(0, arrowheight - 1);
rightarrow[1] = wxPoint(arrowheight / 2, arrowheight / 2);
rightarrow[2] = wxPoint(0, arrowheight - 1);
wxCoord arrowy = (m_heightRow - arrowheight) / 2;
wxCoord larrowx = (m_widthCol - (arrowheight / 2)) / 2;
wxCoord rarrowx = ((m_widthCol - (arrowheight / 2)) / 2) + m_widthCol*6;
wxCoord arrowy = (m_heightRow - arrowheight) / 2;
wxCoord larrowx = (m_widthCol - (arrowheight / 2)) / 2;
wxCoord rarrowx = ((m_widthCol - (arrowheight / 2)) / 2) + m_widthCol*6;
- m_leftArrowRect = wxRect(0, 0, 0, 0);
- m_rightArrowRect = wxRect(0, 0, 0, 0);
+ m_leftArrowRect = m_rightArrowRect = wxRect(0,0,0,0);
if ( AllowMonthChange() )
{
wxDateTime ldpm = wxDateTime(1,m_date.GetMonth(), m_date.GetYear()) - wxDateSpan::Day(); // last day prev month
// Check if range permits change
if ( AllowMonthChange() )
{
wxDateTime ldpm = wxDateTime(1,m_date.GetMonth(), m_date.GetYear()) - wxDateSpan::Day(); // last day prev month
// Check if range permits change
{
m_leftArrowRect = wxRect(larrowx - 3, arrowy - 3, (arrowheight / 2) + 8, (arrowheight + 6));
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
{
m_leftArrowRect = wxRect(larrowx - 3, arrowy - 3, (arrowheight / 2) + 8, (arrowheight + 6));
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawRectangle(m_leftArrowRect);
}
wxDateTime fdnm = wxDateTime(1,m_date.GetMonth(), m_date.GetYear()) + wxDateSpan::Month(); // first day next month
dc.DrawRectangle(m_leftArrowRect);
}
wxDateTime fdnm = wxDateTime(1,m_date.GetMonth(), m_date.GetYear()) + wxDateSpan::Month(); // first day next month
{
m_rightArrowRect = wxRect(rarrowx - 4, arrowy - 3, (arrowheight / 2) + 8, (arrowheight + 6));
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
{
m_rightArrowRect = wxRect(rarrowx - 4, arrowy - 3, (arrowheight / 2) + 8, (arrowheight + 6));
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
}
void wxCalendarCtrl::HighlightRange(wxPaintDC* pDC, const wxDateTime& fromdate, const wxDateTime& todate, wxPen* pPen, wxBrush* pBrush)
}
void wxCalendarCtrl::HighlightRange(wxPaintDC* pDC, const wxDateTime& fromdate, const wxDateTime& todate, wxPen* pPen, wxBrush* pBrush)
-// ----------------------------------------------------------------------------
-// wxCalendarEvent
-// ----------------------------------------------------------------------------
-
-void wxCalendarEvent::Init()
-{
- m_wday = wxDateTime::Inv_WeekDay;
-}