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);
44 wxPoint GetPosition();
46 void, GetPosition(int *OUTPUT, int *OUTPUT),
47 "GetPositionTuple() -> (x,y)",
52 void, GetSize( int *OUTPUT, int *OUTPUT ),
53 "GetSizeTuple() -> (width, height)",
57 wxWindow *GetWindow();
58 %name(MoveXY)void Move(int x, int y);
59 void Move(const wxPoint& pt);
60 %name(SetSizeWH) void SetSize(int width, int height);
61 void SetSize(const wxSize& size);
62 void Show(int show = True);
65 %pythoncode { def __nonzero__(self): return self.IsOk() }
69 int wxCaret_GetBlinkTime() {
70 return wxCaret::GetBlinkTime();
73 void wxCaret_SetBlinkTime(int milliseconds) {
74 wxCaret::SetBlinkTime(milliseconds);
78 //---------------------------------------------------------------------------
82 wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
86 //---------------------------------------------------------------------------
88 class wxWindowDisabler {
90 wxWindowDisabler(wxWindow *winToSkip = NULL);
94 //---------------------------------------------------------------------------
96 class wxBusyInfo : public wxObject {
98 wxBusyInfo(const wxString& message);
103 //---------------------------------------------------------------------------
106 // wxStopWatch: measure time intervals with up to 1ms resolution
110 // ctor starts the stop watch
113 // start the stop watch at the moment t0
114 void Start(long t0 = 0);
116 // pause the stop watch
122 // get elapsed time since the last Start() in milliseconds
128 //---------------------------------------------------------------------------
130 class wxFileHistory : public wxObject
133 wxFileHistory(int maxFiles = 9);
137 void AddFileToHistory(const wxString& file);
138 void RemoveFileFromHistory(int i);
139 int GetMaxFiles() const;
140 void UseMenu(wxMenu *menu);
142 // Remove menu from the list (MDI child may be closing)
143 void RemoveMenu(wxMenu *menu);
145 void Load(wxConfigBase& config);
146 void Save(wxConfigBase& config);
148 void AddFilesToMenu();
149 %name(AddFilesToThisMenu)void AddFilesToMenu(wxMenu* menu);
152 wxString GetHistoryFile(int i) const;
154 int GetCount() const;
155 %pragma(python) addtoclass = "GetNoHistoryFiles = GetCount"
160 //---------------------------------------------------------------------------
163 #include <wx/snglinst.h>
166 class wxSingleInstanceChecker
169 // like Create() but no error checking (dangerous!)
170 wxSingleInstanceChecker(const wxString& name,
171 const wxString& path = wxPyEmptyString);
173 // default ctor, use Create() after it
174 %name(PreSingleInstanceChecker) wxSingleInstanceChecker();
176 ~wxSingleInstanceChecker();
179 // name must be given and be as unique as possible, it is used as the mutex
180 // name under Win32 and the lock file name under Unix -
181 // wxTheApp->GetAppName() may be a good value for this parameter
183 // path is optional and is ignored under Win32 and used as the directory to
184 // create the lock file in under Unix (default is wxGetHomeDir())
186 // returns False if initialization failed, it doesn't mean that another
187 // instance is running - use IsAnotherRunning() to check it
188 bool Create(const wxString& name, const wxString& path = wxPyEmptyString);
190 // is another copy of this program already running?
191 bool IsAnotherRunning() const;
194 //---------------------------------------------------------------------------
201 #include <wx/msw/private.h>
202 #include <wx/dynload.h>
209 void wxDrawWindowOnDC(wxWindow* window, const wxDC& dc, int method)
216 // This one only partially works. Appears to be an undocumented
217 // "standard" convention that not all widgets adhear to. For
218 // example, for some widgets backgrounds or non-client areas may
220 ::SendMessage(GetHwndOf(window), WM_PAINT, (long)GetHdcOf(dc), 0);
224 // This one works much better, except for on XP. On Win2k nearly
225 // all widgets and their children are captured correctly[**]. On
226 // XP with Themes activated most native widgets draw only
227 // partially, if at all. Without themes it works just like on
230 // ** For example the radio buttons in a wxRadioBox are not its
231 // children by default, but you can capture it via the panel
232 // instead, or change RADIOBTN_PARENT_IS_RADIOBOX in radiobox.cpp.
233 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
234 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
235 PRF_ERASEBKGND | PRF_OWNED );
239 // This one is only defined in the latest SDK and is only
240 // available on XP. MSDN says it is similar to sending WM_PRINT
241 // so I expect that it will work similar to the above. Since it
242 // is avaialble only on XP, it can't be compiled like this and
243 // will have to be loaded dynamically.
244 // //::PrintWindow(GetHwndOf(window), GetHdcOf(dc), 0); //break;
249 // Use PrintWindow if available, or fallback to WM_PRINT
250 // otherwise. Unfortunately using PrintWindow is even worse than
251 // WM_PRINT. For most native widgets nothing is drawn to the dc
252 // at all, with or without Themes.
253 typedef BOOL (WINAPI *PrintWindow_t)(HWND, HDC, UINT);
254 static bool s_triedToLoad = False;
255 static PrintWindow_t pfnPrintWindow = NULL;
256 if ( !s_triedToLoad )
259 s_triedToLoad = True;
260 wxDynamicLibrary dllUser32(_T("user32.dll"));
261 if ( dllUser32.IsLoaded() )
263 wxLogNull nolog; // Don't report errors here
264 pfnPrintWindow = (PrintWindow_t)dllUser32.GetSymbol(_T("PrintWindow"));
269 printf("Using PrintWindow\n");
270 pfnPrintWindow(GetHwndOf(window), GetHdcOf(dc), 0);
274 printf("Using WM_PRINT\n");
275 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
276 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN | PRF_ERASEBKGND | PRF_OWNED );
284 //---------------------------------------------------------------------------
285 //---------------------------------------------------------------------------