]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/contrib/ogl/_ogldefs.i
fixed typo
[wxWidgets.git] / wxPython / contrib / ogl / _ogldefs.i
index b71d0e8962d4ebc10546cd96ff0864b0c04223c5..207f8f1895c7d3d657329746ce3b74a75622d018 100644 (file)
 
 
 //---------------------------------------------------------------------------
+// Typemaps just for OGL
 
 
-class wxOGLConstraint;
-class wxBitmapShape;
-class wxDiagram;
-class wxDrawnShape;
-class wxCircleShape;
-class wxCompositeShape;
-class wxDividedShape;
-class wxDivisionShape;
-class wxEllipseShape;
-class wxLineShape;
-class wxPolygonShape;
-class wxRectangleShape;
-class wxPseudoMetaFile;
-class wxShape;
-class wxShapeCanvas;
-class wxShapeEvtHandler;
-class wxTextShape;
-class wxControlPoint;
-
-class wxPyOGLConstraint;
-class wxPyBitmapShape;
-class wxPyDiagram;
-class wxPyDrawnShape;
-class wxPyCircleShape;
-class wxPyCompositeShape;
-class wxPyDividedShape;
-class wxPyDivisionShape;
-class wxPyEllipseShape;
-class wxPyLineShape;
-class wxPyPolygonShape;
-class wxPyRectangleShape;
-class wxPyPseudoMetaFile;
-class wxPyShape;
-class wxPyShapeCanvas;
-class wxPyShapeEvtHandler;
-class wxPyTextShape;
-class wxPyControlPoint;
+// OOR Support
+%typemap(out) wxPyShape*                { $result = wxPyMake_wxShapeEvtHandler($1, $owner); }
+%typemap(out) wxPyShapeEvtHandler*      { $result = wxPyMake_wxShapeEvtHandler($1, $owner); }
+%typemap(out) wxPyDivisionShape*        { $result = wxPyMake_wxShapeEvtHandler($1, $owner); }
+
+%typemap(out) wxPyShapeCanvas*          { $result = wxPyMake_wxObject($1, $owner); }
+%typemap(out) wxDiagram*                { $result = wxPyMake_wxObject($1, $owner); }
+%typemap(out) wxOGLConstraint*          { $result = wxPyMake_wxObject($1, $owner); }
+%typemap(out) wxPseudoMetaFile*         { $result = wxPyMake_wxObject($1, $owner); }
+%typemap(out) wxArrowHead*              { $result = wxPyMake_wxObject($1, $owner); }
+
+
+
+
+// wxOGL doesn't use a ref-counted copy of pens and brushes, so we'll
+// use the pen and brush lists to simulate that...
+
+%typemap(in) wxPen* {
+    wxPen* temp;
+    if ($input) {
+        if ($input == Py_None) { temp = NULL; }
+        else if (! wxPyConvertSwigPtr($input, (void **) &temp, wxT("wxPen"))) {
+            PyErr_SetString(PyExc_TypeError, "Type error, expected wxPen.");
+        return NULL;
+        }
+    }
+    if (temp)
+        $1 = wxThePenList->FindOrCreatePen(temp->GetColour(),
+                                           temp->GetWidth(),
+                                           temp->GetStyle());
+    else
+        $1 = NULL;
+}
+
+%typemap(in) wxBrush* {
+    wxBrush* temp;
+    if ($input) {
+        if ($input == Py_None) { temp = NULL; }
+        else if (! wxPyConvertSwigPtr($input, (void **) &temp, wxT("wxBrush"))) {
+            PyErr_SetString(PyExc_TypeError, "Type error, expected wxBrush.");
+        return NULL;
+        }
+    }
+    if (temp)
+        $1 = wxTheBrushList->FindOrCreateBrush(temp->GetColour(), temp->GetStyle());
+    else
+        $1 = NULL;
+}
+
+
+%typemap(in) wxFont* {
+    wxFont* temp;
+    if ($input) {
+        if ($input == Py_None) { temp = NULL; }
+        else if (! wxPyConvertSwigPtr($input, (void **) &temp, wxT("wxFont"))) {
+            PyErr_SetString(PyExc_TypeError, "Type error, expected wxFont.");
+        return NULL;
+        }
+    }
+    if (temp)
+        $1 = wxTheFontList->FindOrCreateFont(temp->GetPointSize(),
+                                             temp->GetFamily(),
+                                             temp->GetStyle(),
+                                             temp->GetWeight(),
+                                             temp->GetUnderlined(),
+                                             temp->GetFaceName(),
+                                             temp->GetEncoding());
+    else
+        $1 = NULL;
+}
 
 
-//---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------