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 }
188 //---------------------------------------------------------------------------
191 #include <wx/snglinst.h>
194 class wxSingleInstanceChecker
197 // like Create() but no error checking (dangerous!)
198 wxSingleInstanceChecker(const wxString& name,
199 const wxString& path = wxPyEmptyString);
201 // default ctor, use Create() after it
202 %RenameCtor(PreSingleInstanceChecker, wxSingleInstanceChecker());
204 ~wxSingleInstanceChecker();
207 // name must be given and be as unique as possible, it is used as the mutex
208 // name under Win32 and the lock file name under Unix -
209 // wxTheApp->GetAppName() may be a good value for this parameter
211 // path is optional and is ignored under Win32 and used as the directory to
212 // create the lock file in under Unix (default is wxGetHomeDir())
214 // returns False if initialization failed, it doesn't mean that another
215 // instance is running - use IsAnotherRunning() to check it
216 bool Create(const wxString& name, const wxString& path = wxPyEmptyString);
218 // is another copy of this program already running?
219 bool IsAnotherRunning() const;
222 //---------------------------------------------------------------------------
225 // families & sub-families of operating systems
226 enum wxOperatingSystemId
228 wxOS_UNKNOWN = 0, // returned on error
230 wxOS_MAC_OS = 1 << 0, // Apple Mac OS 8/9/X with Mac paths
231 wxOS_MAC_OSX_DARWIN = 1 << 1, // Apple Mac OS X with Unix paths
232 wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN,
234 wxOS_WINDOWS_9X = 1 << 2, // Windows 9x family (95/98/ME)
235 wxOS_WINDOWS_NT = 1 << 3, // Windows NT family (NT/2000/XP)
236 wxOS_WINDOWS_MICRO = 1 << 4, // MicroWindows
237 wxOS_WINDOWS_CE = 1 << 5, // Windows CE (Window Mobile)
238 wxOS_WINDOWS = wxOS_WINDOWS_9X |
243 wxOS_UNIX_LINUX = 1 << 6, // Linux
244 wxOS_UNIX_FREEBSD = 1 << 7, // FreeBSD
245 wxOS_UNIX_OPENBSD = 1 << 8, // OpenBSD
246 wxOS_UNIX_NETBSD = 1 << 9, // NetBSD
247 wxOS_UNIX_SOLARIS = 1 << 10, // SunOS
248 wxOS_UNIX_AIX = 1 << 11, // AIX
249 wxOS_UNIX_HPUX = 1 << 12, // HP/UX
250 wxOS_UNIX = wxOS_UNIX_LINUX |
258 // 1<<13 and 1<<14 available for other Unix flavours
260 wxOS_DOS = 1 << 15, // Microsoft DOS
261 wxOS_OS2 = 1 << 16 // OS/2
264 // list of wxWidgets ports - some of them can be used with more than
268 wxPORT_UNKNOWN = 0, // returned on error
270 wxPORT_BASE = 1 << 0, // wxBase, no native toolkit used
272 wxPORT_MSW = 1 << 1, // wxMSW, native toolkit is Windows API
273 wxPORT_MOTIF = 1 << 2, // wxMotif, using [Open]Motif or Lesstif
274 wxPORT_GTK = 1 << 3, // wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo
275 wxPORT_MGL = 1 << 4, // wxMGL, using wxUniversal
276 wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal
277 wxPORT_PM = 1 << 6, // wxOS2, using OS/2 Presentation Manager
278 wxPORT_OS2 = wxPORT_PM, // wxOS2, using OS/2 Presentation Manager
279 wxPORT_MAC = 1 << 7, // wxMac, using Carbon or Classic Mac API
280 wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API
281 wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API
282 wxPORT_PALMOS = 1 << 10, // wxPalmOS, toolkit is PalmOS API
283 wxPORT_DFB = 1 << 11 // wxDFB, using wxUniversal
286 // architecture of the operating system
287 // (regardless of the build environment of wxWidgets library - see
288 // wxIsPlatform64bit documentation for more info)
291 wxARCH_INVALID = -1, // returned on error
300 // endian-ness of the machine
303 wxENDIAN_INVALID = -1, // returned on error
305 wxENDIAN_BIG, // 4321
306 wxENDIAN_LITTLE, // 1234
307 wxENDIAN_PDP, // 3412
312 // Information about the toolkit that the app is running under and some basic
313 // platform and architecture info
315 %rename(PlatformInformation) wxPlatformInfo; // wxPython already has a wx.PlatformInfo
321 // wxPlatformInfo(wxPortId pid,
322 // int tkMajor = -1, int tkMinor = -1,
323 // wxOperatingSystemId id = wxOS_UNKNOWN,
324 // int osMajor = -1, int osMinor = -1,
325 // wxArchitecture arch = wxARCH_INVALID,
326 // wxEndianness endian = wxENDIAN_INVALID,
327 // bool usingUniversal = false);
329 // default copy ctor, assignment operator and dtor are ok
331 bool operator==(const wxPlatformInfo &t) const;
333 bool operator!=(const wxPlatformInfo &t) const;
336 // // string -> enum conversions
337 // // ---------------------------------
339 // static wxOperatingSystemId GetOperatingSystemId(const wxString &name);
340 // static wxPortId GetPortId(const wxString &portname);
342 // static wxArchitecture GetArch(const wxString &arch);
343 // static wxEndianness GetEndianness(const wxString &end);
345 // // enum -> string conversions
346 // // ---------------------------------
348 // static wxString GetOperatingSystemFamilyName(wxOperatingSystemId os);
349 // static wxString GetOperatingSystemIdName(wxOperatingSystemId os);
350 // static wxString GetPortIdName(wxPortId port, bool usingUniversal);
351 // static wxString GetPortIdShortName(wxPortId port, bool usingUniversal);
353 // static wxString GetArchName(wxArchitecture arch);
354 // static wxString GetEndiannessName(wxEndianness end);
359 int GetOSMajorVersion() const;
360 int GetOSMinorVersion() const;
362 int GetToolkitMajorVersion() const;
363 int GetToolkitMinorVersion() const;
365 bool IsUsingUniversalWidgets() const;
367 wxOperatingSystemId GetOperatingSystemId() const;
368 wxPortId GetPortId() const;
369 wxArchitecture GetArchitecture() const;
370 wxEndianness GetEndianness() const;
376 wxString GetOperatingSystemFamilyName() const;
377 wxString GetOperatingSystemIdName() const;
378 wxString GetPortIdName() const;
379 wxString GetPortIdShortName() const;
380 wxString GetArchName() const;
381 wxString GetEndiannessName() const;
386 void SetOSVersion(int major, int minor);
387 void SetToolkitVersion(int major, int minor);
389 void SetOperatingSystemId(wxOperatingSystemId n);
390 void SetPortId(wxPortId n);
391 void SetArchitecture(wxArchitecture n);
392 void SetEndianness(wxEndianness n);
401 //---------------------------------------------------------------------------
402 //---------------------------------------------------------------------------
407 #include <wx/msw/private.h>
408 #include <wx/dynload.h>
415 bool wxDrawWindowOnDC(wxWindow* window, const wxDC& dc
426 // This one only partially works. Appears to be an undocumented
427 // "standard" convention that not all widgets adhear to. For
428 // example, for some widgets backgrounds or non-client areas may
430 ::SendMessage(GetHwndOf(window), WM_PAINT, (long)GetHdcOf(dc), 0);
435 // This one works much better, nearly all widgets and their
436 // children are captured correctly[**]. Prior to the big
437 // background erase changes that Vadim did in 2004-2005 this
438 // method failed badly on XP with Themes activated, most native
439 // widgets draw only partially, if at all. Without themes it
440 // worked just like on Win2k. After those changes this method
443 // ** For example the radio buttons in a wxRadioBox are not its
444 // children by default, but you can capture it via the panel
445 // instead, or change RADIOBTN_PARENT_IS_RADIOBOX in radiobox.cpp.
446 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
447 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
448 PRF_ERASEBKGND | PRF_OWNED );
454 // This one is only defined in the latest SDK and is only
455 // available on XP. MSDN says it is similar to sending WM_PRINT
456 // so I expect that it will work similar to the above. Since it
457 // is avaialble only on XP, it can't be compiled like this and
458 // will have to be loaded dynamically.
459 // //::PrintWindow(GetHwndOf(window), GetHdcOf(dc), 0); //break;
464 // Use PrintWindow if available, or fallback to WM_PRINT
465 // otherwise. Unfortunately using PrintWindow is even worse than
466 // WM_PRINT. For most native widgets nothing is drawn to the dc
467 // at all, with or without Themes.
468 typedef BOOL (WINAPI *PrintWindow_t)(HWND, HDC, UINT);
469 static bool s_triedToLoad = false;
470 static PrintWindow_t pfnPrintWindow = NULL;
471 if ( !s_triedToLoad )
474 s_triedToLoad = true;
475 wxDynamicLibrary dllUser32(_T("user32.dll"));
476 if ( dllUser32.IsLoaded() )
478 wxLogNull nolog; // Don't report errors here
479 pfnPrintWindow = (PrintWindow_t)dllUser32.GetSymbol(_T("PrintWindow"));
484 //printf("Using PrintWindow\n");
485 pfnPrintWindow(GetHwndOf(window), GetHdcOf(dc), 0);
489 //printf("Using WM_PRINT\n");
490 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
491 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
492 PRF_ERASEBKGND | PRF_OWNED );
507 void t_output_tester1(int* a, int* b, int* c, int* d)
514 PyObject* t_output_tester2(int* a, int* b, int* c, int* d)
523 PyObject* t_output_tester3(int* a, int* b, int* c, int* d)
529 PyObject* res = PyTuple_New(2);
530 PyTuple_SetItem(res, 0, PyInt_FromLong(1));
531 PyTuple_SetItem(res, 1, PyInt_FromLong(2));
534 PyObject* t_output_tester4()
536 PyObject* res = PyTuple_New(2);
537 PyTuple_SetItem(res, 0, PyInt_FromLong(132));
538 PyTuple_SetItem(res, 1, PyInt_FromLong(244));
543 %newobject t_output_tester2;
544 %newobject t_output_tester3;
545 %newobject t_output_tester4;
547 void t_output_tester1(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
548 PyObject* t_output_tester2(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
549 PyObject* t_output_tester3(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
550 PyObject* t_output_tester4();
554 //---------------------------------------------------------------------------
555 //---------------------------------------------------------------------------