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