]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_stockobjs.i
AUI updates
[wxWidgets.git] / wxPython / src / _stockobjs.i
CommitLineData
d14a1e28
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: _stockobjs.i
3// Purpose: SWIG interface defining "stock" GDI objects
4//
5// Author: Robin Dunn
6//
7// Created: 13-Sept-2003
8// RCS-ID: $Id$
9// Copyright: (c) 2003 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15
16//---------------------------------------------------------------------------
17%newgroup
18
19
99a001dd
RD
20class wxStockGDI
21{
22public:
23 enum Item {
24 BRUSH_BLACK,
25 BRUSH_BLUE,
26 BRUSH_CYAN,
27 BRUSH_GREEN,
28 BRUSH_GREY,
29 BRUSH_LIGHTGREY,
30 BRUSH_MEDIUMGREY,
31 BRUSH_RED,
32 BRUSH_TRANSPARENT,
33 BRUSH_WHITE,
34 COLOUR_BLACK,
35 COLOUR_BLUE,
36 COLOUR_CYAN,
37 COLOUR_GREEN,
38 COLOUR_LIGHTGREY,
39 COLOUR_RED,
40 COLOUR_WHITE,
41 CURSOR_CROSS,
42 CURSOR_HOURGLASS,
43 CURSOR_STANDARD,
44 FONT_ITALIC,
45 FONT_NORMAL,
46 FONT_SMALL,
47 FONT_SWISS,
48 PEN_BLACK,
49 PEN_BLACKDASHED,
50 PEN_CYAN,
51 PEN_GREEN,
52 PEN_GREY,
53 PEN_LIGHTGREY,
54 PEN_MEDIUMGREY,
55 PEN_RED,
56 PEN_TRANSPARENT,
57 PEN_WHITE,
58 ITEMCOUNT
59 };
60
61 wxStockGDI();
62 virtual ~wxStockGDI();
63 static void DeleteAll();
64
65 static wxStockGDI& instance();
66
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);
71
72 virtual const wxFont* GetFont(Item item);
99a001dd 73
57ffa585
RD
74 %pythoncode {
75 def _initStockObjects():
76 import wx
bd2903e1
RD
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
99a001dd 81
bd2903e1
RD
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
92
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
103
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
99a001dd 111
bd2903e1
RD
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
115
116 wx.TheFontList.this = _wxPyInitTheFontList().this
117 wx.ThePenList.this = _wxPyInitThePenList().this
118 wx.TheBrushList.this = _wxPyInitTheBrushList().this
119 wx.TheColourDatabase.this = _wxPyInitTheColourDatabase().this
120
57ffa585
RD
121
122 _initStockObjects = staticmethod(_initStockObjects)
123 }
124};
2b9048c5 125
99a001dd 126
bd2903e1
RD
127%pythoncode {
128%# Create an uninitialized instance for the stock objects, they will
129%# be initialized later when the wx.App object is created.
130ITALIC_FONT = Font.__new__(Font)
131NORMAL_FONT = Font.__new__(Font)
132SMALL_FONT = Font.__new__(Font)
133SWISS_FONT = Font.__new__(Font)
134
135BLACK_DASHED_PEN = Pen.__new__(Pen)
136BLACK_PEN = Pen.__new__(Pen)
137CYAN_PEN = Pen.__new__(Pen)
138GREEN_PEN = Pen.__new__(Pen)
139GREY_PEN = Pen.__new__(Pen)
140LIGHT_GREY_PEN = Pen.__new__(Pen)
141MEDIUM_GREY_PEN = Pen.__new__(Pen)
142RED_PEN = Pen.__new__(Pen)
143TRANSPARENT_PEN = Pen.__new__(Pen)
144WHITE_PEN = Pen.__new__(Pen)
145
146BLACK_BRUSH = Brush.__new__(Brush)
147BLUE_BRUSH = Brush.__new__(Brush)
148CYAN_BRUSH = Brush.__new__(Brush)
149GREEN_BRUSH = Brush.__new__(Brush)
150GREY_BRUSH = Brush.__new__(Brush)
151LIGHT_GREY_BRUSH = Brush.__new__(Brush)
152MEDIUM_GREY_BRUSH = Brush.__new__(Brush)
153RED_BRUSH = Brush.__new__(Brush)
154TRANSPARENT_BRUSH = Brush.__new__(Brush)
155WHITE_BRUSH = Brush.__new__(Brush)
156
157BLACK = Colour.__new__(Colour)
158BLUE = Colour.__new__(Colour)
159CYAN = Colour.__new__(Colour)
160GREEN = Colour.__new__(Colour)
161LIGHT_GREY = Colour.__new__(Colour)
162RED = Colour.__new__(Colour)
163WHITE = Colour.__new__(Colour)
164
165CROSS_CURSOR = Cursor.__new__(Cursor)
166HOURGLASS_CURSOR = Cursor.__new__(Cursor)
167STANDARD_CURSOR = Cursor.__new__(Cursor)
168}
169
99a001dd
RD
170
171%immutable;
172%threadWrapperOff;
173
2b9048c5
RD
174const wxBitmap wxNullBitmap;
175const wxIcon wxNullIcon;
176const wxCursor wxNullCursor;
177const wxPen wxNullPen;
178const wxBrush wxNullBrush;
179const wxPalette wxNullPalette;
180const wxFont wxNullFont;
181const wxColour wxNullColour;
182
214c4fbe 183%threadWrapperOn;
2b9048c5
RD
184%mutable;
185
186
187//---------------------------------------------------------------------------
188
99a001dd
RD
189
190class wxGDIObjListBase {
191public:
192 wxGDIObjListBase();
193 ~wxGDIObjListBase();
194};
195
196
197class wxPenList : public wxGDIObjListBase {
d14a1e28
RD
198public:
199
d14a1e28 200 wxPen* FindOrCreatePen(const wxColour& colour, int width, int style);
d14a1e28 201
99a001dd
RD
202 void AddPen(wxPen* pen);
203 void RemovePen(wxPen* pen);
204 %pythoncode {
205 AddPen = wx._deprecated(AddPen)
206 RemovePen = wx._deprecated(RemovePen)
207 }
208// int GetCount();
d14a1e28
RD
209};
210
211
99a001dd 212class wxBrushList : public wxGDIObjListBase {
d14a1e28
RD
213public:
214
4f58a958 215 wxBrush * FindOrCreateBrush(const wxColour& colour, int style=wxSOLID);
99a001dd
RD
216
217 void AddBrush(wxBrush *brush);
d14a1e28 218 void RemoveBrush(wxBrush *brush);
99a001dd
RD
219 %pythoncode {
220 AddBrush = wx._deprecated(AddBrush)
221 RemoveBrush = wx._deprecated(RemoveBrush)
222 }
223// int GetCount();
224};
225
226
227class wxFontList : public wxGDIObjListBase {
228public:
229
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);
d14a1e28 234
99a001dd
RD
235 void AddFont(wxFont* font);
236 void RemoveFont(wxFont *font);
237 %pythoncode {
238 AddFont = wx._deprecated(AddFont)
239 RemoveFont = wx._deprecated(RemoveFont)
240 }
241
242// int GetCount();
d14a1e28
RD
243};
244
245//---------------------------------------------------------------------------
246
ab1f7d2a
RD
247MustHaveApp(wxColourDatabase);
248
99a001dd 249class wxColourDatabase {
d14a1e28
RD
250public:
251 wxColourDatabase();
252 ~wxColourDatabase();
253
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 }
258
259 // add a new colour to the database
260 void AddColour(const wxString& name, const wxColour& colour);
261
262 %extend {
263 void Append(const wxString& name, int red, int green, int blue) {
264 self->AddColour(name, wxColour(red, green, blue));
265 }
266 }
267};
268
d14a1e28
RD
269
270//---------------------------------------------------------------------------
271%newgroup
272
99a001dd
RD
273%inline {
274 wxFontList* _wxPyInitTheFontList() { return wxTheFontList; }
275 wxPenList* _wxPyInitThePenList() { return wxThePenList; }
276 wxBrushList* _wxPyInitTheBrushList() { return wxTheBrushList; }
277 wxColourDatabase* _wxPyInitTheColourDatabase() { return wxTheColourDatabase; }
278}
279
280%pythoncode {
57ffa585 281
bd2903e1
RD
282%# Create an uninitialized instance for the stock objects, they will
283%# be initialized later when the wx.App object is created.
284TheFontList = FontList.__new__(FontList)
285ThePenList = PenList.__new__(PenList)
286TheBrushList = BrushList.__new__(BrushList)
287TheColourDatabase = ColourDatabase.__new__(ColourDatabase)
99a001dd 288}
d14a1e28 289
bd2903e1 290
d14a1e28
RD
291//---------------------------------------------------------------------------
292
2b9048c5
RD
293%pythoncode { NullColor = NullColour }
294
295
296
297