]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_spin.i
GetNumberOfLines on GTK doesn't count wrapped lines again...
[wxWidgets.git] / wxPython / src / _spin.i
CommitLineData
d14a1e28
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: _spin.i
3// Purpose: SWIG interface defs for wxSpinButton and wxSpinCtrl
4//
5// Author: Robin Dunn
6//
7// Created: 10-June-1998
8// RCS-ID: $Id$
9// Copyright: (c) 2003 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15
16//---------------------------------------------------------------------------
17
b2dc1044
RD
18MAKE_CONST_WXSTRING(SPIN_BUTTON_NAME);
19MAKE_CONST_WXSTRING2(SpinCtrlNameStr, _T("wxSpinCtrl"));
d14a1e28
RD
20
21//---------------------------------------------------------------------------
22%newgroup
23
24
25enum {
26 wxSP_HORIZONTAL,
27 wxSP_VERTICAL,
28 wxSP_ARROW_KEYS,
29 wxSP_WRAP
30};
31
32
33// The wxSpinButton is like a small scrollbar than is often placed next
34// to a text control.
35//
36// Styles:
37// wxSP_HORIZONTAL: horizontal spin button
38// wxSP_VERTICAL: vertical spin button (the default)
39// wxSP_ARROW_KEYS: arrow keys increment/decrement value
40// wxSP_WRAP: value wraps at either end
ab1f7d2a 41MustHaveApp(wxSpinButton);
d14a1e28
RD
42class wxSpinButton : public wxControl
43{
44public:
2b9048c5
RD
45 %pythonAppend wxSpinButton "self._setOORInfo(self)"
46 %pythonAppend wxSpinButton() ""
d14a1e28
RD
47
48 wxSpinButton(wxWindow* parent, wxWindowID id = -1,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize,
51 long style = wxSP_HORIZONTAL,
52 const wxString& name = wxPySPIN_BUTTON_NAME);
1b8c7ba6 53 %RenameCtor(PreSpinButton, wxSpinButton());
d14a1e28
RD
54
55 bool Create(wxWindow* parent, wxWindowID id = -1,
56 const wxPoint& pos = wxDefaultPosition,
57 const wxSize& size = wxDefaultSize,
58 long style = wxSP_HORIZONTAL,
59 const wxString& name = wxPySPIN_BUTTON_NAME);
60
61 virtual int GetValue() const;
62 virtual int GetMin() const;
63 virtual int GetMax() const;
64
65 virtual void SetValue(int val);
66 virtual void SetMin(int minVal);
67 virtual void SetMax(int maxVal);
68 virtual void SetRange(int minVal, int maxVal);
69
70 // is this spin button vertically oriented?
71 bool IsVertical() const;
880715c9
RD
72
73 static wxVisualAttributes
74 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
7012bb9f
RD
75
76 %property(Max, GetMax, SetMax, doc="See `GetMax` and `SetMax`");
77 %property(Min, GetMin, SetMin, doc="See `GetMin` and `SetMin`");
78 %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`");
d14a1e28
RD
79};
80
81
82//---------------------------------------------------------------------------
83
84
85// a spin ctrl is a text control with a spin button which is usually used to
86// prompt the user for a numeric input
87
ab1f7d2a
RD
88MustHaveApp(wxSpinCtrl);
89
d14a1e28
RD
90class wxSpinCtrl : public wxControl
91{
92public:
2b9048c5
RD
93 %pythonAppend wxSpinCtrl "self._setOORInfo(self)"
94 %pythonAppend wxSpinCtrl() ""
d14a1e28
RD
95
96 wxSpinCtrl(wxWindow *parent,
97 wxWindowID id = -1,
98 const wxString& value = wxPyEmptyString,
99 const wxPoint& pos = wxDefaultPosition,
100 const wxSize& size = wxDefaultSize,
101 long style = wxSP_ARROW_KEYS,
102 int min = 0, int max = 100, int initial = 0,
103 const wxString& name = wxPySpinCtrlNameStr);
1b8c7ba6 104 %RenameCtor(PreSpinCtrl, wxSpinCtrl());
d14a1e28
RD
105
106 bool Create(wxWindow *parent,
107 wxWindowID id = -1,
108 const wxString& value = wxPyEmptyString,
109 const wxPoint& pos = wxDefaultPosition,
110 const wxSize& size = wxDefaultSize,
111 long style = wxSP_ARROW_KEYS,
112 int min = 0, int max = 100, int initial = 0,
113 const wxString& name = wxPySpinCtrlNameStr);
114
115 virtual int GetValue() const;
116 virtual void SetValue( int value );
1b8c7ba6 117 %Rename(SetValueString, void, SetValue(const wxString& text));
d14a1e28
RD
118
119 virtual void SetRange( int minVal, int maxVal );
120 virtual int GetMin() const;
121 virtual int GetMax() const;
d14a1e28 122 void SetSelection(long from, long to);
880715c9
RD
123
124 static wxVisualAttributes
125 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
7012bb9f
RD
126
127 %property(Max, GetMax, doc="See `GetMax`");
128 %property(Min, GetMin, doc="See `GetMin`");
129 %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`");
d14a1e28
RD
130};
131
132
b1dfbb7a
RD
133//---------------------------------------------------------------------------
134
135class wxSpinEvent : public wxNotifyEvent
136{
137public:
138 wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
139
140 // get the current value of the control
141 int GetPosition() const;
142 void SetPosition(int pos);
7012bb9f
RD
143
144 %property(Position, GetPosition, SetPosition, doc="See `GetPosition` and `SetPosition`");
b1dfbb7a
RD
145};
146
147
d14a1e28
RD
148%constant wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED;
149
150
151%pythoncode {
b1dfbb7a
RD
152EVT_SPIN_UP = wx.PyEventBinder( wx.wxEVT_SCROLL_LINEUP, 1)
153EVT_SPIN_DOWN = wx.PyEventBinder( wx.wxEVT_SCROLL_LINEDOWN, 1)
154EVT_SPIN = wx.PyEventBinder( wx.wxEVT_SCROLL_THUMBTRACK, 1)
155EVT_SPINCTRL = wx.PyEventBinder( wxEVT_COMMAND_SPINCTRL_UPDATED, 1)
d14a1e28
RD
156}
157
158
159//---------------------------------------------------------------------------