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 //---------------------------------------------------------------------------
21 class wxToolTip : public wxObject {
23 wxToolTip(const wxString &tip);
25 void SetTip(const wxString& tip);
27 // *** Not in the "public" interface void SetWindow(wxWindow *win);
28 wxWindow *GetWindow();
30 static void Enable(bool flag);
31 static void SetDelay(long milliseconds);
34 //---------------------------------------------------------------------------
38 wxCaret(wxWindow* window, const wxSize& size);
43 %name(GetPositionTuple)void GetPosition(int *OUTPUT, int *OUTPUT);
44 wxPoint GetPosition();
45 %name(GetSizeTuple)void GetSize(int *OUTPUT, int *OUTPUT);
47 wxWindow *GetWindow();
48 %name(MoveXY)void Move(int x, int y);
49 void Move(const wxPoint& pt);
50 %name(SetSizeWH) void SetSize(int width, int height);
51 void SetSize(const wxSize& size);
52 void Show(int show = TRUE);
55 %pragma(python) addtoclass = "def __nonzero__(self): return self.IsOk()"
59 int wxCaret_GetBlinkTime() {
60 return wxCaret::GetBlinkTime();
63 void wxCaret_SetBlinkTime(int milliseconds) {
64 wxCaret::SetBlinkTime(milliseconds);
68 //---------------------------------------------------------------------------
72 wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
76 //---------------------------------------------------------------------------
78 class wxWindowDisabler {
80 wxWindowDisabler(wxWindow *winToSkip = NULL);
84 //---------------------------------------------------------------------------
86 class wxBusyInfo : public wxObject {
88 wxBusyInfo(const wxString& message);
93 //---------------------------------------------------------------------------
96 // wxStopWatch: measure time intervals with up to 1ms resolution
100 // ctor starts the stop watch
103 // start the stop watch at the moment t0
104 void Start(long t0 = 0);
106 // pause the stop watch
112 // get elapsed time since the last Start() in milliseconds
118 //---------------------------------------------------------------------------
120 class wxFileHistory : public wxObject
123 wxFileHistory(int maxFiles = 9);
127 void AddFileToHistory(const wxString& file);
128 void RemoveFileFromHistory(int i);
129 int GetMaxFiles() const;
130 void UseMenu(wxMenu *menu);
132 // Remove menu from the list (MDI child may be closing)
133 void RemoveMenu(wxMenu *menu);
135 void Load(wxConfigBase& config);
136 void Save(wxConfigBase& config);
138 void AddFilesToMenu();
139 %name(AddFilesToThisMenu)void AddFilesToMenu(wxMenu* menu);
142 wxString GetHistoryFile(int i) const;
144 int GetCount() const;
145 %pragma(python) addtoclass = "GetNoHistoryFiles = GetCount"
150 //---------------------------------------------------------------------------
153 #include <wx/snglinst.h>
156 class wxSingleInstanceChecker
159 // like Create() but no error checking (dangerous!)
160 wxSingleInstanceChecker(const wxString& name,
161 const wxString& path = wxPyEmptyString);
163 // default ctor, use Create() after it
164 %name(PreSingleInstanceChecker) wxSingleInstanceChecker();
166 ~wxSingleInstanceChecker();
169 // name must be given and be as unique as possible, it is used as the mutex
170 // name under Win32 and the lock file name under Unix -
171 // wxTheApp->GetAppName() may be a good value for this parameter
173 // path is optional and is ignored under Win32 and used as the directory to
174 // create the lock file in under Unix (default is wxGetHomeDir())
176 // returns FALSE if initialization failed, it doesn't mean that another
177 // instance is running - use IsAnotherRunning() to check it
178 bool Create(const wxString& name, const wxString& path = wxPyEmptyString);
180 // is another copy of this program already running?
181 bool IsAnotherRunning() const;
184 //---------------------------------------------------------------------------
191 #include <wx/msw/private.h>
192 #include <wx/dynload.h>
199 void wxDrawWindowOnDC(wxWindow* window, const wxDC& dc, int method)
206 // This one only partially works. Appears to be an undocumented
207 // "standard" convention that not all widgets adhear to. For
208 // example, for some widgets backgrounds or non-client areas may
210 ::SendMessage(GetHwndOf(window), WM_PAINT, (long)GetHdcOf(dc), 0);
214 // This one works much better, except for on XP. On Win2k nearly
215 // all widgets and their children are captured correctly[**]. On
216 // XP with Themes activated most native widgets draw only
217 // partially, if at all. Without themes it works just like on
220 // ** For example the radio buttons in a wxRadioBox are not its
221 // children by default, but you can capture it via the panel
222 // instead, or change RADIOBTN_PARENT_IS_RADIOBOX in radiobox.cpp.
223 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
224 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
225 PRF_ERASEBKGND | PRF_OWNED );
229 // This one is only defined in the latest SDK and is only
230 // available on XP. MSDN says it is similar to sending WM_PRINT
231 // so I expect that it will work similar to the above. Since it
232 // is avaialble only on XP, it can't be compiled like this and
233 // will have to be loaded dynamically.
234 // //::PrintWindow(GetHwndOf(window), GetHdcOf(dc), 0); //break;
239 // Use PrintWindow if available, or fallback to WM_PRINT
240 // otherwise. Unfortunately using PrintWindow is even worse than
241 // WM_PRINT. For most native widgets nothing is drawn to the dc
242 // at all, with or without Themes.
243 typedef BOOL (WINAPI *PrintWindow_t)(HWND, HDC, UINT);
244 static bool s_triedToLoad = false;
245 static PrintWindow_t pfnPrintWindow = NULL;
246 if ( !s_triedToLoad )
249 s_triedToLoad = true;
250 wxDynamicLibrary dllUser32(_T("user32.dll"));
251 if ( dllUser32.IsLoaded() )
253 wxLogNull nolog; // Don't report errors here
254 pfnPrintWindow = (PrintWindow_t)dllUser32.GetSymbol(_T("PrintWindow"));
259 printf("Using PrintWindow\n");
260 pfnPrintWindow(GetHwndOf(window), GetHdcOf(dc), 0);
264 printf("Using WM_PRINT\n");
265 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
266 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN | PRF_ERASEBKGND | PRF_OWNED );
274 //---------------------------------------------------------------------------
275 //---------------------------------------------------------------------------