]> git.saurik.com Git - wxWidgets.git/commitdiff
SWIGged updates for wxGTK
authorRobin Dunn <robin@alldunn.com>
Wed, 10 Apr 2002 19:27:53 +0000 (19:27 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 10 Apr 2002 19:27:53 +0000 (19:27 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15083 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

13 files changed:
wxPython/src/gtk/controls2.cpp
wxPython/src/gtk/controls2.py
wxPython/src/gtk/frames.py
wxPython/src/gtk/gdi.cpp
wxPython/src/gtk/gdi.py
wxPython/src/gtk/misc.cpp
wxPython/src/gtk/misc2.cpp
wxPython/src/gtk/misc2.py
wxPython/src/gtk/sizers.cpp
wxPython/src/gtk/utils.cpp
wxPython/src/gtk/windows.cpp
wxPython/src/gtk/wx.cpp
wxPython/src/gtk/wx.py

index 4054e0ff60f05547051a47c1ddc1314474f87411..2f0b0f1b33f407730c9a555436ce9deb4b1e5fc6 100644 (file)
@@ -11183,7 +11183,7 @@ SWIGEXPORT(void) initcontrols2c() {
         PyDict_SetItemString(d,"wxDIRCTRL_SELECT_FIRST", PyInt_FromLong((long) wxDIRCTRL_SELECT_FIRST));
         PyDict_SetItemString(d,"wxDIRCTRL_SHOW_FILTERS", PyInt_FromLong((long) wxDIRCTRL_SHOW_FILTERS));
         PyDict_SetItemString(d,"wxDIRCTRL_3D_INTERNAL", PyInt_FromLong((long) wxDIRCTRL_3D_INTERNAL));
-        PyDict_SetItemString(d,"wxDIRCTRL_EDITABLE", PyInt_FromLong((long) wxDIRCTRL_EDITABLE));
+        PyDict_SetItemString(d,"wxDIRCTRL_EDIT_LABELS", PyInt_FromLong((long) wxDIRCTRL_EDIT_LABELS));
         PyDict_SetItemString(d,"wxID_TREECTRL", PyInt_FromLong((long) wxID_TREECTRL));
         PyDict_SetItemString(d,"wxID_FILTERLISTCTRL", PyInt_FromLong((long) wxID_FILTERLISTCTRL));
 
index dd7d2d4ffb684ea378e90126099366a5abd2c62f..20795adaefd8c1711883e02d7c0d251722adbfff 100644 (file)
@@ -1415,6 +1415,6 @@ wxDIRCTRL_DIR_ONLY = controls2c.wxDIRCTRL_DIR_ONLY
 wxDIRCTRL_SELECT_FIRST = controls2c.wxDIRCTRL_SELECT_FIRST
 wxDIRCTRL_SHOW_FILTERS = controls2c.wxDIRCTRL_SHOW_FILTERS
 wxDIRCTRL_3D_INTERNAL = controls2c.wxDIRCTRL_3D_INTERNAL
-wxDIRCTRL_EDITABLE = controls2c.wxDIRCTRL_EDITABLE
+wxDIRCTRL_EDIT_LABELS = controls2c.wxDIRCTRL_EDIT_LABELS
 wxID_TREECTRL = controls2c.wxID_TREECTRL
 wxID_FILTERLISTCTRL = controls2c.wxID_FILTERLISTCTRL
index 0e4465a5dabf27ee50871ac2e08c8f4032bb959c..d2ac054f6ae78074ff225ba4b09fe893529cff45 100644 (file)
@@ -234,6 +234,7 @@ class wxSplashScreenWindow(wxSplashScreenWindowPtr):
     def __init__(self,*_args,**_kwargs):
         self.this = apply(framesc.new_wxSplashScreenWindow,_args,_kwargs)
         self.thisown = 1
+        self._setOORInfo(self)
 
 
 
@@ -258,6 +259,7 @@ class wxSplashScreen(wxSplashScreenPtr):
     def __init__(self,*_args,**_kwargs):
         self.this = apply(framesc.new_wxSplashScreen,_args,_kwargs)
         self.thisown = 1
+        self._setOORInfo(self)
 
 
 
index 0402b0c83b32d3e63aa6cc8381b11f5cad4c1980..35417a80ba951614580b407afebb457bc55dff02 100644 (file)
@@ -7910,6 +7910,34 @@ static PyObject *_wrap_new_wxBufferedDCInternalBuffer(PyObject *self, PyObject *
     return _resultobj;
 }
 
+#define wxBufferedDC_UnMask(_swigobj)  (_swigobj->UnMask())
+static PyObject *_wrap_wxBufferedDC_UnMask(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxBufferedDC * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxBufferedDC_UnMask",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxBufferedDC_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxBufferedDC_UnMask. Expected _wxBufferedDC_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    wxBufferedDC_UnMask(_arg0);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
 static void *SwigwxBufferedPaintDCTowxBufferedDC(void *ptr) {
     wxBufferedPaintDC *src;
     wxBufferedDC *dest;
@@ -10082,6 +10110,7 @@ static PyMethodDef gdicMethods[] = {
         { "wxScreenDC_StartDrawingOnTopWin", (PyCFunction) _wrap_wxScreenDC_StartDrawingOnTopWin, METH_VARARGS | METH_KEYWORDS },
         { "new_wxScreenDC", (PyCFunction) _wrap_new_wxScreenDC, METH_VARARGS | METH_KEYWORDS },
         { "new_wxBufferedPaintDC", (PyCFunction) _wrap_new_wxBufferedPaintDC, METH_VARARGS | METH_KEYWORDS },
+        { "wxBufferedDC_UnMask", (PyCFunction) _wrap_wxBufferedDC_UnMask, METH_VARARGS | METH_KEYWORDS },
         { "new_wxBufferedDCInternalBuffer", (PyCFunction) _wrap_new_wxBufferedDCInternalBuffer, METH_VARARGS | METH_KEYWORDS },
         { "new_wxBufferedDC", (PyCFunction) _wrap_new_wxBufferedDC, METH_VARARGS | METH_KEYWORDS },
         { "wxMemoryDC_SelectObject", (PyCFunction) _wrap_wxMemoryDC_SelectObject, METH_VARARGS | METH_KEYWORDS },
index 957b775bd392c91808b2a1ae758301d693571c61..e4412749e44b7f2830e7661469241dce78eb4872 100644 (file)
@@ -789,18 +789,23 @@ class wxBufferedDCPtr(wxMemoryDCPtr):
     def __init__(self,this):
         self.this = this
         self.thisown = 0
+    def UnMask(self, *_args, **_kwargs):
+        val = apply(gdic.wxBufferedDC_UnMask,(self,) + _args, _kwargs)
+        return val
     def __repr__(self):
         return "<C wxBufferedDC instance at %s>" % (self.this,)
 class wxBufferedDC(wxBufferedDCPtr):
     def __init__(self,*_args,**_kwargs):
         self.this = apply(gdic.new_wxBufferedDC,_args,_kwargs)
         self.thisown = 1
+        self._dc = _args[0] # save a ref so the other dc won't be deleted before self
 
 
 
 def wxBufferedDCInternalBuffer(*_args,**_kwargs):
     val = wxBufferedDCPtr(apply(gdic.new_wxBufferedDCInternalBuffer,_args,_kwargs))
     val.thisown = 1
+    val._dc = _args[0] # save a ref so the other dc won't be deleted before self
     return val
 
 
index 32a48df4cd7967f6f3051d3e8b054efc429626ee..abe4cf77a98eed0232c8a673718b1259b846082e 100644 (file)
@@ -1383,9 +1383,11 @@ static PyObject *_wrap_wxSize_SetHeight(PyObject *self, PyObject *args, PyObject
 }
 
 static PyObject * wxSize_asTuple(wxSize *self) {
+            wxPyBeginBlockThreads();
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
+            wxPyEndBlockThreads();
             return tup;
         }
 static PyObject *_wrap_wxSize_asTuple(PyObject *self, PyObject *args, PyObject *kwargs) {
@@ -1653,9 +1655,11 @@ static PyObject *_wrap_wxRealPoint_Set(PyObject *self, PyObject *args, PyObject
 }
 
 static PyObject * wxRealPoint_asTuple(wxRealPoint *self) {
+            wxPyBeginBlockThreads();
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x));
             PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y));
+            wxPyEndBlockThreads();
             return tup;
         }
 static PyObject *_wrap_wxRealPoint_asTuple(PyObject *self, PyObject *args, PyObject *kwargs) {
@@ -2003,9 +2007,11 @@ static PyObject *_wrap_wxPoint_Set(PyObject *self, PyObject *args, PyObject *kwa
 }
 
 static PyObject * wxPoint_asTuple(wxPoint *self) {
+            wxPyBeginBlockThreads();
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
+            wxPyEndBlockThreads();
             return tup;
         }
 static PyObject *_wrap_wxPoint_asTuple(PyObject *self, PyObject *args, PyObject *kwargs) {
@@ -2989,11 +2995,13 @@ static PyObject *_wrap_wxRect_height_get(PyObject *self, PyObject *args, PyObjec
 }
 
 static PyObject * wxRect_asTuple(wxRect *self) {
+            wxPyBeginBlockThreads();
             PyObject* tup = PyTuple_New(4);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
             PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(self->width));
             PyTuple_SET_ITEM(tup, 3, PyInt_FromLong(self->height));
+            wxPyEndBlockThreads();
             return tup;
         }
 static PyObject *_wrap_wxRect_asTuple(PyObject *self, PyObject *args, PyObject *kwargs) {
index a8ce12183669b6398ffcd317256cad0b916469c2..a47f87d338c69dfe1e82902ee9711f86d48315e4 100644 (file)
@@ -103,7 +103,7 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
     // Put some wx default wxChar* values into wxStrings.
     DECLARE_DEF_STRING(FileSelectorPromptStr);
     DECLARE_DEF_STRING(FileSelectorDefaultWildcardStr);
-
+    DECLARE_DEF_STRING(DirSelectorPromptStr);
     static const wxString wxPyEmptyString(wxT(""));
 
     int wxCaret_GetBlinkTime() {
@@ -515,6 +515,76 @@ static PyObject *_wrap_wxSaveFileSelector(PyObject *self, PyObject *args, PyObje
     return _resultobj;
 }
 
+static PyObject *_wrap_wxDirSelector(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxString * _result;
+    wxString * _arg0 = (wxString *) &wxPyDirSelectorPromptStr;
+    wxString * _arg1 = (wxString *) &wxPyEmptyString;
+    long  _arg2 = (long ) wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxDD_NEW_DIR_BUTTON;
+    wxPoint * _arg3 = (wxPoint *) &wxDefaultPosition;
+    wxWindow * _arg4 = (wxWindow *) NULL;
+    PyObject * _obj0 = 0;
+    PyObject * _obj1 = 0;
+    wxPoint  temp;
+    PyObject * _obj3 = 0;
+    PyObject * _argo4 = 0;
+    char *_kwnames[] = { "message","defaultPath","style","pos","parent", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|OOlOO:wxDirSelector",_kwnames,&_obj0,&_obj1,&_arg2,&_obj3,&_argo4)) 
+        return NULL;
+    if (_obj0)
+{
+    _arg0 = wxString_in_helper(_obj0);
+    if (_arg0 == NULL)
+        return NULL;
+}
+    if (_obj1)
+{
+    _arg1 = wxString_in_helper(_obj1);
+    if (_arg1 == NULL)
+        return NULL;
+}
+    if (_obj3)
+{
+    _arg3 = &temp;
+    if (! wxPoint_helper(_obj3, &_arg3))
+        return NULL;
+}
+    if (_argo4) {
+        if (_argo4 == Py_None) { _arg4 = NULL; }
+        else if (SWIG_GetPtrObj(_argo4,(void **) &_arg4,"_wxWindow_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 5 of wxDirSelector. Expected _wxWindow_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = new wxString (wxDirSelector(*_arg0,*_arg1,_arg2,*_arg3,_arg4));
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}{
+#if wxUSE_UNICODE
+    _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
+#else
+    _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
+#endif
+}
+{
+    if (_obj0)
+        delete _arg0;
+}
+{
+    if (_obj1)
+        delete _arg1;
+}
+{
+    delete _result;
+}
+    return _resultobj;
+}
+
 static PyObject *_wrap_wxGetTextFromUser(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxString * _result;
@@ -9990,6 +10060,7 @@ static PyMethodDef misc2cMethods[] = {
         { "wxGetSingleChoice", (PyCFunction) _wrap_wxGetSingleChoice, METH_VARARGS | METH_KEYWORDS },
         { "wxGetPasswordFromUser", (PyCFunction) _wrap_wxGetPasswordFromUser, METH_VARARGS | METH_KEYWORDS },
         { "wxGetTextFromUser", (PyCFunction) _wrap_wxGetTextFromUser, METH_VARARGS | METH_KEYWORDS },
+        { "wxDirSelector", (PyCFunction) _wrap_wxDirSelector, METH_VARARGS | METH_KEYWORDS },
         { "wxSaveFileSelector", (PyCFunction) _wrap_wxSaveFileSelector, METH_VARARGS | METH_KEYWORDS },
         { "wxLoadFileSelector", (PyCFunction) _wrap_wxLoadFileSelector, METH_VARARGS | METH_KEYWORDS },
         { "wxFileSelector", (PyCFunction) _wrap_wxFileSelector, METH_VARARGS | METH_KEYWORDS },
index 6d76b60b3db31a82de43628c31d0cbe7660e7c22..ed4dcf89ef19e681b16301b31c92c83f5e24eca8 100644 (file)
@@ -963,6 +963,8 @@ wxLoadFileSelector = misc2c.wxLoadFileSelector
 
 wxSaveFileSelector = misc2c.wxSaveFileSelector
 
+wxDirSelector = misc2c.wxDirSelector
+
 wxGetTextFromUser = misc2c.wxGetTextFromUser
 
 wxGetPasswordFromUser = misc2c.wxGetPasswordFromUser
index 95e66e53946523d2e7d684e22e342ce8dfad5495..14b85b2724585691bbe3a76ccecf07b36c09894e 100644 (file)
@@ -860,7 +860,7 @@ static void *SwigwxSizerTowxObject(void *ptr) {
 }
 
 static void  wxSizer__setOORInfo(wxSizer *self,PyObject * _self) {
-            self->SetClientObject(new wxPyClientData(_self));
+            self->SetClientObject(new wxPyOORClientData(_self));
         }
 static PyObject *_wrap_wxSizer__setOORInfo(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
index 18b44d4935ad8c69758cbc58ffc94aaedc21afeb..847a5fd1ee79660d3882332bd06906b64b7e9687 100644 (file)
@@ -55,14 +55,13 @@ extern PyObject *SWIG_newvarlink(void);
 
 #define SWIG_name    "utilsc"
 
-#include "export.h"
+#include "helpers.h"
 #include <wx/config.h>
 #include <wx/fileconf.h>
 #include <wx/datetime.h>
 
     // Put some wx default wxChar* values into wxStrings.
-    static const wxChar* wxDateFormatStr = wxT("sashWindow");
-    DECLARE_DEF_STRING(DateFormatStr);
+    DECLARE_DEF_STRING2(DateFormatStr, wxT("sashWindow"));
     static const wxString wxPyEmptyString(wxT(""));
 
 
index 1ecd65a4941e1759b8dcdba14dfe4daef04a78b0..03076984e32bf64519042cbb918c719ec3bf981f 100644 (file)
@@ -522,7 +522,7 @@ static PyObject *_wrap_wxEvtHandler_Disconnect(PyObject *self, PyObject *args, P
 }
 
 static void  wxEvtHandler__setOORInfo(wxEvtHandler *self,PyObject * _self) {
-            self->SetClientObject(new wxPyClientData(_self));
+            self->SetClientObject(new wxPyOORClientData(_self));
         }
 static PyObject *_wrap_wxEvtHandler__setOORInfo(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
index 5ea08d388f96244a7316a44b349a01ddfd8cd082..4548449654a05a90db506faa19c43fae1618cd92 100644 (file)
@@ -677,7 +677,11 @@ static wxPyCoreAPI API = {
     wxPyMake_wxSizer,
     wxPyPtrTypeMap_Add,
     wxArrayString2PyList_helper,
-    wxArrayInt2PyList_helper
+    wxArrayInt2PyList_helper,
+
+    wxPyClientData_dtor,
+    wxPyUserData_dtor,
+    wxPyOORClientData_dtor
 };
 
 
@@ -2064,6 +2068,7 @@ SWIGEXPORT(void) initwxc() {
         PyDict_SetItemString(d,"wxPD_ELAPSED_TIME", PyInt_FromLong((long) wxPD_ELAPSED_TIME));
         PyDict_SetItemString(d,"wxPD_ESTIMATED_TIME", PyInt_FromLong((long) wxPD_ESTIMATED_TIME));
         PyDict_SetItemString(d,"wxPD_REMAINING_TIME", PyInt_FromLong((long) wxPD_REMAINING_TIME));
+        PyDict_SetItemString(d,"wxDD_NEW_DIR_BUTTON", PyInt_FromLong((long) wxDD_NEW_DIR_BUTTON));
         PyDict_SetItemString(d,"wxMENU_TEAROFF", PyInt_FromLong((long) wxMENU_TEAROFF));
         PyDict_SetItemString(d,"wxMB_DOCKABLE", PyInt_FromLong((long) wxMB_DOCKABLE));
         PyDict_SetItemString(d,"wxNO_FULL_REPAINT_ON_RESIZE", PyInt_FromLong((long) wxNO_FULL_REPAINT_ON_RESIZE));
index e959bcb357bf695c253ff01e3e675c0d045f87a1..8b4caa410dc3fd988df37f03e872406030734741 100644 (file)
@@ -409,6 +409,7 @@ wxPD_CAN_ABORT = wxc.wxPD_CAN_ABORT
 wxPD_ELAPSED_TIME = wxc.wxPD_ELAPSED_TIME
 wxPD_ESTIMATED_TIME = wxc.wxPD_ESTIMATED_TIME
 wxPD_REMAINING_TIME = wxc.wxPD_REMAINING_TIME
+wxDD_NEW_DIR_BUTTON = wxc.wxDD_NEW_DIR_BUTTON
 wxMENU_TEAROFF = wxc.wxMENU_TEAROFF
 wxMB_DOCKABLE = wxc.wxMB_DOCKABLE
 wxNO_FULL_REPAINT_ON_RESIZE = wxc.wxNO_FULL_REPAINT_ON_RESIZE
@@ -1548,6 +1549,34 @@ def wxPyTypeCast(obj, typeStr):
     return theObj
 
 
+#----------------------------------------------------------------------------
+
+class wxPyDeadObjectError(AttributeError):
+    pass
+
+class _wxPyDeadObject:
+    """
+    Instances of wx objects that are OOR capable will have their __class__
+    changed to this class when the C++ object is deleted.  This should help
+    prevent crashes due to referencing a bogus C++ pointer.
+    """
+    reprStr = "wxPython wrapper for DELETED %s object! (The C++ object no longer exists.)"
+    attrStr = "The C++ %s object has been deleted, attribute access no longer allowed."
+
+    def __repr__( self ):
+        if not hasattr(self, "_name"):
+            self._name = "[unknown]"
+        return self.reprStr % self._name
+
+    def __getattr__( self, *args ):
+        if not hasattr(self, "_name"):
+            self._name = "[unknown]"
+        raise wxPyDeadObjectError( self.attrStr % self._name )
+
+    def __nonzero__(self):
+        return 0
+
+
 #----------------------------------------------------------------------
 #----------------------------------------------------------------------
 
@@ -1664,10 +1693,10 @@ class wxPyWidgetTester(wxApp):
         self.frame.Show(true)
 
 #----------------------------------------------------------------------------
-# DO NOT hold any other references to this object.  This is how we know when
-# to cleanup system resources that wxWin is holding.  When this module is
-# unloaded, the refcount on __cleanMeUp goes to zero and it calls the
-# wxApp_CleanUp function.
+# DO NOT hold any other references to this object.  This is how we
+# know when to cleanup system resources that wxWin is holding.  When
+# the sys module is unloaded, the refcount on sys.__wxPythonCleanup
+# goes to zero and it calls the wxApp_CleanUp function.
 
 class __wxPyCleanup:
     def __init__(self):