#include "helpers.h"
#include "pyistream.h"
-#include <wx/resource.h>
#include <wx/tooltip.h>
#include <wx/caret.h>
#include <wx/tipdlg.h>
#include <wx/mimetype.h>
#include <wx/snglinst.h>
#include <wx/effects.h>
-//#include <wx/spawnbrowser.h>
+#include <wx/sysopt.h>
static PyObject* t_output_helper(PyObject* target, PyObject* o) {
};
#include <wx/docview.h>
+
+#ifdef __WXMSW__
+#include <wx/msw/private.h>
+#include <wx/dynload.h>
+#endif
+
+
+void wxDrawWindowOnDC(wxWindow* window, const wxDC& dc, int method)
+{
+#ifdef __WXMSW__
+
+ switch (method)
+ {
+ case 1:
+ // This one only partially works. Appears to be an undocumented
+ // "standard" convention that not all widgets adhear to. For
+ // example, for some widgets backgrounds or non-client areas may
+ // not be painted.
+ ::SendMessage(GetHwndOf(window), WM_PAINT, (long)GetHdcOf(dc), 0);
+ break;
+
+ case 2:
+ // This one works much better, except for on XP. On Win2k nearly
+ // all widgets and their children are captured correctly[**]. On
+ // XP with Themes activated most native widgets draw only
+ // partially, if at all. Without themes it works just like on
+ // Win2k.
+ //
+ // ** For example the radio buttons in a wxRadioBox are not its
+ // children by default, but you can capture it via the panel
+ // instead, or change RADIOBTN_PARENT_IS_RADIOBOX in radiobox.cpp.
+ ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
+ PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
+ PRF_ERASEBKGND | PRF_OWNED );
+ break;
+
+ case 3:
+ // This one is only defined in the latest SDK and is only
+ // available on XP. MSDN says it is similar to sending WM_PRINT
+ // so I expect that it will work similar to the above. Since it
+ // is avaialble only on XP, it can't be compiled like this and
+ // will have to be loaded dynamically.
+ // //::PrintWindow(GetHwndOf(window), GetHdcOf(dc), 0); //break;
+
+ // fall through
+
+ case 4:
+ // Use PrintWindow if available, or fallback to WM_PRINT
+ // otherwise. Unfortunately using PrintWindow is even worse than
+ // WM_PRINT. For most native widgets nothing is drawn to the dc
+ // at all, with or without Themes.
+ typedef BOOL (WINAPI *PrintWindow_t)(HWND, HDC, UINT);
+ static bool s_triedToLoad = false;
+ static PrintWindow_t pfnPrintWindow = NULL;
+ if ( !s_triedToLoad )
+ {
+
+ s_triedToLoad = true;
+ wxDynamicLibrary dllUser32(_T("user32.dll"));
+ if ( dllUser32.IsLoaded() )
+ {
+ wxLogNull nolog; // Don't report errors here
+ pfnPrintWindow = (PrintWindow_t)dllUser32.GetSymbol(_T("PrintWindow"));
+ }
+ }
+ if (pfnPrintWindow)
+ {
+ printf("Using PrintWindow\n");
+ pfnPrintWindow(GetHwndOf(window), GetHdcOf(dc), 0);
+ }
+ else
+ {
+ printf("Using WM_PRINT\n");
+ ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
+ PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN | PRF_ERASEBKGND | PRF_OWNED );
+ }
+ }
+#endif
+}
+
#ifdef __cplusplus
extern "C" {
#endif
return pyobj;
}
+static PyObject *_wrap_wxDrawWindowOnDC(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxWindow * _arg0;
+ wxDC * _arg1;
+ int _arg2;
+ PyObject * _argo0 = 0;
+ PyObject * _argo1 = 0;
+ char *_kwnames[] = { "window","dc","method", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOi:wxDrawWindowOnDC",_kwnames,&_argo0,&_argo1,&_arg2))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDrawWindowOnDC. Expected _wxWindow_p.");
+ return NULL;
+ }
+ }
+ if (_argo1) {
+ if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxDrawWindowOnDC. Expected _wxDC_p.");
+ return NULL;
+ }
+ }
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ wxDrawWindowOnDC(_arg0,*_arg1,_arg2);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
static PyObject *_wrap_wxSystemSettings_GetColour(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxColour * _result;
return _resultobj;
}
+static void *SwigwxSystemOptionsTowxObject(void *ptr) {
+ wxSystemOptions *src;
+ wxObject *dest;
+ src = (wxSystemOptions *) ptr;
+ dest = (wxObject *) src;
+ return (void *) dest;
+}
+
+#define new_wxSystemOptions() (new wxSystemOptions())
+static PyObject *_wrap_new_wxSystemOptions(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxSystemOptions * _result;
+ char *_kwnames[] = { NULL };
+ char _ptemp[128];
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxSystemOptions",_kwnames))
+ return NULL;
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ _result = (wxSystemOptions *)new_wxSystemOptions();
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} if (_result) {
+ SWIG_MakePtr(_ptemp, (char *) _result,"_wxSystemOptions_p");
+ _resultobj = Py_BuildValue("s",_ptemp);
+ } else {
+ Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ }
+ return _resultobj;
+}
+
+static PyObject *_wrap_wxSystemOptions_SetOption(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxString * _arg0;
+ wxString * _arg1;
+ PyObject * _obj0 = 0;
+ PyObject * _obj1 = 0;
+ char *_kwnames[] = { "name","value", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxSystemOptions_SetOption",_kwnames,&_obj0,&_obj1))
+ return NULL;
+{
+ _arg0 = wxString_in_helper(_obj0);
+ if (_arg0 == NULL)
+ return NULL;
+}
+{
+ _arg1 = wxString_in_helper(_obj1);
+ if (_arg1 == NULL)
+ return NULL;
+}
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ wxSystemOptions::SetOption(*_arg0,*_arg1);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+{
+ if (_obj0)
+ delete _arg0;
+}
+{
+ if (_obj1)
+ delete _arg1;
+}
+ return _resultobj;
+}
+
+static PyObject *_wrap_wxSystemOptions_SetOptionInt(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxString * _arg0;
+ int _arg1;
+ PyObject * _obj0 = 0;
+ char *_kwnames[] = { "name","value", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxSystemOptions_SetOptionInt",_kwnames,&_obj0,&_arg1))
+ return NULL;
+{
+ _arg0 = wxString_in_helper(_obj0);
+ if (_arg0 == NULL)
+ return NULL;
+}
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ wxSystemOptions::SetOption(*_arg0,_arg1);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+{
+ if (_obj0)
+ delete _arg0;
+}
+ return _resultobj;
+}
+
+static PyObject *_wrap_wxSystemOptions_GetOption(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxString * _result;
+ wxString * _arg0;
+ PyObject * _obj0 = 0;
+ char *_kwnames[] = { "name", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSystemOptions_GetOption",_kwnames,&_obj0))
+ return NULL;
+{
+ _arg0 = wxString_in_helper(_obj0);
+ if (_arg0 == NULL)
+ return NULL;
+}
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ _result = new wxString (wxSystemOptions::GetOption(*_arg0));
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+}{
+#if wxUSE_UNICODE
+ _resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
+#else
+ _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
+#endif
+}
+{
+ if (_obj0)
+ delete _arg0;
+}
+{
+ delete _result;
+}
+ return _resultobj;
+}
+
+static PyObject *_wrap_wxSystemOptions_GetOptionInt(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ int _result;
+ wxString * _arg0;
+ PyObject * _obj0 = 0;
+ char *_kwnames[] = { "name", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSystemOptions_GetOptionInt",_kwnames,&_obj0))
+ return NULL;
+{
+ _arg0 = wxString_in_helper(_obj0);
+ if (_arg0 == NULL)
+ return NULL;
+}
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ _result = (int )wxSystemOptions::GetOptionInt(*_arg0);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} _resultobj = Py_BuildValue("i",_result);
+{
+ if (_obj0)
+ delete _arg0;
+}
+ return _resultobj;
+}
+
+static PyObject *_wrap_wxSystemOptions_HasOption(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ bool _result;
+ wxString * _arg0;
+ PyObject * _obj0 = 0;
+ char *_kwnames[] = { "name", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSystemOptions_HasOption",_kwnames,&_obj0))
+ return NULL;
+{
+ _arg0 = wxString_in_helper(_obj0);
+ if (_arg0 == NULL)
+ return NULL;
+}
+{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ _result = (bool )wxSystemOptions::HasOption(*_arg0);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
+} _resultobj = Py_BuildValue("i",_result);
+{
+ if (_obj0)
+ delete _arg0;
+}
+ return _resultobj;
+}
+
static void *SwigwxToolTipTowxObject(void *ptr) {
wxToolTip *src;
wxObject *dest;
#define wxPyTimer_Start(_swigobj,_swigarg0,_swigarg1) (_swigobj->Start(_swigarg0,_swigarg1))
static PyObject *_wrap_wxPyTimer_Start(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
+ bool _result;
wxPyTimer * _arg0;
int _arg1 = (int ) -1;
int _arg2 = (int ) FALSE;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
- wxPyTimer_Start(_arg0,_arg1,_arg2);
+ _result = (bool )wxPyTimer_Start(_arg0,_arg1,_arg2);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
-} Py_INCREF(Py_None);
- _resultobj = Py_None;
+} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
return _resultobj;
}
-#define wxLog_HasPendingMessages(_swigobj) (_swigobj->HasPendingMessages())
-static PyObject *_wrap_wxLog_HasPendingMessages(PyObject *self, PyObject *args, PyObject *kwargs) {
- PyObject * _resultobj;
- bool _result;
- wxLog * _arg0;
- PyObject * _argo0 = 0;
- char *_kwnames[] = { "self", NULL };
-
- self = self;
- if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxLog_HasPendingMessages",_kwnames,&_argo0))
- return NULL;
- if (_argo0) {
- if (_argo0 == Py_None) { _arg0 = NULL; }
- else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxLog_p")) {
- PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxLog_HasPendingMessages. Expected _wxLog_p.");
- return NULL;
- }
- }
-{
- PyThreadState* __tstate = wxPyBeginAllowThreads();
- _result = (bool )wxLog_HasPendingMessages(_arg0);
-
- wxPyEndAllowThreads(__tstate);
- if (PyErr_Occurred()) return NULL;
-} _resultobj = Py_BuildValue("i",_result);
- return _resultobj;
-}
-
static PyObject *_wrap_wxLog_FlushActive(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
char *_kwnames[] = { NULL };
}
static wxIcon * wxFileType_GetIcon(wxFileType *self) {
- wxIcon icon;
- if (self->GetIcon(&icon))
- return new wxIcon(icon);
+ wxIconLocation loc;
+ if (self->GetIcon(&loc))
+ return new wxIcon(loc);
else
return NULL;
}
}
static PyObject * wxFileType_GetIconInfo(wxFileType *self) {
- wxIcon icon;
- wxString iconFile;
- int iconIndex;
- if (self->GetIcon(&icon, &iconFile, &iconIndex)) {
+ wxIconLocation loc;
+ if (self->GetIcon(&loc)) {
+ wxString iconFile = loc.GetFileName();
+ int iconIndex = -1;
+#ifdef __WXMSW__
+ iconIndex = loc.GetIndex();
+#endif
+ // Make a tuple and put the values in it
wxPyBeginBlockThreads();
PyObject* tuple = PyTuple_New(3);
- PyTuple_SetItem(tuple, 0, wxPyConstructObject(new wxIcon(icon),
- wxT("wxIcon"), TRUE));
+ PyTuple_SetItem(tuple, 0,
+ wxPyConstructObject(new wxIcon(loc), wxT("wxIcon"), TRUE));
#if wxUSE_UNICODE
PyTuple_SetItem(tuple, 1, PyUnicode_FromWideChar(iconFile.c_str(), iconFile.Len()));
#else
static PyObject *_wrap_wxMimeTypesManager_Initialize(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxMimeTypesManager * _arg0;
- int _arg1 = (int ) (wxMAILCAP_STANDARD);
+ int _arg1 = (int ) (wxMAILCAP_ALL);
wxString * _arg2 = (wxString *) &wxPyEmptyString;
PyObject * _argo0 = 0;
PyObject * _obj2 = 0;
return _resultobj;
}
-#define wxFileHistory_GetNoHistoryFiles(_swigobj) (_swigobj->GetNoHistoryFiles())
-static PyObject *_wrap_wxFileHistory_GetNoHistoryFiles(PyObject *self, PyObject *args, PyObject *kwargs) {
- PyObject * _resultobj;
- int _result;
- wxFileHistory * _arg0;
- PyObject * _argo0 = 0;
- char *_kwnames[] = { "self", NULL };
-
- self = self;
- if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxFileHistory_GetNoHistoryFiles",_kwnames,&_argo0))
- return NULL;
- if (_argo0) {
- if (_argo0 == Py_None) { _arg0 = NULL; }
- else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxFileHistory_p")) {
- PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxFileHistory_GetNoHistoryFiles. Expected _wxFileHistory_p.");
- return NULL;
- }
- }
-{
- PyThreadState* __tstate = wxPyBeginAllowThreads();
- _result = (int )wxFileHistory_GetNoHistoryFiles(_arg0);
-
- wxPyEndAllowThreads(__tstate);
- if (PyErr_Occurred()) return NULL;
-} _resultobj = Py_BuildValue("i",_result);
- return _resultobj;
-}
-
static void *SwigwxEffectsTowxObject(void *ptr) {
wxEffects *src;
wxObject *dest;
{ "wxEffects_GetLightShadow", (PyCFunction) _wrap_wxEffects_GetLightShadow, METH_VARARGS | METH_KEYWORDS },
{ "wxEffects_GetHighlightColour", (PyCFunction) _wrap_wxEffects_GetHighlightColour, METH_VARARGS | METH_KEYWORDS },
{ "new_wxEffects", (PyCFunction) _wrap_new_wxEffects, METH_VARARGS | METH_KEYWORDS },
- { "wxFileHistory_GetNoHistoryFiles", (PyCFunction) _wrap_wxFileHistory_GetNoHistoryFiles, METH_VARARGS | METH_KEYWORDS },
{ "wxFileHistory_GetCount", (PyCFunction) _wrap_wxFileHistory_GetCount, METH_VARARGS | METH_KEYWORDS },
{ "wxFileHistory_GetHistoryFile", (PyCFunction) _wrap_wxFileHistory_GetHistoryFile, METH_VARARGS | METH_KEYWORDS },
{ "wxFileHistory_AddFilesToThisMenu", (PyCFunction) _wrap_wxFileHistory_AddFilesToThisMenu, METH_VARARGS | METH_KEYWORDS },
{ "wxLog_SetActiveTarget", (PyCFunction) _wrap_wxLog_SetActiveTarget, METH_VARARGS | METH_KEYWORDS },
{ "wxLog_GetActiveTarget", (PyCFunction) _wrap_wxLog_GetActiveTarget, METH_VARARGS | METH_KEYWORDS },
{ "wxLog_FlushActive", (PyCFunction) _wrap_wxLog_FlushActive, METH_VARARGS | METH_KEYWORDS },
- { "wxLog_HasPendingMessages", (PyCFunction) _wrap_wxLog_HasPendingMessages, METH_VARARGS | METH_KEYWORDS },
{ "wxLog_Flush", (PyCFunction) _wrap_wxLog_Flush, METH_VARARGS | METH_KEYWORDS },
{ "wxLog_OnLog", (PyCFunction) _wrap_wxLog_OnLog, METH_VARARGS | METH_KEYWORDS },
{ "wxLog_EnableLogging", (PyCFunction) _wrap_wxLog_EnableLogging, METH_VARARGS | METH_KEYWORDS },
{ "wxToolTip_GetTip", (PyCFunction) _wrap_wxToolTip_GetTip, METH_VARARGS | METH_KEYWORDS },
{ "wxToolTip_SetTip", (PyCFunction) _wrap_wxToolTip_SetTip, METH_VARARGS | METH_KEYWORDS },
{ "new_wxToolTip", (PyCFunction) _wrap_new_wxToolTip, METH_VARARGS | METH_KEYWORDS },
+ { "wxSystemOptions_HasOption", (PyCFunction) _wrap_wxSystemOptions_HasOption, METH_VARARGS | METH_KEYWORDS },
+ { "wxSystemOptions_GetOptionInt", (PyCFunction) _wrap_wxSystemOptions_GetOptionInt, METH_VARARGS | METH_KEYWORDS },
+ { "wxSystemOptions_GetOption", (PyCFunction) _wrap_wxSystemOptions_GetOption, METH_VARARGS | METH_KEYWORDS },
+ { "wxSystemOptions_SetOptionInt", (PyCFunction) _wrap_wxSystemOptions_SetOptionInt, METH_VARARGS | METH_KEYWORDS },
+ { "wxSystemOptions_SetOption", (PyCFunction) _wrap_wxSystemOptions_SetOption, METH_VARARGS | METH_KEYWORDS },
+ { "new_wxSystemOptions", (PyCFunction) _wrap_new_wxSystemOptions, METH_VARARGS | METH_KEYWORDS },
{ "wxSystemSettings_SetScreenType", (PyCFunction) _wrap_wxSystemSettings_SetScreenType, METH_VARARGS | METH_KEYWORDS },
{ "wxSystemSettings_GetScreenType", (PyCFunction) _wrap_wxSystemSettings_GetScreenType, METH_VARARGS | METH_KEYWORDS },
{ "wxSystemSettings_HasFeature", (PyCFunction) _wrap_wxSystemSettings_HasFeature, METH_VARARGS | METH_KEYWORDS },
{ "wxSystemSettings_GetMetric", (PyCFunction) _wrap_wxSystemSettings_GetMetric, METH_VARARGS | METH_KEYWORDS },
{ "wxSystemSettings_GetFont", (PyCFunction) _wrap_wxSystemSettings_GetFont, METH_VARARGS | METH_KEYWORDS },
{ "wxSystemSettings_GetColour", (PyCFunction) _wrap_wxSystemSettings_GetColour, METH_VARARGS | METH_KEYWORDS },
+ { "wxDrawWindowOnDC", (PyCFunction) _wrap_wxDrawWindowOnDC, METH_VARARGS | METH_KEYWORDS },
{ "wxWaveData", (PyCFunction) _wrap_wxWaveData, METH_VARARGS | METH_KEYWORDS },
{ "wxExecute", (PyCFunction) _wrap_wxExecute, METH_VARARGS | METH_KEYWORDS },
{ "wxSafeShowMessage", (PyCFunction) _wrap_wxSafeShowMessage, METH_VARARGS | METH_KEYWORDS },
{ "_wxObject","_wxPyTimer",SwigwxPyTimerTowxObject},
{ "_wxObject","_wxGenericDragImage",SwigwxGenericDragImageTowxObject},
{ "_wxObject","_wxToolTip",SwigwxToolTipTowxObject},
+ { "_wxObject","_wxSystemOptions",SwigwxSystemOptionsTowxObject},
{ "_signed_short","_WXTYPE",0},
{ "_signed_short","_short",0},
{ "_unsigned_char","_byte",0},