X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d14a1e28567de23c586bc80017073d0c39f8d18f..ef8e4bf082ce8ac5339e296748441408501c55ed:/wxPython/src/_spin.i diff --git a/wxPython/src/_spin.i b/wxPython/src/_spin.i index 8802d40d7d..fc01e4fa48 100644 --- a/wxPython/src/_spin.i +++ b/wxPython/src/_spin.i @@ -15,11 +15,8 @@ //--------------------------------------------------------------------------- -%{ - DECLARE_DEF_STRING(SPIN_BUTTON_NAME); - wxChar* wxSpinCtrlNameStr = _T("wxSpinCtrl"); - DECLARE_DEF_STRING(SpinCtrlNameStr); -%} +MAKE_CONST_WXSTRING(SPIN_BUTTON_NAME); +MAKE_CONST_WXSTRING2(SpinCtrlNameStr, _T("wxSpinCtrl")); //--------------------------------------------------------------------------- %newgroup @@ -41,18 +38,19 @@ enum { // wxSP_VERTICAL: vertical spin button (the default) // wxSP_ARROW_KEYS: arrow keys increment/decrement value // wxSP_WRAP: value wraps at either end +MustHaveApp(wxSpinButton); class wxSpinButton : public wxControl { public: - %addtofunc wxSpinButton "self._setOORInfo(self)" - %addtofunc wxSpinButton() "" + %pythonAppend wxSpinButton "self._setOORInfo(self)" + %pythonAppend wxSpinButton() "" wxSpinButton(wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxSP_HORIZONTAL, const wxString& name = wxPySPIN_BUTTON_NAME); - %name(PreSpinButton)wxSpinButton(); + %RenameCtor(PreSpinButton, wxSpinButton()); bool Create(wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, @@ -71,6 +69,13 @@ public: // is this spin button vertically oriented? bool IsVertical() const; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + %property(Max, GetMax, SetMax, doc="See `GetMax` and `SetMax`"); + %property(Min, GetMin, SetMin, doc="See `GetMin` and `SetMin`"); + %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`"); }; @@ -80,11 +85,13 @@ public: // a spin ctrl is a text control with a spin button which is usually used to // prompt the user for a numeric input +MustHaveApp(wxSpinCtrl); + class wxSpinCtrl : public wxControl { public: - %addtofunc wxSpinCtrl "self._setOORInfo(self)" - %addtofunc wxSpinCtrl() "" + %pythonAppend wxSpinCtrl "self._setOORInfo(self)" + %pythonAppend wxSpinCtrl() "" wxSpinCtrl(wxWindow *parent, wxWindowID id = -1, @@ -94,7 +101,7 @@ public: long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = wxPySpinCtrlNameStr); - %name(PreSpinCtrl)wxSpinCtrl(); + %RenameCtor(PreSpinCtrl, wxSpinCtrl()); bool Create(wxWindow *parent, wxWindowID id = -1, @@ -107,19 +114,34 @@ public: virtual int GetValue() const; virtual void SetValue( int value ); - %name(SetValueString) void SetValue(const wxString& text); + %Rename(SetValueString, void, SetValue(const wxString& text)); virtual void SetRange( int minVal, int maxVal ); virtual int GetMin() const; virtual int GetMax() const; -#ifdef __WXGTK__ - %extend { - void SetSelection(long from, long to) { - } - } -#else void SetSelection(long from, long to); -#endif + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + %property(Max, GetMax, doc="See `GetMax`"); + %property(Min, GetMin, doc="See `GetMin`"); + %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`"); +}; + + +//--------------------------------------------------------------------------- + +class wxSpinEvent : public wxNotifyEvent +{ +public: + wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); + + // get the current value of the control + int GetPosition() const; + void SetPosition(int pos); + + %property(Position, GetPosition, SetPosition, doc="See `GetPosition` and `SetPosition`"); }; @@ -127,7 +149,10 @@ public: %pythoncode { -EVT_SPINCTRL = wx.PyEventBinder( wxEVT_COMMAND_SPINCTRL_UPDATED, 1) +EVT_SPIN_UP = wx.PyEventBinder( wx.wxEVT_SCROLL_LINEUP, 1) +EVT_SPIN_DOWN = wx.PyEventBinder( wx.wxEVT_SCROLL_LINEDOWN, 1) +EVT_SPIN = wx.PyEventBinder( wx.wxEVT_SCROLL_THUMBTRACK, 1) +EVT_SPINCTRL = wx.PyEventBinder( wxEVT_COMMAND_SPINCTRL_UPDATED, 1) }