]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/misc2.i
applied patch to uncover cells next to 0 automatically
[wxWidgets.git] / 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>
f6bcfd97 23#include <wx/tipdlg.h>
bb0054cd
RD
24%}
25
26//----------------------------------------------------------------------
27
28%include typemaps.i
29%include my_typemaps.i
30
31// Import some definitions of other classes, etc.
32%import _defs.i
33%import windows.i
f0261a72 34%import misc.i
06c0fba4 35%import gdi.i
b1462dfa 36%import events.i
06c0fba4
RD
37
38//---------------------------------------------------------------------------
39// Dialog Functions
40
41wxString wxFileSelector(char* message,
42 char* default_path = NULL,
43 char* default_filename = NULL,
44 char* default_extension = NULL,
45 char* wildcard = "*.*",
46 int flags = 0,
47 wxWindow *parent = NULL,
48 int x = -1, int y = -1);
49
50wxString wxGetTextFromUser(const wxString& message,
51 const wxString& caption = wxPyEmptyStr,
52 const wxString& default_value = wxPyEmptyStr,
53 wxWindow *parent = NULL,
54 int x = -1, int y = -1,
55 bool centre = TRUE);
56
57
58// TODO: Need to custom wrap this one...
59// int wxGetMultipleChoice(char* message, char* caption,
eec92d76 60// int LCOUNT, char** choices,
06c0fba4
RD
61// int nsel, int *selection,
62// wxWindow *parent = NULL, int x = -1, int y = -1,
63// bool centre = TRUE, int width=150, int height=200);
64
65
66wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
eec92d76 67 int LCOUNT, wxString* choices,
06c0fba4
RD
68 wxWindow *parent = NULL,
69 int x = -1, int y = -1,
70 bool centre = TRUE,
71 int width=150, int height=200);
72
73int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
eec92d76 74 int LCOUNT, wxString* choices,
06c0fba4
RD
75 wxWindow *parent = NULL,
76 int x = -1, int y = -1,
77 bool centre = TRUE,
78 int width=150, int height=200);
79
80
81int wxMessageBox(const wxString& message,
82 const wxString& caption = wxPyEmptyStr,
83 int style = wxOK | wxCENTRE,
84 wxWindow *parent = NULL,
85 int x = -1, int y = -1);
86
87long wxGetNumberFromUser(const wxString& message,
88 const wxString& prompt,
89 const wxString& caption,
90 long value,
91 long min = 0, long max = 100,
92 wxWindow *parent = NULL,
93 const wxPoint& pos = wxPyDefaultPosition);
94
95//---------------------------------------------------------------------------
96// GDI Functions
97
98bool wxColourDisplay();
99int wxDisplayDepth();
100void wxSetCursor(wxCursor& cursor);
bb0054cd
RD
101
102//----------------------------------------------------------------------
06c0fba4 103// Miscellaneous functions
bb0054cd
RD
104
105wxWindow * wxFindWindowByLabel(const wxString& label, wxWindow *parent=NULL);
106wxWindow * wxFindWindowByName(const wxString& name, wxWindow *parent=NULL);
107
06c0fba4
RD
108void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
109wxWindow * wxGetActiveWindow();
110
111
112//---------------------------------------------------------------------------
113// Resource System
114
115bool wxResourceAddIdentifier(char *name, int value);
116void wxResourceClear(void);
117wxBitmap wxResourceCreateBitmap(char *resource);
118wxIcon wxResourceCreateIcon(char *resource);
119wxMenuBar * wxResourceCreateMenuBar(char *resource);
120int wxResourceGetIdentifier(char *name);
121bool wxResourceParseData(char *resource, wxResourceTable *table = NULL);
122bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL);
123bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
bb0054cd 124
06c0fba4
RD
125//---------------------------------------------------------------------------
126// System Settings
127
128enum {
129 wxSYS_WHITE_BRUSH,
130 wxSYS_LTGRAY_BRUSH,
131 wxSYS_GRAY_BRUSH,
132 wxSYS_DKGRAY_BRUSH,
133 wxSYS_BLACK_BRUSH,
134 wxSYS_NULL_BRUSH,
135 wxSYS_HOLLOW_BRUSH,
136 wxSYS_WHITE_PEN,
137 wxSYS_BLACK_PEN,
138 wxSYS_NULL_PEN,
139 wxSYS_OEM_FIXED_FONT,
140 wxSYS_ANSI_FIXED_FONT,
141 wxSYS_ANSI_VAR_FONT,
142 wxSYS_SYSTEM_FONT,
143 wxSYS_DEVICE_DEFAULT_FONT,
144 wxSYS_DEFAULT_PALETTE,
145 wxSYS_SYSTEM_FIXED_FONT,
146 wxSYS_DEFAULT_GUI_FONT,
147
148 wxSYS_COLOUR_SCROLLBAR,
149 wxSYS_COLOUR_BACKGROUND,
150 wxSYS_COLOUR_ACTIVECAPTION,
151 wxSYS_COLOUR_INACTIVECAPTION,
152 wxSYS_COLOUR_MENU,
153 wxSYS_COLOUR_WINDOW,
154 wxSYS_COLOUR_WINDOWFRAME,
155 wxSYS_COLOUR_MENUTEXT,
156 wxSYS_COLOUR_WINDOWTEXT,
157 wxSYS_COLOUR_CAPTIONTEXT,
158 wxSYS_COLOUR_ACTIVEBORDER,
159 wxSYS_COLOUR_INACTIVEBORDER,
160 wxSYS_COLOUR_APPWORKSPACE,
161 wxSYS_COLOUR_HIGHLIGHT,
162 wxSYS_COLOUR_HIGHLIGHTTEXT,
163 wxSYS_COLOUR_BTNFACE,
164 wxSYS_COLOUR_BTNSHADOW,
165 wxSYS_COLOUR_GRAYTEXT,
166 wxSYS_COLOUR_BTNTEXT,
167 wxSYS_COLOUR_INACTIVECAPTIONTEXT,
168 wxSYS_COLOUR_BTNHIGHLIGHT,
169
170 wxSYS_COLOUR_3DDKSHADOW,
171 wxSYS_COLOUR_3DLIGHT,
172 wxSYS_COLOUR_INFOTEXT,
173 wxSYS_COLOUR_INFOBK,
174
175 wxSYS_COLOUR_DESKTOP,
176 wxSYS_COLOUR_3DFACE,
177 wxSYS_COLOUR_3DSHADOW,
178 wxSYS_COLOUR_3DHIGHLIGHT,
179 wxSYS_COLOUR_3DHILIGHT,
180 wxSYS_COLOUR_BTNHILIGHT,
181
182 wxSYS_MOUSE_BUTTONS,
183 wxSYS_BORDER_X,
184 wxSYS_BORDER_Y,
185 wxSYS_CURSOR_X,
186 wxSYS_CURSOR_Y,
187 wxSYS_DCLICK_X,
188 wxSYS_DCLICK_Y,
189 wxSYS_DRAG_X,
190 wxSYS_DRAG_Y,
191 wxSYS_EDGE_X,
192 wxSYS_EDGE_Y,
193 wxSYS_HSCROLL_ARROW_X,
194 wxSYS_HSCROLL_ARROW_Y,
195 wxSYS_HTHUMB_X,
196 wxSYS_ICON_X,
197 wxSYS_ICON_Y,
198 wxSYS_ICONSPACING_X,
199 wxSYS_ICONSPACING_Y,
200 wxSYS_WINDOWMIN_X,
201 wxSYS_WINDOWMIN_Y,
202 wxSYS_SCREEN_X,
203 wxSYS_SCREEN_Y,
204 wxSYS_FRAMESIZE_X,
205 wxSYS_FRAMESIZE_Y,
206 wxSYS_SMALLICON_X,
207 wxSYS_SMALLICON_Y,
208 wxSYS_HSCROLL_Y,
209 wxSYS_VSCROLL_X,
210 wxSYS_VSCROLL_ARROW_X,
211 wxSYS_VSCROLL_ARROW_Y,
212 wxSYS_VTHUMB_Y,
213 wxSYS_CAPTION_Y,
214 wxSYS_MENU_Y,
215 wxSYS_NETWORK_PRESENT,
216 wxSYS_PENWINDOWS_PRESENT,
217 wxSYS_SHOW_SOUNDS,
218 wxSYS_SWAP_BUTTONS,
219};
220
221
222
223%inline %{
224
225 wxColour wxSystemSettings_GetSystemColour(int index) {
226 return wxSystemSettings::GetSystemColour(index);
227 }
228
229 wxFont wxSystemSettings_GetSystemFont(int index) {
230 return wxSystemSettings::GetSystemFont(index);
231 }
232
233 int wxSystemSettings_GetSystemMetric(int index) {
234 return wxSystemSettings::GetSystemMetric(index);
235 }
236%}
bb0054cd
RD
237
238//---------------------------------------------------------------------------
239// wxToolTip
240
241class wxToolTip {
242public:
243 wxToolTip(const wxString &tip);
244
245 void SetTip(const wxString& tip);
246 wxString GetTip();
247 // *** Not in the "public" interface void SetWindow(wxWindow *win);
248 wxWindow *GetWindow();
249};
250
251
252%inline %{
253 void wxToolTip_Enable(bool flag) {
254 wxToolTip::Enable(flag);
255 }
256
257 void wxToolTip_SetDelay(long milliseconds) {
258 wxToolTip::SetDelay(milliseconds);
259 }
260%}
261
262//----------------------------------------------------------------------
f0261a72
RD
263
264class wxCaret {
265public:
266 wxCaret(wxWindow* window, const wxSize& size);
267 ~wxCaret();
268
269 bool IsOk();
270 bool IsVisible();
271 %name(GetPositionTuple)void GetPosition(int *OUTPUT, int *OUTPUT);
272 wxPoint GetPosition();
273 %name(GetSizeTuple)void GetSize(int *OUTPUT, int *OUTPUT);
274 wxSize GetSize();
275 wxWindow *GetWindow();
276 %name(MoveXY)void Move(int x, int y);
277 void Move(const wxPoint& pt);
a1df7a95
RD
278 %name(SetSizeWH) void SetSize(int width, int height);
279 void SetSize(const wxSize& size);
f0261a72
RD
280 void Show(int show = TRUE);
281 void Hide();
f0261a72
RD
282};
283
284%inline %{
285 int wxCaret_GetBlinkTime() {
286 return wxCaret::GetBlinkTime();
287 }
288
289 void wxCaret_SetBlinkTime(int milliseconds) {
290 wxCaret::SetBlinkTime(milliseconds);
291 }
292%}
293
bb0054cd 294//----------------------------------------------------------------------
f0261a72
RD
295
296%{
297class wxPyFontEnumerator : public wxFontEnumerator {
298public:
299 wxPyFontEnumerator() {}
300 ~wxPyFontEnumerator() {}
301
b1462dfa 302 DEC_PYCALLBACK_BOOL_STRING(OnFacename);
f0261a72
RD
303 DEC_PYCALLBACK_BOOL_STRINGSTRING(OnFontEncoding);
304
305 PYPRIVATE;
306};
307
b1462dfa 308IMP_PYCALLBACK_BOOL_STRING(wxPyFontEnumerator, wxFontEnumerator, OnFacename);
f0261a72
RD
309IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEncoding);
310
311%}
312
313%name(wxFontEnumerator) class wxPyFontEnumerator {
314public:
b1462dfa
RD
315 wxPyFontEnumerator();
316 ~wxPyFontEnumerator();
f6bcfd97
BP
317 void _setSelf(PyObject* self, PyObject* _class);
318 %pragma(python) addtomethod = "__init__:self._setSelf(self, wxFontEnumerator)"
f0261a72 319
b1462dfa
RD
320 bool EnumerateFacenames(
321 wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
322 bool fixedWidthOnly = FALSE);
323 bool EnumerateEncodings(const char* facename = "");
65dd82cb
RD
324
325 //wxArrayString* GetEncodings();
326 //wxArrayString* GetFacenames();
327 %addmethods {
328 PyObject* GetEncodings() {
329 wxArrayString* arr = self->GetEncodings();
330 PyObject* list = PyList_New(0);
331 for (size_t x=0; x<arr->GetCount(); x++)
332 PyList_Append(list, PyString_FromString((*arr)[x]));
333 return list;
334 }
335
336 PyObject* GetFacenames() {
337 wxArrayString* arr = self->GetFacenames();
338 PyObject* list = PyList_New(0);
339 for (size_t x=0; x<arr->GetCount(); x++)
340 PyList_Append(list, PyString_FromString((*arr)[x]));
341 return list;
342 }
343 }
f0261a72 344};
2abc0a0f
RD
345
346//----------------------------------------------------------------------
347
348class wxBusyCursor {
349public:
350 wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
351 ~wxBusyCursor();
352};
353
b1462dfa 354//----------------------------------------------------------------------
2abc0a0f 355
b1462dfa 356void wxPostEvent(wxEvtHandler *dest, wxEvent& event);
694759cf 357void wxWakeUpIdle();
2abc0a0f
RD
358
359//----------------------------------------------------------------------
f6bcfd97
BP
360
361
362class wxTipProvider
363{
364public:
365 // wxTipProvider(size_t currentTip); **** Abstract base class
366 ~wxTipProvider();
367
368 virtual wxString GetTip() = 0;
369 size_t GetCurrentTip();
370
371};
372
373
374// The C++ version of wxPyTipProvider
375%{
376class wxPyTipProvider : public wxTipProvider {
377public:
378 wxPyTipProvider(size_t currentTip)
379 : wxTipProvider(currentTip) {}
380
381 DEC_PYCALLBACK_STRING__pure(GetTip);
382
383 PYPRIVATE;
384};
385
386IMP_PYCALLBACK_STRING__pure( wxPyTipProvider, wxTipProvider, GetTip);
387
388%}
389
390
391// Now let SWIG know about it
392class wxPyTipProvider : public wxTipProvider {
393public:
394 wxPyTipProvider(size_t currentTip);
395};
396
397
398
399bool wxShowTip(wxWindow *parent, wxTipProvider *tipProvider, bool showAtStartup = TRUE);
400%new wxTipProvider * wxCreateFileTipProvider(const wxString& filename, size_t currentTip);
401
402
403//----------------------------------------------------------------------
404
405%{
406#include <wx/generic/dragimgg.h>
407static wxPoint wxPyNullPoint;
408%}
409
410%name (wxDragImage) class wxGenericDragImage
411{
412public:
413
414 wxGenericDragImage(const wxBitmap& image,
415 const wxCursor& cursor = wxNullCursor,
416 const wxPoint& hotspot = wxPyNullPoint);
417 ~wxGenericDragImage();
418
419 bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
420 bool fullScreen = FALSE, wxRect* rect = NULL);
421
422 %name(BeginDrag2) bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
423 wxWindow* fullScreenRect);
424
425 bool EndDrag();
426 bool Move(const wxPoint& pt);
427 bool Show();
428 bool Hide();
429
430 wxRect GetImageRect(const wxPoint& pos) const;
431 bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos,
432 bool eraseOld, bool drawNew);
433};
434
435
436// Alternate Constructors
437%new wxGenericDragImage* wxDragIcon(const wxIcon& image,
438 const wxCursor& cursor = wxNullCursor,
439 const wxPoint& hotspot = wxPyNullPoint);
440
441%new wxGenericDragImage* wxDragString(const wxString& str,
442 const wxCursor& cursor = wxNullCursor,
443 const wxPoint& hotspot = wxPyNullPoint);
444
445%new wxGenericDragImage* wxDragTreeItem(const wxTreeCtrl& treeCtrl, wxTreeItemId& id);
446
447%new wxGenericDragImage* wxDragListItem(const wxListCtrl& listCtrl, long id);
448
449
450%{
451
452wxGenericDragImage* wxDragIcon(const wxIcon& image,
453 const wxCursor& cursor,
454 const wxPoint& hotspot) {
455 return new wxGenericDragImage(image, cursor, hotspot);
456}
457
458wxGenericDragImage* wxDragString(const wxString& str,
459 const wxCursor& cursor,
460 const wxPoint& hotspot) {
461 return new wxGenericDragImage(str, cursor, hotspot);
462}
463
464wxGenericDragImage* wxDragTreeItem(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) {
465 return new wxGenericDragImage(treeCtrl, id);
466}
467
468wxGenericDragImage* wxDragListItem(const wxListCtrl& listCtrl, long id) {
469 return new wxGenericDragImage(listCtrl, id);
470}
471
472%}
473
474
475
476//----------------------------------------------------------------------
477
478class wxPyTimer {
479public:
480 wxPyTimer(PyObject* notify);
481 ~wxPyTimer();
482 int GetInterval();
483 bool IsOneShot();
484 bool IsRunning();
485 void SetOwner(wxEvtHandler *owner, int id = -1);
486 void Start(int milliseconds=-1, int oneShot=FALSE);
487 void Stop();
488};
489
490//----------------------------------------------------------------------
491//----------------------------------------------------------------------
492
493
494enum
495{
496 wxLOG_FatalError, // program can't continue, abort immediately
497 wxLOG_Error, // a serious error, user must be informed about it
498 wxLOG_Warning, // user is normally informed about it but may be ignored
499 wxLOG_Message, // normal message (i.e. normal output of a non GUI app)
500 wxLOG_Info, // informational message (a.k.a. 'Verbose')
501 wxLOG_Status, // informational: might go to the status line of GUI app
502 wxLOG_Debug, // never shown to the user, disabled in release mode
503 wxLOG_Trace, // trace messages are also only enabled in debug mode
504 wxLOG_Progress, // used for progress indicator (not yet)
505 wxLOG_User = 100 // user defined levels start here
506};
507
508
509class wxLog
510{
511public:
512 wxLog();
513
514 static bool IsEnabled();
515 static bool EnableLogging(bool doIt = TRUE);
516 static void OnLog(wxLogLevel level, const char *szString, int t=0);
517
518 virtual void Flush();
519 bool HasPendingMessages() const;
520
521 static void FlushActive();
522 static wxLog *GetActiveTarget();
523 static wxLog *SetActiveTarget(wxLog *pLogger);
524
525 static void Suspend();
526 static void Resume();
527
528 void SetVerbose(bool bVerbose = TRUE);
529
530 static void DontCreateOnDemand();
531 static void SetTraceMask(wxTraceMask ulMask);
532 static void AddTraceMask(const wxString& str);
533 static void RemoveTraceMask(const wxString& str);
534
535 bool GetVerbose() const { return m_bVerbose; }
536
537 static wxTraceMask GetTraceMask();
538 static bool IsAllowedTraceMask(const char *mask);
539
540};
541
542
543class wxLogStderr : public wxLog
544{
545public:
546 wxLogStderr(/* TODO: FILE *fp = (FILE *) NULL*/);
547};
548
549
550class wxLogTextCtrl : public wxLog
551{
552public:
553 wxLogTextCtrl(wxTextCtrl *pTextCtrl);
554};
555
556
557class wxLogGui : public wxLog
558{
559public:
560 wxLogGui();
561};
562
563class wxLogWindow : public wxLog
564{
565public:
566 wxLogWindow(wxFrame *pParent, // the parent frame (can be NULL)
567 const char *szTitle, // the title of the frame
568 bool bShow = TRUE, // show window immediately?
569 bool bPassToOld = TRUE); // pass log messages to the old target?
570
571 void Show(bool bShow = TRUE);
572 wxFrame *GetFrame() const;
573 wxLog *GetOldLog() const;
574 bool IsPassingMessages() const;
575 void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; }
576};
577
578
579class wxLogNull
580{
581public:
582 wxLogNull();
583 ~wxLogNull();
584};
585
586
587unsigned long wxSysErrorCode();
588const char* wxSysErrorMsg(unsigned long nErrCode = 0);
589void wxLogFatalError(const char *szFormat);
590void wxLogError(const char *szFormat);
591void wxLogWarning(const char *szFormat);
592void wxLogMessage(const char *szFormat);
593void wxLogInfo(const char *szFormat);
594void wxLogVerbose(const char *szFormat);
595void wxLogStatus(const char *szFormat);
596%name(wxLogStatusFrame)void wxLogStatus(wxFrame *pFrame, const char *szFormat);
597void wxLogSysError(const char *szFormat);
598
599
f0261a72
RD
600//----------------------------------------------------------------------
601//----------------------------------------------------------------------
602