]> git.saurik.com Git - wxWidgets.git/commitdiff
reSWIGged
authorRobin Dunn <robin@alldunn.com>
Thu, 18 Dec 2003 19:11:15 +0000 (19:11 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 18 Dec 2003 19:11:15 +0000 (19:11 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24917 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/src/gtk/controls.py
wxPython/src/gtk/controls_wrap.cpp
wxPython/src/gtk/core.py
wxPython/src/gtk/core_wrap.cpp
wxPython/src/gtk/gdi.py
wxPython/wxPython/core.py

index 4a05b92fa31c1bb32a220c0c3c04090599e33d01..a09305defd378b64da8f92094d48762d54a0c17d 100644 (file)
@@ -2543,6 +2543,14 @@ class ToolBarBase(core.Control):
         return self.DoAddTool(id, '', bitmap, bmpDisabled, wx.ITEM_RADIO,
                               shortHelp, longHelp, clientData)
 
+    def AddToolItem(*args, **kwargs):
+        """AddToolItem(ToolBarToolBase tool) -> ToolBarToolBase"""
+        return _controls.ToolBarBase_AddToolItem(*args, **kwargs)
+
+    def InsertToolItem(*args, **kwargs):
+        """InsertToolItem(size_t pos, ToolBarToolBase tool) -> ToolBarToolBase"""
+        return _controls.ToolBarBase_InsertToolItem(*args, **kwargs)
+
     def AddControl(*args, **kwargs):
         """AddControl(Control control) -> ToolBarToolBase"""
         return _controls.ToolBarBase_AddControl(*args, **kwargs)
@@ -2695,6 +2703,10 @@ class ToolBarBase(core.Control):
         """FindToolForPosition(int x, int y) -> ToolBarToolBase"""
         return _controls.ToolBarBase_FindToolForPosition(*args, **kwargs)
 
+    def FindById(*args, **kwargs):
+        """FindById(int toolid) -> ToolBarToolBase"""
+        return _controls.ToolBarBase_FindById(*args, **kwargs)
+
     def IsVertical(*args, **kwargs):
         """IsVertical() -> bool"""
         return _controls.ToolBarBase_IsVertical(*args, **kwargs)
index 76f75031c389c18ea45b92eecd65a72d5da60e8e..8090dbfb4be0ced27940f79d2ee9dffcc46b0b0e 100644 (file)
@@ -13660,6 +13660,70 @@ static PyObject *_wrap_ToolBarBase_DoInsertTool(PyObject *self, PyObject *args,
 }
 
 
+static PyObject *_wrap_ToolBarBase_AddToolItem(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject *resultobj;
+    wxToolBarBase *arg1 = (wxToolBarBase *) 0 ;
+    wxToolBarToolBase *arg2 = (wxToolBarToolBase *) 0 ;
+    wxToolBarToolBase *result;
+    PyObject * obj0 = 0 ;
+    PyObject * obj1 = 0 ;
+    char *kwnames[] = {
+        (char *) "self",(char *) "tool", NULL 
+    };
+    
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ToolBarBase_AddToolItem",kwnames,&obj0,&obj1)) goto fail;
+    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxToolBarBase,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+    if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_wxToolBarToolBase,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+    {
+        PyThreadState* __tstate = wxPyBeginAllowThreads();
+        result = (wxToolBarToolBase *)(arg1)->AddTool(arg2);
+        
+        wxPyEndAllowThreads(__tstate);
+        if (PyErr_Occurred()) SWIG_fail;
+    }
+    {
+        resultobj = wxPyMake_wxObject(result); 
+    }
+    return resultobj;
+    fail:
+    return NULL;
+}
+
+
+static PyObject *_wrap_ToolBarBase_InsertToolItem(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject *resultobj;
+    wxToolBarBase *arg1 = (wxToolBarBase *) 0 ;
+    size_t arg2 ;
+    wxToolBarToolBase *arg3 = (wxToolBarToolBase *) 0 ;
+    wxToolBarToolBase *result;
+    PyObject * obj0 = 0 ;
+    PyObject * obj1 = 0 ;
+    PyObject * obj2 = 0 ;
+    char *kwnames[] = {
+        (char *) "self",(char *) "pos",(char *) "tool", NULL 
+    };
+    
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:ToolBarBase_InsertToolItem",kwnames,&obj0,&obj1,&obj2)) goto fail;
+    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxToolBarBase,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+    arg2 = (size_t) PyInt_AsLong(obj1);
+    if (PyErr_Occurred()) SWIG_fail;
+    if ((SWIG_ConvertPtr(obj2,(void **) &arg3, SWIGTYPE_p_wxToolBarToolBase,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+    {
+        PyThreadState* __tstate = wxPyBeginAllowThreads();
+        result = (wxToolBarToolBase *)(arg1)->InsertTool(arg2,arg3);
+        
+        wxPyEndAllowThreads(__tstate);
+        if (PyErr_Occurred()) SWIG_fail;
+    }
+    {
+        resultobj = wxPyMake_wxObject(result); 
+    }
+    return resultobj;
+    fail:
+    return NULL;
+}
+
+
 static PyObject *_wrap_ToolBarBase_AddControl(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject *resultobj;
     wxToolBarBase *arg1 = (wxToolBarBase *) 0 ;
@@ -14741,6 +14805,34 @@ static PyObject *_wrap_ToolBarBase_FindToolForPosition(PyObject *self, PyObject
 }
 
 
+static PyObject *_wrap_ToolBarBase_FindById(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject *resultobj;
+    wxToolBarBase *arg1 = (wxToolBarBase *) 0 ;
+    int arg2 ;
+    wxToolBarToolBase *result;
+    PyObject * obj0 = 0 ;
+    char *kwnames[] = {
+        (char *) "self",(char *) "toolid", NULL 
+    };
+    
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"Oi:ToolBarBase_FindById",kwnames,&obj0,&arg2)) goto fail;
+    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxToolBarBase,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+    {
+        PyThreadState* __tstate = wxPyBeginAllowThreads();
+        result = (wxToolBarToolBase *)((wxToolBarBase const *)arg1)->FindById(arg2);
+        
+        wxPyEndAllowThreads(__tstate);
+        if (PyErr_Occurred()) SWIG_fail;
+    }
+    {
+        resultobj = wxPyMake_wxObject(result); 
+    }
+    return resultobj;
+    fail:
+    return NULL;
+}
+
+
 static PyObject *_wrap_ToolBarBase_IsVertical(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject *resultobj;
     wxToolBarBase *arg1 = (wxToolBarBase *) 0 ;
@@ -26215,6 +26307,8 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"ToolBarToolBase_swigregister", ToolBarToolBase_swigregister, METH_VARARGS },
         { (char *)"ToolBarBase_DoAddTool", (PyCFunction) _wrap_ToolBarBase_DoAddTool, METH_VARARGS | METH_KEYWORDS },
         { (char *)"ToolBarBase_DoInsertTool", (PyCFunction) _wrap_ToolBarBase_DoInsertTool, METH_VARARGS | METH_KEYWORDS },
+        { (char *)"ToolBarBase_AddToolItem", (PyCFunction) _wrap_ToolBarBase_AddToolItem, METH_VARARGS | METH_KEYWORDS },
+        { (char *)"ToolBarBase_InsertToolItem", (PyCFunction) _wrap_ToolBarBase_InsertToolItem, METH_VARARGS | METH_KEYWORDS },
         { (char *)"ToolBarBase_AddControl", (PyCFunction) _wrap_ToolBarBase_AddControl, METH_VARARGS | METH_KEYWORDS },
         { (char *)"ToolBarBase_InsertControl", (PyCFunction) _wrap_ToolBarBase_InsertControl, METH_VARARGS | METH_KEYWORDS },
         { (char *)"ToolBarBase_FindControl", (PyCFunction) _wrap_ToolBarBase_FindControl, METH_VARARGS | METH_KEYWORDS },
@@ -26253,6 +26347,7 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"ToolBarBase_GetToolBitmapSize", (PyCFunction) _wrap_ToolBarBase_GetToolBitmapSize, METH_VARARGS | METH_KEYWORDS },
         { (char *)"ToolBarBase_GetToolSize", (PyCFunction) _wrap_ToolBarBase_GetToolSize, METH_VARARGS | METH_KEYWORDS },
         { (char *)"ToolBarBase_FindToolForPosition", (PyCFunction) _wrap_ToolBarBase_FindToolForPosition, METH_VARARGS | METH_KEYWORDS },
+        { (char *)"ToolBarBase_FindById", (PyCFunction) _wrap_ToolBarBase_FindById, METH_VARARGS | METH_KEYWORDS },
         { (char *)"ToolBarBase_IsVertical", (PyCFunction) _wrap_ToolBarBase_IsVertical, METH_VARARGS | METH_KEYWORDS },
         { (char *)"ToolBarBase_swigregister", ToolBarBase_swigregister, METH_VARARGS },
         { (char *)"new_ToolBar", (PyCFunction) _wrap_new_ToolBar, METH_VARARGS | METH_KEYWORDS },
index ceae460f07d59b202ced513144e9717533bca0a0..f9281ca384a6e7158284c58c37f6129c291ce699 100644 (file)
@@ -585,6 +585,8 @@ class ObjectPtr(Object):
 _core.Object_swigregister(ObjectPtr)
 _wxPySetDictionary = _core._wxPySetDictionary
 
+_wxPyFixStockObjects = _core._wxPyFixStockObjects
+
 
 #---------------------------------------------------------------------------
 
@@ -7974,7 +7976,6 @@ if RELEASE_VERSION != _core.RELEASE_VERSION:
 class PyDeadObjectError(AttributeError):
     pass
 
-
 class _wxPyDeadObject(object):
     """
     Instances of wx objects that are OOR capable will have their __class__
@@ -7984,15 +7985,46 @@ class _wxPyDeadObject(object):
     reprStr = "wxPython wrapper for DELETED %s object! (The C++ object no longer exists.)"
     attrStr = "The C++ part of the %s object has been deleted, attribute access no longer allowed."
 
-    def __repr__( self ):
+    def __repr__(self):
         if not hasattr(self, "_name"):
             self._name = "[unknown]"
         return self.reprStr % self._name
 
-    def __getattr__( self, *args ):
+    def __getattr__(self, *args):
         if not hasattr(self, "_name"):
             self._name = "[unknown]"
-        raise PyDeadObjectError( self.attrStr % self._name )
+        raise PyDeadObjectError(self.attrStr % self._name)
+
+    def __nonzero__(self):
+        return 0
+
+
+
+class PyUnbornObjectError(AttributeError):
+    pass
+
+class _wxPyUnbornObject(object):
+    """
+    Some stock objects are created when the wx.core module is
+    imported, but their C++ instance is not created until the wx.App
+    object is created and initialized.  These object instances will
+    temporarily have their __class__ changed to this class so an
+    exception will be raised if they are used before the C++ instance
+    is ready.
+    """
+
+    reprStr = "wxPython wrapper for UNBORN object! (The C++ object is not initialized yet.)"
+    attrStr = "The C++ part of this object has not been initialized, attribute access not 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 PyUnbornObjectError(self.attrStr) # % self._name )
 
     def __nonzero__(self):
         return 0
@@ -8127,6 +8159,11 @@ from windows import *
 from controls import *
 from misc import *
 
+
+# Fixup the stock objects since they can't be used yet.  (They will be
+# restored in wx.PyApp.OnInit.)
+_core._wxPyFixStockObjects()
+
 #----------------------------------------------------------------------------
 #----------------------------------------------------------------------------
 
index 8e3c9163b2e5d4aae1b26be761d8f65bd22a537e..cebf4c762047398660e350f725186ed0b5166896 100644 (file)
@@ -35468,6 +35468,7 @@ static PyObject * LayoutConstraints_swigregister(PyObject *self, PyObject *args)
 }
 static PyMethodDef SwigMethods[] = {
         { (char *)"_wxPySetDictionary", __wxPySetDictionary, METH_VARARGS },
+        { (char *)"_wxPyFixStockObjects", __wxPyFixStockObjects, METH_VARARGS },
         { (char *)"Object_GetClassName", (PyCFunction) _wrap_Object_GetClassName, METH_VARARGS | METH_KEYWORDS },
         { (char *)"Object_Destroy", (PyCFunction) _wrap_Object_Destroy, METH_VARARGS | METH_KEYWORDS },
         { (char *)"Object_swigregister", Object_swigregister, METH_VARARGS },
index 04fa689fb14528ffcd3ebb8e5a74e41d1757b3f0..812c149998e4adbdf9b3fe72d6e9fe353fe98cee 100644 (file)
@@ -101,7 +101,7 @@ class Colour(core.Object):
 
     asTuple = Get
     def __str__(self):                  return str(self.asTuple())
-    def __repr__(self):                 return 'wxColour' + str(self.asTuple())
+    def __repr__(self):                 return 'wx.Colour' + str(self.asTuple())
     def __nonzero__(self):              return self.Ok()
     def __getinitargs__(self):          return ()
     def __getstate__(self):             return self.asTuple()
index 3a01af3ac57c2ba52c32bc54a88e69d1958c0b2b..3a730bb285828c63e504fcd785c3f7a2aeb6f38b 100644 (file)
@@ -1089,6 +1089,7 @@ wxRELEASE_VERSION = wx.core.RELEASE_VERSION
 wxSUBREL_VERSION = wx.core.SUBREL_VERSION
 wxVERSION = wx.core.VERSION
 wxRELEASE_NUMBER = wx.core.RELEASE_NUMBER
+wxPyUnbornObjectError = wx.core.PyUnbornObjectError
 wxPyDeadObjectError = wx.core.PyDeadObjectError
 wxCallAfter = wx.core.CallAfter
 wxFutureCall = wx.core.FutureCall