]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/contrib/ogl/oglshapes.i
use wxColourDatabase::Find() instead of deprecated FindColour(); some minor code...
[wxWidgets.git] / wxPython / contrib / ogl / oglshapes.i
index 2b2f94e40f2497ed583db8d991cfe6e7a2237bab..6caa193b961f760ecfe9fd46761af3983bb75034 100644 (file)
@@ -14,7 +14,7 @@
 %module oglshapes
 
 %{
-#include "helpers.h"
+#include "wxPython.h"
 #include "oglhelpers.h"
 %}
 
 %pragma(python) code = "import wx"
 
 //---------------------------------------------------------------------------
+
+enum {
+    oglMETAFLAGS_OUTLINE,
+    oglMETAFLAGS_ATTACHMENTS
+};
+
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 
-class wxPseudoMetaFile {
+class wxPseudoMetaFile : public wxObject {
 public:
   wxPseudoMetaFile();
   ~wxPseudoMetaFile();
 
     void Draw(wxDC& dc, double xoffset, double yoffset);
-
+#ifdef wxUSE_PROLOGIO
     void WriteAttributes(wxExpr *clause, int whichAngle);
     void ReadAttributes(wxExpr *clause, int whichAngle);
+#endif
     void Clear();
     void Copy(wxPseudoMetaFile& copy);
     void Scale(double sx, double sy);
     void ScaleTo(double w, double h);
     void Translate(double x, double y);
     void Rotate(double x, double y, double theta);
-    bool LoadFromMetaFile(char* filename, double *width, double *height);
+    bool LoadFromMetaFile(const wxString& filename, double *width, double *height);
     void GetBounds(double *minX, double *minY, double *maxX, double *maxY);
-    void CalculateSize(wxDrawnShape* shape);
+    void CalculateSize(wxPyDrawnShape* shape);
 
     // ****  fix these...  is it even possible?  these are lists of various GDI opperations (not the objects...)
     // wxList& GetOutlineColours();
@@ -101,15 +108,49 @@ public:
 //---------------------------------------------------------------------------
 
 %{
-    WXSHAPE_IMP_CALLBACKS(wxPyRectangleShape, wxRectangleShape);
+// Using this macro can sometimes provoke an Internal Compiler Error in MSVC
+// 6, so instead I'l just expand it out by hand...
+//    WXSHAPE_IMP_CALLBACKS(wxPyRectangleShape, wxRectangleShape);
+
+    IMP_PYCALLBACK__                (wxPyRectangleShape, wxRectangleShape,  OnDelete);
+    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnDraw);
+    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnDrawContents);
+    IMP_PYCALLBACK__DCBOOL          (wxPyRectangleShape, wxRectangleShape,  OnDrawBranches);
+    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnMoveLinks);
+    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnErase);
+    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnEraseContents);
+    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnHighlight);
+    IMP_PYCALLBACK__2DBL2INT        (wxPyRectangleShape, wxRectangleShape,  OnLeftClick);
+    IMP_PYCALLBACK__2DBL2INT        (wxPyRectangleShape, wxRectangleShape,  OnLeftDoubleClick);
+    IMP_PYCALLBACK__2DBL2INT        (wxPyRectangleShape, wxRectangleShape,  OnRightClick);
+    IMP_PYCALLBACK__2DBL            (wxPyRectangleShape, wxRectangleShape,  OnSize);
+    IMP_PYCALLBACK_BOOL_DC4DBLBOOL  (wxPyRectangleShape, wxRectangleShape,  OnMovePre);
+    IMP_PYCALLBACK__DC4DBLBOOL      (wxPyRectangleShape, wxRectangleShape,  OnMovePost);
+    IMP_PYCALLBACK__BOOL2DBL2INT    (wxPyRectangleShape, wxRectangleShape,  OnDragLeft);
+    IMP_PYCALLBACK__2DBL2INT        (wxPyRectangleShape, wxRectangleShape,  OnBeginDragLeft);
+    IMP_PYCALLBACK__2DBL2INT        (wxPyRectangleShape, wxRectangleShape,  OnEndDragLeft);
+    IMP_PYCALLBACK__BOOL2DBL2INT    (wxPyRectangleShape, wxRectangleShape,  OnDragRight);
+    IMP_PYCALLBACK__2DBL2INT        (wxPyRectangleShape, wxRectangleShape,  OnBeginDragRight);
+    IMP_PYCALLBACK__2DBL2INT        (wxPyRectangleShape, wxRectangleShape,  OnEndDragRight);
+    IMP_PYCALLBACK__DC4DBL          (wxPyRectangleShape, wxRectangleShape,  OnDrawOutline);
+    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnDrawControlPoints);
+    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnEraseControlPoints);
+    IMP_PYCALLBACK__DCBOOL          (wxPyRectangleShape, wxRectangleShape,  OnMoveLink);
+    IMP_PYCALLBACK__WXCPBOOL2DBL2INT(wxPyRectangleShape, wxRectangleShape,  OnSizingDragLeft);
+    IMP_PYCALLBACK__WXCP2DBL2INT    (wxPyRectangleShape, wxRectangleShape,  OnSizingBeginDragLeft);
+    IMP_PYCALLBACK__WXCP2DBL2INT    (wxPyRectangleShape, wxRectangleShape,  OnSizingEndDragLeft);
+    IMP_PYCALLBACK__2DBL            (wxPyRectangleShape, wxRectangleShape,  OnBeginSize);
+    IMP_PYCALLBACK__2DBL            (wxPyRectangleShape, wxRectangleShape,  OnEndSize)
+        
 %}
 
 class wxPyRectangleShape : public wxPyShape {
 public:
     wxPyRectangleShape(double width = 0.0, double height = 0.0);
 
-    void _setSelf(PyObject* self, PyObject* _class);
-    %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyRectangleShape)"
+    void _setCallbackInfo(PyObject* self, PyObject* _class);
+    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyRectangleShape)"
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
     void SetCornerRadius(double radius);
 
