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:
Włodzimierz Skiba
2005-02-15 07:24:37 +00:00
parent a63b47551e
commit 6a27c749b3
8 changed files with 53 additions and 12 deletions

View File

@@ -152,6 +152,7 @@ SOURCES = ../../samples/minimal/minimal.cpp \
../../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 \

View File

@@ -140,6 +140,7 @@ wxPalmOS:
- native wxToggleButton implementation
- native wxRadioButton implementation
- native wxStaticText implementation
- native wxDatePickerCtrl implementation
2.5.3

View File

@@ -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.
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$.

View File

@@ -53,6 +53,9 @@ public:
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;

View File

@@ -311,7 +311,7 @@
// Default is 1
//
// Recommended setting: 1
#define wxUSE_DATETIME 0
#define wxUSE_DATETIME 1
// Set wxUSE_TIMER to 1 to compile wxTimer class
//
@@ -519,7 +519,7 @@
#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

View File

@@ -120,7 +120,9 @@ wxCUSTOM_TYPE_INFO(wxDateTime, wxToStringConverter<wxDateTime> , wxFromStringCon
#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;
@@ -3563,14 +3565,14 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
}
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;

View File

@@ -59,9 +59,9 @@ bool wxDatePickerCtrl::Create(wxWindow *parent,
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;
@@ -73,9 +73,7 @@ bool wxDatePickerCtrl::Create(wxWindow *parent,
wxSize wxDatePickerCtrl::DoGetBestSize() const
{
const int y = GetCharHeight();
return wxSize(DEFAULT_ITEM_WIDTH, EDIT_HEIGHT_FROM_CHAR_HEIGHT(y));
return wxSize(16,16);
}
// ----------------------------------------------------------------------------
@@ -84,7 +82,10 @@ wxSize wxDatePickerCtrl::DoGetBestSize() const
void wxDatePickerCtrl::SetValue(const wxDateTime& dt)
{
SetLabel(_T("test1"));
if ( dt.IsValid() )
SetLabel(dt.FormatDate());
else
SetLabel(wxEmptyString);
}
wxDateTime wxDatePickerCtrl::GetValue() const
@@ -105,5 +106,19 @@ bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) 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

View File

@@ -48,6 +48,7 @@
#include "wx/radiobut.h"
#include "wx/tglbtn.h"
#include "wx/slider.h"
#include "wx/datectrl.h"
// ----------------------------------------------------------------------------
// globals
@@ -257,25 +258,41 @@ bool wxTopLevelWindowPalm::HandleControlSelect(EventType* event)
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;
}
@@ -288,9 +305,11 @@ bool wxTopLevelWindowPalm::HandleControlRepeat(EventType* event)
if(win==NULL)
return false;
#if wxUSE_SLIDER
wxSlider* slider = wxDynamicCast(win,wxSlider);
if(slider)
return slider->SendScrollEvent(event);
#endif // wxUSE_SLIDER
return false;
}