]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/gdi.i
wxGTK version of generated code for recent changes
[wxWidgets.git] / wxPython / src / gdi.i
index 63e628e81ee18901ebc5ca8cf661976430f44224..da68e21f2384e4806de0befeed94391f4fbe943a 100644 (file)
 %import _defs.i
 %import misc.i
 
+
+%{
+    static wxString wxPyEmptyStr("");
+%}
+
 //---------------------------------------------------------------------------
 
 //  class wxGDIImage {
@@ -263,23 +268,15 @@ enum wxFontEncoding
     wxFONTENCODING_MAX
 };
 
+
 class wxFont {
 public:
-    // I'll do it this way to use long-lived objects and not have to
-    // worry about when python may delete the object.
-    %addmethods {
-        wxFont( int pointSize, int family, int style, int weight,
-                int underline=FALSE, char* faceName = "",
-                wxFontEncoding encoding=wxFONTENCODING_DEFAULT) {
-
-            return wxTheFontList->FindOrCreateFont(pointSize, family, style, weight,
-                                                   underline, faceName, encoding);
-        }
-        // NO Destructor.
-    }
+    wxFont( int pointSize, int family, int style, int weight,
+            int underline=FALSE, char* faceName = "",
+            wxFontEncoding encoding=wxFONTENCODING_DEFAULT);
+    ~wxFont();
 
     bool Ok();
-
     wxString GetFaceName();
     int GetFamily();
 #ifdef __WXMSW__
@@ -312,6 +309,18 @@ public:
     }
 %}
 
+
+class wxFontList {
+public:
+
+    void AddFont(wxFont* font);
+    wxFont * FindOrCreateFont(int point_size, int family, int style, int weight,
+                              bool underline = FALSE, const char* facename = NULL,
+                              wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
+    void RemoveFont(wxFont *font);
+};
+
+
 //----------------------------------------------------------------------
 
 class wxColour {
@@ -347,19 +356,28 @@ public:
 %}
 
 
-//----------------------------------------------------------------------
-
 
-class wxPen {
+class wxColourDatabase {
 public:
-    // I'll do it this way to use long-lived objects and not have to
-    // worry about when python may delete the object.
+
+    wxColour *FindColour(const wxString& colour);
+    wxString FindName(const wxColour& colour) const;
+
     %addmethods {
-        wxPen(wxColour* colour, int width=1, int style=wxSOLID) {
-            return wxThePenList->FindOrCreatePen(*colour, width, style);
+        void Append(const wxString& name, int red, int green, int blue) {
+            self->Append(name.c_str(), new wxColour(red, green, blue));
         }
-        // NO Destructor.
     }
+};
+
+
+//----------------------------------------------------------------------
+
+
+class wxPen {
+public:
+    wxPen(wxColour& colour, int width=1, int style=wxSOLID);
+    ~wxPen();
 
     int GetCap();
     wxColour& GetColour();
@@ -384,20 +402,23 @@ public:
 #endif
 };
 
+
+class wxPenList {
+public:
+
+    void AddPen(wxPen* pen);
+    wxPen* FindOrCreatePen(const wxColour& colour, int width, int style);
+    void RemovePen(wxPen* pen);
+};
+
+
+
 //----------------------------------------------------------------------
 
 class wxBrush {
 public:
-    // I'll do it this way to use long-lived objects and not have to
-    // worry about when python may delete the object.
-    %addmethods {
-        wxBrush(const wxColour* colour, int style=wxSOLID) {
-            return wxTheBrushList->FindOrCreateBrush(*colour, style);
-        }
-        // NO Destructor.
-    }
-
-//      wxBrush(const wxColour& colour, int style=wxSOLID);
+    wxBrush(const wxColour& colour, int style=wxSOLID);
+    ~wxBrush();
 
     wxColour& GetColour();
     wxBitmap * GetStipple();
@@ -408,6 +429,15 @@ public:
     void SetStyle(int style);
 };
 
+
+class wxBrushList {
+public:
+
+    void AddBrush(wxBrush *brush);
+    wxBrush * FindOrCreateBrush(const wxColour& colour, int style);
+    void RemoveBrush(wxBrush *brush);
+};
+
 //----------------------------------------------------------------------
 
 
@@ -589,15 +619,6 @@ public:
 
 //---------------------------------------------------------------------------
 
-#ifdef __WXMSW__
-class  wxPrinterDC : public wxDC {
-public:
-    wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output,
-                bool interactive = TRUE, int orientation = wxPORTRAIT);
-};
-#endif
-
-//---------------------------------------------------------------------------
 
 #ifdef __WXMSW__
 class wxMetaFileDC : public wxDC {
@@ -663,6 +684,13 @@ extern wxPalette wxNullPalette;
 extern wxFont   wxNullFont;
 extern wxColour wxNullColour;
 
+
+extern wxFontList*       wxTheFontList;
+extern wxPenList*        wxThePenList;
+extern wxBrushlist*      wxTheBrushList;
+extern wxColourDatabase* wxTheColourDatabase;
+
+
 %readwrite
 %{
 #endif