1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface defining "stock" GDI objects
7 // Created: 13-Sept-2003
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
62 virtual ~wxStockGDI();
63 static void DeleteAll();
65 static wxStockGDI& instance();
67 static const wxBrush* GetBrush(Item item);
68 static const wxColour* GetColour(Item item);
69 static const wxCursor* GetCursor(Item item);
70 static const wxPen* GetPen(Item item);
72 virtual const wxFont* GetFont(Item item);
75 def _initStockObjects():
77 wx.ITALIC_FONT.this = StockGDI.instance().GetFont(StockGDI.FONT_ITALIC).this
78 wx.NORMAL_FONT.this = StockGDI.instance().GetFont(StockGDI.FONT_NORMAL).this
79 wx.SMALL_FONT.this = StockGDI.instance().GetFont(StockGDI.FONT_SMALL).this
80 wx.SWISS_FONT.this = StockGDI.instance().GetFont(StockGDI.FONT_SWISS).this
82 wx.BLACK_DASHED_PEN.this = StockGDI.GetPen(StockGDI.PEN_BLACKDASHED).this
83 wx.BLACK_PEN.this = StockGDI.GetPen(StockGDI.PEN_BLACK).this
84 wx.CYAN_PEN.this = StockGDI.GetPen(StockGDI.PEN_CYAN).this
85 wx.GREEN_PEN.this = StockGDI.GetPen(StockGDI.PEN_GREEN).this
86 wx.GREY_PEN.this = StockGDI.GetPen(StockGDI.PEN_GREY).this
87 wx.LIGHT_GREY_PEN.this = StockGDI.GetPen(StockGDI.PEN_LIGHTGREY).this
88 wx.MEDIUM_GREY_PEN.this = StockGDI.GetPen(StockGDI.PEN_MEDIUMGREY).this
89 wx.RED_PEN.this = StockGDI.GetPen(StockGDI.PEN_RED).this
90 wx.TRANSPARENT_PEN.this = StockGDI.GetPen(StockGDI.PEN_TRANSPARENT).this
91 wx.WHITE_PEN.this = StockGDI.GetPen(StockGDI.PEN_WHITE).this
93 wx.BLACK_BRUSH.this = StockGDI.GetBrush(StockGDI.BRUSH_BLACK).this
94 wx.BLUE_BRUSH.this = StockGDI.GetBrush(StockGDI.BRUSH_BLUE).this
95 wx.CYAN_BRUSH.this = StockGDI.GetBrush(StockGDI.BRUSH_CYAN).this
96 wx.GREEN_BRUSH.this = StockGDI.GetBrush(StockGDI.BRUSH_GREEN).this
97 wx.GREY_BRUSH.this = StockGDI.GetBrush(StockGDI.BRUSH_GREY).this
98 wx.LIGHT_GREY_BRUSH.this = StockGDI.GetBrush(StockGDI.BRUSH_LIGHTGREY).this
99 wx.MEDIUM_GREY_BRUSH.this = StockGDI.GetBrush(StockGDI.BRUSH_MEDIUMGREY).this
100 wx.RED_BRUSH.this = StockGDI.GetBrush(StockGDI.BRUSH_RED).this
101 wx.TRANSPARENT_BRUSH.this = StockGDI.GetBrush(StockGDI.BRUSH_TRANSPARENT).this
102 wx.WHITE_BRUSH.this = StockGDI.GetBrush(StockGDI.BRUSH_WHITE).this
104 wx.BLACK.this = StockGDI.GetColour(StockGDI.COLOUR_BLACK).this
105 wx.BLUE.this = StockGDI.GetColour(StockGDI.COLOUR_BLUE).this
106 wx.CYAN.this = StockGDI.GetColour(StockGDI.COLOUR_CYAN).this
107 wx.GREEN.this = StockGDI.GetColour(StockGDI.COLOUR_GREEN).this
108 wx.LIGHT_GREY.this = StockGDI.GetColour(StockGDI.COLOUR_LIGHTGREY).this
109 wx.RED.this = StockGDI.GetColour(StockGDI.COLOUR_RED).this
110 wx.WHITE.this = StockGDI.GetColour(StockGDI.COLOUR_WHITE).this
112 wx.CROSS_CURSOR.this = StockGDI.GetCursor(StockGDI.CURSOR_CROSS).this
113 wx.HOURGLASS_CURSOR.this = StockGDI.GetCursor(StockGDI.CURSOR_HOURGLASS).this
114 wx.STANDARD_CURSOR.this = StockGDI.GetCursor(StockGDI.CURSOR_STANDARD).this
116 wx.TheFontList.this = _wxPyInitTheFontList().this
117 wx.ThePenList.this = _wxPyInitThePenList().this
118 wx.TheBrushList.this = _wxPyInitTheBrushList().this
119 wx.TheColourDatabase.this = _wxPyInitTheColourDatabase().this
122 _initStockObjects = staticmethod(_initStockObjects)
128 %# Create an uninitialized instance for the stock objects, they will
129 %# be initialized later when the wx.App object is created.
130 ITALIC_FONT = Font.__new__(Font)
131 NORMAL_FONT = Font.__new__(Font)
132 SMALL_FONT = Font.__new__(Font)
133 SWISS_FONT = Font.__new__(Font)
135 BLACK_DASHED_PEN = Pen.__new__(Pen)
136 BLACK_PEN = Pen.__new__(Pen)
137 CYAN_PEN = Pen.__new__(Pen)
138 GREEN_PEN = Pen.__new__(Pen)
139 GREY_PEN = Pen.__new__(Pen)
140 LIGHT_GREY_PEN = Pen.__new__(Pen)
141 MEDIUM_GREY_PEN = Pen.__new__(Pen)
142 RED_PEN = Pen.__new__(Pen)
143 TRANSPARENT_PEN = Pen.__new__(Pen)
144 WHITE_PEN = Pen.__new__(Pen)
146 BLACK_BRUSH = Brush.__new__(Brush)
147 BLUE_BRUSH = Brush.__new__(Brush)
148 CYAN_BRUSH = Brush.__new__(Brush)
149 GREEN_BRUSH = Brush.__new__(Brush)
150 GREY_BRUSH = Brush.__new__(Brush)
151 LIGHT_GREY_BRUSH = Brush.__new__(Brush)
152 MEDIUM_GREY_BRUSH = Brush.__new__(Brush)
153 RED_BRUSH = Brush.__new__(Brush)
154 TRANSPARENT_BRUSH = Brush.__new__(Brush)
155 WHITE_BRUSH = Brush.__new__(Brush)
157 BLACK = Colour.__new__(Colour)
158 BLUE = Colour.__new__(Colour)
159 CYAN = Colour.__new__(Colour)
160 GREEN = Colour.__new__(Colour)
161 LIGHT_GREY = Colour.__new__(Colour)
162 RED = Colour.__new__(Colour)
163 WHITE = Colour.__new__(Colour)
165 CROSS_CURSOR = Cursor.__new__(Cursor)
166 HOURGLASS_CURSOR = Cursor.__new__(Cursor)
167 STANDARD_CURSOR = Cursor.__new__(Cursor)
174 const wxBitmap wxNullBitmap;
175 const wxIcon wxNullIcon;
176 const wxCursor wxNullCursor;
177 const wxPen wxNullPen;
178 const wxBrush wxNullBrush;
179 const wxPalette wxNullPalette;
180 const wxFont wxNullFont;
181 const wxColour wxNullColour;
187 //---------------------------------------------------------------------------
190 class wxGDIObjListBase {
197 class wxPenList : public wxGDIObjListBase {
200 wxPen* FindOrCreatePen(const wxColour& colour, int width, int style);
202 void AddPen(wxPen* pen);
203 void RemovePen(wxPen* pen);
205 AddPen = wx._deprecated(AddPen)
206 RemovePen = wx._deprecated(RemovePen)
212 class wxBrushList : public wxGDIObjListBase {
215 wxBrush * FindOrCreateBrush(const wxColour& colour, int style=wxSOLID);
217 void AddBrush(wxBrush *brush);
218 void RemoveBrush(wxBrush *brush);
220 AddBrush = wx._deprecated(AddBrush)
221 RemoveBrush = wx._deprecated(RemoveBrush)
227 class wxFontList : public wxGDIObjListBase {
230 wxFont * FindOrCreateFont(int point_size, int family, int style, int weight,
231 bool underline = false,
232 const wxString& facename = wxPyEmptyString,
233 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
235 void AddFont(wxFont* font);
236 void RemoveFont(wxFont *font);
238 AddFont = wx._deprecated(AddFont)
239 RemoveFont = wx._deprecated(RemoveFont)
245 //---------------------------------------------------------------------------
247 MustHaveApp(wxColourDatabase);
249 class wxColourDatabase {
254 // find colour by name or name for the given colour
255 wxColour Find(const wxString& name) const;
256 wxString FindName(const wxColour& colour) const;
257 %pythoncode { FindColour = Find }
259 // add a new colour to the database
260 void AddColour(const wxString& name, const wxColour& colour);
263 void Append(const wxString& name, int red, int green, int blue) {
264 self->AddColour(name, wxColour(red, green, blue));
270 //---------------------------------------------------------------------------
274 wxFontList* _wxPyInitTheFontList() { return wxTheFontList; }
275 wxPenList* _wxPyInitThePenList() { return wxThePenList; }
276 wxBrushList* _wxPyInitTheBrushList() { return wxTheBrushList; }
277 wxColourDatabase* _wxPyInitTheColourDatabase() { return wxTheColourDatabase; }
282 %# Create an uninitialized instance for the stock objects, they will
283 %# be initialized later when the wx.App object is created.
284 TheFontList = FontList.__new__(FontList)
285 ThePenList = PenList.__new__(PenList)
286 TheBrushList = BrushList.__new__(BrushList)
287 TheColourDatabase = ColourDatabase.__new__(ColourDatabase)
291 //---------------------------------------------------------------------------
293 %pythoncode { NullColor = NullColour }