]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _combobox.i | |
3 | // Purpose: SWIG interface defs for wxComboBox | |
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 | 18 | MAKE_CONST_WXSTRING(ComboBoxNameStr); |
d14a1e28 RD |
19 | |
20 | //--------------------------------------------------------------------------- | |
21 | %newgroup; | |
22 | ||
23 | ||
6ad421ae | 24 | DocStr(wxComboBox, |
d07d2bc9 RD |
25 | "A combobox is like a combination of an edit control and a |
26 | listbox. It can be displayed as static list with editable or | |
27 | read-only text field; or a drop-down list with text field. | |
28 | ||
29 | A combobox permits a single selection only. Combobox items are | |
30 | numbered from zero.", " | |
31 | ||
32 | Styles | |
33 | ------ | |
34 | ================ =============================================== | |
35 | wx.CB_SIMPLE Creates a combobox with a permanently | |
36 | displayed list. Windows only. | |
37 | ||
38 | wx.CB_DROPDOWN Creates a combobox with a drop-down list. | |
39 | ||
40 | wx.CB_READONLY Same as wxCB_DROPDOWN but only the strings | |
41 | specified as the combobox choices can be | |
42 | selected, it is impossible to select | |
43 | (even from a program) a string which is | |
44 | not in the choices list. | |
45 | ||
46 | wx.CB_SORT Sorts the entries in the list alphabetically. | |
47 | ================ =============================================== | |
48 | ||
49 | Events | |
50 | ------- | |
51 | ================ =============================================== | |
52 | EVT_COMBOBOX Sent when an item on the list is selected. | |
b7287719 RD |
53 | Note that calling `GetValue` in this handler |
54 | will return the newly selected value. | |
d07d2bc9 RD |
55 | EVT_TEXT Sent when the combobox text changes. |
56 | ================ =============================================== | |
6ad421ae RD |
57 | "); |
58 | ||
59 | ||
60 | ||
ab1f7d2a RD |
61 | MustHaveApp(wxComboBox); |
62 | ||
d14a1e28 RD |
63 | #ifdef __WXMSW__ |
64 | class wxComboBox : public wxChoice | |
65 | #else | |
66 | class wxComboBox : public wxControl, public wxItemContainer | |
67 | #endif | |
68 | { | |
69 | public: | |
2b9048c5 RD |
70 | %pythonAppend wxComboBox "self._setOORInfo(self)" |
71 | %pythonAppend wxComboBox() "" | |
d14a1e28 | 72 | |
6ad421ae | 73 | DocCtorAStr( |
907c2926 | 74 | wxComboBox(wxWindow* parent, wxWindowID id=-1, |
6ad421ae RD |
75 | const wxString& value = wxPyEmptyString, |
76 | const wxPoint& pos = wxDefaultPosition, | |
77 | const wxSize& size = wxDefaultSize, | |
78 | const wxArrayString& choices = wxPyEmptyStringArray, | |
79 | long style = 0, | |
80 | const wxValidator& validator = wxDefaultValidator, | |
81 | const wxString& name = wxPyComboBoxNameStr), | |
d07d2bc9 RD |
82 | "__init__(Window parent, int id, String value=EmptyString, |
83 | Point pos=DefaultPosition, Size size=DefaultSize, | |
84 | List choices=[], long style=0, Validator validator=DefaultValidator, | |
85 | String name=ComboBoxNameStr) -> ComboBox", | |
86 | "Constructor, creates and shows a ComboBox control.", ""); | |
6ad421ae RD |
87 | |
88 | DocCtorStrName( | |
89 | wxComboBox(), | |
d07d2bc9 | 90 | "Precreate a ComboBox control for 2-phase creation.", "", |
6ad421ae RD |
91 | PreComboBox); |
92 | ||
93 | ||
94 | DocDeclAStr( | |
907c2926 | 95 | bool, Create(wxWindow *parent, wxWindowID id=-1, |
6ad421ae RD |
96 | const wxString& value = wxPyEmptyString, |
97 | const wxPoint& pos = wxDefaultPosition, | |
98 | const wxSize& size = wxDefaultSize, | |
99 | const wxArrayString& choices = wxPyEmptyStringArray, | |
100 | long style = 0, | |
101 | const wxValidator& validator = wxDefaultValidator, | |
102 | const wxString& name = wxPyChoiceNameStr), | |
d07d2bc9 RD |
103 | "Create(Window parent, int id, String value=EmptyString, |
104 | Point pos=DefaultPosition, Size size=DefaultSize, | |
105 | List choices=[], long style=0, Validator validator=DefaultValidator, | |
106 | String name=ChoiceNameStr) -> bool", | |
107 | "Actually create the GUI wxComboBox control for 2-phase creation", ""); | |
6ad421ae RD |
108 | |
109 | ||
110 | DocDeclStr( | |
111 | virtual wxString , GetValue() const, | |
d07d2bc9 | 112 | "Returns the current value in the combobox text field.", ""); |
6ad421ae RD |
113 | |
114 | DocDeclStr( | |
115 | virtual void , SetValue(const wxString& value), | |
d07d2bc9 | 116 | "", ""); |
6ad421ae RD |
117 | |
118 | ||
119 | DocDeclStr( | |
120 | virtual void , Copy(), | |
d07d2bc9 | 121 | "Copies the selected text to the clipboard.", ""); |
6ad421ae RD |
122 | |
123 | DocDeclStr( | |
124 | virtual void , Cut(), | |
d07d2bc9 | 125 | "Copies the selected text to the clipboard and removes the selection.", ""); |
6ad421ae RD |
126 | |
127 | DocDeclStr( | |
128 | virtual void , Paste(), | |
d07d2bc9 | 129 | "Pastes text from the clipboard to the text field.", ""); |
6ad421ae RD |
130 | |
131 | ||
132 | DocDeclStr( | |
133 | virtual void , SetInsertionPoint(long pos), | |
d07d2bc9 | 134 | "Sets the insertion point in the combobox text field.", ""); |
6ad421ae RD |
135 | |
136 | DocDeclStr( | |
137 | virtual long , GetInsertionPoint() const, | |
d07d2bc9 | 138 | "Returns the insertion point for the combobox's text field.", ""); |
6ad421ae RD |
139 | |
140 | DocDeclStr( | |
141 | virtual long , GetLastPosition() const, | |
d07d2bc9 | 142 | "Returns the last position in the combobox text field.", ""); |
6ad421ae RD |
143 | |
144 | DocDeclStr( | |
145 | virtual void , Replace(long from, long to, const wxString& value), | |
d07d2bc9 RD |
146 | "Replaces the text between two positions with the given text, in the |
147 | combobox text field.", ""); | |
6ad421ae RD |
148 | |
149 | DocDeclStr( | |
150 | void , SetSelection(int n), | |
d07d2bc9 | 151 | "Sets the item at index 'n' to be the selected item.", ""); |
d14a1e28 | 152 | |
f8c88923 RD |
153 | DocDeclStrName( |
154 | virtual void , SetSelection(long from, long to), | |
d07d2bc9 | 155 | "Selects the text between the two positions in the combobox text field.", "", |
f8c88923 | 156 | SetMark); |
d14a1e28 | 157 | |
f8c88923 RD |
158 | DocDeclStr( |
159 | bool , SetStringSelection(const wxString& string), | |
d07d2bc9 | 160 | "Select the item with the specifed string", ""); |
f8c88923 RD |
161 | |
162 | DocDeclStr( | |
163 | void , SetString(int n, const wxString& string), | |
d07d2bc9 | 164 | "Set the label for the n'th item (zero based) in the list.", ""); |
f8c88923 | 165 | |
6ad421ae RD |
166 | DocDeclStr( |
167 | virtual void , SetEditable(bool editable), | |
d07d2bc9 | 168 | "", ""); |
6ad421ae RD |
169 | |
170 | ||
171 | DocDeclStr( | |
172 | virtual void , SetInsertionPointEnd(), | |
d07d2bc9 | 173 | "Sets the insertion point at the end of the combobox text field.", ""); |
6ad421ae RD |
174 | |
175 | DocDeclStr( | |
176 | virtual void , Remove(long from, long to), | |
d07d2bc9 | 177 | "Removes the text between the two positions in the combobox text field.", ""); |
6ad421ae | 178 | |
880715c9 RD |
179 | static wxVisualAttributes |
180 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
d14a1e28 RD |
181 | }; |
182 | ||
183 | //--------------------------------------------------------------------------- |