]>
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) | |
65571936 | 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 | ||
62a9d04c VS |
33 | class WXDLLIMPEXP_CORE wxBitmap; |
34 | class WXDLLIMPEXP_CORE wxBrush; | |
35 | class WXDLLIMPEXP_CORE wxColour; | |
36 | class WXDLLIMPEXP_CORE wxCursor; | |
37 | class WXDLLIMPEXP_CORE wxFont; | |
38 | class WXDLLIMPEXP_CORE wxIcon; | |
39 | class WXDLLIMPEXP_CORE wxPalette; | |
40 | class WXDLLIMPEXP_CORE wxPen; | |
41 | class WXDLLIMPEXP_CORE wxRegion; | |
42 | class WXDLLIMPEXP_BASE wxString; | |
f03fc89f VZ |
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 | ||
119727ad WS |
192 | /* Macro for avoiding #ifdefs when value have to be different depending on size of |
193 | device we display on | |
194 | */ | |
195 | ||
196 | #if defined(__SMARTPHONE__) | |
197 | #define wxLARGESMALL(large,small) small | |
198 | #else | |
199 | #define wxLARGESMALL(large,small) large | |
200 | #endif | |
201 | ||
f03fc89f VZ |
202 | // =========================================================================== |
203 | // classes | |
204 | // =========================================================================== | |
c801d85f | 205 | |
f03fc89f VZ |
206 | // --------------------------------------------------------------------------- |
207 | // wxSize | |
208 | // --------------------------------------------------------------------------- | |
1e6feb95 | 209 | |
6a6c0a8b | 210 | class WXDLLEXPORT wxSize |
c801d85f KB |
211 | { |
212 | public: | |
e6c96a7c | 213 | // members are public for compatibility, don't use them directly. |
72cdf4c9 | 214 | int x, y; |
f03fc89f VZ |
215 | |
216 | // constructors | |
7ee31b00 GD |
217 | wxSize() : x(0), y(0) { } |
218 | wxSize(int xx, int yy) : x(xx), y(yy) { } | |
f03fc89f VZ |
219 | |
220 | // no copy ctor or assignment operator - the defaults are ok | |
1e6feb95 | 221 | |
f03fc89f | 222 | bool operator==(const wxSize& sz) const { return x == sz.x && y == sz.y; } |
1e6feb95 | 223 | bool operator!=(const wxSize& sz) const { return x != sz.x || y != sz.y; } |
f03fc89f VZ |
224 | |
225 | // FIXME are these really useful? If they're, we should have += &c as well | |
226 | wxSize operator+(const wxSize& sz) { return wxSize(x + sz.x, y + sz.y); } | |
227 | wxSize operator-(const wxSize& sz) { return wxSize(x - sz.x, y - sz.y); } | |
706f1421 | 228 | |
5b087ae2 VZ |
229 | void IncTo(const wxSize& sz) |
230 | { if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; } | |
231 | void DecTo(const wxSize& sz) | |
232 | { if ( sz.x < x ) x = sz.x; if ( sz.y < y ) y = sz.y; } | |
f03fc89f | 233 | |
eddf46fe JS |
234 | // accessors |
235 | void Set(int xx, int yy) { x = xx; y = yy; } | |
72cdf4c9 VZ |
236 | void SetWidth(int w) { x = w; } |
237 | void SetHeight(int h) { y = h; } | |
cc775580 | 238 | |
72cdf4c9 VZ |
239 | int GetWidth() const { return x; } |
240 | int GetHeight() const { return y; } | |
f03fc89f | 241 | |
706f1421 VZ |
242 | bool IsFullySpecified() const { return x != -1 && y != -1; } |
243 | ||
244 | // combine this size with the other one replacing the default (i.e. equal | |
245 | // to -1) components of this object with those of the other | |
246 | void SetDefaults(const wxSize& size) | |
247 | { | |
248 | if ( x == -1 ) | |
249 | x = size.x; | |
250 | if ( y == -1 ) | |
251 | y = size.y; | |
252 | } | |
253 | ||
cc775580 | 254 | // compatibility |
72cdf4c9 VZ |
255 | int GetX() const { return x; } |
256 | int GetY() const { return y; } | |
c801d85f KB |
257 | }; |
258 | ||
f03fc89f VZ |
259 | // --------------------------------------------------------------------------- |
260 | // Point classes: with real or integer coordinates | |
261 | // --------------------------------------------------------------------------- | |
764a3a49 | 262 | |
6a6c0a8b | 263 | class WXDLLEXPORT wxRealPoint |
c801d85f | 264 | { |
f03fc89f VZ |
265 | public: |
266 | double x; | |
267 | double y; | |
268 | ||
7ee31b00 GD |
269 | wxRealPoint() : x(0.0), y(0.0) { } |
270 | wxRealPoint(double xx, double yy) : x(xx), y(yy) { } | |
f03fc89f | 271 | |
f6bcfd97 BP |
272 | wxRealPoint operator+(const wxRealPoint& pt) const { return wxRealPoint(x + pt.x, y + pt.y); } |
273 | wxRealPoint operator-(const wxRealPoint& pt) const { return wxRealPoint(x - pt.x, y - pt.y); } | |
f03fc89f VZ |
274 | |
275 | bool operator==(const wxRealPoint& pt) const { return x == pt.x && y == pt.y; } | |
2b5f62a0 | 276 | bool operator!=(const wxRealPoint& pt) const { return x != pt.x || y != pt.y; } |
c801d85f KB |
277 | }; |
278 | ||
6a6c0a8b | 279 | class WXDLLEXPORT wxPoint |
c801d85f | 280 | { |
f03fc89f | 281 | public: |
72cdf4c9 | 282 | int x, y; |
6a6c0a8b | 283 | |
7ee31b00 GD |
284 | wxPoint() : x(0), y(0) { } |
285 | wxPoint(int xx, int yy) : x(xx), y(yy) { } | |
f03fc89f VZ |
286 | |
287 | // no copy ctor or assignment operator - the defaults are ok | |
6a6c0a8b | 288 | |
764a3a49 VZ |
289 | // comparison |
290 | bool operator==(const wxPoint& p) const { return x == p.x && y == p.y; } | |
291 | bool operator!=(const wxPoint& p) const { return !(*this == p); } | |
292 | ||
293 | // arithmetic operations (component wise) | |
f6bcfd97 BP |
294 | wxPoint operator+(const wxPoint& p) const { return wxPoint(x + p.x, y + p.y); } |
295 | wxPoint operator-(const wxPoint& p) const { return wxPoint(x - p.x, y - p.y); } | |
f03fc89f | 296 | |
764a3a49 VZ |
297 | wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; } |
298 | wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; } | |
d02bc4c8 JS |
299 | |
300 | wxPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } | |
301 | wxPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } | |
302 | ||
303 | wxPoint operator+(const wxSize& s) const { return wxPoint(x + s.GetWidth(), y + s.GetHeight()); } | |
304 | wxPoint operator-(const wxSize& s) const { return wxPoint(x - s.GetWidth(), y - s.GetHeight()); } | |
c801d85f KB |
305 | }; |
306 | ||
f03fc89f VZ |
307 | // --------------------------------------------------------------------------- |
308 | // wxRect | |
309 | // --------------------------------------------------------------------------- | |
c801d85f | 310 | |
6a6c0a8b JS |
311 | class WXDLLEXPORT wxRect |
312 | { | |
c801d85f | 313 | public: |
7ee31b00 GD |
314 | wxRect() |
315 | : x(0), y(0), width(0), height(0) | |
316 | { } | |
72cdf4c9 | 317 | wxRect(int xx, int yy, int ww, int hh) |
7ee31b00 GD |
318 | : x(xx), y(yy), width(ww), height(hh) |
319 | { } | |
f03fc89f VZ |
320 | wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); |
321 | wxRect(const wxPoint& pos, const wxSize& size); | |
a23fd0e1 VZ |
322 | |
323 | // default copy ctor and assignment operators ok | |
c801d85f | 324 | |
72cdf4c9 VZ |
325 | int GetX() const { return x; } |
326 | void SetX(int xx) { x = xx; } | |
c801d85f | 327 | |
72cdf4c9 VZ |
328 | int GetY() const { return y; } |
329 | void SetY(int yy) { y = yy; } | |
c801d85f | 330 | |
72cdf4c9 VZ |
331 | int GetWidth() const { return width; } |
332 | void SetWidth(int w) { width = w; } | |
c801d85f | 333 | |
72cdf4c9 VZ |
334 | int GetHeight() const { return height; } |
335 | void SetHeight(int h) { height = h; } | |
f03fc89f | 336 | |
dcb44466 | 337 | wxPoint GetPosition() const { return wxPoint(x, y); } |
4aa0010b RL |
338 | void SetPosition( const wxPoint &p ) { x = p.x; y = p.y; } |
339 | ||
dcb44466 | 340 | wxSize GetSize() const { return wxSize(width, height); } |
4aa0010b | 341 | void SetSize( const wxSize &s ) { width = s.GetWidth(); height = s.GetHeight(); } |
f03fc89f | 342 | |
355a5e2b JS |
343 | wxPoint GetTopLeft() const { return GetPosition(); } |
344 | wxPoint GetLeftTop() const { return GetTopLeft(); } | |
345 | void SetTopLeft(const wxPoint &p) { SetPosition(p); } | |
346 | void SetLeftTop(const wxPoint &p) { SetTopLeft(p); } | |
347 | ||
348 | wxPoint GetBottomRight() const { return wxPoint(GetRight(), GetBottom()); } | |
349 | wxPoint GetRightBottom() const { return GetBottomRight(); } | |
350 | void SetBottomRight(const wxPoint &p) { SetRight(p.x); SetBottom(p.y); } | |
351 | void SetRightBottom(const wxPoint &p) { SetBottomRight(p); } | |
352 | ||
72cdf4c9 VZ |
353 | int GetLeft() const { return x; } |
354 | int GetTop() const { return y; } | |
355 | int GetBottom() const { return y + height - 1; } | |
356 | int GetRight() const { return x + width - 1; } | |
f03fc89f | 357 | |
72cdf4c9 VZ |
358 | void SetLeft(int left) { x = left; } |
359 | void SetRight(int right) { width = right - x + 1; } | |
360 | void SetTop(int top) { y = top; } | |
361 | void SetBottom(int bottom) { height = bottom - y + 1; } | |
dcb44466 | 362 | |
1e6feb95 VZ |
363 | // operations with rect |
364 | wxRect& Inflate(wxCoord dx, wxCoord dy); | |
365 | wxRect& Inflate(wxCoord d) { return Inflate(d, d); } | |
366 | wxRect Inflate(wxCoord dx, wxCoord dy) const | |
367 | { | |
368 | wxRect r = *this; | |
369 | r.Inflate(dx, dy); | |
370 | return r; | |
371 | } | |
372 | ||
373 | wxRect& Deflate(wxCoord dx, wxCoord dy) { return Inflate(-dx, -dy); } | |
374 | wxRect& Deflate(wxCoord d) { return Inflate(-d); } | |
375 | wxRect Deflate(wxCoord dx, wxCoord dy) const | |
376 | { | |
377 | wxRect r = *this; | |
378 | r.Deflate(dx, dy); | |
379 | return r; | |
380 | } | |
381 | ||
382 | void Offset(wxCoord dx, wxCoord dy) { x += dx; y += dy; } | |
383 | void Offset(const wxPoint& pt) { Offset(pt.x, pt.y); } | |
384 | ||
385 | wxRect& Intersect(const wxRect& rect); | |
386 | wxRect Intersect(const wxRect& rect) const | |
45816ddd | 387 | { |
1e6feb95 VZ |
388 | wxRect r = *this; |
389 | r.Intersect(rect); | |
390 | return r; | |
45816ddd VZ |
391 | } |
392 | ||
1e6feb95 VZ |
393 | wxRect operator+(const wxRect& rect) const; |
394 | wxRect& operator+=(const wxRect& rect); | |
45816ddd | 395 | |
1e6feb95 | 396 | // compare rectangles |
764a3a49 VZ |
397 | bool operator==(const wxRect& rect) const; |
398 | bool operator!=(const wxRect& rect) const { return !(*this == rect); } | |
f03fc89f | 399 | |
1e6feb95 VZ |
400 | // return TRUE if the point is (not strcitly) inside the rect |
401 | bool Inside(int x, int y) const; | |
59a12e90 | 402 | bool Inside(const wxPoint& pt) const { return Inside(pt.x, pt.y); } |
1e6feb95 VZ |
403 | |
404 | // return TRUE if the rectangles have a non empty intersection | |
405 | bool Intersects(const wxRect& rect) const; | |
72cdf4c9 | 406 | |
f03fc89f | 407 | public: |
72cdf4c9 | 408 | int x, y, width, height; |
f03fc89f | 409 | }; |
c801d85f | 410 | |
f03fc89f | 411 | // --------------------------------------------------------------------------- |
c801d85f | 412 | // Management of pens, brushes and fonts |
f03fc89f VZ |
413 | // --------------------------------------------------------------------------- |
414 | ||
236a9de3 RL |
415 | typedef wxInt8 wxDash; |
416 | ||
f03fc89f | 417 | class WXDLLEXPORT wxPenList : public wxList |
c801d85f | 418 | { |
f03fc89f VZ |
419 | public: |
420 | wxPenList() { } | |
9b51403d | 421 | ~wxPenList(); |
f03fc89f VZ |
422 | |
423 | void AddPen(wxPen *pen); | |
424 | void RemovePen(wxPen *pen); | |
425 | wxPen *FindOrCreatePen(const wxColour& colour, int width, int style); | |
c801d85f KB |
426 | }; |
427 | ||
f03fc89f | 428 | class WXDLLEXPORT wxBrushList : public wxList |
c801d85f | 429 | { |
f03fc89f VZ |
430 | public: |
431 | wxBrushList() { } | |
9b51403d | 432 | ~wxBrushList(); |
f03fc89f VZ |
433 | |
434 | void AddBrush(wxBrush *brush); | |
435 | void RemoveBrush(wxBrush *brush); | |
436 | wxBrush *FindOrCreateBrush(const wxColour& colour, int style); | |
c801d85f KB |
437 | }; |
438 | ||
f03fc89f | 439 | class WXDLLEXPORT wxFontList : public wxList |
c801d85f | 440 | { |
f03fc89f VZ |
441 | public: |
442 | wxFontList() { } | |
9b51403d | 443 | ~wxFontList(); |
f03fc89f VZ |
444 | |
445 | void AddFont(wxFont *font); | |
446 | void RemoveFont(wxFont *font); | |
447 | wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight, | |
448 | bool underline = FALSE, | |
37bebc11 RD |
449 | const wxString& face = wxEmptyString, |
450 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
c801d85f KB |
451 | }; |
452 | ||
bdcade0a | 453 | WX_DECLARE_STRING_HASH_MAP( wxColour *, wxStringToColourHashMap ); |
222ed1d6 MB |
454 | |
455 | class WXDLLEXPORT wxColourDatabase | |
c801d85f | 456 | { |
f03fc89f | 457 | public: |
222ed1d6 | 458 | wxColourDatabase(); |
c50f92d0 | 459 | ~wxColourDatabase(); |
f03fc89f | 460 | |
c50f92d0 VZ |
461 | // find colour by name or name for the given colour |
462 | wxColour Find(const wxString& name) const; | |
f03fc89f | 463 | wxString FindName(const wxColour& colour) const; |
c50f92d0 VZ |
464 | |
465 | // add a new colour to the database | |
466 | void AddColour(const wxString& name, const wxColour& colour); | |
467 | ||
492e2a5b VZ |
468 | // deprecated, use Find() instead |
469 | wxDEPRECATED( wxColour *FindColour(const wxString& name) ); | |
c50f92d0 VZ |
470 | |
471 | ||
19bf0c69 DW |
472 | #ifdef __WXPM__ |
473 | // PM keeps its own type of colour table | |
474 | long* m_palTable; | |
475 | size_t m_nSize; | |
476 | #endif | |
c50f92d0 | 477 | |
222ed1d6 | 478 | private: |
c50f92d0 VZ |
479 | // load the database with the built in colour values when called for the |
480 | // first time, do nothing after this | |
481 | void Initialize(); | |
222ed1d6 | 482 | |
c50f92d0 | 483 | wxStringToColourHashMap *m_map; |
c801d85f KB |
484 | }; |
485 | ||
f03fc89f | 486 | class WXDLLEXPORT wxBitmapList : public wxList |
c801d85f | 487 | { |
f03fc89f VZ |
488 | public: |
489 | wxBitmapList(); | |
9b51403d | 490 | ~wxBitmapList(); |
f03fc89f VZ |
491 | |
492 | void AddBitmap(wxBitmap *bitmap); | |
493 | void RemoveBitmap(wxBitmap *bitmap); | |
c801d85f KB |
494 | }; |
495 | ||
f03fc89f VZ |
496 | class WXDLLEXPORT wxResourceCache: public wxList |
497 | { | |
498 | public: | |
499 | wxResourceCache() { } | |
222ed1d6 | 500 | #if !wxUSE_STL |
f03fc89f | 501 | wxResourceCache(const unsigned int keyType) : wxList(keyType) { } |
222ed1d6 | 502 | #endif |
9b51403d | 503 | ~wxResourceCache(); |
f03fc89f VZ |
504 | }; |
505 | ||
506 | // --------------------------------------------------------------------------- | |
507 | // global variables | |
508 | // --------------------------------------------------------------------------- | |
509 | ||
c801d85f | 510 | // Lists of GDI objects |
f03fc89f VZ |
511 | WXDLLEXPORT_DATA(extern wxPenList*) wxThePenList; |
512 | WXDLLEXPORT_DATA(extern wxBrushList*) wxTheBrushList; | |
513 | WXDLLEXPORT_DATA(extern wxFontList*) wxTheFontList; | |
514 | WXDLLEXPORT_DATA(extern wxBitmapList*) wxTheBitmapList; | |
c801d85f KB |
515 | |
516 | // Stock objects | |
f03fc89f VZ |
517 | WXDLLEXPORT_DATA(extern wxFont*) wxNORMAL_FONT; |
518 | WXDLLEXPORT_DATA(extern wxFont*) wxSMALL_FONT; | |
519 | WXDLLEXPORT_DATA(extern wxFont*) wxITALIC_FONT; | |
520 | WXDLLEXPORT_DATA(extern wxFont*) wxSWISS_FONT; | |
521 | ||
522 | WXDLLEXPORT_DATA(extern wxPen*) wxRED_PEN; | |
523 | WXDLLEXPORT_DATA(extern wxPen*) wxCYAN_PEN; | |
524 | WXDLLEXPORT_DATA(extern wxPen*) wxGREEN_PEN; | |
525 | WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_PEN; | |
526 | WXDLLEXPORT_DATA(extern wxPen*) wxWHITE_PEN; | |
527 | WXDLLEXPORT_DATA(extern wxPen*) wxTRANSPARENT_PEN; | |
528 | WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_DASHED_PEN; | |
529 | WXDLLEXPORT_DATA(extern wxPen*) wxGREY_PEN; | |
530 | WXDLLEXPORT_DATA(extern wxPen*) wxMEDIUM_GREY_PEN; | |
531 | WXDLLEXPORT_DATA(extern wxPen*) wxLIGHT_GREY_PEN; | |
532 | ||
533 | WXDLLEXPORT_DATA(extern wxBrush*) wxBLUE_BRUSH; | |
534 | WXDLLEXPORT_DATA(extern wxBrush*) wxGREEN_BRUSH; | |
535 | WXDLLEXPORT_DATA(extern wxBrush*) wxWHITE_BRUSH; | |
536 | WXDLLEXPORT_DATA(extern wxBrush*) wxBLACK_BRUSH; | |
537 | WXDLLEXPORT_DATA(extern wxBrush*) wxGREY_BRUSH; | |
538 | WXDLLEXPORT_DATA(extern wxBrush*) wxMEDIUM_GREY_BRUSH; | |
539 | WXDLLEXPORT_DATA(extern wxBrush*) wxLIGHT_GREY_BRUSH; | |
540 | WXDLLEXPORT_DATA(extern wxBrush*) wxTRANSPARENT_BRUSH; | |
541 | WXDLLEXPORT_DATA(extern wxBrush*) wxCYAN_BRUSH; | |
542 | WXDLLEXPORT_DATA(extern wxBrush*) wxRED_BRUSH; | |
543 | ||
544 | WXDLLEXPORT_DATA(extern wxColour*) wxBLACK; | |
545 | WXDLLEXPORT_DATA(extern wxColour*) wxWHITE; | |
546 | WXDLLEXPORT_DATA(extern wxColour*) wxRED; | |
547 | WXDLLEXPORT_DATA(extern wxColour*) wxBLUE; | |
548 | WXDLLEXPORT_DATA(extern wxColour*) wxGREEN; | |
549 | WXDLLEXPORT_DATA(extern wxColour*) wxCYAN; | |
550 | WXDLLEXPORT_DATA(extern wxColour*) wxLIGHT_GREY; | |
c801d85f KB |
551 | |
552 | // 'Null' objects | |
f03fc89f VZ |
553 | WXDLLEXPORT_DATA(extern wxBitmap) wxNullBitmap; |
554 | WXDLLEXPORT_DATA(extern wxIcon) wxNullIcon; | |
555 | WXDLLEXPORT_DATA(extern wxCursor) wxNullCursor; | |
556 | WXDLLEXPORT_DATA(extern wxPen) wxNullPen; | |
557 | WXDLLEXPORT_DATA(extern wxBrush) wxNullBrush; | |
558 | WXDLLEXPORT_DATA(extern wxPalette) wxNullPalette; | |
559 | WXDLLEXPORT_DATA(extern wxFont) wxNullFont; | |
560 | WXDLLEXPORT_DATA(extern wxColour) wxNullColour; | |
c801d85f KB |
561 | |
562 | // Stock cursors types | |
f03fc89f VZ |
563 | WXDLLEXPORT_DATA(extern wxCursor*) wxSTANDARD_CURSOR; |
564 | WXDLLEXPORT_DATA(extern wxCursor*) wxHOURGLASS_CURSOR; | |
565 | WXDLLEXPORT_DATA(extern wxCursor*) wxCROSS_CURSOR; | |
566 | ||
567 | WXDLLEXPORT_DATA(extern wxColourDatabase*) wxTheColourDatabase; | |
568 | ||
569 | WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr; | |
c801d85f | 570 | |
f03fc89f VZ |
571 | WXDLLEXPORT_DATA(extern const wxSize) wxDefaultSize; |
572 | WXDLLEXPORT_DATA(extern const wxPoint) wxDefaultPosition; | |
573 | ||
574 | // The list of objects which should be deleted | |
575 | WXDLLEXPORT_DATA(extern wxList) wxPendingDelete; | |
576 | ||
577 | // --------------------------------------------------------------------------- | |
578 | // global functions | |
579 | // --------------------------------------------------------------------------- | |
580 | ||
581 | // resource management | |
6a6c0a8b | 582 | extern void WXDLLEXPORT wxInitializeStockObjects(); |
a3622daa | 583 | extern void WXDLLEXPORT wxInitializeStockLists(); |
6a6c0a8b | 584 | extern void WXDLLEXPORT wxDeleteStockObjects(); |
a3622daa | 585 | extern void WXDLLEXPORT wxDeleteStockLists(); |
c801d85f | 586 | |
f03fc89f | 587 | // is the display colour (or monochrome)? |
6a6c0a8b | 588 | extern bool WXDLLEXPORT wxColourDisplay(); |
c801d85f KB |
589 | |
590 | // Returns depth of screen | |
6a6c0a8b JS |
591 | extern int WXDLLEXPORT wxDisplayDepth(); |
592 | #define wxGetDisplayDepth wxDisplayDepth | |
c801d85f | 593 | |
904a68b6 | 594 | // get the display size |
c801d85f | 595 | extern void WXDLLEXPORT wxDisplaySize(int *width, int *height); |
6a6c0a8b | 596 | extern wxSize WXDLLEXPORT wxGetDisplaySize(); |
904a68b6 RL |
597 | extern void WXDLLEXPORT wxDisplaySizeMM(int *width, int *height); |
598 | extern wxSize WXDLLEXPORT wxGetDisplaySizeMM(); | |
c801d85f | 599 | |
ec5d7799 RD |
600 | // Get position and size of the display workarea |
601 | extern void WXDLLEXPORT wxClientDisplayRect(int *x, int *y, int *width, int *height); | |
602 | extern wxRect WXDLLEXPORT wxGetClientDisplayRect(); | |
603 | ||
f03fc89f | 604 | // set global cursor |
c801d85f KB |
605 | extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor); |
606 | ||
c801d85f | 607 | #endif |
34138703 | 608 | // _WX_GDICMNH__ |