diff --git a/wxPython/demo/DatePickerCtrl.py b/wxPython/demo/DatePickerCtrl.py
new file mode 100644
index 0000000000..82eb6eda27
--- /dev/null
+++ b/wxPython/demo/DatePickerCtrl.py
@@ -0,0 +1,49 @@
+
+import wx
+
+#----------------------------------------------------------------------
+
+class TestPanel(wx.Panel):
+ def __init__(self, parent, log):
+ self.log = log
+ wx.Panel.__init__(self, parent, -1)
+
+ dpc = wx.DatePickerCtrl(self, size=(120,-1),
+ style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY)
+
+ sizer = wx.BoxSizer(wx.VERTICAL)
+ sizer.Add(dpc, 0, wx.ALL, 50)
+
+ self.SetSizer(sizer)
+
+
+#----------------------------------------------------------------------
+
+def runTest(frame, nb, log):
+ win = TestPanel(nb, log)
+ return win
+
+#----------------------------------------------------------------------
+
+
+
+overview = """
+wx.DatePickerCtrl
+
+This control allows the user to select a date. Unlike
+wx.calendar.CalendarCtrl, which is a relatively big control,
+wx.DatePickerCtrl 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.
+
+
+"""
+
+
+
+if __name__ == '__main__':
+ import sys,os
+ import run
+ run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
+
diff --git a/wxPython/demo/Dialog.py b/wxPython/demo/Dialog.py
index 5cef4815ea..8897c26e86 100644
--- a/wxPython/demo/Dialog.py
+++ b/wxPython/demo/Dialog.py
@@ -71,12 +71,13 @@ class TestDialog(wx.Dialog):
btn = wx.Button(self, wx.ID_OK)
btn.SetHelpText("The OK button completes the dialog")
+ btn.SetDefault()
btnsizer.AddButton(btn)
btn = wx.Button(self, wx.ID_CANCEL)
btn.SetHelpText("The Cancel button cnacels the dialog. (Cool, huh?)")
btnsizer.AddButton(btn)
- btnsizer.Finalise()
+ btnsizer.Realize()
sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
diff --git a/wxPython/docs/CHANGES.txt b/wxPython/docs/CHANGES.txt
index d5affae4eb..1ca38daee8 100644
--- a/wxPython/docs/CHANGES.txt
+++ b/wxPython/docs/CHANGES.txt
@@ -17,7 +17,7 @@ consecutive (there may be intervening controls). Without this fix, an
out-of-sync assert is generated when clicking on a radio button and
then calling GetValue().
-XRC:
+Some XRC changes:
- Added 'icon' property to wxFrame and wxDialog
- No longer ignores menu bitmaps on non-MSW platforms
- Notebook page bitmaps are now supported
@@ -33,7 +33,7 @@ wx.GetPasswordFromUser dialog function.
OGL patch from Shane Holloway:
Two simple problems found in the new python ogl code. First is
- the patch for _canvas.py. Essentially:
+ the patch for _canvas.py. Essentially::
dx = abs(dc.LogicalToDeviceX(x - self._firstDragX))
dy = abs(dc.LogicalToDeviceY(y - self._firstDragY))
@@ -112,7 +112,7 @@ original patch were changed/removed, so we are still not free of
patches. A new patch for SWIG is located in the wxPython/SWIG
directory of the wxPython source tree. SWIG 1.3.24 plus this patch
should be used by anyone who is making custom modifications to
-wxPython's *.i files, or building their own extension modules or
+wxPython's .i files, or building their own extension modules or
etc. that need to interact with the wxPython swigged types. For the
morbidly curious, here are a few more details:
@@ -170,7 +170,7 @@ and GTK+'s context menu code.
wxGTK: Applied patch #1100327 for correct feedback from DND actions
(not all actions are allowed).
-Fixed memory leak in wxGRID::UpdateAttr[Rows][Or][Cols] (patch 1104355)
+Fixed memory leak in wxGrid::UpdateAttr[Rows][Or][Cols] (patch 1104355)
For efficiency reasons, text controls no longer set the string for
each text updated event, but rather query for the string value only
@@ -183,9 +183,6 @@ Several patches applied, such as #1111174, #1110252 and others, that
make the generic wx.TreeCtrl (used on wxGTK and wxMac) be more
conistent with the wxMSW native wx.TreeCtrl.
-wxMac: wx.DC implemented using CoreGraphics
- ??? NEED MORE DETAILS HERE ???
-
XRCed:
* Edit->Locate command (Ctrl-L) for quick selection of items.
Works with event-handling controls (buttons, text fields) but
@@ -198,17 +195,31 @@ wxMac: Fixed a long-standing issue where wxSlider controls with a
hardcoded size would misplace their labels behind the slider control.
wx.HtmlListBox fixed so calling RefreshLine(s) will cause the data for
-that line to be refetched from the derived class.
+that line to be refetched from the overridden methods in the derived
+class.
The default DoGetBestSize now includes the difference (if any) between
-the client size and total size of the window. Code that sets the
-client size using the best size, or that added extra space to sizers
-to compensate for this bug may need to be changed.
+the client size and total size of the window, (such as the size of
+borders.) Code that sets the client size using the best size, or that
+added extra space to sizers to compensate for this bug may need to be
+changed.
-Can suppress themed notebook page with wxNB_NOPAGETHEME or
-setting system option msw.notebook.themed-background to 0
+Can suppress themed notebook pages with the wxNB_NOPAGETHEME style or
+setting system option msw.notebook.themed-background to 0.
+wxSyledTextCtrl updated to use Scintilla 1.62.
+Can now set the msw.window.no-clip-children system option to 1 to
+eliminate weird refresh behaviour (delays between a window being
+erased and repainted, giving a ghostly gradual-redraw effect). May be
+a temporary 'fix' until properly fixed before 2.6.
+
+wxMac: CoreGraphics [[WRITE MORE HERE]]
+
+wxMac: Toolbar is now more native looking with borderless toolbar
+buttons.
+
+Added wx.DatePickerCtrl.
diff --git a/wxPython/setup.py b/wxPython/setup.py
index 4438af8fb2..23e701403f 100755
--- a/wxPython/setup.py
+++ b/wxPython/setup.py
@@ -264,6 +264,7 @@ swig_sources = run_swig(['controls.i'], 'src', GENDIR, PKGDIR,
'src/_pycontrol.i',
'src/_cshelp.i',
'src/_dragimg.i',
+ 'src/_datectrl.i',
],
True)
ext = Extension('_controls_', swig_sources,
diff --git a/wxPython/src/_datectrl.i b/wxPython/src/_datectrl.i
new file mode 100644
index 0000000000..fa6ded1e2b
--- /dev/null
+++ b/wxPython/src/_datectrl.i
@@ -0,0 +1,179 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: _datectrl.i
+// Purpose: SWIG interface defs for wxwxDatePickerCtrl
+//
+// Author: Robin Dunn
+//
+// Created: 15-Feb-2005
+// RCS-ID: $Id$
+// Copyright: (c) 2005 by Total Control Software
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// Not a %module
+
+
+//---------------------------------------------------------------------------
+
+MAKE_CONST_WXSTRING(DatePickerCtrlNameStr);
+
+//---------------------------------------------------------------------------
+%newgroup
+
+DocStr(wxDatePickerCtrl,
+"This control allows the user to select a date. Unlike
+`wx.calendar.CalendarCtrl`, which is a relatively big control,
+`wx.DatePickerCtrl` 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.", "
+
+Styles
+------
+ ================= ======================================================
+ wx.DP_SPIN Creates a control without month calendar drop down but
+ with spin control-like arrows to change individual
+ date components. This style is not supported by the
+ generic version.
+
+ wx.DP_DROPDOWN Creates a control with a month calendar drop down
+ part from which the user can select a date.
+
+ wx.DP_DEFAULT Creates a control with default style which is the
+ best supported for the current platform
+ (currently wx.DP_SPIN under Windows and
+ wx.DP_DROPDOWN elsewhere).
+
+ wx.DP_ALLOWNONE With this style, the control allows the user to not
+ enter any valid date at all. Without it -- which
+ is by default -- the control always has some
+ valid date.
+
+ wx.DP_SHOWCENTURY Forces display of the century in the default
+ date format. Without this flas the century
+ could be displayed or not depending on the
+ default date representation in the system.
+ ================= ======================================================
+
+Events
+------
+
+ ================= ======================================================
+ EVT_DATE_CHANGED This event fires when the user changes the current
+ selection in the control.
+ ================= ======================================================
+
+:see: `wx.calendar.CalendarCtrl`, `wx.DateEvent`
+");
+
+
+
+
+enum
+{
+ wxDP_DEFAULT = 0,
+ wxDP_SPIN = 1,
+ wxDP_DROPDOWN = 2,
+ wxDP_SHOWCENTURY = 4,
+ wxDP_ALLOWNONE = 8
+};
+
+
+MustHaveApp(wxDatePickerCtrl);
+
+class wxDatePickerCtrl : public wxControl
+{
+public:
+ %pythonAppend wxDatePickerCtrl "self._setOORInfo(self)";
+ %pythonAppend wxDatePickerCtrl() "";
+
+ DocCtorStr(
+ wxDatePickerCtrl(wxWindow *parent,
+ wxWindowID id=-1,
+ const wxDateTime& dt = wxDefaultDateTime,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxPyDatePickerCtrlNameStr),
+ "Create a new DatePickerCtrl.", "");
+
+
+ DocCtorStrName(
+ wxDatePickerCtrl(),
+ "Precreate a DatePickerCtrl for use in 2-phase creation.", "",
+ PreDatePickerCtrl);
+
+
+ DocDeclStr(
+ bool , Create(wxWindow *parent,
+ wxWindowID id=-1,
+ const wxDateTime& dt = wxDefaultDateTime,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxPyDatePickerCtrlNameStr),
+ "Create the GUI parts of the DatePickerCtrl, for use in 2-phase
+creation.", "");
+
+
+
+ DocDeclStr(
+ virtual void , SetValue(const wxDateTime& dt),
+ "Changes the current value of the control. The date should be valid and
+included in the currently selected range, if any.
+
+Calling this method does not result in a date change event.", "");
+
+ DocDeclStr(
+ virtual wxDateTime , GetValue() const,
+ "Returns the currently selected date. If there is no selection or the
+selection is outside of the current range, an invalid `wx.DateTime`
+object is returned.", "");
+
+
+ DocDeclStr(
+ virtual void , SetRange(const wxDateTime& dt1, const wxDateTime& dt2),
+ "Sets the valid range for the date selection. If dt1 is valid, it
+becomes the earliest date (inclusive) accepted by the control. If dt2
+is valid, it becomes the latest possible date.
+
+If the current value of the control is outside of the newly set range
+bounds, the behaviour is undefined.", "");
+
+ // virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const;
+
+ %extend {
+ DocStr(
+ GetLowerLimit,
+ "Get the lower limit of the valid range for the date selection, if any.
+If there is no range or there is no lower limit, then the
+`wx.DateTime` value returned will be invalid.", "");
+ wxDateTime GetLowerLimit() {
+ wxDateTime rv;
+ self->GetRange(&rv, NULL);
+ return rv;
+ }
+
+
+ DocStr(
+ GetUpperLimit,
+ "Get the upper limit of the valid range for the date selection, if any.
+If there is no range or there is no upper limit, then the
+`wx.DateTime` value returned will be invalid.", "");
+ wxDateTime GetUpperLimit() {
+ wxDateTime rv;
+ self->GetRange(NULL, &rv);
+ return rv;
+ }
+ }
+
+};
+
+
+
+
+//---------------------------------------------------------------------------
+
+
diff --git a/wxPython/src/_event.i b/wxPython/src/_event.i
index 8feb6f6934..b564f3ef59 100644
--- a/wxPython/src/_event.i
+++ b/wxPython/src/_event.i
@@ -1273,4 +1273,22 @@ public:
//---------------------------------------------------------------------------
+class wxDateEvent : public wxCommandEvent
+{
+public:
+ wxDateEvent(wxWindow *win, const wxDateTime& dt, wxEventType type);
+ const wxDateTime& GetDate() const;
+ void SetDate(const wxDateTime &date);
+
+};
+
+
+%constant wxEventType wxEVT_DATE_CHANGED;
+
+%pythoncode {
+ EVT_DATE_CHANGED = wx.PyEventBinder( wxEVT_DATE_CHANGED, 1 )
+}
+
+
+//---------------------------------------------------------------------------
diff --git a/wxPython/src/calendar.i b/wxPython/src/calendar.i
index 7dfc184c9b..7225d98553 100644
--- a/wxPython/src/calendar.i
+++ b/wxPython/src/calendar.i
@@ -109,13 +109,11 @@ public:
class wxCalendarCtrl;
-class wxCalendarEvent : public wxCommandEvent
+class wxCalendarEvent : public wxDateEvent
{
public:
wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type);
- const wxDateTime GetDate() const;
- void SetDate(const wxDateTime &date);
void SetWeekDay(const wxDateTime::WeekDay wd);
wxDateTime::WeekDay GetWeekDay() const;
@@ -174,7 +172,7 @@ and font and without border, but setting custom attributes with
SetAttr allows to modify its appearance. Just create a custom
attribute object and set it for the day you want to be displayed
specially A day may be marked as being a holiday, (even if it is not
-recognized as one by wx.DateTime) by using the SetHoliday method.
+recognized as one by `wx.DateTime`) by using the SetHoliday method.
As the attributes are specified for each day, they may change when the
month is changed, so you will often want to update them in an