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);
 
  44 //---------------------------------------------------------------------------
 
  50     wxCaret(wxWindow* window, const wxSize& size);
 
  54         %pythonAppend Destroy "args[0].thisown = 0"
 
  56                "Deletes the C++ object this Python object is a proxy for.", "");
 
  65     wxPoint GetPosition();
 
  67         void, GetPosition(int *OUTPUT, int *OUTPUT),
 
  68         "GetPositionTuple() -> (x,y)",
 
  73         void, GetSize( int *OUTPUT, int *OUTPUT ),
 
  74         "GetSizeTuple() -> (width, height)",
 
  78     wxWindow *GetWindow();
 
  79     %Rename(MoveXY, void, Move(int x, int y));
 
  80     void Move(const wxPoint& pt);
 
  81     %Rename(SetSizeWH,  void, SetSize(int width, int height));
 
  82     void SetSize(const wxSize& size);
 
  83     void Show(int show = true);
 
  86     %pythoncode { def __nonzero__(self): return self.IsOk() }
 
  88     static int GetBlinkTime();
 
  89     static void SetBlinkTime(int milliseconds);
 
  93 //---------------------------------------------------------------------------
 
  95 MustHaveApp(wxBusyCursor);
 
  99     wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
 
 103 //---------------------------------------------------------------------------
 
 105 MustHaveApp(wxWindowDisabler);
 
 107 class wxWindowDisabler {
 
 109     wxWindowDisabler(wxWindow *winToSkip = NULL);
 
 113 //---------------------------------------------------------------------------
 
 115 MustHaveApp(wxBusyInfo);
 
 117 class wxBusyInfo : public wxObject {
 
 119     wxBusyInfo(const wxString& message);
 
 124 //---------------------------------------------------------------------------
 
 127 // wxStopWatch: measure time intervals with up to 1ms resolution
 
 131     // ctor starts the stop watch
 
 134     // start the stop watch at the moment t0
 
 135     void Start(long t0 = 0);
 
 137     // pause the stop watch
 
 143     // get elapsed time since the last Start() in milliseconds
 
 149 //---------------------------------------------------------------------------
 
 151 class wxFileHistory : public wxObject
 
 154     wxFileHistory(int maxFiles = 9, wxWindowID idBase = wxID_FILE1);
 
 158     void AddFileToHistory(const wxString& file);
 
 159     void RemoveFileFromHistory(int i);
 
 160     int GetMaxFiles() const;
 
 161     void UseMenu(wxMenu *menu);
 
 163     // Remove menu from the list (MDI child may be closing)
 
 164     void RemoveMenu(wxMenu *menu);
 
 166     void Load(wxConfigBase& config);
 
 167     void Save(wxConfigBase& config);
 
 169     void AddFilesToMenu();
 
 170     %Rename(AddFilesToThisMenu, void, AddFilesToMenu(wxMenu* menu));
 
 173     wxString GetHistoryFile(int i) const;
 
 175     int GetCount() const;
 
 176     %pythoncode { GetNoHistoryFiles = GetCount }
 
 181 //---------------------------------------------------------------------------
 
 184 #include <wx/snglinst.h>
 
 187 class wxSingleInstanceChecker
 
 190     // like Create() but no error checking (dangerous!)
 
 191     wxSingleInstanceChecker(const wxString& name,
 
 192                             const wxString& path = wxPyEmptyString);
 
 194     // default ctor, use Create() after it
 
 195     %RenameCtor(PreSingleInstanceChecker,  wxSingleInstanceChecker());
 
 197     ~wxSingleInstanceChecker();
 
 200     // name must be given and be as unique as possible, it is used as the mutex
 
 201     // name under Win32 and the lock file name under Unix -
 
 202     // wxTheApp->GetAppName() may be a good value for this parameter
 
 204     // path is optional and is ignored under Win32 and used as the directory to
 
 205     // create the lock file in under Unix (default is wxGetHomeDir())
 
 207     // returns False if initialization failed, it doesn't mean that another
 
 208     // instance is running - use IsAnotherRunning() to check it
 
 209     bool Create(const wxString& name, const wxString& path = wxPyEmptyString);
 
 211     // is another copy of this program already running?
 
 212     bool IsAnotherRunning() const;
 
 215 //---------------------------------------------------------------------------
 
 220 #include <wx/msw/private.h>
 
 221 #include <wx/dynload.h>
 
 228 bool wxDrawWindowOnDC(wxWindow* window, const wxDC& dc
 
 239             // This one only partially works.  Appears to be an undocumented
 
 240             // "standard" convention that not all widgets adhear to.  For
 
 241             // example, for some widgets backgrounds or non-client areas may
 
 243             ::SendMessage(GetHwndOf(window), WM_PAINT, (long)GetHdcOf(dc), 0);
 
 248             // This one works much better, nearly all widgets and their
 
 249             // children are captured correctly[**].  Prior to the big
 
 250             // background erase changes that Vadim did in 2004-2005 this
 
 251             // method failed badly on XP with Themes activated, most native
 
 252             // widgets draw only partially, if at all.  Without themes it
 
 253             // worked just like on Win2k.  After those changes this method
 
 256             // ** For example the radio buttons in a wxRadioBox are not its
 
 257             // children by default, but you can capture it via the panel
 
 258             // instead, or change RADIOBTN_PARENT_IS_RADIOBOX in radiobox.cpp.
 
 259             ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
 
 260                           PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
 
 261                           PRF_ERASEBKGND | PRF_OWNED );
 
 267             // This one is only defined in the latest SDK and is only
 
 268             // available on XP.  MSDN says it is similar to sending WM_PRINT
 
 269             // so I expect that it will work similar to the above.  Since it
 
 270             // is avaialble only on XP, it can't be compiled like this and
 
 271             // will have to be loaded dynamically.
 
 272             // //::PrintWindow(GetHwndOf(window), GetHdcOf(dc), 0); //break;
 
 277             // Use PrintWindow if available, or fallback to WM_PRINT
 
 278             // otherwise.  Unfortunately using PrintWindow is even worse than
 
 279             // WM_PRINT.  For most native widgets nothing is drawn to the dc
 
 280             // at all, with or without Themes.
 
 281             typedef BOOL (WINAPI *PrintWindow_t)(HWND, HDC, UINT);
 
 282             static bool s_triedToLoad = false;
 
 283             static PrintWindow_t pfnPrintWindow = NULL;
 
 284             if ( !s_triedToLoad )
 
 287                 s_triedToLoad = true;
 
 288                 wxDynamicLibrary dllUser32(_T("user32.dll"));
 
 289                 if ( dllUser32.IsLoaded() )
 
 291                     wxLogNull nolog;  // Don't report errors here
 
 292                     pfnPrintWindow = (PrintWindow_t)dllUser32.GetSymbol(_T("PrintWindow"));
 
 297                 //printf("Using PrintWindow\n");
 
 298                 pfnPrintWindow(GetHwndOf(window), GetHdcOf(dc), 0);
 
 302                 //printf("Using WM_PRINT\n");
 
 303                 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
 
 304                               PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
 
 305                               PRF_ERASEBKGND | PRF_OWNED );
 
 320     void t_output_tester1(int* a, int* b, int* c, int* d)
 
 327     PyObject* t_output_tester2(int* a, int* b, int* c, int* d)
 
 336     PyObject* t_output_tester3(int* a, int* b, int* c, int* d)
 
 342         PyObject* res = PyTuple_New(2);
 
 343         PyTuple_SetItem(res, 0, PyInt_FromLong(1));
 
 344         PyTuple_SetItem(res, 1, PyInt_FromLong(2));
 
 347     PyObject* t_output_tester4()
 
 349         PyObject* res = PyTuple_New(2);
 
 350         PyTuple_SetItem(res, 0, PyInt_FromLong(132));
 
 351         PyTuple_SetItem(res, 1, PyInt_FromLong(244));
 
 356 %newobject t_output_tester2;
 
 357 %newobject t_output_tester3;
 
 358 %newobject t_output_tester4;
 
 360 void      t_output_tester1(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
 
 361 PyObject* t_output_tester2(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
 
 362 PyObject* t_output_tester3(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
 
 363 PyObject* t_output_tester4();
 
 367 //---------------------------------------------------------------------------
 
 368 //---------------------------------------------------------------------------