1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface definitions for lots of little stuff that
4 // don't deserve their own file. ;-)
8 // Created: 18-June-1999
10 // Copyright: (c) 2003 by Total Control Software
11 // Licence: wxWindows license
12 /////////////////////////////////////////////////////////////////////////////
17 //---------------------------------------------------------------------------
23 MustHaveApp(wxToolTip);
25 class wxToolTip : public wxObject {
27 %typemap(out) wxToolTip*; // turn off this typemap
28 wxToolTip(const wxString &tip);
29 // Turn it back on again
30 %typemap(out) wxToolTip* { $result = wxPyMake_wxObject($1, $owner); }
34 void SetTip(const wxString& tip);
36 // *** Not in the "public" interface void SetWindow(wxWindow *win);
37 wxWindow *GetWindow();
39 static void Enable(bool flag);
40 static void SetDelay(long milliseconds);
44 //---------------------------------------------------------------------------
50 wxCaret(wxWindow* window, const wxSize& size);
54 %pythonAppend Destroy "args[0].thisown = 0"
56 "Deletes the C++ object this Python object is a proxy for.", "");
65 wxPoint GetPosition();
67 void, GetPosition(int *OUTPUT, int *OUTPUT),
68 "GetPositionTuple() -> (x,y)",
73 void, GetSize( int *OUTPUT, int *OUTPUT ),
74 "GetSizeTuple() -> (width, height)",
78 wxWindow *GetWindow();
79 %Rename(MoveXY, void, Move(int x, int y));
80 void Move(const wxPoint& pt);
81 %Rename(SetSizeWH, void, SetSize(int width, int height));
82 void SetSize(const wxSize& size);
83 void Show(int show = true);
86 %pythoncode { def __nonzero__(self): return self.IsOk() }
88 static int GetBlinkTime();
89 static void SetBlinkTime(int milliseconds);
91 %property(Position, GetPosition, doc="See `GetPosition`");
92 %property(Size, GetSize, SetSize, doc="See `GetSize` and `SetSize`");
93 %property(Window, GetWindow, doc="See `GetWindow`");
98 //---------------------------------------------------------------------------
100 MustHaveApp(wxBusyCursor);
104 wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
108 //---------------------------------------------------------------------------
110 MustHaveApp(wxWindowDisabler);
112 class wxWindowDisabler {
114 wxWindowDisabler(wxWindow *winToSkip = NULL);
118 //---------------------------------------------------------------------------
120 MustHaveApp(wxBusyInfo);
122 class wxBusyInfo : public wxObject {
124 wxBusyInfo(const wxString& message);
127 %pythoncode { def Destroy(self): pass }
131 //---------------------------------------------------------------------------
134 // wxStopWatch: measure time intervals with up to 1ms resolution
138 // ctor starts the stop watch
141 // start the stop watch at the moment t0
142 void Start(long t0 = 0);
144 // pause the stop watch
150 // get elapsed time since the last Start() in milliseconds
156 //---------------------------------------------------------------------------
158 class wxFileHistory : public wxObject
161 wxFileHistory(int maxFiles = 9, wxWindowID idBase = wxID_FILE1);
165 void AddFileToHistory(const wxString& file);
166 void RemoveFileFromHistory(int i);
167 int GetMaxFiles() const;
168 void UseMenu(wxMenu *menu);
170 // Remove menu from the list (MDI child may be closing)
171 void RemoveMenu(wxMenu *menu);
173 void Load(wxConfigBase& config);
174 void Save(wxConfigBase& config);
176 void AddFilesToMenu();
177 %Rename(AddFilesToThisMenu, void, AddFilesToMenu(wxMenu* menu));
180 wxString GetHistoryFile(int i) const;
182 int GetCount() const;
183 %pythoncode { GetNoHistoryFiles = GetCount }
185 %property(Count, GetCount, doc="See `GetCount`");
186 %property(HistoryFile, GetHistoryFile, doc="See `GetHistoryFile`");
187 %property(MaxFiles, GetMaxFiles, doc="See `GetMaxFiles`");
188 %property(NoHistoryFiles, GetNoHistoryFiles, doc="See `GetNoHistoryFiles`");
192 //---------------------------------------------------------------------------
195 #include <wx/snglinst.h>
198 class wxSingleInstanceChecker
201 // like Create() but no error checking (dangerous!)
202 wxSingleInstanceChecker(const wxString& name,
203 const wxString& path = wxPyEmptyString);
205 // default ctor, use Create() after it
206 %RenameCtor(PreSingleInstanceChecker, wxSingleInstanceChecker());
208 ~wxSingleInstanceChecker();
211 // name must be given and be as unique as possible, it is used as the mutex
212 // name under Win32 and the lock file name under Unix -
213 // wxTheApp->GetAppName() may be a good value for this parameter
215 // path is optional and is ignored under Win32 and used as the directory to
216 // create the lock file in under Unix (default is wxGetHomeDir())
218 // returns False if initialization failed, it doesn't mean that another
219 // instance is running - use IsAnotherRunning() to check it
220 bool Create(const wxString& name, const wxString& path = wxPyEmptyString);
222 // is another copy of this program already running?
223 bool IsAnotherRunning() const;
226 //---------------------------------------------------------------------------
229 // families & sub-families of operating systems
230 enum wxOperatingSystemId
232 wxOS_UNKNOWN = 0, // returned on error
234 wxOS_MAC_OS = 1 << 0, // Apple Mac OS 8/9/X with Mac paths
235 wxOS_MAC_OSX_DARWIN = 1 << 1, // Apple Mac OS X with Unix paths
236 wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN,
238 wxOS_WINDOWS_9X = 1 << 2, // Windows 9x family (95/98/ME)
239 wxOS_WINDOWS_NT = 1 << 3, // Windows NT family (NT/2000/XP)
240 wxOS_WINDOWS_MICRO = 1 << 4, // MicroWindows
241 wxOS_WINDOWS_CE = 1 << 5, // Windows CE (Window Mobile)
242 wxOS_WINDOWS = wxOS_WINDOWS_9X |
247 wxOS_UNIX_LINUX = 1 << 6, // Linux
248 wxOS_UNIX_FREEBSD = 1 << 7, // FreeBSD
249 wxOS_UNIX_OPENBSD = 1 << 8, // OpenBSD
250 wxOS_UNIX_NETBSD = 1 << 9, // NetBSD
251 wxOS_UNIX_SOLARIS = 1 << 10, // SunOS
252 wxOS_UNIX_AIX = 1 << 11, // AIX
253 wxOS_UNIX_HPUX = 1 << 12, // HP/UX
254 wxOS_UNIX = wxOS_UNIX_LINUX |
262 // 1<<13 and 1<<14 available for other Unix flavours
264 wxOS_DOS = 1 << 15, // Microsoft DOS
265 wxOS_OS2 = 1 << 16 // OS/2
268 // list of wxWidgets ports - some of them can be used with more than
272 wxPORT_UNKNOWN = 0, // returned on error
274 wxPORT_BASE = 1 << 0, // wxBase, no native toolkit used
276 wxPORT_MSW = 1 << 1, // wxMSW, native toolkit is Windows API
277 wxPORT_MOTIF = 1 << 2, // wxMotif, using [Open]Motif or Lesstif
278 wxPORT_GTK = 1 << 3, // wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo
279 wxPORT_MGL = 1 << 4, // wxMGL, using wxUniversal
280 wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal
281 wxPORT_PM = 1 << 6, // wxOS2, using OS/2 Presentation Manager
282 wxPORT_OS2 = wxPORT_PM, // wxOS2, using OS/2 Presentation Manager
283 wxPORT_MAC = 1 << 7, // wxMac, using Carbon or Classic Mac API
284 wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API
285 wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API
286 wxPORT_PALMOS = 1 << 10, // wxPalmOS, toolkit is PalmOS API
287 wxPORT_DFB = 1 << 11 // wxDFB, using wxUniversal
290 // architecture of the operating system
291 // (regardless of the build environment of wxWidgets library - see
292 // wxIsPlatform64bit documentation for more info)
295 wxARCH_INVALID = -1, // returned on error
304 // endian-ness of the machine
307 wxENDIAN_INVALID = -1, // returned on error
309 wxENDIAN_BIG, // 4321
310 wxENDIAN_LITTLE, // 1234
311 wxENDIAN_PDP, // 3412
316 // Information about the toolkit that the app is running under and some basic
317 // platform and architecture info
319 %rename(PlatformInformation) wxPlatformInfo; // wxPython already has a wx.PlatformInfo
325 // wxPlatformInfo(wxPortId pid,
326 // int tkMajor = -1, int tkMinor = -1,
327 // wxOperatingSystemId id = wxOS_UNKNOWN,
328 // int osMajor = -1, int osMinor = -1,
329 // wxArchitecture arch = wxARCH_INVALID,
330 // wxEndianness endian = wxENDIAN_INVALID,
331 // bool usingUniversal = false);
333 // default copy ctor, assignment operator and dtor are ok
335 bool operator==(const wxPlatformInfo &t) const;
337 bool operator!=(const wxPlatformInfo &t) const;
340 // // string -> enum conversions
341 // // ---------------------------------
343 // static wxOperatingSystemId GetOperatingSystemId(const wxString &name);
344 // static wxPortId GetPortId(const wxString &portname);
346 // static wxArchitecture GetArch(const wxString &arch);
347 // static wxEndianness GetEndianness(const wxString &end);
349 // // enum -> string conversions
350 // // ---------------------------------
352 // static wxString GetOperatingSystemFamilyName(wxOperatingSystemId os);
353 // static wxString GetOperatingSystemIdName(wxOperatingSystemId os);
354 // static wxString GetPortIdName(wxPortId port, bool usingUniversal);
355 // static wxString GetPortIdShortName(wxPortId port, bool usingUniversal);
357 // static wxString GetArchName(wxArchitecture arch);
358 // static wxString GetEndiannessName(wxEndianness end);
363 int GetOSMajorVersion() const;
364 int GetOSMinorVersion() const;
366 int GetToolkitMajorVersion() const;
367 int GetToolkitMinorVersion() const;
369 bool IsUsingUniversalWidgets() const;
371 wxOperatingSystemId GetOperatingSystemId() const;
372 wxPortId GetPortId() const;
373 wxArchitecture GetArchitecture() const;
374 wxEndianness GetEndianness() const;
380 wxString GetOperatingSystemFamilyName() const;
381 wxString GetOperatingSystemIdName() const;
382 wxString GetPortIdName() const;
383 wxString GetPortIdShortName() const;
384 wxString GetArchName() const;
385 wxString GetEndiannessName() const;
390 void SetOSVersion(int major, int minor);
391 void SetToolkitVersion(int major, int minor);
393 void SetOperatingSystemId(wxOperatingSystemId n);
394 void SetPortId(wxPortId n);
395 void SetArchitecture(wxArchitecture n);
396 void SetEndianness(wxEndianness n);
405 //---------------------------------------------------------------------------
406 //---------------------------------------------------------------------------
411 #include <wx/msw/private.h>
412 #include <wx/dynload.h>
419 bool wxDrawWindowOnDC(wxWindow* window, const wxDC& dc
430 // This one only partially works. Appears to be an undocumented
431 // "standard" convention that not all widgets adhear to. For
432 // example, for some widgets backgrounds or non-client areas may
434 ::SendMessage(GetHwndOf(window), WM_PAINT, (long)GetHdcOf(dc), 0);
439 // This one works much better, nearly all widgets and their
440 // children are captured correctly[**]. Prior to the big
441 // background erase changes that Vadim did in 2004-2005 this
442 // method failed badly on XP with Themes activated, most native
443 // widgets draw only partially, if at all. Without themes it
444 // worked just like on Win2k. After those changes this method
447 // ** For example the radio buttons in a wxRadioBox are not its
448 // children by default, but you can capture it via the panel
449 // instead, or change RADIOBTN_PARENT_IS_RADIOBOX in radiobox.cpp.
450 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
451 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
452 PRF_ERASEBKGND | PRF_OWNED );
458 // This one is only defined in the latest SDK and is only
459 // available on XP. MSDN says it is similar to sending WM_PRINT
460 // so I expect that it will work similar to the above. Since it
461 // is avaialble only on XP, it can't be compiled like this and
462 // will have to be loaded dynamically.
463 // //::PrintWindow(GetHwndOf(window), GetHdcOf(dc), 0); //break;
468 // Use PrintWindow if available, or fallback to WM_PRINT
469 // otherwise. Unfortunately using PrintWindow is even worse than
470 // WM_PRINT. For most native widgets nothing is drawn to the dc
471 // at all, with or without Themes.
472 typedef BOOL (WINAPI *PrintWindow_t)(HWND, HDC, UINT);
473 static bool s_triedToLoad = false;
474 static PrintWindow_t pfnPrintWindow = NULL;
475 if ( !s_triedToLoad )
478 s_triedToLoad = true;
479 wxDynamicLibrary dllUser32(_T("user32.dll"));
480 if ( dllUser32.IsLoaded() )
482 wxLogNull nolog; // Don't report errors here
483 pfnPrintWindow = (PrintWindow_t)dllUser32.GetSymbol(_T("PrintWindow"));
488 //printf("Using PrintWindow\n");
489 pfnPrintWindow(GetHwndOf(window), GetHdcOf(dc), 0);
493 //printf("Using WM_PRINT\n");
494 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
495 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
496 PRF_ERASEBKGND | PRF_OWNED );
511 void t_output_tester1(int* a, int* b, int* c, int* d)
518 PyObject* t_output_tester2(int* a, int* b, int* c, int* d)
527 PyObject* t_output_tester3(int* a, int* b, int* c, int* d)
533 PyObject* res = PyTuple_New(2);
534 PyTuple_SetItem(res, 0, PyInt_FromLong(1));
535 PyTuple_SetItem(res, 1, PyInt_FromLong(2));
538 PyObject* t_output_tester4()
540 PyObject* res = PyTuple_New(2);
541 PyTuple_SetItem(res, 0, PyInt_FromLong(132));
542 PyTuple_SetItem(res, 1, PyInt_FromLong(244));
547 %newobject t_output_tester2;
548 %newobject t_output_tester3;
549 %newobject t_output_tester4;
551 void t_output_tester1(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
552 PyObject* t_output_tester2(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
553 PyObject* t_output_tester3(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
554 PyObject* t_output_tester4();
558 //---------------------------------------------------------------------------
559 //---------------------------------------------------------------------------