../../src/common/socket.cpp \
../../src/common/statbar.cpp \
../../src/common/stockitem.cpp \
+../../src/common/stopwatch.cpp \
../../src/common/strconv.cpp \
../../src/common/stream.cpp \
../../src/common/string.cpp \
- native wxToggleButton implementation
- native wxRadioButton implementation
- native wxStaticText implementation
+- native wxDatePickerCtrl implementation
2.5.3
wxDatePickerCtrl is implemented as a small window showing the currently selected date.
The control can be edited using the keyboard, and can also display a popup
window for more user-friendly date selection, depending on the styles used and
-the platform.
+the platform, except PalmOS where date is selected using native dialog.
It is only available if \texttt{wxUSE\_DATEPICKCTRL} is set to $1$.
virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2);
virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const;
+ // send a notification event, return true if processed
+ bool SendClickEvent();
+
protected:
virtual wxSize DoGetBestSize() const;
// Default is 1
//
// Recommended setting: 1
-#define wxUSE_DATETIME 0
+#define wxUSE_DATETIME 1
// Set wxUSE_TIMER to 1 to compile wxTimer class
//
#define wxUSE_CHECKLISTBOX 0 // wxCheckListBox (requires wxUSE_OWNER_DRAWN)
#define wxUSE_CHOICE 0 // wxChoice
#define wxUSE_COMBOBOX 0 // wxComboBox
-#define wxUSE_DATEPICKCTRL 0 // wxDatePickerCtrl
+#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl
#define wxUSE_GAUGE 0 // wxGauge
#define wxUSE_LISTBOX 0 // wxListBox
#define wxUSE_LISTCTRL 0 // wxListCtrl
#endif
#if !defined(WX_TIMEZONE) && !defined(WX_GMTOFF_IN_TM)
- #if defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__)
+ #if defined(__WXPALMOS__)
+ #define WX_GMTOFF_IN_TM
+ #elif defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__)
#define WX_TIMEZONE _timezone
#elif defined(__MWERKS__)
long wxmw_timezone = 28800;
}
else // may be either day or year
{
- wxDateTime_t maxDays = (wxDateTime_t)(
+ wxDateTime_t max_days = (wxDateTime_t)(
haveMon
? GetNumOfDaysInMonth(haveYear ? year : Inv_Year, mon)
: 31
);
// can it be day?
- if ( (val == 0) || (val > (unsigned long)maxDays) )
+ if ( (val == 0) || (val > (unsigned long)max_days) )
{
// no
isYear = true;
wxString label;
if ( dt.IsValid() )
- label = _T("test2");
+ label = dt.FormatDate();
- ig(!wxControl::PalmCreateControl(selectorTriggerCtl, label, pos, size))
+ if(!wxControl::PalmCreateControl(selectorTriggerCtl, label, pos, size))
return false;
return true;
wxSize wxDatePickerCtrl::DoGetBestSize() const
{
- const int y = GetCharHeight();
-
- return wxSize(DEFAULT_ITEM_WIDTH, EDIT_HEIGHT_FROM_CHAR_HEIGHT(y));
+ return wxSize(16,16);
}
// ----------------------------------------------------------------------------
void wxDatePickerCtrl::SetValue(const wxDateTime& dt)
{
- SetLabel(_T("test1"));
+ if ( dt.IsValid() )
+ SetLabel(dt.FormatDate());
+ else
+ SetLabel(wxEmptyString);
}
wxDateTime wxDatePickerCtrl::GetValue() const
return false;
}
+// ----------------------------------------------------------------------------
+// helpers
+// ----------------------------------------------------------------------------
+
+bool wxDatePickerCtrl::SendClickEvent()
+{
+ wxDateTime dt(wxDateTime::Today());
+ int16_t month = dt.GetMonth();
+ int16_t day = dt.GetDay();
+ int16_t year = dt.GetYear();
+
+ if(SelectDay(selectDayByMonth,&month,&day,&year,_T("Pick date")));
+}
+
#endif // wxUSE_DATEPICKCTRL
#include "wx/radiobut.h"
#include "wx/tglbtn.h"
#include "wx/slider.h"
+#include "wx/datectrl.h"
// ----------------------------------------------------------------------------
// globals
if(win==NULL)
return false;
+#if wxUSE_BUTTON
wxButton* button = wxDynamicCast(win,wxButton);
if(button)
return button->SendClickEvent();
+#endif // wxUSE_BUTTON
+#if wxUSE_CHECKBOX
wxCheckBox* checkbox = wxDynamicCast(win,wxCheckBox);
if(checkbox)
return checkbox->SendClickEvent();
+#endif // wxUSE_CHECKBOX
+#if wxUSE_TOGGLEBTN
wxToggleButton* toggle = wxDynamicCast(win,wxToggleButton);
if(toggle)
return toggle->SendClickEvent();
+#endif // wxUSE_TOGGLEBTN
+#if wxUSE_RADIOBTN
wxRadioButton* radio = wxDynamicCast(win,wxRadioButton);
if(radio)
return radio->SendClickEvent();
+#endif // wxUSE_RADIOBTN
+#if wxUSE_DATEPICKCTRL
+ wxDatePickerCtrl* datepicker = wxDynamicCast(win,wxDatePickerCtrl);
+ if(datepicker)
+ return datepicker->SendClickEvent();
+#endif // wxUSE_DATEPICKCTRL
+
+#if wxUSE_SLIDER
wxSlider* slider = wxDynamicCast(win,wxSlider);
if(slider)
return slider->SendUpdatedEvent();
+#endif // wxUSE_SLIDER
return false;
}
if(win==NULL)
return false;
+#if wxUSE_SLIDER
wxSlider* slider = wxDynamicCast(win,wxSlider);
if(slider)
return slider->SendScrollEvent(event);
+#endif // wxUSE_SLIDER
return false;
}