Enabling the use of masks for wxGTK in some of the demos
wxWindow.GetHandle returns the X-Window instead of the GtkWidget pointer so the X-Window can be given to other Python modules such as VTK. wxPython.lib.vtk updated to get the window handle at widget creation instead of in the constructor. other updates git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5147 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -153,10 +153,10 @@ def EVT_QUERY_NEW_PALETTE(win, func):
|
||||
win.Connect(-1, -1, wxEVT_QUERY_NEW_PALETTE, func)
|
||||
|
||||
def EVT_WINDOW_CREATE(win, func):
|
||||
win.Connect(-1, -1, wxEVT_WINDOW_CREATE, func)
|
||||
win.Connect(-1, -1, wxEVT_CREATE, func)
|
||||
|
||||
def EVT_WINDOW_DESTROY(win, func):
|
||||
win.Connect(-1, -1, wxEVT_WINDOW_DESTROY, func)
|
||||
win.Connect(-1, -1, wxEVT_DESTROY, func)
|
||||
|
||||
|
||||
|
||||
|
@@ -1784,6 +1784,7 @@ static wxListItem * wxListCtrl_GetItem(wxListCtrl *self,long itemId,int col) {
|
||||
wxListItem* info = new wxListItem;
|
||||
info->m_itemId = itemId;
|
||||
info->m_col = col;
|
||||
info->m_mask = 0xFFFF;
|
||||
self->GetItem(*info);
|
||||
return info;
|
||||
}
|
||||
|
@@ -112,7 +112,7 @@ static char* wxStringErrorMsg = "string type is required for parameter";
|
||||
|
||||
// Since this one would be tough and ugly to do with the Macros...
|
||||
void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) {
|
||||
bool hadErr = false;
|
||||
bool hadErr = FALSE;
|
||||
|
||||
bool doSave = wxPyRestoreThread();
|
||||
if (m_myInst.findCallback("GetPageInfo")) {
|
||||
@@ -122,22 +122,22 @@ void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *p
|
||||
|
||||
val = PyTuple_GetItem(result, 0);
|
||||
if (PyInt_Check(val)) *minPage = PyInt_AsLong(val);
|
||||
else hadErr = true;
|
||||
else hadErr = TRUE;
|
||||
|
||||
val = PyTuple_GetItem(result, 1);
|
||||
if (PyInt_Check(val)) *maxPage = PyInt_AsLong(val);
|
||||
else hadErr = true;
|
||||
else hadErr = TRUE;
|
||||
|
||||
val = PyTuple_GetItem(result, 2);
|
||||
if (PyInt_Check(val)) *pageFrom = PyInt_AsLong(val);
|
||||
else hadErr = true;
|
||||
else hadErr = TRUE;
|
||||
|
||||
val = PyTuple_GetItem(result, 3);
|
||||
if (PyInt_Check(val)) *pageTo = PyInt_AsLong(val);
|
||||
else hadErr = true;
|
||||
else hadErr = TRUE;
|
||||
}
|
||||
else
|
||||
hadErr = true;
|
||||
hadErr = TRUE;
|
||||
|
||||
if (hadErr) {
|
||||
PyErr_SetString(PyExc_TypeError, "GetPageInfo should return a tuple of 4 integers.");
|
||||
|
@@ -1610,7 +1610,7 @@ static PyObject *_wrap_wxWindow_GetGrandParent(PyObject *self, PyObject *args, P
|
||||
}
|
||||
|
||||
static long wxWindow_GetHandle(wxWindow *self) {
|
||||
return (long)self->GetHandle();
|
||||
return wxPyGetWinHandle(self); //(long)self->GetHandle();
|
||||
}
|
||||
static PyObject *_wrap_wxWindow_GetHandle(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
|
@@ -2540,6 +2540,7 @@ SWIGEXPORT(void) initwxc() {
|
||||
PyDict_SetItemString(d,"wxEVT_COMMAND_LISTBOX_SELECTED", PyInt_FromLong((long) wxEVT_COMMAND_LISTBOX_SELECTED));
|
||||
PyDict_SetItemString(d,"wxEVT_COMMAND_LISTBOX_DOUBLECLICKED", PyInt_FromLong((long) wxEVT_COMMAND_LISTBOX_DOUBLECLICKED));
|
||||
PyDict_SetItemString(d,"wxEVT_COMMAND_CHECKLISTBOX_TOGGLED", PyInt_FromLong((long) wxEVT_COMMAND_CHECKLISTBOX_TOGGLED));
|
||||
PyDict_SetItemString(d,"wxEVT_COMMAND_SPINCTRL_UPDATED", PyInt_FromLong((long) wxEVT_COMMAND_SPINCTRL_UPDATED));
|
||||
PyDict_SetItemString(d,"wxEVT_COMMAND_TEXT_UPDATED", PyInt_FromLong((long) wxEVT_COMMAND_TEXT_UPDATED));
|
||||
PyDict_SetItemString(d,"wxEVT_COMMAND_TEXT_ENTER", PyInt_FromLong((long) wxEVT_COMMAND_TEXT_ENTER));
|
||||
PyDict_SetItemString(d,"wxEVT_COMMAND_MENU_SELECTED", PyInt_FromLong((long) wxEVT_COMMAND_MENU_SELECTED));
|
||||
|
@@ -662,6 +662,7 @@ wxEVT_COMMAND_CHOICE_SELECTED = wxc.wxEVT_COMMAND_CHOICE_SELECTED
|
||||
wxEVT_COMMAND_LISTBOX_SELECTED = wxc.wxEVT_COMMAND_LISTBOX_SELECTED
|
||||
wxEVT_COMMAND_LISTBOX_DOUBLECLICKED = wxc.wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
|
||||
wxEVT_COMMAND_CHECKLISTBOX_TOGGLED = wxc.wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
|
||||
wxEVT_COMMAND_SPINCTRL_UPDATED = wxc.wxEVT_COMMAND_SPINCTRL_UPDATED
|
||||
wxEVT_COMMAND_TEXT_UPDATED = wxc.wxEVT_COMMAND_TEXT_UPDATED
|
||||
wxEVT_COMMAND_TEXT_ENTER = wxc.wxEVT_COMMAND_TEXT_ENTER
|
||||
wxEVT_COMMAND_MENU_SELECTED = wxc.wxEVT_COMMAND_MENU_SELECTED
|
||||
@@ -961,6 +962,20 @@ def EVT_ICONIZE(win, func):
|
||||
def EVT_NAVIGATION_KEY(win, func):
|
||||
win.Connect(-1, -1, wxEVT_NAVIGATION_KEY, func)
|
||||
|
||||
def EVT_PALETTE_CHANGED(win, func):
|
||||
win.Connect(-1, -1, wxEVT_PALETTE_CHANGED, func)
|
||||
|
||||
def EVT_QUERY_NEW_PALETTE(win, func):
|
||||
win.Connect(-1, -1, wxEVT_QUERY_NEW_PALETTE, func)
|
||||
|
||||
def EVT_WINDOW_CREATE(win, func):
|
||||
win.Connect(-1, -1, wxEVT_CREATE, func)
|
||||
|
||||
def EVT_WINDOW_DESTROY(win, func):
|
||||
win.Connect(-1, -1, wxEVT_DESTROY, func)
|
||||
|
||||
|
||||
|
||||
def EVT_IDLE(win, func):
|
||||
win.Connect(-1, -1, wxEVT_IDLE, func)
|
||||
|
||||
@@ -1205,15 +1220,25 @@ def EVT_COMBOBOX(win, id, func):
|
||||
def EVT_TOOL(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_TOOL_CLICKED, func)
|
||||
|
||||
def EVT_TOOL_RANGE(win, id, id2, func):
|
||||
win.Connect(id, id2, wxEVT_COMMAND_TOOL_CLICKED, func)
|
||||
|
||||
def EVT_TOOL_RCLICKED(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_TOOL_RCLICKED, func)
|
||||
|
||||
def EVT_TOOL_RCLICKED_RANGE(win, id, id2, func):
|
||||
win.Connect(id, id2, wxEVT_COMMAND_TOOL_RCLICKED, func)
|
||||
|
||||
def EVT_TOOL_ENTER(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_TOOL_ENTER, func)
|
||||
|
||||
def EVT_CHECKLISTBOX(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, func)
|
||||
|
||||
def EVT_SPINCTRL(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_COMMAND_SPINCTRL_UPDATED, func)
|
||||
|
||||
|
||||
|
||||
# Generic command events
|
||||
|
||||
|
@@ -27,6 +27,11 @@
|
||||
|
||||
#ifdef __WXGTK__
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkprivate.h>
|
||||
#include <wx/gtk/win_gtk.h>
|
||||
//#include <gdk/gdk.h>
|
||||
//#include <gdk/gdkx.h>
|
||||
//#include <gtk/gtkwindow.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -575,6 +580,25 @@ PyObject* wxPy_ConvertList(wxListBase* list, const char* className) {
|
||||
return pyList;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
long wxPyGetWinHandle(wxWindow* win) {
|
||||
#ifdef __WXMSW__
|
||||
return (long)win->GetHandle();
|
||||
#endif
|
||||
|
||||
// Find and return the actual X-Window.
|
||||
#ifdef __WXGTK__
|
||||
if (win->m_wxwindow) {
|
||||
GdkWindowPrivate* bwin = (GdkWindowPrivate*)GTK_PIZZA(win->m_wxwindow)->bin_window;
|
||||
if (bwin) {
|
||||
return (long)bwin->xwindow;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Some helper functions for typemaps in my_typemaps.i, so they won't be
|
||||
// included in every file...
|
||||
|
@@ -70,7 +70,7 @@ HELPEREXPORT PyObject* wxPyConstructObject(void* ptr, const char* className);
|
||||
HELPEREXPORT bool wxPyRestoreThread();
|
||||
HELPEREXPORT void wxPySaveThread(bool doSave);
|
||||
HELPEREXPORT PyObject* wxPy_ConvertList(wxListBase* list, const char* className);
|
||||
|
||||
HELPEREXPORT long wxPyGetWinHandle(wxWindow* win);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
@@ -207,7 +207,7 @@ public:
|
||||
wxWindow * GetGrandParent();
|
||||
%addmethods {
|
||||
long GetHandle() {
|
||||
return (long)self->GetHandle();
|
||||
return wxPyGetWinHandle(self); //(long)self->GetHandle();
|
||||
}
|
||||
}
|
||||
int GetId();
|
||||
|
Reference in New Issue
Block a user