@@ -158,8 +199,9 @@ public:
                      double size = 0.0, double the_xoffset = 0.0,
                      double the_yoffset = 0.0, int the_type = 0);
 
-    void _setSelf(PyObject* self, PyObject* _class);
-    %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyControlPoint)"
+    void _setCallbackInfo(PyObject* self, PyObject* _class);
+    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyControlPoint)"
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
     void SetCornerRadius(double radius);
 
@@ -205,8 +247,9 @@ class wxPyBitmapShape : public wxPyRectangleShape {
 public:
     wxPyBitmapShape();
 
-    void _setSelf(PyObject* self, PyObject* _class);
-    %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyBitmapShape)"
+    void _setCallbackInfo(PyObject* self, PyObject* _class);
+    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyBitmapShape)"
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
     wxBitmap& GetBitmap();
     wxString GetFilename();
@@ -254,8 +297,9 @@ class wxPyDrawnShape : public wxPyRectangleShape {
 public:
     wxPyDrawnShape();
 
-    void _setSelf(PyObject* self, PyObject* _class);
-    %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyDrawnShape)"
+    void _setCallbackInfo(PyObject* self, PyObject* _class);
+    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyDrawnShape)"
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
     void CalculateSize();
     void DestroyClippingRect();
@@ -276,7 +320,7 @@ public:
     wxPseudoMetaFile& GetMetaFile();
 
     double GetRotation();
-    bool LoadFromMetaFile(char * filename);
+    bool LoadFromMetaFile(const wxString& filename);
     void Rotate(double x, double y, double theta);
     void SetClippingRect(const wxRect& rect);
     void SetDrawnBackgroundColour(const wxColour& colour);
@@ -326,7 +370,7 @@ public:
 
 //---------------------------------------------------------------------------
 
-class wxOGLConstraint  {
+class wxOGLConstraint : public wxObject {
 public:
     //wxOGLConstraint(int type, wxPyShape *constraining, wxList& constrained);
     %addmethods {
@@ -337,7 +381,8 @@ public:
             return rv;
         }
     }
-    ~wxOGLConstraint();
+
+    //~wxOGLConstraint();  The wxCompositShape takes ownership of the constraint
 
     bool Evaluate();
     void SetSpacing(double x, double y);
@@ -357,8 +402,9 @@ class wxPyCompositeShape : public wxPyRectangleShape {
 public:
     wxPyCompositeShape();
 
-    void _setSelf(PyObject* self, PyObject* _class);
-    %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyCompositeShape)"
+    void _setCallbackInfo(PyObject* self, PyObject* _class);
+    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyCompositeShape)"
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
     void AddChild(wxPyShape *child, wxPyShape *addAfter = NULL);
 
@@ -402,7 +448,7 @@ public:
 
         PyObject* GetDivisions() {
             wxList& list = self->GetDivisions();
-            return wxPy_ConvertList(&list, "wxPyDivisionShape");
+            return wxPy_ConvertShapeList(&list, "wxPyDivisionShape");
         }
     }
 
@@ -455,8 +501,9 @@ class wxPyDividedShape : public wxPyRectangleShape {
 public:
     wxPyDividedShape(double width = 0.0, double height = 0.0);
 
-    void _setSelf(PyObject* self, PyObject* _class);
-    %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyDividedShape)"
+    void _setCallbackInfo(PyObject* self, PyObject* _class);
+    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyDividedShape)"
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
     void EditRegions();
     void SetRegionSizes();
@@ -504,8 +551,9 @@ class wxPyDivisionShape : public wxPyCompositeShape {
 public:
     wxPyDivisionShape();
 
-    void _setSelf(PyObject* self, PyObject* _class);
-    %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyDivisionShape)"
+    void _setCallbackInfo(PyObject* self, PyObject* _class);
+    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyDivisionShape)"
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
     void AdjustBottom(double bottom, bool test);
     void AdjustLeft(double left, bool test);