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);
93 //---------------------------------------------------------------------------
95 MustHaveApp(wxBusyCursor);
99 wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
103 //---------------------------------------------------------------------------
105 MustHaveApp(wxWindowDisabler);
107 class wxWindowDisabler {
109 wxWindowDisabler(wxWindow *winToSkip = NULL);
113 //---------------------------------------------------------------------------
115 MustHaveApp(wxBusyInfo);
117 class wxBusyInfo : public wxObject {
119 wxBusyInfo(const wxString& message);
122 %pythoncode { def Destroy(self): pass }
126 //---------------------------------------------------------------------------
129 // wxStopWatch: measure time intervals with up to 1ms resolution
133 // ctor starts the stop watch
136 // start the stop watch at the moment t0
137 void Start(long t0 = 0);
139 // pause the stop watch
145 // get elapsed time since the last Start() in milliseconds
151 //---------------------------------------------------------------------------
153 class wxFileHistory : public wxObject
156 wxFileHistory(int maxFiles = 9, wxWindowID idBase = wxID_FILE1);
160 void AddFileToHistory(const wxString& file);
161 void RemoveFileFromHistory(int i);
162 int GetMaxFiles() const;
163 void UseMenu(wxMenu *menu);
165 // Remove menu from the list (MDI child may be closing)
166 void RemoveMenu(wxMenu *menu);
168 void Load(wxConfigBase& config);
169 void Save(wxConfigBase& config);
171 void AddFilesToMenu();
172 %Rename(AddFilesToThisMenu, void, AddFilesToMenu(wxMenu* menu));
175 wxString GetHistoryFile(int i) const;
177 int GetCount() const;
178 %pythoncode { GetNoHistoryFiles = GetCount }
183 //---------------------------------------------------------------------------
186 #include <wx/snglinst.h>
189 class wxSingleInstanceChecker
192 // like Create() but no error checking (dangerous!)
193 wxSingleInstanceChecker(const wxString& name,
194 const wxString& path = wxPyEmptyString);
196 // default ctor, use Create() after it
197 %RenameCtor(PreSingleInstanceChecker, wxSingleInstanceChecker());
199 ~wxSingleInstanceChecker();
202 // name must be given and be as unique as possible, it is used as the mutex
203 // name under Win32 and the lock file name under Unix -
204 // wxTheApp->GetAppName() may be a good value for this parameter
206 // path is optional and is ignored under Win32 and used as the directory to
207 // create the lock file in under Unix (default is wxGetHomeDir())
209 // returns False if initialization failed, it doesn't mean that another
210 // instance is running - use IsAnotherRunning() to check it
211 bool Create(const wxString& name, const wxString& path = wxPyEmptyString);
213 // is another copy of this program already running?
214 bool IsAnotherRunning() const;
217 //---------------------------------------------------------------------------
220 // families & sub-families of operating systems
221 enum wxOperatingSystemId
223 wxOS_UNKNOWN = 0, // returned on error
225 wxOS_MAC_OS = 1 << 0, // Apple Mac OS 8/9/X with Mac paths
226 wxOS_MAC_OSX_DARWIN = 1 << 1, // Apple Mac OS X with Unix paths
227 wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN,
229 wxOS_WINDOWS_9X = 1 << 2, // Windows 9x family (95/98/ME)
230 wxOS_WINDOWS_NT = 1 << 3, // Windows NT family (NT/2000/XP)
231 wxOS_WINDOWS_MICRO = 1 << 4, // MicroWindows
232 wxOS_WINDOWS_CE = 1 << 5, // Windows CE (Window Mobile)
233 wxOS_WINDOWS = wxOS_WINDOWS_9X |
238 wxOS_UNIX_LINUX = 1 << 6, // Linux
239 wxOS_UNIX_FREEBSD = 1 << 7, // FreeBSD
240 wxOS_UNIX_OPENBSD = 1 << 8, // OpenBSD
241 wxOS_UNIX_NETBSD = 1 << 9, // NetBSD
242 wxOS_UNIX_SOLARIS = 1 << 10, // SunOS
243 wxOS_UNIX_AIX = 1 << 11, // AIX
244 wxOS_UNIX_HPUX = 1 << 12, // HP/UX
245 wxOS_UNIX = wxOS_UNIX_LINUX |
253 // 1<<13 and 1<<14 available for other Unix flavours
255 wxOS_DOS = 1 << 15, // Microsoft DOS
256 wxOS_OS2 = 1 << 16 // OS/2
259 // list of wxWidgets ports - some of them can be used with more than
263 wxPORT_UNKNOWN = 0, // returned on error
265 wxPORT_BASE = 1 << 0, // wxBase, no native toolkit used
267 wxPORT_MSW = 1 << 1, // wxMSW, native toolkit is Windows API
268 wxPORT_MOTIF = 1 << 2, // wxMotif, using [Open]Motif or Lesstif
269 wxPORT_GTK = 1 << 3, // wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo
270 wxPORT_MGL = 1 << 4, // wxMGL, using wxUniversal
271 wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal
272 wxPORT_OS2 = 1 << 6, // wxOS2, using OS/2 Presentation Manager
273 wxPORT_MAC = 1 << 7, // wxMac, using Carbon or Classic Mac API
274 wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API
275 wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API
276 wxPORT_PALMOS = 1 << 10 // wxPalmOS, toolkit is PalmOS API
279 // architecture of the operating system
280 // (regardless of the build environment of wxWidgets library - see
281 // wxIsPlatform64bit documentation for more info)
284 wxARCH_INVALID = -1, // returned on error
293 // endian-ness of the machine
296 wxENDIAN_INVALID = -1, // returned on error
298 wxENDIAN_BIG, // 4321
299 wxENDIAN_LITTLE, // 1234
300 wxENDIAN_PDP, // 3412
305 // Information about the toolkit that the app is running under and some basic
306 // platform and architecture info
308 %rename(PlatformInformation) wxPlatformInfo; // wxPython already has a wx.PlatformInfo
314 // wxPlatformInfo(wxPortId pid,
315 // int tkMajor = -1, int tkMinor = -1,
316 // wxOperatingSystemId id = wxOS_UNKNOWN,
317 // int osMajor = -1, int osMinor = -1,
318 // wxArchitecture arch = wxARCH_INVALID,
319 // wxEndianness endian = wxENDIAN_INVALID,
320 // bool usingUniversal = false);
322 // default copy ctor, assignment operator and dtor are ok
324 bool operator==(const wxPlatformInfo &t) const;
326 bool operator!=(const wxPlatformInfo &t) const;
329 // // string -> enum conversions
330 // // ---------------------------------
332 // static wxOperatingSystemId GetOperatingSystemId(const wxString &name);
333 // static wxPortId GetPortId(const wxString &portname);
335 // static wxArchitecture GetArch(const wxString &arch);
336 // static wxEndianness GetEndianness(const wxString &end);
338 // // enum -> string conversions
339 // // ---------------------------------
341 // static wxString GetOperatingSystemFamilyName(wxOperatingSystemId os);
342 // static wxString GetOperatingSystemIdName(wxOperatingSystemId os);
343 // static wxString GetPortIdName(wxPortId port, bool usingUniversal);
344 // static wxString GetPortIdShortName(wxPortId port, bool usingUniversal);
346 // static wxString GetArchName(wxArchitecture arch);
347 // static wxString GetEndiannessName(wxEndianness end);
352 int GetOSMajorVersion() const;
353 int GetOSMinorVersion() const;
355 int GetToolkitMajorVersion() const;
356 int GetToolkitMinorVersion() const;
358 bool IsUsingUniversalWidgets() const;
360 wxOperatingSystemId GetOperatingSystemId() const;
361 wxPortId GetPortId() const;
362 wxArchitecture GetArchitecture() const;
363 wxEndianness GetEndianness() const;
369 wxString GetOperatingSystemFamilyName() const;
370 wxString GetOperatingSystemIdName() const;
371 wxString GetPortIdName() const;
372 wxString GetPortIdShortName() const;
373 wxString GetArchName() const;
374 wxString GetEndiannessName() const;
379 void SetOSVersion(int major, int minor);
380 void SetToolkitVersion(int major, int minor);
382 void SetOperatingSystemId(wxOperatingSystemId n);
383 void SetPortId(wxPortId n);
384 void SetArchitecture(wxArchitecture n);
385 void SetEndianness(wxEndianness n);
394 //---------------------------------------------------------------------------
395 //---------------------------------------------------------------------------
400 #include <wx/msw/private.h>
401 #include <wx/dynload.h>
408 bool wxDrawWindowOnDC(wxWindow* window, const wxDC& dc
419 // This one only partially works. Appears to be an undocumented
420 // "standard" convention that not all widgets adhear to. For
421 // example, for some widgets backgrounds or non-client areas may
423 ::SendMessage(GetHwndOf(window), WM_PAINT, (long)GetHdcOf(dc), 0);
428 // This one works much better, nearly all widgets and their
429 // children are captured correctly[**]. Prior to the big
430 // background erase changes that Vadim did in 2004-2005 this
431 // method failed badly on XP with Themes activated, most native
432 // widgets draw only partially, if at all. Without themes it
433 // worked just like on Win2k. After those changes this method
436 // ** For example the radio buttons in a wxRadioBox are not its
437 // children by default, but you can capture it via the panel
438 // instead, or change RADIOBTN_PARENT_IS_RADIOBOX in radiobox.cpp.
439 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
440 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
441 PRF_ERASEBKGND | PRF_OWNED );
447 // This one is only defined in the latest SDK and is only
448 // available on XP. MSDN says it is similar to sending WM_PRINT
449 // so I expect that it will work similar to the above. Since it
450 // is avaialble only on XP, it can't be compiled like this and
451 // will have to be loaded dynamically.
452 // //::PrintWindow(GetHwndOf(window), GetHdcOf(dc), 0); //break;
457 // Use PrintWindow if available, or fallback to WM_PRINT
458 // otherwise. Unfortunately using PrintWindow is even worse than
459 // WM_PRINT. For most native widgets nothing is drawn to the dc
460 // at all, with or without Themes.
461 typedef BOOL (WINAPI *PrintWindow_t)(HWND, HDC, UINT);
462 static bool s_triedToLoad = false;
463 static PrintWindow_t pfnPrintWindow = NULL;
464 if ( !s_triedToLoad )
467 s_triedToLoad = true;
468 wxDynamicLibrary dllUser32(_T("user32.dll"));
469 if ( dllUser32.IsLoaded() )
471 wxLogNull nolog; // Don't report errors here
472 pfnPrintWindow = (PrintWindow_t)dllUser32.GetSymbol(_T("PrintWindow"));
477 //printf("Using PrintWindow\n");
478 pfnPrintWindow(GetHwndOf(window), GetHdcOf(dc), 0);
482 //printf("Using WM_PRINT\n");
483 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
484 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
485 PRF_ERASEBKGND | PRF_OWNED );
500 void t_output_tester1(int* a, int* b, int* c, int* d)
507 PyObject* t_output_tester2(int* a, int* b, int* c, int* d)
516 PyObject* t_output_tester3(int* a, int* b, int* c, int* d)
522 PyObject* res = PyTuple_New(2);
523 PyTuple_SetItem(res, 0, PyInt_FromLong(1));
524 PyTuple_SetItem(res, 1, PyInt_FromLong(2));
527 PyObject* t_output_tester4()
529 PyObject* res = PyTuple_New(2);
530 PyTuple_SetItem(res, 0, PyInt_FromLong(132));
531 PyTuple_SetItem(res, 1, PyInt_FromLong(244));
536 %newobject t_output_tester2;
537 %newobject t_output_tester3;
538 %newobject t_output_tester4;
540 void t_output_tester1(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
541 PyObject* t_output_tester2(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
542 PyObject* t_output_tester3(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
543 PyObject* t_output_tester4();
547 //---------------------------------------------------------------------------
548 //---------------------------------------------------------------------------