]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/calctrl.cpp
[ 1509599 ] 'Split pickers page in widgets sample' with more icons and rebaking.
[wxWidgets.git] / src / generic / calctrl.cpp
index 10995b0442d6c919fd45d785512e8130e4593e10..e5e98717bc626f66e9eebd949c3fbf953bbd1b87 100644 (file)
@@ -788,21 +788,32 @@ void wxCalendarCtrl::DoMoveWindow(int x, int y, int width, int height)
 {
     int yDiff;
 
-    if ( !HasFlag(wxCAL_SEQUENTIAL_MONTH_SELECTION) )
+    if ( !HasFlag(wxCAL_SEQUENTIAL_MONTH_SELECTION) && m_staticMonth )
     {
         wxSize sizeCombo = m_comboMonth->GetSize();
         wxSize sizeStatic = m_staticMonth->GetSize();
         wxSize sizeSpin = m_spinYear->GetSize();
-        int dy = (sizeCombo.y - sizeStatic.y) / 2;
+
+        // wxMSW sometimes reports the wrong combo height,
+        // so on this platform we'll use the spin control
+        // height instead.
+#ifdef __WXMSW__
+        int maxHeight = sizeSpin.y;
+        int requiredSpinHeight = -1;
+#else
+        int maxHeight = sizeCombo.y;
+        int requiredSpinHeight = sizeCombo.y;
+#endif
+        int dy = (maxHeight - sizeStatic.y) / 2;
         m_comboMonth->Move(x, y);
-        m_staticMonth->SetSize(x, y + dy, sizeCombo.x, sizeStatic.y);
+        m_staticMonth->SetSize(x, y + dy, sizeCombo.x, -1, sizeStatic.y);
 
         int xDiff = sizeCombo.x + HORZ_MARGIN;
 
-        m_spinYear->SetSize(x + xDiff, y, width - xDiff, sizeCombo.y);
+        m_spinYear->SetSize(x + xDiff, y, width - xDiff, requiredSpinHeight);
         m_staticYear->SetSize(x + xDiff, y + dy, width - xDiff, sizeStatic.y);
 
-        yDiff = wxMax(sizeSpin.y, sizeCombo.y) + VERT_MARGIN;
+        yDiff = wxMax(sizeSpin.y, maxHeight) + VERT_MARGIN;
     }
     else // no controls on the top
     {
@@ -816,7 +827,7 @@ void wxCalendarCtrl::DoGetPosition(int *x, int *y) const
 {
     wxControl::DoGetPosition(x, y);
 
-    if ( !(GetWindowStyle() & wxCAL_SEQUENTIAL_MONTH_SELECTION) )
+    if ( !HasFlag(wxCAL_SEQUENTIAL_MONTH_SELECTION) && GetMonthControl() )
     {
         // our real top corner is not in this position
         if ( y )
@@ -1211,7 +1222,7 @@ void wxCalendarCtrl::RefreshDate(const wxDateTime& date)
     Refresh(true, &rect);
 }
 
-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, const wxPen* pPen, const wxBrush* pBrush)
 {
     // Highlights the given range using pen and brush
     // Does nothing if todate < fromdate