]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/calctrl.cpp
use iterators in HtmlizeLinebreaks()
[wxWidgets.git] / src / msw / calctrl.cpp
index a44ba3ae36a79c357eae35d488561e3a855f8e7e..37bd62296f4cd327c1a38c68670583c76abea863 100644 (file)
@@ -56,6 +56,9 @@ wxCalendarCtrl::Create(wxWindow *parent,
     if ( !wxMSWDateControls::CheckInitialization() )
         return false;
 
+    // we need the arrows for the navigation
+    style |= wxWANTS_CHARS;
+
     // initialize the base class
     if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) )
         return false;
@@ -94,6 +97,8 @@ wxCalendarCtrl::Create(wxWindow *parent,
 
     UpdateMarks();
 
+    Connect(wxEVT_LEFT_DOWN,
+            wxMouseEventHandler(wxCalendarCtrl::MSWOnClick));
     Connect(wxEVT_LEFT_DCLICK,
             wxMouseEventHandler(wxCalendarCtrl::MSWOnDoubleClick));
 
@@ -325,7 +330,7 @@ void wxCalendarCtrl::UpdateMarks()
 {
     MONTHDAYSTATE states[3];
     const int nMonths = MonthCal_GetMonthRange(GetHwnd(), GMR_DAYSTATE, NULL);
-    wxCHECK_RET( nMonths <= WXSIZEOF(states), "unexpected months range" );
+    wxCHECK_RET( nMonths <= (int)WXSIZEOF(states), "unexpected months range" );
 
     for ( int i = 0; i < nMonths; i++ )
         states[i] = m_marks;
@@ -397,4 +402,13 @@ void wxCalendarCtrl::MSWOnDoubleClick(wxMouseEvent& event)
     event.Skip();
 }
 
+void wxCalendarCtrl::MSWOnClick(wxMouseEvent& event)
+{
+    // for some reason, the control doesn't get focus on its own when the user
+    // clicks in it
+    SetFocus();
+
+    event.Skip();
+}
+
 #endif // wxUSE_CALENDARCTRL