]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_graphics.i
docstring update
[wxWidgets.git] / wxPython / src / _graphics.i
index 9a761ed4eeb012bbe4b02675b4fdf50acd8a6667..9f55496112310bd5e52b8da6ed2d386dccdca786 100644 (file)
@@ -80,11 +80,22 @@ public:
         wxPyEndBlockThreads(blocked);
         return NULL;
     }
-    
+
+    static wxGraphicsContext* CreateFromNative( void *  ) {
+        wxPyBlock_t blocked = wxPyBeginBlockThreads();
+        PyErr_SetString(PyExc_NotImplementedError,
+                        "wxGraphicsContext is not available on this platform.");
+        wxPyEndBlockThreads(blocked);
+        return NULL;
+    }        
+
     wxGraphicsPath * CreatePath() { return NULL; }
     void PushState() {}
     void PopState() {}
     void Clip( const wxRegion & ) {}
+    void Clip( wxDouble, wxDouble, wxDouble, wxDouble ) {}
+    void ResetClip() {}
+    void * GetNativeContext() { return NULL; }
     void Translate( wxDouble  , wxDouble  ) {}
     void Scale( wxDouble  , wxDouble  ) {}
     void Rotate( wxDouble  ) {}
@@ -95,7 +106,7 @@ public:
     void SetRadialGradientBrush( wxDouble , wxDouble , wxDouble , wxDouble , wxDouble ,
         const wxColour &, const wxColour &) {}
     void SetFont( const wxFont & ) {}
-    void SetTextColor( const wxColour & ) {}
+    void SetTextColour( const wxColour & ) {}
     void StrokePath( const wxGraphicsPath * ) {}
     void FillPath( const wxGraphicsPath *, int  ) {}
     void DrawPath( const wxGraphicsPath *, int  ) {}
@@ -135,7 +146,8 @@ public:
     
     virtual ~wxGCDC() {}
 
-    wxGraphicsContext* GetGraphicContext() { return NULL; }
+    wxGraphicsContext* GetGraphicsContext() { return NULL; }
+    void SetGraphicsContext( wxGraphicsContext* ) {}
 };
 
 #endif
@@ -236,6 +248,43 @@ to (x2,y2), also a straight line from (current) to (x1,y1)", "");
 
 };
 
+//---------------------------------------------------------------------------
+
+/*
+class wxGraphicsMatrix
+{
+public :
+    wxGraphicsMatrix() {}
+       
+    virtual ~wxGraphicsMatrix() {}
+       
+    wxGraphicsMatrix* Concat( const wxGraphicsMatrix *t ) const;
+       
+    // returns the inverse matrix
+    wxGraphicsMatrix* Invert() const;
+       
+    // returns true if the elements of the transformation matrix are equal ?
+    bool operator==(const wxGraphicsMatrix& t) const;
+       
+    // return true if this is the identity matrix
+    bool IsIdentity();
+       
+    //
+    // transformation
+    //
+    
+    // translate
+    virtual void Translate( wxDouble dx , wxDouble dy ) = 0;
+
+    // scale
+    virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0;
+
+    // rotate (radians)
+    virtual void Rotate( wxDouble angle ) = 0; 
+} ;
+*/
+
+
 //---------------------------------------------------------------------------
 
 
@@ -244,17 +293,33 @@ class wxGraphicsContext
 public:
     // wxGraphicsContext()         This is also an ABC, use Create to make an instance...
     virtual ~wxGraphicsContext();
-    
+
+    %newobject Create;
+    %nokwargs Create;
     %pythonAppend Create
-        "val.__dc = args[0] # save a ref so the other dc will not be deleted before self";
+        "val.__dc = args[0] # save a ref so the dc will not be deleted before self";
     static wxGraphicsContext* Create( const wxWindowDC& dc);
+    
+    static wxGraphicsContext* Create( wxWindow* window ) ;
 
