]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/calctrl.cpp
fixed clipping of items with icons text in report mode
[wxWidgets.git] / src / generic / calctrl.cpp
index f2ecd265a11c072bfe3d3141844fad8ee39021db..04facbffb19ee93513f206be31730f78277fe602 100644 (file)
@@ -36,8 +36,7 @@
     #include "wx/stattext.h"
 #endif //WX_PRECOMP
 
-// Can only use wxSpinEvent if this is enabled
-#if wxUSE_SPINBTN
+#if wxUSE_CALENDARCTRL
 
 #include "wx/calctrl.h"
 
@@ -97,6 +96,17 @@ END_EVENT_TABLE()
 IMPLEMENT_DYNAMIC_CLASS(wxCalendarCtrl, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxCalendarEvent, wxCommandEvent)
 
+// ----------------------------------------------------------------------------
+// events
+// ----------------------------------------------------------------------------
+
+DEFINE_EVENT_TYPE(wxEVT_CALENDAR_SEL_CHANGED)
+DEFINE_EVENT_TYPE(wxEVT_CALENDAR_DAY_CHANGED)
+DEFINE_EVENT_TYPE(wxEVT_CALENDAR_MONTH_CHANGED)
+DEFINE_EVENT_TYPE(wxEVT_CALENDAR_YEAR_CHANGED)
+DEFINE_EVENT_TYPE(wxEVT_CALENDAR_DOUBLECLICKED)
+DEFINE_EVENT_TYPE(wxEVT_CALENDAR_WEEKDAY_CLICKED)
+
 // ============================================================================
 // implementation
 // ============================================================================
@@ -461,15 +471,14 @@ wxSize wxCalendarCtrl::DoGetBestSize() const
     wxCoord width = 7*m_widthCol,
             height = 7*m_heightRow;
 
-    wxSize sizeCombo = m_comboMonth->GetBestSize(),
-           sizeSpin = m_spinYear->GetBestSize();
-
-    height += VERT_MARGIN + wxMax(sizeCombo.y, sizeSpin.y);
+    // the combobox doesn't report its height correctly (it returns the
+    // height including the drop down list) so don't use it
+    height += VERT_MARGIN + m_spinYear->GetBestSize().y;
 
     if ( GetWindowStyle() & (wxRAISED_BORDER | wxSUNKEN_BORDER) )
     {
         // the border would clip the last line otherwise
-        height += 4;
+        height += 6;
     }
 
     return wxSize(width, height);
@@ -637,7 +646,7 @@ void wxCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
 
                 wxCalendarDateAttr *attr = m_attrs[day - 1];
 
-                bool isSel = m_date == date;
+                bool isSel = date.IsSameDate(m_date);
                 if ( isSel )
                 {
                     dc.SetTextForeground(m_colHighlightFg);
@@ -1048,5 +1057,5 @@ wxCalendarEvent::wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type)
     m_date = cal->GetDate();
 }
 
-#endif // wxUSE_SPINBTN
+#endif // wxUSE_CALENDARCTRL