]>
Commit | Line | Data |
---|---|---|
bb0054cd RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: misc2.i | |
3 | // Purpose: Definitions of miscelaneous functions and classes that need | |
4 | // to know about wxWindow. (So they can't be in misc.i or an | |
5 | // import loop will happen.) | |
6 | // | |
7 | // Author: Robin Dunn | |
8 | // | |
9 | // Created: 18-June-1999 | |
10 | // RCS-ID: $Id$ | |
11 | // Copyright: (c) 1998 by Total Control Software | |
12 | // Licence: wxWindows license | |
13 | ///////////////////////////////////////////////////////////////////////////// | |
14 | ||
15 | %module misc2 | |
16 | ||
17 | %{ | |
18 | #include "helpers.h" | |
19 | #include <wx/resource.h> | |
20 | #include <wx/tooltip.h> | |
f0261a72 RD |
21 | #include <wx/caret.h> |
22 | #include <wx/fontenum.h> | |
bb0054cd RD |
23 | %} |
24 | ||
25 | //---------------------------------------------------------------------- | |
26 | ||
27 | %include typemaps.i | |
28 | %include my_typemaps.i | |
29 | ||
30 | // Import some definitions of other classes, etc. | |
31 | %import _defs.i | |
32 | %import windows.i | |
f0261a72 | 33 | %import misc.i |
06c0fba4 | 34 | %import gdi.i |
b1462dfa | 35 | %import events.i |
06c0fba4 RD |
36 | |
37 | //--------------------------------------------------------------------------- | |
38 | // Dialog Functions | |
39 | ||
40 | wxString wxFileSelector(char* message, | |
41 | char* default_path = NULL, | |
42 | char* default_filename = NULL, | |
43 | char* default_extension = NULL, | |
44 | char* wildcard = "*.*", | |
45 | int flags = 0, | |
46 | wxWindow *parent = NULL, | |
47 | int x = -1, int y = -1); | |
48 | ||
49 | wxString wxGetTextFromUser(const wxString& message, | |
50 | const wxString& caption = wxPyEmptyStr, | |
51 | const wxString& default_value = wxPyEmptyStr, | |
52 | wxWindow *parent = NULL, | |
53 | int x = -1, int y = -1, | |
54 | bool centre = TRUE); | |
55 | ||
56 | ||
57 | // TODO: Need to custom wrap this one... | |
58 | // int wxGetMultipleChoice(char* message, char* caption, | |
59 | // int LCOUNT, char** LIST, | |
60 | // int nsel, int *selection, | |
61 | // wxWindow *parent = NULL, int x = -1, int y = -1, | |
62 | // bool centre = TRUE, int width=150, int height=200); | |
63 | ||
64 | ||
65 | wxString wxGetSingleChoice(const wxString& message, const wxString& caption, | |
66 | int LCOUNT, wxString* LIST, | |
67 | wxWindow *parent = NULL, | |
68 | int x = -1, int y = -1, | |
69 | bool centre = TRUE, | |
70 | int width=150, int height=200); | |
71 | ||
72 | int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, | |
73 | int LCOUNT, wxString* LIST, | |
74 | wxWindow *parent = NULL, | |
75 | int x = -1, int y = -1, | |
76 | bool centre = TRUE, | |
77 | int width=150, int height=200); | |
78 | ||
79 | ||
80 | int wxMessageBox(const wxString& message, | |
81 | const wxString& caption = wxPyEmptyStr, | |
82 | int style = wxOK | wxCENTRE, | |
83 | wxWindow *parent = NULL, | |
84 | int x = -1, int y = -1); | |
85 | ||
86 | long wxGetNumberFromUser(const wxString& message, | |
87 | const wxString& prompt, | |
88 | const wxString& caption, | |
89 | long value, | |
90 | long min = 0, long max = 100, | |
91 | wxWindow *parent = NULL, | |
92 | const wxPoint& pos = wxPyDefaultPosition); | |
93 | ||
94 | //--------------------------------------------------------------------------- | |
95 | // GDI Functions | |
96 | ||
97 | bool wxColourDisplay(); | |
98 | int wxDisplayDepth(); | |
99 | void wxSetCursor(wxCursor& cursor); | |
bb0054cd RD |
100 | |
101 | //---------------------------------------------------------------------- | |
06c0fba4 | 102 | // Miscellaneous functions |
bb0054cd RD |
103 | |
104 | wxWindow * wxFindWindowByLabel(const wxString& label, wxWindow *parent=NULL); | |
105 | wxWindow * wxFindWindowByName(const wxString& name, wxWindow *parent=NULL); | |
106 | ||
06c0fba4 RD |
107 | void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR); |
108 | wxWindow * wxGetActiveWindow(); | |
109 | ||
110 | ||
111 | //--------------------------------------------------------------------------- | |
112 | // Resource System | |
113 | ||
114 | bool wxResourceAddIdentifier(char *name, int value); | |
115 | void wxResourceClear(void); | |
116 | wxBitmap wxResourceCreateBitmap(char *resource); | |
117 | wxIcon wxResourceCreateIcon(char *resource); | |
118 | wxMenuBar * wxResourceCreateMenuBar(char *resource); | |
119 | int wxResourceGetIdentifier(char *name); | |
120 | bool wxResourceParseData(char *resource, wxResourceTable *table = NULL); | |
121 | bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL); | |
122 | bool wxResourceParseString(char *resource, wxResourceTable *table = NULL); | |
bb0054cd | 123 | |
06c0fba4 RD |
124 | //--------------------------------------------------------------------------- |
125 | // System Settings | |
126 | ||
127 | enum { | |
128 | wxSYS_WHITE_BRUSH, | |
129 | wxSYS_LTGRAY_BRUSH, | |
130 | wxSYS_GRAY_BRUSH, | |
131 | wxSYS_DKGRAY_BRUSH, | |
132 | wxSYS_BLACK_BRUSH, | |
133 | wxSYS_NULL_BRUSH, | |
134 | wxSYS_HOLLOW_BRUSH, | |
135 | wxSYS_WHITE_PEN, | |
136 | wxSYS_BLACK_PEN, | |
137 | wxSYS_NULL_PEN, | |
138 | wxSYS_OEM_FIXED_FONT, | |
139 | wxSYS_ANSI_FIXED_FONT, | |
140 | wxSYS_ANSI_VAR_FONT, | |
141 | wxSYS_SYSTEM_FONT, | |
142 | wxSYS_DEVICE_DEFAULT_FONT, | |
143 | wxSYS_DEFAULT_PALETTE, | |
144 | wxSYS_SYSTEM_FIXED_FONT, | |
145 | wxSYS_DEFAULT_GUI_FONT, | |
146 | ||
147 | wxSYS_COLOUR_SCROLLBAR, | |
148 | wxSYS_COLOUR_BACKGROUND, | |
149 | wxSYS_COLOUR_ACTIVECAPTION, | |
150 | wxSYS_COLOUR_INACTIVECAPTION, | |
151 | wxSYS_COLOUR_MENU, | |
152 | wxSYS_COLOUR_WINDOW, | |
153 | wxSYS_COLOUR_WINDOWFRAME, | |
154 | wxSYS_COLOUR_MENUTEXT, | |
155 | wxSYS_COLOUR_WINDOWTEXT, | |
156 | wxSYS_COLOUR_CAPTIONTEXT, | |
157 | wxSYS_COLOUR_ACTIVEBORDER, | |
158 | wxSYS_COLOUR_INACTIVEBORDER, | |
159 | wxSYS_COLOUR_APPWORKSPACE, | |
160 | wxSYS_COLOUR_HIGHLIGHT, | |
161 | wxSYS_COLOUR_HIGHLIGHTTEXT, | |
162 | wxSYS_COLOUR_BTNFACE, | |
163 | wxSYS_COLOUR_BTNSHADOW, | |
164 | wxSYS_COLOUR_GRAYTEXT, | |
165 | wxSYS_COLOUR_BTNTEXT, | |
166 | wxSYS_COLOUR_INACTIVECAPTIONTEXT, | |
167 | wxSYS_COLOUR_BTNHIGHLIGHT, | |
168 | ||
169 | wxSYS_COLOUR_3DDKSHADOW, | |
170 | wxSYS_COLOUR_3DLIGHT, | |
171 | wxSYS_COLOUR_INFOTEXT, | |
172 | wxSYS_COLOUR_INFOBK, | |
173 | ||
174 | wxSYS_COLOUR_DESKTOP, | |
175 | wxSYS_COLOUR_3DFACE, | |
176 | wxSYS_COLOUR_3DSHADOW, | |
177 | wxSYS_COLOUR_3DHIGHLIGHT, | |
178 | wxSYS_COLOUR_3DHILIGHT, | |
179 | wxSYS_COLOUR_BTNHILIGHT, | |
180 | ||
181 | wxSYS_MOUSE_BUTTONS, | |
182 | wxSYS_BORDER_X, | |
183 | wxSYS_BORDER_Y, | |
184 | wxSYS_CURSOR_X, | |
185 | wxSYS_CURSOR_Y, | |
186 | wxSYS_DCLICK_X, | |
187 | wxSYS_DCLICK_Y, | |
188 | wxSYS_DRAG_X, | |
189 | wxSYS_DRAG_Y, | |
190 | wxSYS_EDGE_X, | |
191 | wxSYS_EDGE_Y, | |
192 | wxSYS_HSCROLL_ARROW_X, | |
193 | wxSYS_HSCROLL_ARROW_Y, | |
194 | wxSYS_HTHUMB_X, | |
195 | wxSYS_ICON_X, | |
196 | wxSYS_ICON_Y, | |
197 | wxSYS_ICONSPACING_X, | |
198 | wxSYS_ICONSPACING_Y, | |
199 | wxSYS_WINDOWMIN_X, | |
200 | wxSYS_WINDOWMIN_Y, | |
201 | wxSYS_SCREEN_X, | |
202 | wxSYS_SCREEN_Y, | |
203 | wxSYS_FRAMESIZE_X, | |
204 | wxSYS_FRAMESIZE_Y, | |
205 | wxSYS_SMALLICON_X, | |
206 | wxSYS_SMALLICON_Y, | |
207 | wxSYS_HSCROLL_Y, | |
208 | wxSYS_VSCROLL_X, | |
209 | wxSYS_VSCROLL_ARROW_X, | |
210 | wxSYS_VSCROLL_ARROW_Y, | |
211 | wxSYS_VTHUMB_Y, | |
212 | wxSYS_CAPTION_Y, | |
213 | wxSYS_MENU_Y, | |
214 | wxSYS_NETWORK_PRESENT, | |
215 | wxSYS_PENWINDOWS_PRESENT, | |
216 | wxSYS_SHOW_SOUNDS, | |
217 | wxSYS_SWAP_BUTTONS, | |
218 | }; | |
219 | ||
220 | ||
221 | ||
222 | %inline %{ | |
223 | ||
224 | wxColour wxSystemSettings_GetSystemColour(int index) { | |
225 | return wxSystemSettings::GetSystemColour(index); | |
226 | } | |
227 | ||
228 | wxFont wxSystemSettings_GetSystemFont(int index) { | |
229 | return wxSystemSettings::GetSystemFont(index); | |
230 | } | |
231 | ||
232 | int wxSystemSettings_GetSystemMetric(int index) { | |
233 | return wxSystemSettings::GetSystemMetric(index); | |
234 | } | |
235 | %} | |
bb0054cd RD |
236 | |
237 | //--------------------------------------------------------------------------- | |
238 | // wxToolTip | |
239 | ||
240 | class wxToolTip { | |
241 | public: | |
242 | wxToolTip(const wxString &tip); | |
243 | ||
244 | void SetTip(const wxString& tip); | |
245 | wxString GetTip(); | |
246 | // *** Not in the "public" interface void SetWindow(wxWindow *win); | |
247 | wxWindow *GetWindow(); | |
248 | }; | |
249 | ||
250 | ||
251 | %inline %{ | |
252 | void wxToolTip_Enable(bool flag) { | |
253 | wxToolTip::Enable(flag); | |
254 | } | |
255 | ||
256 | void wxToolTip_SetDelay(long milliseconds) { | |
257 | wxToolTip::SetDelay(milliseconds); | |
258 | } | |
259 | %} | |
260 | ||
261 | //---------------------------------------------------------------------- | |
f0261a72 RD |
262 | |
263 | class wxCaret { | |
264 | public: | |
265 | wxCaret(wxWindow* window, const wxSize& size); | |
266 | ~wxCaret(); | |
267 | ||
268 | bool IsOk(); | |
269 | bool IsVisible(); | |
270 | %name(GetPositionTuple)void GetPosition(int *OUTPUT, int *OUTPUT); | |
271 | wxPoint GetPosition(); | |
272 | %name(GetSizeTuple)void GetSize(int *OUTPUT, int *OUTPUT); | |
273 | wxSize GetSize(); | |
274 | wxWindow *GetWindow(); | |
275 | %name(MoveXY)void Move(int x, int y); | |
276 | void Move(const wxPoint& pt); | |
a1df7a95 RD |
277 | %name(SetSizeWH) void SetSize(int width, int height); |
278 | void SetSize(const wxSize& size); | |
f0261a72 RD |
279 | void Show(int show = TRUE); |
280 | void Hide(); | |
281 | void OnSetFocus(); | |
282 | void OnKillFocus(); | |
283 | }; | |
284 | ||
285 | %inline %{ | |
286 | int wxCaret_GetBlinkTime() { | |
287 | return wxCaret::GetBlinkTime(); | |
288 | } | |
289 | ||
290 | void wxCaret_SetBlinkTime(int milliseconds) { | |
291 | wxCaret::SetBlinkTime(milliseconds); | |
292 | } | |
293 | %} | |
294 | ||
bb0054cd | 295 | //---------------------------------------------------------------------- |
f0261a72 RD |
296 | |
297 | %{ | |
298 | class wxPyFontEnumerator : public wxFontEnumerator { | |
299 | public: | |
300 | wxPyFontEnumerator() {} | |
301 | ~wxPyFontEnumerator() {} | |
302 | ||
b1462dfa | 303 | DEC_PYCALLBACK_BOOL_STRING(OnFacename); |
f0261a72 RD |
304 | DEC_PYCALLBACK_BOOL_STRINGSTRING(OnFontEncoding); |
305 | ||
306 | PYPRIVATE; | |
307 | }; | |
308 | ||
b1462dfa | 309 | IMP_PYCALLBACK_BOOL_STRING(wxPyFontEnumerator, wxFontEnumerator, OnFacename); |
f0261a72 RD |
310 | IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEncoding); |
311 | ||
312 | %} | |
313 | ||
314 | %name(wxFontEnumerator) class wxPyFontEnumerator { | |
315 | public: | |
b1462dfa RD |
316 | wxPyFontEnumerator(); |
317 | ~wxPyFontEnumerator(); | |
318 | void _setSelf(PyObject* self); | |
f0261a72 RD |
319 | %pragma(python) addtomethod = "__init__:self._setSelf(self)" |
320 | ||
b1462dfa RD |
321 | bool EnumerateFacenames( |
322 | wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all | |
323 | bool fixedWidthOnly = FALSE); | |
324 | bool EnumerateEncodings(const char* facename = ""); | |
65dd82cb RD |
325 | |
326 | //wxArrayString* GetEncodings(); | |
327 | //wxArrayString* GetFacenames(); | |
328 | %addmethods { | |
329 | PyObject* GetEncodings() { | |
330 | wxArrayString* arr = self->GetEncodings(); | |
331 | PyObject* list = PyList_New(0); | |
332 | for (size_t x=0; x<arr->GetCount(); x++) | |
333 | PyList_Append(list, PyString_FromString((*arr)[x])); | |
334 | return list; | |
335 | } | |
336 | ||
337 | PyObject* GetFacenames() { | |
338 | wxArrayString* arr = self->GetFacenames(); | |
339 | PyObject* list = PyList_New(0); | |
340 | for (size_t x=0; x<arr->GetCount(); x++) | |
341 | PyList_Append(list, PyString_FromString((*arr)[x])); | |
342 | return list; | |
343 | } | |
344 | } | |
f0261a72 | 345 | }; |
2abc0a0f RD |
346 | |
347 | //---------------------------------------------------------------------- | |
348 | ||
349 | class wxBusyCursor { | |
350 | public: | |
351 | wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR); | |
352 | ~wxBusyCursor(); | |
353 | }; | |
354 | ||
b1462dfa | 355 | //---------------------------------------------------------------------- |
2abc0a0f | 356 | |
b1462dfa | 357 | void wxPostEvent(wxEvtHandler *dest, wxEvent& event); |
694759cf | 358 | void wxWakeUpIdle(); |
2abc0a0f RD |
359 | |
360 | //---------------------------------------------------------------------- | |
f0261a72 RD |
361 | //---------------------------------------------------------------------- |
362 | //---------------------------------------------------------------------- | |
363 |