+    %newobject CreateFromNative;
+    static wxGraphicsContext* CreateFromNative( void * context ) ;
+
+
+    %newobject CreatePath;
     // creates a path instance that corresponds to the type of graphics context, ie GDIPlus, cairo, CoreGraphics ...
     DocDeclStr(
         virtual wxGraphicsPath * , CreatePath(),
         "", "");
     
+    /*
+    // create a 'native' matrix corresponding to these values
+    virtual wxGraphicsMatrix* CreateMatrix( wxDouble a=1.0, wxDouble b=0.0,
+                                            wxDouble c=0.0, wxDouble d=1.0, 
+                                            wxDouble tx=0.0, wxDouble ty=0.0) = 0;
+    */
 
+    
     // push the current state of the context, ie the transformation matrix on a stack
     DocDeclStr(
         virtual void , PushState(),
@@ -268,13 +333,32 @@ public:
     
 
     // clips drawings to the region
-    DocDeclStr(
+    DocDeclStrName(
         virtual void , Clip( const wxRegion &region ),
+        "", "",
+        ClipRegion);
+    
+    // clips drawings to the rect
+    DocDeclStr(
+        virtual void , Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ),
+        "", "");
+    
+       
+    // resets the clipping to original extent
+    DocDeclStr(
+        virtual void , ResetClip(),
+        "", "");
+    
+
+    // returns the native context
+    DocDeclStr(
+        virtual void * , GetNativeContext(),
         "", "");
     
 
+    
     //
-    // transformation
+    // transformation: changes the current transformation matrix CTM of the context
     //
     
     // translate
@@ -318,12 +402,12 @@ public:
         "", "");
     
 
-    // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) 
-    // with radius r and color cColor
+    // sets the brush to a radial gradient originating at (xo,yc) with color oColour and ends on a circle around (xc,yc) 
+    // with radius r and color cColour
     DocDeclStr(
         virtual void , SetRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc,
                                                wxDouble radius,
-                                               const wxColour &oColor, const wxColour &cColor),
+                                               const wxColour &oColour, const wxColour &cColour),
         "", "");
     
 
@@ -335,7 +419,7 @@ public:
     
     // sets the text color
     DocDeclStr(
-        virtual void , SetTextColor( const wxColour &col ),
+        virtual void , SetTextColour( const wxColour &col ),
         "", "");
     
 
@@ -378,7 +462,7 @@ public:
                                       wxDouble *OUTPUT /*height*/,
                                       wxDouble *OUTPUT /*descent*/,
                                       wxDouble *OUTPUT /*externalLeading*/ ) const ,
-        "GetTextExtend(self, text) --> (width, height, descent, externalLeading)",
+        "GetTextExtent(self, text) --> (width, height, descent, externalLeading)",
         "", "");
     
 
@@ -428,9 +512,8 @@ public:
 //     // stroke disconnected lines from begin to end points
 //     virtual void StrokeLines( size_t n, const wxPoint2D *beginPoints, const wxPoint2D *endPoints);
 
-    // is there a better name for this?
     %extend {
-        void StrokeDisconnectedLines(PyObject* beginPoints, PyObject* endPoints)
+        void StrokeLineSegements(PyObject* beginPoints, PyObject* endPoints)
         {
             size_t c1, c2, count;
             wxPoint2D* beginP = wxPoint2D_LIST_helper(beginPoints, &c1);
@@ -474,6 +557,9 @@ public:
 
 //---------------------------------------------------------------------------
 
+%{
+#include "wx/dcgraph.h"
+%}
 
 class wxGCDC: public wxDC
 {
@@ -484,7 +570,10 @@ public:
     //wxGCDC();
     virtual ~wxGCDC();
 
-    wxGraphicsContext* GetGraphicContext();
+    wxGraphicsContext* GetGraphicsContext();
+    virtual void SetGraphicsContext( wxGraphicsContext* ctx );
+
+    %property(GraphicsContext, GetGraphicsContext, SetGraphicsContext);
 };