]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/calctrlg.cpp
Fix wchar_t with int comparisons for Apple gcc.
[wxWidgets.git] / src / generic / calctrlg.cpp
index 21d116ccb13e46703dc989b03a6619e8c1a121c3..1129f56c54be1154ae9a330c9dfec556a6329c81 100644 (file)
@@ -248,11 +248,11 @@ bool wxGenericCalendarCtrl::Create(wxWindow *parent,
     if ( !HasFlag(wxCAL_SEQUENTIAL_MONTH_SELECTION) )
     {
         CreateYearSpinCtrl();
     if ( !HasFlag(wxCAL_SEQUENTIAL_MONTH_SELECTION) )
     {
         CreateYearSpinCtrl();
-        m_staticYear = new wxStaticText(GetParent(), wxID_ANY, m_date.Format(_T("%Y")),
+        m_staticYear = new wxStaticText(GetParent(), wxID_ANY, m_date.Format(wxT("%Y")),
                                         wxDefaultPosition, wxDefaultSize,
                                         wxALIGN_CENTRE);
         CreateMonthComboBox();
                                         wxDefaultPosition, wxDefaultSize,
                                         wxALIGN_CENTRE);
         CreateMonthComboBox();
-        m_staticMonth = new wxStaticText(GetParent(), wxID_ANY, m_date.Format(_T("%B")),
+        m_staticMonth = new wxStaticText(GetParent(), wxID_ANY, m_date.Format(wxT("%B")),
                                          wxDefaultPosition, wxDefaultSize,
                                          wxALIGN_CENTRE);
     }
                                          wxDefaultPosition, wxDefaultSize,
                                          wxALIGN_CENTRE);
     }
@@ -296,7 +296,7 @@ void wxGenericCalendarCtrl::SetWindowStyleFlag(long style)
     // created/shown/hidden accordingly
     wxASSERT_MSG( (style & wxCAL_SEQUENTIAL_MONTH_SELECTION) ==
                     (m_windowStyle & wxCAL_SEQUENTIAL_MONTH_SELECTION),
     // created/shown/hidden accordingly
     wxASSERT_MSG( (style & wxCAL_SEQUENTIAL_MONTH_SELECTION) ==
                     (m_windowStyle & wxCAL_SEQUENTIAL_MONTH_SELECTION),
-                  _T("wxCAL_SEQUENTIAL_MONTH_SELECTION can't be changed after creation") );
+                  wxT("wxCAL_SEQUENTIAL_MONTH_SELECTION can't be changed after creation") );
 
     wxControl::SetWindowStyleFlag(style);
 }
 
     wxControl::SetWindowStyleFlag(style);
 }
@@ -335,7 +335,7 @@ void wxGenericCalendarCtrl::CreateMonthComboBox()
 void wxGenericCalendarCtrl::CreateYearSpinCtrl()
 {
     m_spinYear = new wxSpinCtrl(GetParent(), wxID_ANY,
 void wxGenericCalendarCtrl::CreateYearSpinCtrl()
 {
     m_spinYear = new wxSpinCtrl(GetParent(), wxID_ANY,
-                                GetDate().Format(_T("%Y")),
+                                GetDate().Format(wxT("%Y")),
                                 wxDefaultPosition,
                                 wxDefaultSize,
                                 wxSP_ARROW_KEYS | wxCLIP_SIBLINGS,
                                 wxDefaultPosition,
                                 wxDefaultSize,
                                 wxSP_ARROW_KEYS | wxCLIP_SIBLINGS,
@@ -520,7 +520,7 @@ bool wxGenericCalendarCtrl::SetDate(const wxDateTime& date)
                     if ( AllowYearChange() )
                     {
                         if ( !m_userChangedYear )
                     if ( AllowYearChange() )
                     {
                         if ( !m_userChangedYear )
-                            m_spinYear->SetValue(m_date.Format(_T("%Y")));
+                            m_spinYear->SetValue(m_date.Format(wxT("%Y")));
                     }
                 }
 
                     }
                 }
 
@@ -800,7 +800,7 @@ wxSize wxGenericCalendarCtrl::DoGetBestSize() const
                     + VERT_MARGIN;
 #ifdef __WXMAC__
         // the spin control get clipped otherwise
                     + VERT_MARGIN;
 #ifdef __WXMAC__
         // the spin control get clipped otherwise
-        width += 10;
+        width += 25;
 #endif
 
         wxCoord w2 = bestSizeCombo.x + HORZ_MARGIN + GetCharWidth()*6;
 #endif
 
         wxCoord w2 = bestSizeCombo.x + HORZ_MARGIN + GetCharWidth()*6;
@@ -1081,7 +1081,7 @@ void wxGenericCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
             {
                 // don't use wxDate::Format() which prepends 0s
                 unsigned int day = date.GetDay();
             {
                 // don't use wxDate::Format() which prepends 0s
                 unsigned int day = date.GetDay();
-                wxString dayStr = wxString::Format(_T("%u"), day);
+                wxString dayStr = wxString::Format(wxT("%u"), day);
                 wxCoord width;
                 dc.GetTextExtent(dayStr, &width, NULL);
 
                 wxCoord width;
                 dc.GetTextExtent(dayStr, &width, NULL);
 
@@ -1176,7 +1176,7 @@ void wxGenericCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
                             break;
 
                         default:
                             break;
 
                         default:
-                            wxFAIL_MSG(_T("unknown border type"));
+                            wxFAIL_MSG(wxT("unknown border type"));
                     }
                 }
 
                     }
                 }
 
