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);
42 %property(Tip, GetTip, SetTip, doc="See `GetTip` and `SetTip`");
43 %property(Window, GetWindow, doc="See `GetWindow`");
47 //---------------------------------------------------------------------------
53 wxCaret(wxWindow* window, const wxSize& size);
57 %pythonAppend Destroy "args[0].thisown = 0"
59 "Deletes the C++ object this Python object is a proxy for.", "");
68 wxPoint GetPosition();
70 void, GetPosition(int *OUTPUT, int *OUTPUT),
71 "GetPositionTuple() -> (x,y)",
76 void, GetSize( int *OUTPUT, int *OUTPUT ),
77 "GetSizeTuple() -> (width, height)",
81 wxWindow *GetWindow();
82 %Rename(MoveXY, void, Move(int x, int y));
83 void Move(const wxPoint& pt);
84 %Rename(SetSizeWH, void, SetSize(int width, int height));
85 void SetSize(const wxSize& size);
86 void Show(int show = true);
89 %pythoncode { def __nonzero__(self): return self.IsOk() }
91 static int GetBlinkTime();
92 static void SetBlinkTime(int milliseconds);
94 %property(Position, GetPosition, doc="See `GetPosition`");
95 %property(Size, GetSize, SetSize, doc="See `GetSize` and `SetSize`");
96 %property(Window, GetWindow, doc="See `GetWindow`");
101 //---------------------------------------------------------------------------
103 MustHaveApp(wxBusyCursor);
107 wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
111 //---------------------------------------------------------------------------
113 MustHaveApp(wxWindowDisabler);
115 class wxWindowDisabler {
117 wxWindowDisabler(wxWindow *winToSkip = NULL);
121 //---------------------------------------------------------------------------
123 MustHaveApp(wxBusyInfo);
125 class wxBusyInfo : public wxObject {
127 wxBusyInfo(const wxString& message);
130 %pythoncode { def Destroy(self): pass }
134 //---------------------------------------------------------------------------
137 // wxStopWatch: measure time intervals with up to 1ms resolution
141 // ctor starts the stop watch
144 // start the stop watch at the moment t0
145 void Start(long t0 = 0);
147 // pause the stop watch
153 // get elapsed time since the last Start() in milliseconds
159 //---------------------------------------------------------------------------
161 class wxFileHistory : public wxObject
164 wxFileHistory(int maxFiles = 9, wxWindowID idBase = wxID_FILE1);
168 void AddFileToHistory(const wxString& file);
169 void RemoveFileFromHistory(int i);
170 int GetMaxFiles() const;
171 void UseMenu(wxMenu *menu);
173 // Remove menu from the list (MDI child may be closing)
174 void RemoveMenu(wxMenu *menu);
176 void Load(wxConfigBase& config);
177 void Save(wxConfigBase& config);
179 void AddFilesToMenu();
180 %Rename(AddFilesToThisMenu, void, AddFilesToMenu(wxMenu* menu));
183 wxString GetHistoryFile(int i) const;
185 int GetCount() const;
186 %pythoncode { GetNoHistoryFiles = GetCount }
188 %property(Count, GetCount, doc="See `GetCount`");
189 %property(HistoryFile, GetHistoryFile, doc="See `GetHistoryFile`");
190 %property(MaxFiles, GetMaxFiles, doc="See `GetMaxFiles`");
191 %property(NoHistoryFiles, GetNoHistoryFiles, doc="See `GetNoHistoryFiles`");
195 //---------------------------------------------------------------------------
198 #include <wx/snglinst.h>
201 class wxSingleInstanceChecker
204 // like Create() but no error checking (dangerous!)
205 wxSingleInstanceChecker(const wxString& name,
206 const wxString& path = wxPyEmptyString);
208 // default ctor, use Create() after it
209 %RenameCtor(PreSingleInstanceChecker, wxSingleInstanceChecker());
211 ~wxSingleInstanceChecker();
214 // name must be given and be as unique as possible, it is used as the mutex
215 // name under Win32 and the lock file name under Unix -
216 // wxTheApp->GetAppName() may be a good value for this parameter
218 // path is optional and is ignored under Win32 and used as the directory to
219 // create the lock file in under Unix (default is wxGetHomeDir())
221 // returns False if initialization failed, it doesn't mean that another
222 // instance is running - use IsAnotherRunning() to check it
223 bool Create(const wxString& name, const wxString& path = wxPyEmptyString);
225 // is another copy of this program already running?
226 bool IsAnotherRunning() const;
229 //---------------------------------------------------------------------------
232 // families & sub-families of operating systems
233 enum wxOperatingSystemId
235 wxOS_UNKNOWN = 0, // returned on error
237 wxOS_MAC_OS = 1 << 0, // Apple Mac OS 8/9/X with Mac paths
238 wxOS_MAC_OSX_DARWIN = 1 << 1, // Apple Mac OS X with Unix paths
239 wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN,
241 wxOS_WINDOWS_9X = 1 << 2, // Windows 9x family (95/98/ME)
242 wxOS_WINDOWS_NT = 1 << 3, // Windows NT family (NT/2000/XP)
243 wxOS_WINDOWS_MICRO = 1 << 4, // MicroWindows
244 wxOS_WINDOWS_CE = 1 << 5, // Windows CE (Window Mobile)
245 wxOS_WINDOWS = wxOS_WINDOWS_9X |
250 wxOS_UNIX_LINUX = 1 << 6, // Linux
251 wxOS_UNIX_FREEBSD = 1 << 7, // FreeBSD
252 wxOS_UNIX_OPENBSD = 1 << 8, // OpenBSD
253 wxOS_UNIX_NETBSD = 1 << 9, // NetBSD
254 wxOS_UNIX_SOLARIS = 1 << 10, // SunOS
255 wxOS_UNIX_AIX = 1 << 11, // AIX
256 wxOS_UNIX_HPUX = 1 << 12, // HP/UX
257 wxOS_UNIX = wxOS_UNIX_LINUX |
265 // 1<<13 and 1<<14 available for other Unix flavours
267 wxOS_DOS = 1 << 15, // Microsoft DOS
268 wxOS_OS2 = 1 << 16 // OS/2
271 // list of wxWidgets ports - some of them can be used with more than
275 wxPORT_UNKNOWN = 0, // returned on error
277 wxPORT_BASE = 1 << 0, // wxBase, no native toolkit used
279 wxPORT_MSW = 1 << 1, // wxMSW, native toolkit is Windows API
280 wxPORT_MOTIF = 1 << 2, // wxMotif, using [Open]Motif or Lesstif
281 wxPORT_GTK = 1 << 3, // wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo
282 wxPORT_MGL = 1 << 4, // wxMGL, using wxUniversal
283 wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal
284 wxPORT_PM = 1 << 6, // wxOS2, using OS/2 Presentation Manager
285 wxPORT_OS2 = wxPORT_PM, // wxOS2, using OS/2 Presentation Manager
286 wxPORT_MAC = 1 << 7, // wxMac, using Carbon or Classic Mac API
287 wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API
288 wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API
289 wxPORT_PALMOS = 1 << 10, // wxPalmOS, toolkit is PalmOS API
290 wxPORT_DFB = 1 << 11 // wxDFB, using wxUniversal
293 // architecture of the operating system
294 // (regardless of the build environment of wxWidgets library - see
295 // wxIsPlatform64bit documentation for more info)
298 wxARCH_INVALID = -1, // returned on error
307 // endian-ness of the machine
310 wxENDIAN_INVALID = -1, // returned on error
312 wxENDIAN_BIG, // 4321
313 wxENDIAN_LITTLE, // 1234
314 wxENDIAN_PDP, // 3412
319 // Information about the toolkit that the app is running under and some basic
320 // platform and architecture info
322 %rename(PlatformInformation) wxPlatformInfo; // wxPython already has a wx.PlatformInfo
328 // wxPlatformInfo(wxPortId pid,
329 // int tkMajor = -1, int tkMinor = -1,
330 // wxOperatingSystemId id = wxOS_UNKNOWN,
331 // int osMajor = -1, int osMinor = -1,
332 // wxArchitecture arch = wxARCH_INVALID,
333 // wxEndianness endian = wxENDIAN_INVALID,
334 // bool usingUniversal = false);
336 // default copy ctor, assignment operator and dtor are ok
338 bool operator==(const wxPlatformInfo &t) const;
340 bool operator!=(const wxPlatformInfo &t) const;
343 // // string -> enum conversions
344 // // ---------------------------------
346 // static wxOperatingSystemId GetOperatingSystemId(const wxString &name);
347 // static wxPortId GetPortId(const wxString &portname);
349 // static wxArchitecture GetArch(const wxString &arch);
350 // static wxEndianness GetEndianness(const wxString &end);
352 // // enum -> string conversions
353 // // ---------------------------------
355 // static wxString GetOperatingSystemFamilyName(wxOperatingSystemId os);
356 // static wxString GetOperatingSystemIdName(wxOperatingSystemId os);
357 // static wxString GetPortIdName(wxPortId port, bool usingUniversal);
358 // static wxString GetPortIdShortName(wxPortId port, bool usingUniversal);
360 // static wxString GetArchName(wxArchitecture arch);
361 // static wxString GetEndiannessName(wxEndianness end);
366 int GetOSMajorVersion() const;
367 int GetOSMinorVersion() const;
369 bool CheckOSVersion(int major, int minor) const;
371 int GetToolkitMajorVersion() const;
372 int GetToolkitMinorVersion() const;
374 bool CheckToolkitVersion(int major, int minor) const;
376 bool IsUsingUniversalWidgets() const;
378 wxOperatingSystemId GetOperatingSystemId() const;
379 wxPortId GetPortId() const;
380 wxArchitecture GetArchitecture() const;
381 wxEndianness GetEndianness() const;
387 wxString GetOperatingSystemFamilyName() const;
388 wxString GetOperatingSystemIdName() const;
389 wxString GetPortIdName() const;
390 wxString GetPortIdShortName() const;
391 wxString GetArchName() const;
392 wxString GetEndiannessName() const;
397 void SetOSVersion(int major, int minor);
398 void SetToolkitVersion(int major, int minor);
400 void SetOperatingSystemId(wxOperatingSystemId n);
401 void SetPortId(wxPortId n);
402 void SetArchitecture(wxArchitecture n);
403 void SetEndianness(wxEndianness n);
410 %property(ArchName, GetArchName, doc="See `GetArchName`");
411 %property(Architecture, GetArchitecture, SetArchitecture, doc="See `GetArchitecture` and `SetArchitecture`");
412 %property(Endianness, GetEndianness, SetEndianness, doc="See `GetEndianness` and `SetEndianness`");
413 %property(EndiannessName, GetEndiannessName, doc="See `GetEndiannessName`");
414 %property(OSMajorVersion, GetOSMajorVersion, doc="See `GetOSMajorVersion`");
415 %property(OSMinorVersion, GetOSMinorVersion, doc="See `GetOSMinorVersion`");
416 %property(OperatingSystemFamilyName, GetOperatingSystemFamilyName, doc="See `GetOperatingSystemFamilyName`");
417 %property(OperatingSystemId, GetOperatingSystemId, SetOperatingSystemId, doc="See `GetOperatingSystemId` and `SetOperatingSystemId`");
418 %property(OperatingSystemIdName, GetOperatingSystemIdName, doc="See `GetOperatingSystemIdName`");
419 %property(PortId, GetPortId, SetPortId, doc="See `GetPortId` and `SetPortId`");
420 %property(PortIdName, GetPortIdName, doc="See `GetPortIdName`");
421 %property(PortIdShortName, GetPortIdShortName, doc="See `GetPortIdShortName`");
422 %property(ToolkitMajorVersion, GetToolkitMajorVersion, doc="See `GetToolkitMajorVersion`");
423 %property(ToolkitMinorVersion, GetToolkitMinorVersion, doc="See `GetToolkitMinorVersion`");
428 //---------------------------------------------------------------------------
429 //---------------------------------------------------------------------------
434 #include <wx/msw/private.h>
435 #include <wx/dynload.h>
442 bool wxDrawWindowOnDC(wxWindow* window, const wxDC& dc
453 // This one only partially works. Appears to be an undocumented
454 // "standard" convention that not all widgets adhear to. For
455 // example, for some widgets backgrounds or non-client areas may
457 ::SendMessage(GetHwndOf(window), WM_PAINT, (long)GetHdcOf(dc), 0);
462 // This one works much better, nearly all widgets and their
463 // children are captured correctly[**]. Prior to the big
464 // background erase changes that Vadim did in 2004-2005 this
465 // method failed badly on XP with Themes activated, most native
466 // widgets draw only partially, if at all. Without themes it
467 // worked just like on Win2k. After those changes this method
470 // ** For example the radio buttons in a wxRadioBox are not its
471 // children by default, but you can capture it via the panel
472 // instead, or change RADIOBTN_PARENT_IS_RADIOBOX in radiobox.cpp.
473 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
474 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
475 PRF_ERASEBKGND | PRF_OWNED );
481 // This one is only defined in the latest SDK and is only
482 // available on XP. MSDN says it is similar to sending WM_PRINT
483 // so I expect that it will work similar to the above. Since it
484 // is avaialble only on XP, it can't be compiled like this and
485 // will have to be loaded dynamically.
486 // //::PrintWindow(GetHwndOf(window), GetHdcOf(dc), 0); //break;
491 // Use PrintWindow if available, or fallback to WM_PRINT
492 // otherwise. Unfortunately using PrintWindow is even worse than
493 // WM_PRINT. For most native widgets nothing is drawn to the dc
494 // at all, with or without Themes.
495 typedef BOOL (WINAPI *PrintWindow_t)(HWND, HDC, UINT);
496 static bool s_triedToLoad = false;
497 static PrintWindow_t pfnPrintWindow = NULL;
498 if ( !s_triedToLoad )
501 s_triedToLoad = true;
502 wxDynamicLibrary dllUser32(_T("user32.dll"));
503 if ( dllUser32.IsLoaded() )
505 wxLogNull nolog; // Don't report errors here
506 pfnPrintWindow = (PrintWindow_t)dllUser32.GetSymbol(_T("PrintWindow"));
511 //printf("Using PrintWindow\n");
512 pfnPrintWindow(GetHwndOf(window), GetHdcOf(dc), 0);
516 //printf("Using WM_PRINT\n");
517 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
518 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
519 PRF_ERASEBKGND | PRF_OWNED );
534 void t_output_tester1(int* a, int* b, int* c, int* d)
541 PyObject* t_output_tester2(int* a, int* b, int* c, int* d)
550 PyObject* t_output_tester3(int* a, int* b, int* c, int* d)
556 PyObject* res = PyTuple_New(2);
557 PyTuple_SetItem(res, 0, PyInt_FromLong(1));
558 PyTuple_SetItem(res, 1, PyInt_FromLong(2));
561 PyObject* t_output_tester4()
563 PyObject* res = PyTuple_New(2);
564 PyTuple_SetItem(res, 0, PyInt_FromLong(132));
565 PyTuple_SetItem(res, 1, PyInt_FromLong(244));
570 %newobject t_output_tester2;
571 %newobject t_output_tester3;
572 %newobject t_output_tester4;
574 void t_output_tester1(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
575 PyObject* t_output_tester2(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
576 PyObject* t_output_tester3(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
577 PyObject* t_output_tester4();
581 //---------------------------------------------------------------------------
582 //---------------------------------------------------------------------------