wxDatePicker and wxDateTime for PalmOS. Remove conflict with internal maxDays in PalmOS. #if wxUSE_XXX for limited builds.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32064 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -152,6 +152,7 @@ SOURCES = ../../samples/minimal/minimal.cpp \
|
|||||||
../../src/common/socket.cpp \
|
../../src/common/socket.cpp \
|
||||||
../../src/common/statbar.cpp \
|
../../src/common/statbar.cpp \
|
||||||
../../src/common/stockitem.cpp \
|
../../src/common/stockitem.cpp \
|
||||||
|
../../src/common/stopwatch.cpp \
|
||||||
../../src/common/strconv.cpp \
|
../../src/common/strconv.cpp \
|
||||||
../../src/common/stream.cpp \
|
../../src/common/stream.cpp \
|
||||||
../../src/common/string.cpp \
|
../../src/common/string.cpp \
|
||||||
|
@@ -140,6 +140,7 @@ wxPalmOS:
|
|||||||
- native wxToggleButton implementation
|
- native wxToggleButton implementation
|
||||||
- native wxRadioButton implementation
|
- native wxRadioButton implementation
|
||||||
- native wxStaticText implementation
|
- native wxStaticText implementation
|
||||||
|
- native wxDatePickerCtrl implementation
|
||||||
|
|
||||||
|
|
||||||
2.5.3
|
2.5.3
|
||||||
|
@@ -15,7 +15,7 @@ This control allows the user to select a date. Unlike
|
|||||||
wxDatePickerCtrl is implemented as a small window showing the currently selected date.
|
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
|
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
|
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$.
|
It is only available if \texttt{wxUSE\_DATEPICKCTRL} is set to $1$.
|
||||||
|
|
||||||
|
@@ -53,6 +53,9 @@ public:
|
|||||||
virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2);
|
virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2);
|
||||||
virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const;
|
virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const;
|
||||||
|
|
||||||
|
// send a notification event, return true if processed
|
||||||
|
bool SendClickEvent();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
|
@@ -311,7 +311,7 @@
|
|||||||
// Default is 1
|
// Default is 1
|
||||||
//
|
//
|
||||||
// Recommended setting: 1
|
// Recommended setting: 1
|
||||||
#define wxUSE_DATETIME 0
|
#define wxUSE_DATETIME 1
|
||||||
|
|
||||||
// Set wxUSE_TIMER to 1 to compile wxTimer class
|
// Set wxUSE_TIMER to 1 to compile wxTimer class
|
||||||
//
|
//
|
||||||
@@ -519,7 +519,7 @@
|
|||||||
#define wxUSE_CHECKLISTBOX 0 // wxCheckListBox (requires wxUSE_OWNER_DRAWN)
|
#define wxUSE_CHECKLISTBOX 0 // wxCheckListBox (requires wxUSE_OWNER_DRAWN)
|
||||||
#define wxUSE_CHOICE 0 // wxChoice
|
#define wxUSE_CHOICE 0 // wxChoice
|
||||||
#define wxUSE_COMBOBOX 0 // wxComboBox
|
#define wxUSE_COMBOBOX 0 // wxComboBox
|
||||||
#define wxUSE_DATEPICKCTRL 0 // wxDatePickerCtrl
|
#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl
|
||||||
#define wxUSE_GAUGE 0 // wxGauge
|
#define wxUSE_GAUGE 0 // wxGauge
|
||||||
#define wxUSE_LISTBOX 0 // wxListBox
|
#define wxUSE_LISTBOX 0 // wxListBox
|
||||||
#define wxUSE_LISTCTRL 0 // wxListCtrl
|
#define wxUSE_LISTCTRL 0 // wxListCtrl
|
||||||
|
@@ -120,7 +120,9 @@ wxCUSTOM_TYPE_INFO(wxDateTime, wxToStringConverter<wxDateTime> , wxFromStringCon
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(WX_TIMEZONE) && !defined(WX_GMTOFF_IN_TM)
|
#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
|
#define WX_TIMEZONE _timezone
|
||||||
#elif defined(__MWERKS__)
|
#elif defined(__MWERKS__)
|
||||||
long wxmw_timezone = 28800;
|
long wxmw_timezone = 28800;
|
||||||
@@ -3563,14 +3565,14 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
|
|||||||
}
|
}
|
||||||
else // may be either day or year
|
else // may be either day or year
|
||||||
{
|
{
|
||||||
wxDateTime_t maxDays = (wxDateTime_t)(
|
wxDateTime_t max_days = (wxDateTime_t)(
|
||||||
haveMon
|
haveMon
|
||||||
? GetNumOfDaysInMonth(haveYear ? year : Inv_Year, mon)
|
? GetNumOfDaysInMonth(haveYear ? year : Inv_Year, mon)
|
||||||
: 31
|
: 31
|
||||||
);
|
);
|
||||||
|
|
||||||
// can it be day?
|
// can it be day?
|
||||||
if ( (val == 0) || (val > (unsigned long)maxDays) )
|
if ( (val == 0) || (val > (unsigned long)max_days) )
|
||||||
{
|
{
|
||||||
// no
|
// no
|
||||||
isYear = true;
|
isYear = true;
|
||||||
|
@@ -59,9 +59,9 @@ bool wxDatePickerCtrl::Create(wxWindow *parent,
|
|||||||
wxString label;
|
wxString label;
|
||||||
|
|
||||||
if ( dt.IsValid() )
|
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 false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -73,9 +73,7 @@ bool wxDatePickerCtrl::Create(wxWindow *parent,
|
|||||||
|
|
||||||
wxSize wxDatePickerCtrl::DoGetBestSize() const
|
wxSize wxDatePickerCtrl::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
const int y = GetCharHeight();
|
return wxSize(16,16);
|
||||||
|
|
||||||
return wxSize(DEFAULT_ITEM_WIDTH, EDIT_HEIGHT_FROM_CHAR_HEIGHT(y));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -84,7 +82,10 @@ wxSize wxDatePickerCtrl::DoGetBestSize() const
|
|||||||
|
|
||||||
void wxDatePickerCtrl::SetValue(const wxDateTime& dt)
|
void wxDatePickerCtrl::SetValue(const wxDateTime& dt)
|
||||||
{
|
{
|
||||||
SetLabel(_T("test1"));
|
if ( dt.IsValid() )
|
||||||
|
SetLabel(dt.FormatDate());
|
||||||
|
else
|
||||||
|
SetLabel(wxEmptyString);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDateTime wxDatePickerCtrl::GetValue() const
|
wxDateTime wxDatePickerCtrl::GetValue() const
|
||||||
@@ -105,5 +106,19 @@ bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) const
|
|||||||
return false;
|
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
|
#endif // wxUSE_DATEPICKCTRL
|
||||||
|
|
||||||
|
@@ -48,6 +48,7 @@
|
|||||||
#include "wx/radiobut.h"
|
#include "wx/radiobut.h"
|
||||||
#include "wx/tglbtn.h"
|
#include "wx/tglbtn.h"
|
||||||
#include "wx/slider.h"
|
#include "wx/slider.h"
|
||||||
|
#include "wx/datectrl.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// globals
|
// globals
|
||||||
@@ -257,25 +258,41 @@ bool wxTopLevelWindowPalm::HandleControlSelect(EventType* event)
|
|||||||
if(win==NULL)
|
if(win==NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#if wxUSE_BUTTON
|
||||||
wxButton* button = wxDynamicCast(win,wxButton);
|
wxButton* button = wxDynamicCast(win,wxButton);
|
||||||
if(button)
|
if(button)
|
||||||
return button->SendClickEvent();
|
return button->SendClickEvent();
|
||||||
|
#endif // wxUSE_BUTTON
|
||||||
|
|
||||||
|
#if wxUSE_CHECKBOX
|
||||||
wxCheckBox* checkbox = wxDynamicCast(win,wxCheckBox);
|
wxCheckBox* checkbox = wxDynamicCast(win,wxCheckBox);
|
||||||
if(checkbox)
|
if(checkbox)
|
||||||
return checkbox->SendClickEvent();
|
return checkbox->SendClickEvent();
|
||||||
|
#endif // wxUSE_CHECKBOX
|
||||||
|
|
||||||
|
#if wxUSE_TOGGLEBTN
|
||||||
wxToggleButton* toggle = wxDynamicCast(win,wxToggleButton);
|
wxToggleButton* toggle = wxDynamicCast(win,wxToggleButton);
|
||||||
if(toggle)
|
if(toggle)
|
||||||
return toggle->SendClickEvent();
|
return toggle->SendClickEvent();
|
||||||
|
#endif // wxUSE_TOGGLEBTN
|
||||||
|
|
||||||
|
#if wxUSE_RADIOBTN
|
||||||
wxRadioButton* radio = wxDynamicCast(win,wxRadioButton);
|
wxRadioButton* radio = wxDynamicCast(win,wxRadioButton);
|
||||||
if(radio)
|
if(radio)
|
||||||
return radio->SendClickEvent();
|
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);
|
wxSlider* slider = wxDynamicCast(win,wxSlider);
|
||||||
if(slider)
|
if(slider)
|
||||||
return slider->SendUpdatedEvent();
|
return slider->SendUpdatedEvent();
|
||||||
|
#endif // wxUSE_SLIDER
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -288,9 +305,11 @@ bool wxTopLevelWindowPalm::HandleControlRepeat(EventType* event)
|
|||||||
if(win==NULL)
|
if(win==NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#if wxUSE_SLIDER
|
||||||
wxSlider* slider = wxDynamicCast(win,wxSlider);
|
wxSlider* slider = wxDynamicCast(win,wxSlider);
|
||||||
if(slider)
|
if(slider)
|
||||||
return slider->SendScrollEvent(event);
|
return slider->SendScrollEvent(event);
|
||||||
|
#endif // wxUSE_SLIDER
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user