]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: gdicmn.h | |
3 | // Purpose: Common GDI classes, types and declarations | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) | |
f03fc89f | 9 | // Licence: wxWindows licence |
c801d85f KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
34138703 JS |
12 | #ifndef _WX_GDICMNH__ |
13 | #define _WX_GDICMNH__ | |
c801d85f | 14 | |
f03fc89f VZ |
15 | // --------------------------------------------------------------------------- |
16 | // headers | |
17 | // --------------------------------------------------------------------------- | |
18 | ||
12028905 | 19 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
f03fc89f | 20 | #pragma interface "gdicmn.h" |
c801d85f KB |
21 | #endif |
22 | ||
ed39ff57 | 23 | #include "wx/setup.h" |
c801d85f | 24 | #include "wx/list.h" |
34138703 | 25 | #include "wx/string.h" |
ed39ff57 | 26 | #include "wx/fontenc.h" |
bdcade0a | 27 | #include "wx/hashmap.h" |
c801d85f | 28 | |
f03fc89f VZ |
29 | // --------------------------------------------------------------------------- |
30 | // forward declarations | |
31 | // --------------------------------------------------------------------------- | |
32 | ||
33 | class WXDLLEXPORT wxBitmap; | |
34 | class WXDLLEXPORT wxBrush; | |
35 | class WXDLLEXPORT wxColour; | |
36 | class WXDLLEXPORT wxCursor; | |
37 | class WXDLLEXPORT wxFont; | |
38 | class WXDLLEXPORT wxIcon; | |
39 | class WXDLLEXPORT wxPalette; | |
40 | class WXDLLEXPORT wxPen; | |
41 | class WXDLLEXPORT wxRegion; | |
42 | class WXDLLEXPORT wxString; | |
43 | ||
44 | // --------------------------------------------------------------------------- | |
45 | // constants | |
46 | // --------------------------------------------------------------------------- | |
47 | ||
48 | // Bitmap flags | |
2aeec9ec | 49 | enum wxBitmapType |
f03fc89f | 50 | { |
6d167489 VZ |
51 | wxBITMAP_TYPE_INVALID, // should be == 0 for compatibility! |
52 | wxBITMAP_TYPE_BMP, | |
f03fc89f VZ |
53 | wxBITMAP_TYPE_BMP_RESOURCE, |
54 | wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE, | |
55 | wxBITMAP_TYPE_ICO, | |
56 | wxBITMAP_TYPE_ICO_RESOURCE, | |
57 | wxBITMAP_TYPE_CUR, | |
58 | wxBITMAP_TYPE_CUR_RESOURCE, | |
59 | wxBITMAP_TYPE_XBM, | |
60 | wxBITMAP_TYPE_XBM_DATA, | |
61 | wxBITMAP_TYPE_XPM, | |
62 | wxBITMAP_TYPE_XPM_DATA, | |
63 | wxBITMAP_TYPE_TIF, | |
64 | wxBITMAP_TYPE_TIF_RESOURCE, | |
65 | wxBITMAP_TYPE_GIF, | |
66 | wxBITMAP_TYPE_GIF_RESOURCE, | |
67 | wxBITMAP_TYPE_PNG, | |
68 | wxBITMAP_TYPE_PNG_RESOURCE, | |
69 | wxBITMAP_TYPE_JPEG, | |
70 | wxBITMAP_TYPE_JPEG_RESOURCE, | |
bcc46c75 SB |
71 | wxBITMAP_TYPE_PNM, |
72 | wxBITMAP_TYPE_PNM_RESOURCE, | |
6523d119 GRG |
73 | wxBITMAP_TYPE_PCX, |
74 | wxBITMAP_TYPE_PCX_RESOURCE, | |
6d167489 VZ |
75 | wxBITMAP_TYPE_PICT, |
76 | wxBITMAP_TYPE_PICT_RESOURCE, | |
77 | wxBITMAP_TYPE_ICON, | |
78 | wxBITMAP_TYPE_ICON_RESOURCE, | |
658974ae | 79 | wxBITMAP_TYPE_ANI, |
63f8abca | 80 | wxBITMAP_TYPE_IFF, |
6d167489 VZ |
81 | wxBITMAP_TYPE_MACCURSOR, |
82 | wxBITMAP_TYPE_MACCURSOR_RESOURCE, | |
f03fc89f VZ |
83 | wxBITMAP_TYPE_ANY = 50 |
84 | }; | |
85 | ||
c801d85f | 86 | // Standard cursors |
f03fc89f VZ |
87 | enum wxStockCursor |
88 | { | |
89 | wxCURSOR_NONE, // should be 0 | |
90 | wxCURSOR_ARROW, | |
15dadf31 | 91 | wxCURSOR_RIGHT_ARROW, |
f03fc89f VZ |
92 | wxCURSOR_BULLSEYE, |
93 | wxCURSOR_CHAR, | |
94 | wxCURSOR_CROSS, | |
95 | wxCURSOR_HAND, | |
96 | wxCURSOR_IBEAM, | |
97 | wxCURSOR_LEFT_BUTTON, | |
98 | wxCURSOR_MAGNIFIER, | |
99 | wxCURSOR_MIDDLE_BUTTON, | |
100 | wxCURSOR_NO_ENTRY, | |
101 | wxCURSOR_PAINT_BRUSH, | |
102 | wxCURSOR_PENCIL, | |
103 | wxCURSOR_POINT_LEFT, | |
104 | wxCURSOR_POINT_RIGHT, | |
105 | wxCURSOR_QUESTION_ARROW, | |
106 | wxCURSOR_RIGHT_BUTTON, | |
107 | wxCURSOR_SIZENESW, | |
108 | wxCURSOR_SIZENS, | |
109 | wxCURSOR_SIZENWSE, | |
110 | wxCURSOR_SIZEWE, | |
111 | wxCURSOR_SIZING, | |
112 | wxCURSOR_SPRAYCAN, | |
113 | wxCURSOR_WAIT, | |
114 | wxCURSOR_WATCH, | |
115 | wxCURSOR_BLANK, | |
ae53c98c KB |
116 | #ifdef __WXGTK__ |
117 | wxCURSOR_DEFAULT, // standard X11 cursor | |
118 | #endif | |
5f7a6626 | 119 | #ifdef __WXMAC__ |
706f1421 | 120 | wxCURSOR_COPY_ARROW , // MacOS Theme Plus arrow |
5f7a6626 | 121 | #endif |
c801d85f | 122 | #ifdef __X__ |
f03fc89f VZ |
123 | // Not yet implemented for Windows |
124 | wxCURSOR_CROSS_REVERSE, | |
125 | wxCURSOR_DOUBLE_ARROW, | |
126 | wxCURSOR_BASED_ARROW_UP, | |
ea804aad | 127 | wxCURSOR_BASED_ARROW_DOWN, |
f03fc89f VZ |
128 | #endif // X11 |
129 | ||
83f96286 RD |
130 | wxCURSOR_ARROWWAIT, |
131 | ||
f03fc89f VZ |
132 | wxCURSOR_MAX |
133 | }; | |
134 | ||
943d28e4 VZ |
135 | #ifndef __WXGTK__ |
136 | #define wxCURSOR_DEFAULT wxCURSOR_ARROW | |
137 | #endif | |
138 | ||
f03fc89f VZ |
139 | // --------------------------------------------------------------------------- |
140 | // macros | |
141 | // --------------------------------------------------------------------------- | |
142 | ||
143 | /* Useful macro for creating icons portably, for example: | |
144 | ||
145 | wxIcon *icon = new wxICON(mondrian); | |
146 | ||
147 | expands into: | |
148 | ||
149 | wxIcon *icon = new wxIcon("mondrian"); // On wxMSW | |
150 | wxIcon *icon = new wxIcon(mondrian_xpm); // On wxGTK | |
151 | */ | |
152 | ||
153 | #ifdef __WXMSW__ | |
154 | // Load from a resource | |
2b5f62a0 | 155 | #define wxICON(X) wxIcon(wxT(#X)) |
1777b9bb DW |
156 | #elif defined(__WXPM__) |
157 | // Load from a resource | |
2b5f62a0 | 158 | #define wxICON(X) wxIcon(wxT(#X)) |
1e6feb95 | 159 | #elif defined(__WXMGL__) |
1d965e2f VS |
160 | // Initialize from an included XPM |
161 | #define wxICON(X) wxIcon( (const char**) X##_xpm ) | |
f03fc89f VZ |
162 | #elif defined(__WXGTK__) |
163 | // Initialize from an included XPM | |
164 | #define wxICON(X) wxIcon( (const char**) X##_xpm ) | |
0532484d GD |
165 | #elif defined(__WXMAC__) |
166 | // Initialize from an included XPM | |
167 | #define wxICON(X) wxIcon( (const char**) X##_xpm ) | |
f03fc89f VZ |
168 | #elif defined(__WXMOTIF__) |
169 | // Initialize from an included XPM | |
170 | #define wxICON(X) wxIcon( X##_xpm ) | |
83df96d6 JS |
171 | #elif defined(__WXX11__) |
172 | // Initialize from an included XPM | |
173 | #define wxICON(X) wxIcon( X##_xpm ) | |
f03fc89f VZ |
174 | #else |
175 | // This will usually mean something on any platform | |
2b5f62a0 | 176 | #define wxICON(X) wxIcon(wxT(#X)) |
f03fc89f VZ |
177 | #endif // platform |
178 | ||
0c5d3e1c VZ |
179 | /* Another macro: this one is for portable creation of bitmaps. We assume that |
180 | under Unix bitmaps live in XPMs and under Windows they're in ressources. | |
181 | */ | |
182 | ||
1d965e2f | 183 | #if defined(__WXMSW__) || defined(__WXPM__) |
2b5f62a0 | 184 | #define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_RESOURCE) |
35c1cfdd | 185 | #elif defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXCOCOA__) |
bab537dc VS |
186 | // Initialize from an included XPM |
187 | #define wxBITMAP(name) wxBitmap( (const char**) name##_xpm ) | |
b8aa1680 | 188 | #else // other platforms |
0c5d3e1c VZ |
189 | #define wxBITMAP(name) wxBitmap(name##_xpm, wxBITMAP_TYPE_XPM) |
190 | #endif // platform | |
191 | ||
f03fc89f VZ |
192 | // =========================================================================== |
193 | // classes | |
194 | // =========================================================================== | |
c801d85f | 195 | |
f03fc89f VZ |
196 | // --------------------------------------------------------------------------- |
197 | // wxSize | |
198 | // --------------------------------------------------------------------------- | |
1e6feb95 | 199 | |
6a6c0a8b | 200 | class WXDLLEXPORT wxSize |
c801d85f KB |
201 | { |
202 | public: | |
e6c96a7c | 203 | // members are public for compatibility, don't use them directly. |
72cdf4c9 | 204 | int x, y; |
f03fc89f VZ |
205 | |
206 | // constructors | |
7ee31b00 GD |
207 | wxSize() : x(0), y(0) { } |
208 | wxSize(int xx, int yy) : x(xx), y(yy) { } | |
f03fc89f VZ |
209 | |
210 | // no copy ctor or assignment operator - the defaults are ok | |
1e6feb95 | 211 | |
f03fc89f | 212 | bool operator==(const wxSize& sz) const { return x == sz.x && y == sz.y; } |
1e6feb95 | 213 | bool operator!=(const wxSize& sz) const { return x != sz.x || y != sz.y; } |
f03fc89f VZ |
214 | |
215 | // FIXME are these really useful? If they're, we should have += &c as well | |
216 | wxSize operator+(const wxSize& sz) { return wxSize(x + sz.x, y + sz.y); } | |
217 | wxSize operator-(const wxSize& sz) { return wxSize(x - sz.x, y - sz.y); } | |
706f1421 | 218 | |
5b087ae2 VZ |
219 | void IncTo(const wxSize& sz) |
220 | { if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; } | |
221 | void DecTo(const wxSize& sz) | |
222 | { if ( sz.x < x ) x = sz.x; if ( sz.y < y ) y = sz.y; } | |
f03fc89f | 223 | |
eddf46fe JS |
224 | // accessors |
225 | void Set(int xx, int yy) { x = xx; y = yy; } | |
72cdf4c9 VZ |
226 | void SetWidth(int w) { x = w; } |
227 | void SetHeight(int h) { y = h; } | |
cc775580 | 228 | |
72cdf4c9 VZ |
229 | int GetWidth() const { return x; } |
230 | int GetHeight() const { return y; } | |
f03fc89f | 231 | |
706f1421 VZ |
232 | bool IsFullySpecified() const { return x != -1 && y != -1; } |
233 | ||
234 | // combine this size with the other one replacing the default (i.e. equal | |
235 | // to -1) components of this object with those of the other | |
236 | void SetDefaults(const wxSize& size) | |
237 | { | |
238 | if ( x == -1 ) | |
239 | x = size.x; | |
240 | if ( y == -1 ) | |
241 | y = size.y; | |
242 | } | |
243 | ||
cc775580 | 244 | // compatibility |
72cdf4c9 VZ |
245 | int GetX() const { return x; } |
246 | int GetY() const { return y; } | |
c801d85f KB |
247 | }; |
248 | ||
f03fc89f VZ |
249 | // --------------------------------------------------------------------------- |
250 | // Point classes: with real or integer coordinates | |
251 | // --------------------------------------------------------------------------- | |
764a3a49 | 252 | |
6a6c0a8b | 253 | class WXDLLEXPORT wxRealPoint |
c801d85f | 254 | { |
f03fc89f VZ |
255 | public: |
256 | double x; | |
257 | double y; | |
258 | ||
7ee31b00 GD |
259 | wxRealPoint() : x(0.0), y(0.0) { } |
260 | wxRealPoint(double xx, double yy) : x(xx), y(yy) { } | |
f03fc89f | 261 | |
f6bcfd97 BP |
262 | wxRealPoint operator+(const wxRealPoint& pt) const { return wxRealPoint(x + pt.x, y + pt.y); } |
263 | wxRealPoint operator-(const wxRealPoint& pt) const { return wxRealPoint(x - pt.x, y - pt.y); } | |
f03fc89f VZ |
264 | |
265 | bool operator==(const wxRealPoint& pt) const { return x == pt.x && y == pt.y; } | |
2b5f62a0 | 266 | bool operator!=(const wxRealPoint& pt) const { return x != pt.x || y != pt.y; } |
c801d85f KB |
267 | }; |
268 | ||
6a6c0a8b | 269 | class WXDLLEXPORT wxPoint |
c801d85f | 270 | { |
f03fc89f | 271 | public: |
72cdf4c9 | 272 | int x, y; |
6a6c0a8b | 273 | |
7ee31b00 GD |
274 | wxPoint() : x(0), y(0) { } |
275 | wxPoint(int xx, int yy) : x(xx), y(yy) { } | |
f03fc89f VZ |
276 | |
277 | // no copy ctor or assignment operator - the defaults are ok | |
6a6c0a8b | 278 | |
764a3a49 VZ |
279 | // comparison |
280 | bool operator==(const wxPoint& p) const { return x == p.x && y == p.y; } | |
281 | bool operator!=(const wxPoint& p) const { return !(*this == p); } | |
282 | ||
283 | // arithmetic operations (component wise) | |
f6bcfd97 BP |
284 | wxPoint operator+(const wxPoint& p) const { return wxPoint(x + p.x, y + p.y); } |
285 | wxPoint operator-(const wxPoint& p) const { return wxPoint(x - p.x, y - p.y); } | |
f03fc89f | 286 | |
764a3a49 VZ |
287 | wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; } |
288 | wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; } | |
d02bc4c8 JS |
289 | |
290 | wxPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } | |
291 | wxPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } | |
292 | ||
293 | wxPoint operator+(const wxSize& s) const { return wxPoint(x + s.GetWidth(), y + s.GetHeight()); } | |
294 | wxPoint operator-(const wxSize& s) const { return wxPoint(x - s.GetWidth(), y - s.GetHeight()); } | |
c801d85f KB |
295 | }; |
296 | ||
f03fc89f VZ |
297 | // --------------------------------------------------------------------------- |
298 | // wxRect | |
299 | // --------------------------------------------------------------------------- | |
c801d85f | 300 | |
6a6c0a8b JS |
301 | class WXDLLEXPORT wxRect |
302 | { | |
c801d85f | 303 | public: |
7ee31b00 GD |
304 | wxRect() |
305 | : x(0), y(0), width(0), height(0) | |
306 | { } | |
72cdf4c9 | 307 | wxRect(int xx, int yy, int ww, int hh) |
7ee31b00 GD |
308 | : x(xx), y(yy), width(ww), height(hh) |
309 | { } | |
f03fc89f VZ |
310 | wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); |
311 | wxRect(const wxPoint& pos, const wxSize& size); | |
a23fd0e1 VZ |
312 | |
313 | // default copy ctor and assignment operators ok | |
c801d85f | 314 | |
72cdf4c9 VZ |
315 | int GetX() const { return x; } |
316 | void SetX(int xx) { x = xx; } | |
c801d85f | 317 | |
72cdf4c9 VZ |
318 | int GetY() const { return y; } |
319 | void SetY(int yy) { y = yy; } | |
c801d85f | 320 | |
72cdf4c9 VZ |
321 | int GetWidth() const { return width; } |
322 | void SetWidth(int w) { width = w; } | |
c801d85f | 323 | |
72cdf4c9 VZ |
324 | int GetHeight() const { return height; } |
325 | void SetHeight(int h) { height = h; } | |
f03fc89f | 326 | |
dcb44466 | 327 | wxPoint GetPosition() const { return wxPoint(x, y); } |
4aa0010b RL |
328 | void SetPosition( const wxPoint &p ) { x = p.x; y = p.y; } |
329 | ||
dcb44466 | 330 | wxSize GetSize() const { return wxSize(width, height); } |
4aa0010b | 331 | void SetSize( const wxSize &s ) { width = s.GetWidth(); height = s.GetHeight(); } |
f03fc89f | 332 | |
355a5e2b JS |
333 | wxPoint GetTopLeft() const { return GetPosition(); } |
334 | wxPoint GetLeftTop() const { return GetTopLeft(); } | |
335 | void SetTopLeft(const wxPoint &p) { SetPosition(p); } | |
336 | void SetLeftTop(const wxPoint &p) { SetTopLeft(p); } | |
337 | ||
338 | wxPoint GetBottomRight() const { return wxPoint(GetRight(), GetBottom()); } | |
339 | wxPoint GetRightBottom() const { return GetBottomRight(); } | |
340 | void SetBottomRight(const wxPoint &p) { SetRight(p.x); SetBottom(p.y); } | |
341 | void SetRightBottom(const wxPoint &p) { SetBottomRight(p); } | |
342 | ||
72cdf4c9 VZ |
343 | int GetLeft() const { return x; } |
344 | int GetTop() const { return y; } | |
345 | int GetBottom() const { return y + height - 1; } | |
346 | int GetRight() const { return x + width - 1; } | |
f03fc89f | 347 | |
72cdf4c9 VZ |
348 | void SetLeft(int left) { x = left; } |
349 | void SetRight(int right) { width = right - x + 1; } | |
350 | void SetTop(int top) { y = top; } | |
351 | void SetBottom(int bottom) { height = bottom - y + 1; } | |
dcb44466 | 352 | |
1e6feb95 VZ |
353 | // operations with rect |
354 | wxRect& Inflate(wxCoord dx, wxCoord dy); | |
355 | wxRect& Inflate(wxCoord d) { return Inflate(d, d); } | |
356 | wxRect Inflate(wxCoord dx, wxCoord dy) const | |
357 | { | |
358 | wxRect r = *this; | |
359 | r.Inflate(dx, dy); | |
360 | return r; | |
361 | } | |
362 | ||
363 | wxRect& Deflate(wxCoord dx, wxCoord dy) { return Inflate(-dx, -dy); } | |
364 | wxRect& Deflate(wxCoord d) { return Inflate(-d); } | |
365 | wxRect Deflate(wxCoord dx, wxCoord dy) const | |
366 | { | |
367 | wxRect r = *this; | |
368 | r.Deflate(dx, dy); | |
369 | return r; | |
370 | } | |
371 | ||
372 | void Offset(wxCoord dx, wxCoord dy) { x += dx; y += dy; } | |
373 | void Offset(const wxPoint& pt) { Offset(pt.x, pt.y); } | |
374 | ||
375 | wxRect& Intersect(const wxRect& rect); | |
376 | wxRect Intersect(const wxRect& rect) const | |
45816ddd | 377 | { |
1e6feb95 VZ |
378 | wxRect r = *this; |
379 | r.Intersect(rect); | |
380 | return r; | |
45816ddd VZ |
381 | } |
382 | ||
1e6feb95 VZ |
383 | wxRect operator+(const wxRect& rect) const; |
384 | wxRect& operator+=(const wxRect& rect); | |
45816ddd | 385 | |
1e6feb95 | 386 | // compare rectangles |
764a3a49 VZ |
387 | bool operator==(const wxRect& rect) const; |
388 | bool operator!=(const wxRect& rect) const { return !(*this == rect); } | |
f03fc89f | 389 | |
1e6feb95 VZ |
390 | // return TRUE if the point is (not strcitly) inside the rect |
391 | bool Inside(int x, int y) const; | |
59a12e90 | 392 | bool Inside(const wxPoint& pt) const { return Inside(pt.x, pt.y); } |
1e6feb95 VZ |
393 | |
394 | // return TRUE if the rectangles have a non empty intersection | |
395 | bool Intersects(const wxRect& rect) const; | |
72cdf4c9 | 396 | |
f03fc89f | 397 | public: |
72cdf4c9 | 398 | int x, y, width, height; |
f03fc89f | 399 | }; |
c801d85f | 400 | |
f03fc89f | 401 | // --------------------------------------------------------------------------- |
c801d85f | 402 | // Management of pens, brushes and fonts |
f03fc89f VZ |
403 | // --------------------------------------------------------------------------- |
404 | ||
236a9de3 RL |
405 | typedef wxInt8 wxDash; |
406 | ||
f03fc89f | 407 | class WXDLLEXPORT wxPenList : public wxList |
c801d85f | 408 | { |
f03fc89f VZ |
409 | public: |
410 | wxPenList() { } | |
9b51403d | 411 | ~wxPenList(); |
f03fc89f VZ |
412 | |
413 | void AddPen(wxPen *pen); | |
414 | void RemovePen(wxPen *pen); | |
415 | wxPen *FindOrCreatePen(const wxColour& colour, int width, int style); | |
c801d85f KB |
416 | }; |
417 | ||
f03fc89f | 418 | class WXDLLEXPORT wxBrushList : public wxList |
c801d85f | 419 | { |
f03fc89f VZ |
420 | public: |
421 | wxBrushList() { } | |
9b51403d | 422 | ~wxBrushList(); |
f03fc89f VZ |
423 | |
424 | void AddBrush(wxBrush *brush); | |
425 | void RemoveBrush(wxBrush *brush); | |
426 | wxBrush *FindOrCreateBrush(const wxColour& colour, int style); | |
c801d85f KB |
427 | }; |
428 | ||
f03fc89f | 429 | class WXDLLEXPORT wxFontList : public wxList |
c801d85f | 430 | { |
f03fc89f VZ |
431 | public: |
432 | wxFontList() { } | |
9b51403d | 433 | ~wxFontList(); |
f03fc89f VZ |
434 | |
435 | void AddFont(wxFont *font); | |
436 | void RemoveFont(wxFont *font); | |
437 | wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight, | |
438 | bool underline = FALSE, | |
37bebc11 RD |
439 | const wxString& face = wxEmptyString, |
440 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
c801d85f KB |
441 | }; |
442 | ||
bdcade0a | 443 | WX_DECLARE_STRING_HASH_MAP( wxColour *, wxStringToColourHashMap ); |
222ed1d6 MB |
444 | |
445 | class WXDLLEXPORT wxColourDatabase | |
c801d85f | 446 | { |
f03fc89f | 447 | public: |
222ed1d6 | 448 | wxColourDatabase(); |
c50f92d0 | 449 | ~wxColourDatabase(); |
f03fc89f | 450 | |
c50f92d0 VZ |
451 | // find colour by name or name for the given colour |
452 | wxColour Find(const wxString& name) const; | |
f03fc89f | 453 | wxString FindName(const wxColour& colour) const; |
c50f92d0 VZ |
454 | |
455 | // add a new colour to the database | |
456 | void AddColour(const wxString& name, const wxColour& colour); | |
457 | ||
492e2a5b VZ |
458 | // deprecated, use Find() instead |
459 | wxDEPRECATED( wxColour *FindColour(const wxString& name) ); | |
c50f92d0 VZ |
460 | |
461 | ||
19bf0c69 DW |
462 | #ifdef __WXPM__ |
463 | // PM keeps its own type of colour table | |
464 | long* m_palTable; | |
465 | size_t m_nSize; | |
466 | #endif | |
c50f92d0 | 467 | |
222ed1d6 | 468 | private: |
c50f92d0 VZ |
469 | // load the database with the built in colour values when called for the |
470 | // first time, do nothing after this | |
471 | void Initialize(); | |
222ed1d6 | 472 | |
c50f92d0 | 473 | wxStringToColourHashMap *m_map; |
c801d85f KB |
474 | }; |
475 | ||
f03fc89f | 476 | class WXDLLEXPORT wxBitmapList : public wxList |
c801d85f | 477 | { |
f03fc89f VZ |
478 | public: |
479 | wxBitmapList(); | |
9b51403d | 480 | ~wxBitmapList(); |
f03fc89f VZ |
481 | |
482 | void AddBitmap(wxBitmap *bitmap); | |
483 | void RemoveBitmap(wxBitmap *bitmap); | |
c801d85f KB |
484 | }; |
485 | ||
f03fc89f VZ |
486 | class WXDLLEXPORT wxResourceCache: public wxList |
487 | { | |
488 | public: | |
489 | wxResourceCache() { } | |
222ed1d6 | 490 | #if !wxUSE_STL |
f03fc89f | 491 | wxResourceCache(const unsigned int keyType) : wxList(keyType) { } |
222ed1d6 | 492 | #endif |
9b51403d | 493 | ~wxResourceCache(); |
f03fc89f VZ |
494 | }; |
495 | ||
496 | // --------------------------------------------------------------------------- | |
497 | // global variables | |
498 | // --------------------------------------------------------------------------- | |
499 | ||
c801d85f | 500 | // Lists of GDI objects |
f03fc89f VZ |
501 | WXDLLEXPORT_DATA(extern wxPenList*) wxThePenList; |
502 | WXDLLEXPORT_DATA(extern wxBrushList*) wxTheBrushList; | |
503 | WXDLLEXPORT_DATA(extern wxFontList*) wxTheFontList; | |
504 | WXDLLEXPORT_DATA(extern wxBitmapList*) wxTheBitmapList; | |
c801d85f KB |
505 | |
506 | // Stock objects | |
f03fc89f VZ |
507 | WXDLLEXPORT_DATA(extern wxFont*) wxNORMAL_FONT; |
508 | WXDLLEXPORT_DATA(extern wxFont*) wxSMALL_FONT; | |
509 | WXDLLEXPORT_DATA(extern wxFont*) wxITALIC_FONT; | |
510 | WXDLLEXPORT_DATA(extern wxFont*) wxSWISS_FONT; | |
511 | ||
512 | WXDLLEXPORT_DATA(extern wxPen*) wxRED_PEN; | |
513 | WXDLLEXPORT_DATA(extern wxPen*) wxCYAN_PEN; | |
514 | WXDLLEXPORT_DATA(extern wxPen*) wxGREEN_PEN; | |
515 | WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_PEN; | |
516 | WXDLLEXPORT_DATA(extern wxPen*) wxWHITE_PEN; | |
517 | WXDLLEXPORT_DATA(extern wxPen*) wxTRANSPARENT_PEN; | |
518 | WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_DASHED_PEN; | |
519 | WXDLLEXPORT_DATA(extern wxPen*) wxGREY_PEN; | |
520 | WXDLLEXPORT_DATA(extern wxPen*) wxMEDIUM_GREY_PEN; | |
521 | WXDLLEXPORT_DATA(extern wxPen*) wxLIGHT_GREY_PEN; | |
522 | ||
523 | WXDLLEXPORT_DATA(extern wxBrush*) wxBLUE_BRUSH; | |
524 | WXDLLEXPORT_DATA(extern wxBrush*) wxGREEN_BRUSH; | |
525 | WXDLLEXPORT_DATA(extern wxBrush*) wxWHITE_BRUSH; | |
526 | WXDLLEXPORT_DATA(extern wxBrush*) wxBLACK_BRUSH; | |
527 | WXDLLEXPORT_DATA(extern wxBrush*) wxGREY_BRUSH; | |
528 | WXDLLEXPORT_DATA(extern wxBrush*) wxMEDIUM_GREY_BRUSH; | |
529 | WXDLLEXPORT_DATA(extern wxBrush*) wxLIGHT_GREY_BRUSH; | |
530 | WXDLLEXPORT_DATA(extern wxBrush*) wxTRANSPARENT_BRUSH; | |
531 | WXDLLEXPORT_DATA(extern wxBrush*) wxCYAN_BRUSH; | |
532 | WXDLLEXPORT_DATA(extern wxBrush*) wxRED_BRUSH; | |
533 | ||
534 | WXDLLEXPORT_DATA(extern wxColour*) wxBLACK; | |
535 | WXDLLEXPORT_DATA(extern wxColour*) wxWHITE; | |
536 | WXDLLEXPORT_DATA(extern wxColour*) wxRED; | |
537 | WXDLLEXPORT_DATA(extern wxColour*) wxBLUE; | |
538 | WXDLLEXPORT_DATA(extern wxColour*) wxGREEN; | |
539 | WXDLLEXPORT_DATA(extern wxColour*) wxCYAN; | |
540 | WXDLLEXPORT_DATA(extern wxColour*) wxLIGHT_GREY; | |
c801d85f KB |
541 | |
542 | // 'Null' objects | |
f03fc89f VZ |
543 | WXDLLEXPORT_DATA(extern wxBitmap) wxNullBitmap; |
544 | WXDLLEXPORT_DATA(extern wxIcon) wxNullIcon; | |
545 | WXDLLEXPORT_DATA(extern wxCursor) wxNullCursor; | |
546 | WXDLLEXPORT_DATA(extern wxPen) wxNullPen; | |
547 | WXDLLEXPORT_DATA(extern wxBrush) wxNullBrush; | |
548 | WXDLLEXPORT_DATA(extern wxPalette) wxNullPalette; | |
549 | WXDLLEXPORT_DATA(extern wxFont) wxNullFont; | |
550 | WXDLLEXPORT_DATA(extern wxColour) wxNullColour; | |
c801d85f KB |
551 | |
552 | // Stock cursors types | |
f03fc89f VZ |
553 | WXDLLEXPORT_DATA(extern wxCursor*) wxSTANDARD_CURSOR; |
554 | WXDLLEXPORT_DATA(extern wxCursor*) wxHOURGLASS_CURSOR; | |
555 | WXDLLEXPORT_DATA(extern wxCursor*) wxCROSS_CURSOR; | |
556 | ||
557 | WXDLLEXPORT_DATA(extern wxColourDatabase*) wxTheColourDatabase; | |
558 | ||
559 | WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr; | |
c801d85f | 560 | |
f03fc89f VZ |
561 | WXDLLEXPORT_DATA(extern const wxSize) wxDefaultSize; |
562 | WXDLLEXPORT_DATA(extern const wxPoint) wxDefaultPosition; | |
563 | ||
564 | // The list of objects which should be deleted | |
565 | WXDLLEXPORT_DATA(extern wxList) wxPendingDelete; | |
566 | ||
567 | // --------------------------------------------------------------------------- | |
568 | // global functions | |
569 | // --------------------------------------------------------------------------- | |
570 | ||
571 | // resource management | |
6a6c0a8b | 572 | extern void WXDLLEXPORT wxInitializeStockObjects(); |
a3622daa | 573 | extern void WXDLLEXPORT wxInitializeStockLists(); |
6a6c0a8b | 574 | extern void WXDLLEXPORT wxDeleteStockObjects(); |
a3622daa | 575 | extern void WXDLLEXPORT wxDeleteStockLists(); |
c801d85f | 576 | |
f03fc89f | 577 | // is the display colour (or monochrome)? |
6a6c0a8b | 578 | extern bool WXDLLEXPORT wxColourDisplay(); |
c801d85f KB |
579 | |
580 | // Returns depth of screen | |
6a6c0a8b JS |
581 | extern int WXDLLEXPORT wxDisplayDepth(); |
582 | #define wxGetDisplayDepth wxDisplayDepth | |
c801d85f | 583 | |
904a68b6 | 584 | // get the display size |
c801d85f | 585 | extern void WXDLLEXPORT wxDisplaySize(int *width, int *height); |
6a6c0a8b | 586 | extern wxSize WXDLLEXPORT wxGetDisplaySize(); |
904a68b6 RL |
587 | extern void WXDLLEXPORT wxDisplaySizeMM(int *width, int *height); |
588 | extern wxSize WXDLLEXPORT wxGetDisplaySizeMM(); | |
c801d85f | 589 | |
ec5d7799 RD |
590 | // Get position and size of the display workarea |
591 | extern void WXDLLEXPORT wxClientDisplayRect(int *x, int *y, int *width, int *height); | |
592 | extern wxRect WXDLLEXPORT wxGetClientDisplayRect(); | |
593 | ||
f03fc89f | 594 | // set global cursor |
c801d85f KB |
595 | extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor); |
596 | ||
c801d85f | 597 | #endif |
34138703 | 598 | // _WX_GDICMNH__ |