]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/misc2.i
Some updates and fixes
[wxWidgets.git] / utils / wxPython / src / misc2.i
CommitLineData
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
40wxString 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
49wxString 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,
eec92d76 59// int LCOUNT, char** choices,
06c0fba4
RD
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
65wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
eec92d76 66 int LCOUNT, wxString* choices,
06c0fba4
RD
67 wxWindow *parent = NULL,
68 int x = -1, int y = -1,
69 bool centre = TRUE,
70 int width=150, int height=200);
71
72int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
eec92d76 73 int LCOUNT, wxString* choices,
06c0fba4
RD
74 wxWindow *parent = NULL,
75 int x = -1, int y = -1,
76 bool centre = TRUE,
77 int width=150, int height=200);
78
79
80int 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
86long 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
97bool wxColourDisplay();
98int wxDisplayDepth();
99void wxSetCursor(wxCursor& cursor);
bb0054cd
RD
100
101//----------------------------------------------------------------------
06c0fba4 102// Miscellaneous functions
bb0054cd
RD
103
104wxWindow * wxFindWindowByLabel(const wxString& label, wxWindow *parent=NULL);
105wxWindow * wxFindWindowByName(const wxString& name, wxWindow *parent=NULL);
106
06c0fba4
RD
107void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
108wxWindow * wxGetActiveWindow();
109
110
111//---------------------------------------------------------------------------
112// Resource System
113
114bool wxResourceAddIdentifier(char *name, int value);
115void wxResourceClear(void);
116wxBitmap wxResourceCreateBitmap(char *resource);
117wxIcon wxResourceCreateIcon(char *resource);
118wxMenuBar * wxResourceCreateMenuBar(char *resource);
119int wxResourceGetIdentifier(char *name);
120bool wxResourceParseData(char *resource, wxResourceTable *table = NULL);
121bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL);
122bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
bb0054cd 123
06c0fba4
RD
124//---------------------------------------------------------------------------
125// System Settings
126
127enum {
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
240class wxToolTip {
241public:
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
263class wxCaret {
264public:
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();
f0261a72
RD
281};
282
283%inline %{
284 int wxCaret_GetBlinkTime() {
285 return wxCaret::GetBlinkTime();
286 }
287
288 void wxCaret_SetBlinkTime(int milliseconds) {
289 wxCaret::SetBlinkTime(milliseconds);
290 }
291%}
292
bb0054cd 293//----------------------------------------------------------------------
f0261a72
RD
294
295%{
296class wxPyFontEnumerator : public wxFontEnumerator {
297public:
298 wxPyFontEnumerator() {}
299 ~wxPyFontEnumerator() {}
300
b1462dfa 301 DEC_PYCALLBACK_BOOL_STRING(OnFacename);
f0261a72
RD
302 DEC_PYCALLBACK_BOOL_STRINGSTRING(OnFontEncoding);
303
304 PYPRIVATE;
305};
306
b1462dfa 307IMP_PYCALLBACK_BOOL_STRING(wxPyFontEnumerator, wxFontEnumerator, OnFacename);
f0261a72
RD
308IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEncoding);
309
310%}
311
312%name(wxFontEnumerator) class wxPyFontEnumerator {
313public:
b1462dfa
RD
314 wxPyFontEnumerator();
315 ~wxPyFontEnumerator();
316 void _setSelf(PyObject* self);
f0261a72
RD
317 %pragma(python) addtomethod = "__init__:self._setSelf(self)"
318
b1462dfa
RD
319 bool EnumerateFacenames(
320 wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
321 bool fixedWidthOnly = FALSE);
322 bool EnumerateEncodings(const char* facename = "");
65dd82cb
RD
323
324 //wxArrayString* GetEncodings();
325 //wxArrayString* GetFacenames();
326 %addmethods {
327 PyObject* GetEncodings() {
328 wxArrayString* arr = self->GetEncodings();
329 PyObject* list = PyList_New(0);
330 for (size_t x=0; x<arr->GetCount(); x++)
331 PyList_Append(list, PyString_FromString((*arr)[x]));
332 return list;
333 }
334
335 PyObject* GetFacenames() {
336 wxArrayString* arr = self->GetFacenames();
337 PyObject* list = PyList_New(0);
338 for (size_t x=0; x<arr->GetCount(); x++)
339 PyList_Append(list, PyString_FromString((*arr)[x]));
340 return list;
341 }
342 }
f0261a72 343};
2abc0a0f
RD
344
345//----------------------------------------------------------------------
346
347class wxBusyCursor {
348public:
349 wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
350 ~wxBusyCursor();
351};
352
b1462dfa 353//----------------------------------------------------------------------
2abc0a0f 354
b1462dfa 355void wxPostEvent(wxEvtHandler *dest, wxEvent& event);
694759cf 356void wxWakeUpIdle();
2abc0a0f
RD
357
358//----------------------------------------------------------------------
f0261a72
RD
359//----------------------------------------------------------------------
360//----------------------------------------------------------------------
361