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 //---------------------------------------------------------------------------
22 class wxToolTip : public wxObject {
24 wxToolTip(const wxString &tip);
26 void SetTip(const wxString& tip);
28 // *** Not in the "public" interface void SetWindow(wxWindow *win);
29 wxWindow *GetWindow();
31 static void Enable(bool flag);
32 static void SetDelay(long milliseconds);
36 //---------------------------------------------------------------------------
40 wxCaret(wxWindow* window, const wxSize& size);
46 wxPoint GetPosition();
48 void, GetPosition(int *OUTPUT, int *OUTPUT),
49 "GetPositionTuple() -> (x,y)",
54 void, GetSize( int *OUTPUT, int *OUTPUT ),
55 "GetSizeTuple() -> (width, height)",
59 wxWindow *GetWindow();
60 %name(MoveXY)void Move(int x, int y);
61 void Move(const wxPoint& pt);
62 %name(SetSizeWH) void SetSize(int width, int height);
63 void SetSize(const wxSize& size);
64 void Show(int show = True);
67 %pythoncode { def __nonzero__(self): return self.IsOk() }
71 int wxCaret_GetBlinkTime() {
72 return wxCaret::GetBlinkTime();
75 void wxCaret_SetBlinkTime(int milliseconds) {
76 wxCaret::SetBlinkTime(milliseconds);
80 //---------------------------------------------------------------------------
84 wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
88 //---------------------------------------------------------------------------
90 class wxWindowDisabler {
92 wxWindowDisabler(wxWindow *winToSkip = NULL);
96 //---------------------------------------------------------------------------
98 class wxBusyInfo : public wxObject {
100 wxBusyInfo(const wxString& message);
105 //---------------------------------------------------------------------------
108 // wxStopWatch: measure time intervals with up to 1ms resolution
112 // ctor starts the stop watch
115 // start the stop watch at the moment t0
116 void Start(long t0 = 0);
118 // pause the stop watch
124 // get elapsed time since the last Start() in milliseconds
130 //---------------------------------------------------------------------------
132 class wxFileHistory : public wxObject
135 wxFileHistory(int maxFiles = 9);
139 void AddFileToHistory(const wxString& file);
140 void RemoveFileFromHistory(int i);
141 int GetMaxFiles() const;
142 void UseMenu(wxMenu *menu);
144 // Remove menu from the list (MDI child may be closing)
145 void RemoveMenu(wxMenu *menu);
147 void Load(wxConfigBase& config);
148 void Save(wxConfigBase& config);
150 void AddFilesToMenu();
151 %name(AddFilesToThisMenu)void AddFilesToMenu(wxMenu* menu);
154 wxString GetHistoryFile(int i) const;
156 int GetCount() const;
157 %pragma(python) addtoclass = "GetNoHistoryFiles = GetCount"
162 //---------------------------------------------------------------------------
165 #include <wx/snglinst.h>
168 class wxSingleInstanceChecker
171 // like Create() but no error checking (dangerous!)
172 wxSingleInstanceChecker(const wxString& name,
173 const wxString& path = wxPyEmptyString);
175 // default ctor, use Create() after it
176 %name(PreSingleInstanceChecker) wxSingleInstanceChecker();
178 ~wxSingleInstanceChecker();
181 // name must be given and be as unique as possible, it is used as the mutex
182 // name under Win32 and the lock file name under Unix -
183 // wxTheApp->GetAppName() may be a good value for this parameter
185 // path is optional and is ignored under Win32 and used as the directory to
186 // create the lock file in under Unix (default is wxGetHomeDir())
188 // returns False if initialization failed, it doesn't mean that another
189 // instance is running - use IsAnotherRunning() to check it
190 bool Create(const wxString& name, const wxString& path = wxPyEmptyString);
192 // is another copy of this program already running?
193 bool IsAnotherRunning() const;
196 //---------------------------------------------------------------------------
203 #include <wx/msw/private.h>
204 #include <wx/dynload.h>
211 void wxDrawWindowOnDC(wxWindow* window, const wxDC& dc, int method)
218 // This one only partially works. Appears to be an undocumented
219 // "standard" convention that not all widgets adhear to. For
220 // example, for some widgets backgrounds or non-client areas may
222 ::SendMessage(GetHwndOf(window), WM_PAINT, (long)GetHdcOf(dc), 0);
226 // This one works much better, except for on XP. On Win2k nearly
227 // all widgets and their children are captured correctly[**]. On
228 // XP with Themes activated most native widgets draw only
229 // partially, if at all. Without themes it works just like on
232 // ** For example the radio buttons in a wxRadioBox are not its
233 // children by default, but you can capture it via the panel
234 // instead, or change RADIOBTN_PARENT_IS_RADIOBOX in radiobox.cpp.
235 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
236 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
237 PRF_ERASEBKGND | PRF_OWNED );
241 // This one is only defined in the latest SDK and is only
242 // available on XP. MSDN says it is similar to sending WM_PRINT
243 // so I expect that it will work similar to the above. Since it
244 // is avaialble only on XP, it can't be compiled like this and
245 // will have to be loaded dynamically.
246 // //::PrintWindow(GetHwndOf(window), GetHdcOf(dc), 0); //break;
251 // Use PrintWindow if available, or fallback to WM_PRINT
252 // otherwise. Unfortunately using PrintWindow is even worse than
253 // WM_PRINT. For most native widgets nothing is drawn to the dc
254 // at all, with or without Themes.
255 typedef BOOL (WINAPI *PrintWindow_t)(HWND, HDC, UINT);
256 static bool s_triedToLoad = False;
257 static PrintWindow_t pfnPrintWindow = NULL;
258 if ( !s_triedToLoad )
261 s_triedToLoad = True;
262 wxDynamicLibrary dllUser32(_T("user32.dll"));
263 if ( dllUser32.IsLoaded() )
265 wxLogNull nolog; // Don't report errors here
266 pfnPrintWindow = (PrintWindow_t)dllUser32.GetSymbol(_T("PrintWindow"));
271 printf("Using PrintWindow\n");
272 pfnPrintWindow(GetHwndOf(window), GetHdcOf(dc), 0);
276 printf("Using WM_PRINT\n");
277 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
278 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN | PRF_ERASEBKGND | PRF_OWNED );
286 //---------------------------------------------------------------------------
287 //---------------------------------------------------------------------------