]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_spin.i
Removed calls to wx.InitAllImageHandlers.
[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
41class wxSpinButton : public wxControl
42{
43public:
2b9048c5
RD
44 %pythonAppend wxSpinButton "self._setOORInfo(self)"
45 %pythonAppend wxSpinButton() ""
d14a1e28
RD
46
47 wxSpinButton(wxWindow* parent, wxWindowID id = -1,
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 long style = wxSP_HORIZONTAL,
51 const wxString& name = wxPySPIN_BUTTON_NAME);
52 %name(PreSpinButton)wxSpinButton();
53
54 bool Create(wxWindow* parent, wxWindowID id = -1,
55 const wxPoint& pos = wxDefaultPosition,
56 const wxSize& size = wxDefaultSize,
57 long style = wxSP_HORIZONTAL,
58 const wxString& name = wxPySPIN_BUTTON_NAME);
59
60 virtual int GetValue() const;
61 virtual int GetMin() const;
62 virtual int GetMax() const;
63
64 virtual void SetValue(int val);
65 virtual void SetMin(int minVal);
66 virtual void SetMax(int maxVal);
67 virtual void SetRange(int minVal, int maxVal);
68
69 // is this spin button vertically oriented?
70 bool IsVertical() const;
880715c9
RD
71
72 static wxVisualAttributes
73 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
d14a1e28
RD
74};
75
76
77//---------------------------------------------------------------------------
78
79
80// a spin ctrl is a text control with a spin button which is usually used to
81// prompt the user for a numeric input
82
83class wxSpinCtrl : public wxControl
84{
85public:
2b9048c5
RD
86 %pythonAppend wxSpinCtrl "self._setOORInfo(self)"
87 %pythonAppend wxSpinCtrl() ""
d14a1e28
RD
88
89 wxSpinCtrl(wxWindow *parent,
90 wxWindowID id = -1,
91 const wxString& value = wxPyEmptyString,
92 const wxPoint& pos = wxDefaultPosition,
93 const wxSize& size = wxDefaultSize,
94 long style = wxSP_ARROW_KEYS,
95 int min = 0, int max = 100, int initial = 0,
96 const wxString& name = wxPySpinCtrlNameStr);
97 %name(PreSpinCtrl)wxSpinCtrl();
98
99 bool Create(wxWindow *parent,
100 wxWindowID id = -1,
101 const wxString& value = wxPyEmptyString,
102 const wxPoint& pos = wxDefaultPosition,
103 const wxSize& size = wxDefaultSize,
104 long style = wxSP_ARROW_KEYS,
105 int min = 0, int max = 100, int initial = 0,
106 const wxString& name = wxPySpinCtrlNameStr);
107
108 virtual int GetValue() const;
109 virtual void SetValue( int value );
110 %name(SetValueString) void SetValue(const wxString& text);
111
112 virtual void SetRange( int minVal, int maxVal );
113 virtual int GetMin() const;
114 virtual int GetMax() const;
d14a1e28 115 void SetSelection(long from, long to);
880715c9
RD
116
117 static wxVisualAttributes
118 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
d14a1e28
RD
119};
120
121
b1dfbb7a
RD
122//---------------------------------------------------------------------------
123
124class wxSpinEvent : public wxNotifyEvent
125{
126public:
127 wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
128
129 // get the current value of the control
130 int GetPosition() const;
131 void SetPosition(int pos);
132};
133
134
d14a1e28
RD
135%constant wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED;
136
137
138%pythoncode {
b1dfbb7a
RD
139EVT_SPIN_UP = wx.PyEventBinder( wx.wxEVT_SCROLL_LINEUP, 1)
140EVT_SPIN_DOWN = wx.PyEventBinder( wx.wxEVT_SCROLL_LINEDOWN, 1)
141EVT_SPIN = wx.PyEventBinder( wx.wxEVT_SCROLL_THUMBTRACK, 1)
142EVT_SPINCTRL = wx.PyEventBinder( wxEVT_COMMAND_SPINCTRL_UPDATED, 1)
d14a1e28
RD
143}
144
145
146//---------------------------------------------------------------------------