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