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 wxToolTip(const wxString &tip);
29 void SetTip(const wxString& tip);
31 // *** Not in the "public" interface void SetWindow(wxWindow *win);
32 wxWindow *GetWindow();
34 static void Enable(bool flag);
35 static void SetDelay(long milliseconds);
39 //---------------------------------------------------------------------------
45 wxCaret(wxWindow* window, const wxSize& size);
46 // ~wxCaret(); Window takes ownership
50 "Deletes the C++ object this Python object is a proxy for.", "");
59 wxPoint GetPosition();
61 void, GetPosition(int *OUTPUT, int *OUTPUT),
62 "GetPositionTuple() -> (x,y)",
67 void, GetSize( int *OUTPUT, int *OUTPUT ),
68 "GetSizeTuple() -> (width, height)",
72 wxWindow *GetWindow();
73 %Rename(MoveXY, void, Move(int x, int y));
74 void Move(const wxPoint& pt);
75 %Rename(SetSizeWH, void, SetSize(int width, int height));
76 void SetSize(const wxSize& size);
77 void Show(int show = true);
80 %pythoncode { def __nonzero__(self): return self.IsOk() }
82 static int GetBlinkTime();
83 static void SetBlinkTime(int milliseconds);
87 //---------------------------------------------------------------------------
89 MustHaveApp(wxBusyCursor);
93 wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
97 //---------------------------------------------------------------------------
99 MustHaveApp(wxWindowDisabler);
101 class wxWindowDisabler {
103 wxWindowDisabler(wxWindow *winToSkip = NULL);
107 //---------------------------------------------------------------------------
109 MustHaveApp(wxBusyInfo);
111 class wxBusyInfo : public wxObject {
113 wxBusyInfo(const wxString& message);
118 //---------------------------------------------------------------------------
121 // wxStopWatch: measure time intervals with up to 1ms resolution
125 // ctor starts the stop watch
128 // start the stop watch at the moment t0
129 void Start(long t0 = 0);
131 // pause the stop watch
137 // get elapsed time since the last Start() in milliseconds
143 //---------------------------------------------------------------------------
145 class wxFileHistory : public wxObject
148 wxFileHistory(int maxFiles = 9, wxWindowID idBase = wxID_FILE1);
152 void AddFileToHistory(const wxString& file);
153 void RemoveFileFromHistory(int i);
154 int GetMaxFiles() const;
155 void UseMenu(wxMenu *menu);
157 // Remove menu from the list (MDI child may be closing)
158 void RemoveMenu(wxMenu *menu);
160 void Load(wxConfigBase& config);
161 void Save(wxConfigBase& config);
163 void AddFilesToMenu();
164 %Rename(AddFilesToThisMenu, void, AddFilesToMenu(wxMenu* menu));
167 wxString GetHistoryFile(int i) const;
169 int GetCount() const;
170 %pythoncode { GetNoHistoryFiles = GetCount }
175 //---------------------------------------------------------------------------
178 #include <wx/snglinst.h>
181 class wxSingleInstanceChecker
184 // like Create() but no error checking (dangerous!)
185 wxSingleInstanceChecker(const wxString& name,
186 const wxString& path = wxPyEmptyString);
188 // default ctor, use Create() after it
189 %RenameCtor(PreSingleInstanceChecker, wxSingleInstanceChecker());
191 ~wxSingleInstanceChecker();
194 // name must be given and be as unique as possible, it is used as the mutex
195 // name under Win32 and the lock file name under Unix -
196 // wxTheApp->GetAppName() may be a good value for this parameter
198 // path is optional and is ignored under Win32 and used as the directory to
199 // create the lock file in under Unix (default is wxGetHomeDir())
201 // returns False if initialization failed, it doesn't mean that another
202 // instance is running - use IsAnotherRunning() to check it
203 bool Create(const wxString& name, const wxString& path = wxPyEmptyString);
205 // is another copy of this program already running?
206 bool IsAnotherRunning() const;
209 //---------------------------------------------------------------------------
214 #include <wx/msw/private.h>
215 #include <wx/dynload.h>
222 bool wxDrawWindowOnDC(wxWindow* window, const wxDC& dc
233 // This one only partially works. Appears to be an undocumented
234 // "standard" convention that not all widgets adhear to. For
235 // example, for some widgets backgrounds or non-client areas may
237 ::SendMessage(GetHwndOf(window), WM_PAINT, (long)GetHdcOf(dc), 0);
242 // This one works much better, nearly all widgets and their
243 // children are captured correctly[**]. Prior to the big
244 // background erase changes that Vadim did in 2004-2005 this
245 // method failed badly on XP with Themes activated, most native
246 // widgets draw only partially, if at all. Without themes it
247 // worked just like on Win2k. After those changes this method
250 // ** For example the radio buttons in a wxRadioBox are not its
251 // children by default, but you can capture it via the panel
252 // instead, or change RADIOBTN_PARENT_IS_RADIOBOX in radiobox.cpp.
253 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
254 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
255 PRF_ERASEBKGND | PRF_OWNED );
261 // This one is only defined in the latest SDK and is only
262 // available on XP. MSDN says it is similar to sending WM_PRINT
263 // so I expect that it will work similar to the above. Since it
264 // is avaialble only on XP, it can't be compiled like this and
265 // will have to be loaded dynamically.
266 // //::PrintWindow(GetHwndOf(window), GetHdcOf(dc), 0); //break;
271 // Use PrintWindow if available, or fallback to WM_PRINT
272 // otherwise. Unfortunately using PrintWindow is even worse than
273 // WM_PRINT. For most native widgets nothing is drawn to the dc
274 // at all, with or without Themes.
275 typedef BOOL (WINAPI *PrintWindow_t)(HWND, HDC, UINT);
276 static bool s_triedToLoad = false;
277 static PrintWindow_t pfnPrintWindow = NULL;
278 if ( !s_triedToLoad )
281 s_triedToLoad = true;
282 wxDynamicLibrary dllUser32(_T("user32.dll"));
283 if ( dllUser32.IsLoaded() )
285 wxLogNull nolog; // Don't report errors here
286 pfnPrintWindow = (PrintWindow_t)dllUser32.GetSymbol(_T("PrintWindow"));
291 //printf("Using PrintWindow\n");
292 pfnPrintWindow(GetHwndOf(window), GetHdcOf(dc), 0);
296 //printf("Using WM_PRINT\n");
297 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
298 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
299 PRF_ERASEBKGND | PRF_OWNED );
311 //---------------------------------------------------------------------------
312 //---------------------------------------------------------------------------