@@ -1500,7 +1500,7 @@ void wxGenericCalendarCtrl::OnClick(wxMouseEvent& event)
             break;
 
         default:
             break;
 
         default:
-            wxFAIL_MSG(_T("unknown hittest code"));
+            wxFAIL_MSG(wxT("unknown hittest code"));
             // fall through
 
         case wxCAL_HITTEST_NOWHERE:
             // fall through
 
         case wxCAL_HITTEST_NOWHERE:
@@ -1564,6 +1564,7 @@ wxCalendarHitTestResult wxGenericCalendarCtrl::HitTest(const wxPoint& pos,
     }
 
     if ( pos.x - x0 < 0 )
     }
 
     if ( pos.x - x0 < 0 )
+    {
         if ( pos.x >= 0 && pos.y > m_rowOffset + m_heightRow && pos.y <= m_rowOffset + m_heightRow * 7 )
         {
             if ( date )
         if ( pos.x >= 0 && pos.y > m_rowOffset + m_heightRow && pos.y <= m_rowOffset + m_heightRow * 7 )
         {
             if ( date )
@@ -1577,6 +1578,7 @@ wxCalendarHitTestResult wxGenericCalendarCtrl::HitTest(const wxPoint& pos,
         }
         else    // early exit -> the rest of the function checks for clicks on days
             return wxCAL_HITTEST_NOWHERE;
         }
         else    // early exit -> the rest of the function checks for clicks on days
             return wxCAL_HITTEST_NOWHERE;
+    }
 
     // header: week days
     int wday = (pos.x - x0) / m_widthCol;
 
     // header: week days
     int wday = (pos.x - x0) / m_widthCol;
@@ -1717,7 +1719,7 @@ void wxGenericCalendarCtrl::OnChar(wxKeyEvent& event)
     wxDateTime target;
     switch ( event.GetKeyCode() )
     {
     wxDateTime target;
     switch ( event.GetKeyCode() )
     {
-        case _T('+'):
+        case wxT('+'):
         case WXK_ADD:
             target = m_date + wxDateSpan::Year();
             if ( ChangeYear(&target) )
         case WXK_ADD:
             target = m_date + wxDateSpan::Year();
             if ( ChangeYear(&target) )
@@ -1726,7 +1728,7 @@ void wxGenericCalendarCtrl::OnChar(wxKeyEvent& event)
             }
             break;
 
             }
             break;
 
-        case _T('-'):
+        case wxT('-'):
         case WXK_SUBTRACT:
             target = m_date - wxDateSpan::Year();
             if ( ChangeYear(&target) )
         case WXK_SUBTRACT:
             target = m_date - wxDateSpan::Year();
             if ( ChangeYear(&target) )
@@ -1813,7 +1815,7 @@ void wxGenericCalendarCtrl::OnChar(wxKeyEvent& event)
 
 void wxGenericCalendarCtrl::SetHoliday(size_t day)
 {
 
 void wxGenericCalendarCtrl::SetHoliday(size_t day)
 {
-    wxCHECK_RET( day > 0 && day < 32, _T("invalid day in SetHoliday") );
+    wxCHECK_RET( day > 0 && day < 32, wxT("invalid day in SetHoliday") );
 
     wxCalendarDateAttr *attr = GetAttr(day);
     if ( !attr )
 
     wxCalendarDateAttr *attr = GetAttr(day);
     if ( !attr )
@@ -1840,7 +1842,7 @@ void wxGenericCalendarCtrl::ResetHolidayAttrs()
 
 void wxGenericCalendarCtrl::Mark(size_t day, bool mark)
 {
 
 void wxGenericCalendarCtrl::Mark(size_t day, bool mark)
 {
-    wxCHECK_RET( day > 0 && day < 32, _T("invalid day in Mark") );
+    wxCHECK_RET( day > 0 && day < 32, wxT("invalid day in Mark") );
 
     const wxCalendarDateAttr& m = wxCalendarDateAttr::GetMark();
     if (mark) {
 
     const wxCalendarDateAttr& m = wxCalendarDateAttr::GetMark();
     if (mark) {