]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/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) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_GDICMNH__ | |
13 | #define _WX_GDICMNH__ | |
14 | ||
15 | // --------------------------------------------------------------------------- | |
16 | // headers | |
17 | // --------------------------------------------------------------------------- | |
18 | ||
19 | #include "wx/defs.h" | |
20 | #include "wx/list.h" | |
21 | #include "wx/string.h" | |
22 | #include "wx/fontenc.h" | |
23 | #include "wx/hashmap.h" | |
24 | #include "wx/math.h" | |
25 | ||
26 | // --------------------------------------------------------------------------- | |
27 | // forward declarations | |
28 | // --------------------------------------------------------------------------- | |
29 | ||
30 | class WXDLLIMPEXP_FWD_CORE wxBitmap; | |
31 | class WXDLLIMPEXP_FWD_CORE wxBrush; | |
32 | class WXDLLIMPEXP_FWD_CORE wxColour; | |
33 | class WXDLLIMPEXP_FWD_CORE wxCursor; | |
34 | class WXDLLIMPEXP_FWD_CORE wxFont; | |
35 | class WXDLLIMPEXP_FWD_CORE wxIcon; | |
36 | class WXDLLIMPEXP_FWD_CORE wxPalette; | |
37 | class WXDLLIMPEXP_FWD_CORE wxPen; | |
38 | class WXDLLIMPEXP_FWD_CORE wxRegion; | |
39 | class WXDLLIMPEXP_FWD_BASE wxString; | |
40 | class WXDLLIMPEXP_FWD_CORE wxIconBundle; | |
41 | class WXDLLIMPEXP_FWD_CORE wxPoint; | |
42 | ||
43 | // --------------------------------------------------------------------------- | |
44 | // constants | |
45 | // --------------------------------------------------------------------------- | |
46 | ||
47 | // Bitmap flags | |
48 | enum wxBitmapType | |
49 | { | |
50 | wxBITMAP_TYPE_INVALID, // should be == 0 for compatibility! | |
51 | wxBITMAP_TYPE_BMP, | |
52 | wxBITMAP_TYPE_BMP_RESOURCE, | |
53 | wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE, | |
54 | wxBITMAP_TYPE_ICO, | |
55 | wxBITMAP_TYPE_ICO_RESOURCE, | |
56 | wxBITMAP_TYPE_CUR, | |
57 | wxBITMAP_TYPE_CUR_RESOURCE, | |
58 | wxBITMAP_TYPE_XBM, | |
59 | wxBITMAP_TYPE_XBM_DATA, | |
60 | wxBITMAP_TYPE_XPM, | |
61 | wxBITMAP_TYPE_XPM_DATA, | |
62 | wxBITMAP_TYPE_TIF, | |
63 | wxBITMAP_TYPE_TIF_RESOURCE, | |
64 | wxBITMAP_TYPE_GIF, | |
65 | wxBITMAP_TYPE_GIF_RESOURCE, | |
66 | wxBITMAP_TYPE_PNG, | |
67 | wxBITMAP_TYPE_PNG_RESOURCE, | |
68 | wxBITMAP_TYPE_JPEG, | |
69 | wxBITMAP_TYPE_JPEG_RESOURCE, | |
70 | wxBITMAP_TYPE_PNM, | |
71 | wxBITMAP_TYPE_PNM_RESOURCE, | |
72 | wxBITMAP_TYPE_PCX, | |
73 | wxBITMAP_TYPE_PCX_RESOURCE, | |
74 | wxBITMAP_TYPE_PICT, | |
75 | wxBITMAP_TYPE_PICT_RESOURCE, | |
76 | wxBITMAP_TYPE_ICON, | |
77 | wxBITMAP_TYPE_ICON_RESOURCE, | |
78 | wxBITMAP_TYPE_ANI, | |
79 | wxBITMAP_TYPE_IFF, | |
80 | wxBITMAP_TYPE_TGA, | |
81 | wxBITMAP_TYPE_MACCURSOR, | |
82 | wxBITMAP_TYPE_MACCURSOR_RESOURCE, | |
83 | ||
84 | wxBITMAP_TYPE_MAX, | |
85 | wxBITMAP_TYPE_ANY = 50 | |
86 | }; | |
87 | ||
88 | // Polygon filling mode | |
89 | enum wxPolygonFillMode | |
90 | { | |
91 | wxODDEVEN_RULE = 1, | |
92 | wxWINDING_RULE | |
93 | }; | |
94 | ||
95 | // Standard cursors | |
96 | enum wxStockCursor | |
97 | { | |
98 | wxCURSOR_NONE, // should be 0 | |
99 | wxCURSOR_ARROW, | |
100 | wxCURSOR_RIGHT_ARROW, | |
101 | wxCURSOR_BULLSEYE, | |
102 | wxCURSOR_CHAR, | |
103 | wxCURSOR_CROSS, | |
104 | wxCURSOR_HAND, | |
105 | wxCURSOR_IBEAM, | |
106 | wxCURSOR_LEFT_BUTTON, | |
107 | wxCURSOR_MAGNIFIER, | |
108 | wxCURSOR_MIDDLE_BUTTON, | |
109 | wxCURSOR_NO_ENTRY, | |
110 | wxCURSOR_PAINT_BRUSH, | |
111 | wxCURSOR_PENCIL, | |
112 | wxCURSOR_POINT_LEFT, | |
113 | wxCURSOR_POINT_RIGHT, | |
114 | wxCURSOR_QUESTION_ARROW, | |
115 | wxCURSOR_RIGHT_BUTTON, | |
116 | wxCURSOR_SIZENESW, | |
117 | wxCURSOR_SIZENS, | |
118 | wxCURSOR_SIZENWSE, | |
119 | wxCURSOR_SIZEWE, | |
120 | wxCURSOR_SIZING, | |
121 | wxCURSOR_SPRAYCAN, | |
122 | wxCURSOR_WAIT, | |
123 | wxCURSOR_WATCH, | |
124 | wxCURSOR_BLANK, | |
125 | #ifdef __WXGTK__ | |
126 | wxCURSOR_DEFAULT, // standard X11 cursor | |
127 | #endif | |
128 | #ifdef __WXMAC__ | |
129 | wxCURSOR_COPY_ARROW , // MacOS Theme Plus arrow | |
130 | #endif | |
131 | #ifdef __X__ | |
132 | // Not yet implemented for Windows | |
133 | wxCURSOR_CROSS_REVERSE, | |
134 | wxCURSOR_DOUBLE_ARROW, | |
135 | wxCURSOR_BASED_ARROW_UP, | |
136 | wxCURSOR_BASED_ARROW_DOWN, | |
137 | #endif // X11 | |
138 | wxCURSOR_ARROWWAIT, | |
139 | #ifdef __WXMAC__ | |
140 | wxCURSOR_OPEN_HAND, | |
141 | wxCURSOR_CLOSED_HAND, | |
142 | #endif | |
143 | ||
144 | wxCURSOR_MAX | |
145 | }; | |
146 | ||
147 | #ifndef __WXGTK__ | |
148 | #define wxCURSOR_DEFAULT wxCURSOR_ARROW | |
149 | #endif | |
150 | ||
151 | #ifndef __WXMAC__ | |
152 | // TODO CS supply openhand and closedhand cursors | |
153 | #define wxCURSOR_OPEN_HAND wxCURSOR_HAND | |
154 | #define wxCURSOR_CLOSED_HAND wxCURSOR_HAND | |
155 | #endif | |
156 | ||
157 | // --------------------------------------------------------------------------- | |
158 | // macros | |
159 | // --------------------------------------------------------------------------- | |
160 | ||
161 | /* Useful macro for creating icons portably, for example: | |
162 | ||
163 | wxIcon *icon = new wxICON(sample); | |
164 | ||
165 | expands into: | |
166 | ||
167 | wxIcon *icon = new wxIcon("sample"); // On wxMSW | |
168 | wxIcon *icon = new wxIcon(sample_xpm); // On wxGTK | |
169 | */ | |
170 | ||
171 | #ifdef __WXMSW__ | |
172 | // Load from a resource | |
173 | #define wxICON(X) wxIcon(wxT(#X)) | |
174 | #elif defined(__WXPM__) | |
175 | // Load from a resource | |
176 | #define wxICON(X) wxIcon(wxT(#X)) | |
177 | #elif defined(__WXMGL__) | |
178 | // Initialize from an included XPM | |
179 | #define wxICON(X) wxIcon( X##_xpm ) | |
180 | #elif defined(__WXDFB__) | |
181 | // Initialize from an included XPM | |
182 | #define wxICON(X) wxIcon( X##_xpm ) | |
183 | #elif defined(__WXGTK__) | |
184 | // Initialize from an included XPM | |
185 | #define wxICON(X) wxIcon( X##_xpm ) | |
186 | #elif defined(__WXMAC__) | |
187 | // Initialize from an included XPM | |
188 | #define wxICON(X) wxIcon( X##_xpm ) | |
189 | #elif defined(__WXMOTIF__) | |
190 | // Initialize from an included XPM | |
191 | #define wxICON(X) wxIcon( X##_xpm ) | |
192 | #elif defined(__WXX11__) | |
193 | // Initialize from an included XPM | |
194 | #define wxICON(X) wxIcon( X##_xpm ) | |
195 | #else | |
196 | // This will usually mean something on any platform | |
197 | #define wxICON(X) wxIcon(wxT(#X)) | |
198 | #endif // platform | |
199 | ||
200 | /* Another macro: this one is for portable creation of bitmaps. We assume that | |
201 | under Unix bitmaps live in XPMs and under Windows they're in ressources. | |
202 | */ | |
203 | ||
204 | #if defined(__WXMSW__) || defined(__WXPM__) | |
205 | #define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_RESOURCE) | |
206 | #elif defined(__WXGTK__) || \ | |
207 | defined(__WXMOTIF__) || \ | |
208 | defined(__WXX11__) || \ | |
209 | defined(__WXMAC__) || \ | |
210 | defined(__WXMGL__) || \ | |
211 | defined(__WXDFB__) || \ | |
212 | defined(__WXCOCOA__) | |
213 | // Initialize from an included XPM | |
214 | #define wxBITMAP(name) wxBitmap(name##_xpm) | |
215 | #else // other platforms | |
216 | #define wxBITMAP(name) wxBitmap(name##_xpm, wxBITMAP_TYPE_XPM) | |
217 | #endif // platform | |
218 | ||
219 | // =========================================================================== | |
220 | // classes | |
221 | // =========================================================================== | |
222 | ||
223 | // --------------------------------------------------------------------------- | |
224 | // wxSize | |
225 | // --------------------------------------------------------------------------- | |
226 | ||
227 | class WXDLLIMPEXP_CORE wxSize | |
228 | { | |
229 | public: | |
230 | // members are public for compatibility, don't use them directly. | |
231 | int x, y; | |
232 | ||
233 | // constructors | |
234 | wxSize() : x(0), y(0) { } | |
235 | wxSize(int xx, int yy) : x(xx), y(yy) { } | |
236 | ||
237 | // no copy ctor or assignment operator - the defaults are ok | |
238 | ||
239 | wxSize& operator+=(const wxSize& sz) { x += sz.x; y += sz.y; return *this; } | |
240 | wxSize& operator-=(const wxSize& sz) { x -= sz.x; y -= sz.y; return *this; } | |
241 | wxSize& operator/=(int i) { x /= i; y /= i; return *this; } | |
242 | wxSize& operator*=(int i) { x *= i; y *= i; return *this; } | |
243 | wxSize& operator/=(unsigned int i) { x /= i; y /= i; return *this; } | |
244 | wxSize& operator*=(unsigned int i) { x *= i; y *= i; return *this; } | |
245 | wxSize& operator/=(long i) { x /= i; y /= i; return *this; } | |
246 | wxSize& operator*=(long i) { x *= i; y *= i; return *this; } | |
247 | wxSize& operator/=(unsigned long i) { x /= i; y /= i; return *this; } | |
248 | wxSize& operator*=(unsigned long i) { x *= i; y *= i; return *this; } | |
249 | wxSize& operator/=(double i) { x = int(x/i); y = int(y/i); return *this; } | |
250 | wxSize& operator*=(double i) { x = int(x*i); y = int(y*i); return *this; } | |
251 | ||
252 | void IncTo(const wxSize& sz) | |
253 | { if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; } | |
254 | void DecTo(const wxSize& sz) | |
255 | { if ( sz.x < x ) x = sz.x; if ( sz.y < y ) y = sz.y; } | |
256 | ||
257 | void IncBy(int dx, int dy) { x += dx; y += dy; } | |
258 | void IncBy(const wxPoint& pt); | |
259 | void IncBy(const wxSize& sz) { IncBy(sz.x, sz.y); } | |
260 | void IncBy(int d) { IncBy(d, d); } | |
261 | ||
262 | void DecBy(int dx, int dy) { IncBy(-dx, -dy); } | |
263 | void DecBy(const wxPoint& pt); | |
264 | void DecBy(const wxSize& sz) { DecBy(sz.x, sz.y); } | |
265 | void DecBy(int d) { DecBy(d, d); } | |
266 | ||
267 | ||
268 | wxSize& Scale(float xscale, float yscale) | |
269 | { x = (int)(x*xscale); y = (int)(y*yscale); return *this; } | |
270 | ||
271 | // accessors | |
272 | void Set(int xx, int yy) { x = xx; y = yy; } | |
273 | void SetWidth(int w) { x = w; } | |
274 | void SetHeight(int h) { y = h; } | |
275 | ||
276 | int GetWidth() const { return x; } | |
277 | int GetHeight() const { return y; } | |
278 | ||
279 | bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; } | |
280 | ||
281 | // combine this size with the other one replacing the default (i.e. equal | |
282 | // to wxDefaultCoord) components of this object with those of the other | |
283 | void SetDefaults(const wxSize& size) | |
284 | { | |
285 | if ( x == wxDefaultCoord ) | |
286 | x = size.x; | |
287 | if ( y == wxDefaultCoord ) | |
288 | y = size.y; | |
289 | } | |
290 | ||
291 | // compatibility | |
292 | int GetX() const { return x; } | |
293 | int GetY() const { return y; } | |
294 | }; | |
295 | ||
296 | inline bool operator==(const wxSize& s1, const wxSize& s2) | |
297 | { | |
298 | return s1.x == s2.x && s1.y == s2.y; | |
299 | } | |
300 | ||
301 | inline bool operator!=(const wxSize& s1, const wxSize& s2) | |
302 | { | |
303 | return s1.x != s2.x || s1.y != s2.y; | |
304 | } | |
305 | ||
306 | inline wxSize operator+(const wxSize& s1, const wxSize& s2) | |
307 | { | |
308 | return wxSize(s1.x + s2.x, s1.y + s2.y); | |
309 | } | |
310 | ||
311 | inline wxSize operator-(const wxSize& s1, const wxSize& s2) | |
312 | { | |
313 | return wxSize(s1.x - s2.x, s1.y - s2.y); | |
314 | } | |
315 | ||
316 | inline wxSize operator/(const wxSize& s, int i) | |
317 | { | |
318 | return wxSize(s.x / i, s.y / i); | |
319 | } | |
320 | ||
321 | inline wxSize operator*(const wxSize& s, int i) | |
322 | { | |
323 | return wxSize(s.x * i, s.y * i); | |
324 | } | |
325 | ||
326 | inline wxSize operator*(int i, const wxSize& s) | |
327 | { | |
328 | return wxSize(s.x * i, s.y * i); | |
329 | } | |
330 | ||
331 | inline wxSize operator/(const wxSize& s, unsigned int i) | |
332 | { | |
333 | return wxSize(s.x / i, s.y / i); | |
334 | } | |
335 | ||
336 | inline wxSize operator*(const wxSize& s, unsigned int i) | |
337 | { | |
338 | return wxSize(s.x * i, s.y * i); | |
339 | } | |
340 | ||
341 | inline wxSize operator*(unsigned int i, const wxSize& s) | |
342 | { | |
343 | return wxSize(s.x * i, s.y * i); | |
344 | } | |
345 | ||
346 | inline wxSize operator/(const wxSize& s, long i) | |
347 | { | |
348 | return wxSize(s.x / i, s.y / i); | |
349 | } | |
350 | ||
351 | inline wxSize operator*(const wxSize& s, long i) | |
352 | { | |
353 | return wxSize(s.x * i, s.y * i); | |
354 | } | |
355 | ||
356 | inline wxSize operator*(long i, const wxSize& s) | |
357 | { | |
358 | return wxSize(s.x * i, s.y * i); | |
359 | } | |
360 | ||
361 | inline wxSize operator/(const wxSize& s, unsigned long i) | |
362 | { | |
363 | return wxSize(s.x / i, s.y / i); | |
364 | } | |
365 | ||
366 | inline wxSize operator*(const wxSize& s, unsigned long i) | |
367 | { | |
368 | return wxSize(s.x * i, s.y * i); | |
369 | } | |
370 | ||
371 | inline wxSize operator*(unsigned long i, const wxSize& s) | |
372 | { | |
373 | return wxSize(s.x * i, s.y * i); | |
374 | } | |
375 | ||
376 | inline wxSize operator*(const wxSize& s, double i) | |
377 | { | |
378 | return wxSize(int(s.x * i), int(s.y * i)); | |
379 | } | |
380 | ||
381 | inline wxSize operator*(double i, const wxSize& s) | |
382 | { | |
383 | return wxSize(int(s.x * i), int(s.y * i)); | |
384 | } | |
385 | ||
386 | ||
387 | ||
388 | // --------------------------------------------------------------------------- | |
389 | // Point classes: with real or integer coordinates | |
390 | // --------------------------------------------------------------------------- | |
391 | ||
392 | class WXDLLIMPEXP_CORE wxRealPoint | |
393 | { | |
394 | public: | |
395 | double x; | |
396 | double y; | |
397 | ||
398 | wxRealPoint() : x(0.0), y(0.0) { } | |
399 | wxRealPoint(double xx, double yy) : x(xx), y(yy) { } | |
400 | wxRealPoint(const wxPoint& pt); | |
401 | ||
402 | // no copy ctor or assignment operator - the defaults are ok | |
403 | ||
404 | //assignment operators | |
405 | wxRealPoint& operator+=(const wxRealPoint& p) { x += p.x; y += p.y; return *this; } | |
406 | wxRealPoint& operator-=(const wxRealPoint& p) { x -= p.x; y -= p.y; return *this; } | |
407 | ||
408 | wxRealPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } | |
409 | wxRealPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } | |
410 | }; | |
411 | ||
412 | ||
413 | inline bool operator==(const wxRealPoint& p1, const wxRealPoint& p2) | |
414 | { | |
415 | return wxIsSameDouble(p1.x, p2.x) && wxIsSameDouble(p1.y, p2.y); | |
416 | } | |
417 | ||
418 | inline bool operator!=(const wxRealPoint& p1, const wxRealPoint& p2) | |
419 | { | |
420 | return !(p1 == p2); | |
421 | } | |
422 | ||
423 | inline wxRealPoint operator+(const wxRealPoint& p1, const wxRealPoint& p2) | |
424 | { | |
425 | return wxRealPoint(p1.x + p2.x, p1.y + p2.y); | |
426 | } | |
427 | ||
428 | ||
429 | inline wxRealPoint operator-(const wxRealPoint& p1, const wxRealPoint& p2) | |
430 | { | |
431 | return wxRealPoint(p1.x - p2.x, p1.y - p2.y); | |
432 | } | |
433 | ||
434 | ||
435 | inline wxRealPoint operator/(const wxRealPoint& s, int i) | |
436 | { | |
437 | return wxRealPoint(s.x / i, s.y / i); | |
438 | } | |
439 | ||
440 | inline wxRealPoint operator*(const wxRealPoint& s, int i) | |
441 | { | |
442 | return wxRealPoint(s.x * i, s.y * i); | |
443 | } | |
444 | ||
445 | inline wxRealPoint operator*(int i, const wxRealPoint& s) | |
446 | { | |
447 | return wxRealPoint(s.x * i, s.y * i); | |
448 | } | |
449 | ||
450 | inline wxRealPoint operator/(const wxRealPoint& s, unsigned int i) | |
451 | { | |
452 | return wxRealPoint(s.x / i, s.y / i); | |
453 | } | |
454 | ||
455 | inline wxRealPoint operator*(const wxRealPoint& s, unsigned int i) | |
456 | { | |
457 | return wxRealPoint(s.x * i, s.y * i); | |
458 | } | |
459 | ||
460 | inline wxRealPoint operator*(unsigned int i, const wxRealPoint& s) | |
461 | { | |
462 | return wxRealPoint(s.x * i, s.y * i); | |
463 | } | |
464 | ||
465 | inline wxRealPoint operator/(const wxRealPoint& s, long i) | |
466 | { | |
467 | return wxRealPoint(s.x / i, s.y / i); | |
468 | } | |
469 | ||
470 | inline wxRealPoint operator*(const wxRealPoint& s, long i) | |
471 | { | |
472 | return wxRealPoint(s.x * i, s.y * i); | |
473 | } | |
474 | ||
475 | inline wxRealPoint operator*(long i, const wxRealPoint& s) | |
476 | { | |
477 | return wxRealPoint(s.x * i, s.y * i); | |
478 | } | |
479 | ||
480 | inline wxRealPoint operator/(const wxRealPoint& s, unsigned long i) | |
481 | { | |
482 | return wxRealPoint(s.x / i, s.y / i); | |
483 | } | |
484 | ||
485 | inline wxRealPoint operator*(const wxRealPoint& s, unsigned long i) | |
486 | { | |
487 | return wxRealPoint(s.x * i, s.y * i); | |
488 | } | |
489 | ||
490 | inline wxRealPoint operator*(unsigned long i, const wxRealPoint& s) | |
491 | { | |
492 | return wxRealPoint(s.x * i, s.y * i); | |
493 | } | |
494 | ||
495 | inline wxRealPoint operator*(const wxRealPoint& s, double i) | |
496 | { | |
497 | return wxRealPoint(int(s.x * i), int(s.y * i)); | |
498 | } | |
499 | ||
500 | inline wxRealPoint operator*(double i, const wxRealPoint& s) | |
501 | { | |
502 | return wxRealPoint(int(s.x * i), int(s.y * i)); | |
503 | } | |
504 | ||
505 | ||
506 | // ---------------------------------------------------------------------------- | |
507 | // wxPoint: 2D point with integer coordinates | |
508 | // ---------------------------------------------------------------------------- | |
509 | ||
510 | class WXDLLIMPEXP_CORE wxPoint | |
511 | { | |
512 | public: | |
513 | int x, y; | |
514 | ||
515 | wxPoint() : x(0), y(0) { } | |
516 | wxPoint(int xx, int yy) : x(xx), y(yy) { } | |
517 | wxPoint(const wxRealPoint& pt) : x(int(pt.x)), y(int(pt.y)) { } | |
518 | ||
519 | // no copy ctor or assignment operator - the defaults are ok | |
520 | ||
521 | //assignment operators | |
522 | wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; } | |
523 | wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; } | |
524 | ||
525 | wxPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } | |
526 | wxPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } | |
527 | ||
528 | // check if both components are set/initialized | |
529 | bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; } | |
530 | ||
531 | // fill in the unset components with the values from the other point | |
532 | void SetDefaults(const wxPoint& pt) | |
533 | { | |
534 | if ( x == wxDefaultCoord ) | |
535 | x = pt.x; | |
536 | if ( y == wxDefaultCoord ) | |
537 | y = pt.y; | |
538 | } | |
539 | }; | |
540 | ||
541 | ||
542 | // comparison | |
543 | inline bool operator==(const wxPoint& p1, const wxPoint& p2) | |
544 | { | |
545 | return p1.x == p2.x && p1.y == p2.y; | |
546 | } | |
547 | ||
548 | inline bool operator!=(const wxPoint& p1, const wxPoint& p2) | |
549 | { | |
550 | return !(p1 == p2); | |
551 | } | |
552 | ||
553 | ||
554 | // arithmetic operations (component wise) | |
555 | inline wxPoint operator+(const wxPoint& p1, const wxPoint& p2) | |
556 | { | |
557 | return wxPoint(p1.x + p2.x, p1.y + p2.y); | |
558 | } | |
559 | ||
560 | inline wxPoint operator-(const wxPoint& p1, const wxPoint& p2) | |
561 | { | |
562 | return wxPoint(p1.x - p2.x, p1.y - p2.y); | |
563 | } | |
564 | ||
565 | inline wxPoint operator+(const wxPoint& p, const wxSize& s) | |
566 | { | |
567 | return wxPoint(p.x + s.x, p.y + s.y); | |
568 | } | |
569 | ||
570 | inline wxPoint operator-(const wxPoint& p, const wxSize& s) | |
571 | { | |
572 | return wxPoint(p.x - s.x, p.y - s.y); | |
573 | } | |
574 | ||
575 | inline wxPoint operator+(const wxSize& s, const wxPoint& p) | |
576 | { | |
577 | return wxPoint(p.x + s.x, p.y + s.y); | |
578 | } | |
579 | ||
580 | inline wxPoint operator-(const wxSize& s, const wxPoint& p) | |
581 | { | |
582 | return wxPoint(s.x - p.x, s.y - p.y); | |
583 | } | |
584 | ||
585 | inline wxPoint operator-(const wxPoint& p) | |
586 | { | |
587 | return wxPoint(-p.x, -p.y); | |
588 | } | |
589 | ||
590 | inline wxPoint operator/(const wxPoint& s, int i) | |
591 | { | |
592 | return wxPoint(s.x / i, s.y / i); | |
593 | } | |
594 | ||
595 | inline wxPoint operator*(const wxPoint& s, int i) | |
596 | { | |
597 | return wxPoint(s.x * i, s.y * i); | |
598 | } | |
599 | ||
600 | inline wxPoint operator*(int i, const wxPoint& s) | |
601 | { | |
602 | return wxPoint(s.x * i, s.y * i); | |
603 | } | |
604 | ||
605 | inline wxPoint operator/(const wxPoint& s, unsigned int i) | |
606 | { | |
607 | return wxPoint(s.x / i, s.y / i); | |
608 | } | |
609 | ||
610 | inline wxPoint operator*(const wxPoint& s, unsigned int i) | |
611 | { | |
612 | return wxPoint(s.x * i, s.y * i); | |
613 | } | |
614 | ||
615 | inline wxPoint operator*(unsigned int i, const wxPoint& s) | |
616 | { | |
617 | return wxPoint(s.x * i, s.y * i); | |
618 | } | |
619 | ||
620 | inline wxPoint operator/(const wxPoint& s, long i) | |
621 | { | |
622 | return wxPoint(s.x / i, s.y / i); | |
623 | } | |
624 | ||
625 | inline wxPoint operator*(const wxPoint& s, long i) | |
626 | { | |
627 | return wxPoint(s.x * i, s.y * i); | |
628 | } | |
629 | ||
630 | inline wxPoint operator*(long i, const wxPoint& s) | |
631 | { | |
632 | return wxPoint(s.x * i, s.y * i); | |
633 | } | |
634 | ||
635 | inline wxPoint operator/(const wxPoint& s, unsigned long i) | |
636 | { | |
637 | return wxPoint(s.x / i, s.y / i); | |
638 | } | |
639 | ||
640 | inline wxPoint operator*(const wxPoint& s, unsigned long i) | |
641 | { | |
642 | return wxPoint(s.x * i, s.y * i); | |
643 | } | |
644 | ||
645 | inline wxPoint operator*(unsigned long i, const wxPoint& s) | |
646 | { | |
647 | return wxPoint(s.x * i, s.y * i); | |
648 | } | |
649 | ||
650 | inline wxPoint operator*(const wxPoint& s, double i) | |
651 | { | |
652 | return wxPoint(int(s.x * i), int(s.y * i)); | |
653 | } | |
654 | ||
655 | inline wxPoint operator*(double i, const wxPoint& s) | |
656 | { | |
657 | return wxPoint(int(s.x * i), int(s.y * i)); | |
658 | } | |
659 | ||
660 | WX_DECLARE_LIST_WITH_DECL(wxPoint, wxPointList, class WXDLLIMPEXP_CORE); | |
661 | ||
662 | // --------------------------------------------------------------------------- | |
663 | // wxRect | |
664 | // --------------------------------------------------------------------------- | |
665 | ||
666 | class WXDLLIMPEXP_CORE wxRect | |
667 | { | |
668 | public: | |
669 | wxRect() | |
670 | : x(0), y(0), width(0), height(0) | |
671 | { } | |
672 | wxRect(int xx, int yy, int ww, int hh) | |
673 | : x(xx), y(yy), width(ww), height(hh) | |
674 | { } | |
675 | wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); | |
676 | wxRect(const wxPoint& pt, const wxSize& size) | |
677 | : x(pt.x), y(pt.y), width(size.x), height(size.y) | |
678 | { } | |
679 | wxRect(const wxSize& size) | |
680 | : x(0), y(0), width(size.x), height(size.y) | |
681 | { } | |
682 | ||
683 | // default copy ctor and assignment operators ok | |
684 | ||
685 | int GetX() const { return x; } | |
686 | void SetX(int xx) { x = xx; } | |
687 | ||
688 | int GetY() const { return y; } | |
689 | void SetY(int yy) { y = yy; } | |
690 | ||
691 | int GetWidth() const { return width; } | |
692 | void SetWidth(int w) { width = w; } | |
693 | ||
694 | int GetHeight() const { return height; } | |
695 | void SetHeight(int h) { height = h; } | |
696 | ||
697 | wxPoint GetPosition() const { return wxPoint(x, y); } | |
698 | void SetPosition( const wxPoint &p ) { x = p.x; y = p.y; } | |
699 | ||
700 | wxSize GetSize() const { return wxSize(width, height); } | |
701 | void SetSize( const wxSize &s ) { width = s.GetWidth(); height = s.GetHeight(); } | |
702 | ||
703 | bool IsEmpty() const { return (width <= 0) || (height <= 0); } | |
704 | ||
705 | int GetLeft() const { return x; } | |
706 | int GetTop() const { return y; } | |
707 | int GetBottom() const { return y + height - 1; } | |
708 | int GetRight() const { return x + width - 1; } | |
709 | ||
710 | void SetLeft(int left) { x = left; } | |
711 | void SetRight(int right) { width = right - x + 1; } | |
712 | void SetTop(int top) { y = top; } | |
713 | void SetBottom(int bottom) { height = bottom - y + 1; } | |
714 | ||
715 | wxPoint GetTopLeft() const { return GetPosition(); } | |
716 | wxPoint GetLeftTop() const { return GetTopLeft(); } | |
717 | void SetTopLeft(const wxPoint &p) { SetPosition(p); } | |
718 | void SetLeftTop(const wxPoint &p) { SetTopLeft(p); } | |
719 | ||
720 | wxPoint GetBottomRight() const { return wxPoint(GetRight(), GetBottom()); } | |
721 | wxPoint GetRightBottom() const { return GetBottomRight(); } | |
722 | void SetBottomRight(const wxPoint &p) { SetRight(p.x); SetBottom(p.y); } | |
723 | void SetRightBottom(const wxPoint &p) { SetBottomRight(p); } | |
724 | ||
725 | wxPoint GetTopRight() const { return wxPoint(GetRight(), GetTop()); } | |
726 | wxPoint GetRightTop() const { return GetTopRight(); } | |
727 | void SetTopRight(const wxPoint &p) { SetRight(p.x); SetTop(p.y); } | |
728 | void SetRightTop(const wxPoint &p) { SetTopRight(p); } | |
729 | ||
730 | wxPoint GetBottomLeft() const { return wxPoint(GetLeft(), GetBottom()); } | |
731 | wxPoint GetLeftBottom() const { return GetBottomLeft(); } | |
732 | void SetBottomLeft(const wxPoint &p) { SetLeft(p.x); SetBottom(p.y); } | |
733 | void SetLeftBottom(const wxPoint &p) { SetBottomLeft(p); } | |
734 | ||
735 | // operations with rect | |
736 | wxRect& Inflate(wxCoord dx, wxCoord dy); | |
737 | wxRect& Inflate(const wxSize& d) { return Inflate(d.x, d.y); } | |
738 | wxRect& Inflate(wxCoord d) { return Inflate(d, d); } | |
739 | wxRect Inflate(wxCoord dx, wxCoord dy) const | |
740 | { | |
741 | wxRect r = *this; | |
742 | r.Inflate(dx, dy); | |
743 | return r; | |
744 | } | |
745 | ||
746 | wxRect& Deflate(wxCoord dx, wxCoord dy) { return Inflate(-dx, -dy); } | |
747 | wxRect& Deflate(const wxSize& d) { return Inflate(-d.x, -d.y); } | |
748 | wxRect& Deflate(wxCoord d) { return Inflate(-d); } | |
749 | wxRect Deflate(wxCoord dx, wxCoord dy) const | |
750 | { | |
751 | wxRect r = *this; | |
752 | r.Deflate(dx, dy); | |
753 | return r; | |
754 | } | |
755 | ||
756 | void Offset(wxCoord dx, wxCoord dy) { x += dx; y += dy; } | |
757 | void Offset(const wxPoint& pt) { Offset(pt.x, pt.y); } | |
758 | ||
759 | wxRect& Intersect(const wxRect& rect); | |
760 | wxRect Intersect(const wxRect& rect) const | |
761 | { | |
762 | wxRect r = *this; | |
763 | r.Intersect(rect); | |
764 | return r; | |
765 | } | |
766 | ||
767 | wxRect& Union(const wxRect& rect); | |
768 | wxRect Union(const wxRect& rect) const | |
769 | { | |
770 | wxRect r = *this; | |
771 | r.Union(rect); | |
772 | return r; | |
773 | } | |
774 | ||
775 | // return true if the point is (not strcitly) inside the rect | |
776 | bool Contains(int x, int y) const; | |
777 | bool Contains(const wxPoint& pt) const { return Contains(pt.x, pt.y); } | |
778 | // return true if the rectangle 'rect' is (not strictly) inside this rect | |
779 | bool Contains(const wxRect& rect) const; | |
780 | ||
781 | #if WXWIN_COMPATIBILITY_2_6 | |
782 | // use Contains() instead | |
783 | wxDEPRECATED( bool Inside(int x, int y) const ); | |
784 | wxDEPRECATED( bool Inside(const wxPoint& pt) const ); | |
785 | wxDEPRECATED( bool Inside(const wxRect& rect) const ); | |
786 | #endif // WXWIN_COMPATIBILITY_2_6 | |
787 | ||
788 | // return true if the rectangles have a non empty intersection | |
789 | bool Intersects(const wxRect& rect) const; | |
790 | ||
791 | // like Union() but don't ignore empty rectangles | |
792 | wxRect& operator+=(const wxRect& rect); | |
793 | ||
794 | // intersections of two rectrangles not testing for empty rectangles | |
795 | wxRect& operator*=(const wxRect& rect); | |
796 | ||
797 | // centre this rectangle in the given (usually, but not necessarily, | |
798 | // larger) one | |
799 | wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const | |
800 | { | |
801 | return wxRect(dir & wxHORIZONTAL ? r.x + (r.width - width)/2 : x, | |
802 | dir & wxVERTICAL ? r.y + (r.height - height)/2 : y, | |
803 | width, height); | |
804 | } | |
805 | ||
806 | wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const | |
807 | { | |
808 | return CentreIn(r, dir); | |
809 | } | |
810 | ||
811 | public: | |
812 | int x, y, width, height; | |
813 | }; | |
814 | ||
815 | ||
816 | // compare rectangles | |
817 | inline bool operator==(const wxRect& r1, const wxRect& r2) | |
818 | { | |
819 | return (r1.x == r2.x) && (r1.y == r2.y) && | |
820 | (r1.width == r2.width) && (r1.height == r2.height); | |
821 | } | |
822 | ||
823 | inline bool operator!=(const wxRect& r1, const wxRect& r2) | |
824 | { | |
825 | return !(r1 == r2); | |
826 | } | |
827 | ||
828 | // like Union() but don't treat empty rectangles specially | |
829 | WXDLLIMPEXP_CORE wxRect operator+(const wxRect& r1, const wxRect& r2); | |
830 | ||
831 | // intersections of two rectangles | |
832 | WXDLLIMPEXP_CORE wxRect operator*(const wxRect& r1, const wxRect& r2); | |
833 | ||
834 | ||
835 | ||
836 | ||
837 | #if WXWIN_COMPATIBILITY_2_6 | |
838 | inline bool wxRect::Inside(int cx, int cy) const { return Contains(cx, cy); } | |
839 | inline bool wxRect::Inside(const wxPoint& pt) const { return Contains(pt); } | |
840 | inline bool wxRect::Inside(const wxRect& rect) const { return Contains(rect); } | |
841 | #endif // WXWIN_COMPATIBILITY_2_6 | |
842 | ||
843 | ||
844 | // define functions which couldn't be defined above because of declarations | |
845 | // order | |
846 | inline void wxSize::IncBy(const wxPoint& pt) { IncBy(pt.x, pt.y); } | |
847 | inline void wxSize::DecBy(const wxPoint& pt) { DecBy(pt.x, pt.y); } | |
848 | ||
849 | // --------------------------------------------------------------------------- | |
850 | // Management of pens, brushes and fonts | |
851 | // --------------------------------------------------------------------------- | |
852 | ||
853 | typedef wxInt8 wxDash; | |
854 | ||
855 | class WXDLLIMPEXP_CORE wxGDIObjListBase { | |
856 | public: | |
857 | wxGDIObjListBase(); | |
858 | ~wxGDIObjListBase(); | |
859 | ||
860 | protected: | |
861 | wxList list; | |
862 | }; | |
863 | ||
864 | WX_DECLARE_STRING_HASH_MAP(wxColour*, wxStringToColourHashMap); | |
865 | ||
866 | class WXDLLIMPEXP_CORE wxColourDatabase | |
867 | { | |
868 | public: | |
869 | wxColourDatabase(); | |
870 | ~wxColourDatabase(); | |
871 | ||
872 | // find colour by name or name for the given colour | |
873 | wxColour Find(const wxString& name) const; | |
874 | wxString FindName(const wxColour& colour) const; | |
875 | ||
876 | // add a new colour to the database | |
877 | void AddColour(const wxString& name, const wxColour& colour); | |
878 | ||
879 | #if WXWIN_COMPATIBILITY_2_6 | |
880 | // deprecated, use Find() instead | |
881 | wxDEPRECATED( wxColour *FindColour(const wxString& name) ); | |
882 | #endif // WXWIN_COMPATIBILITY_2_6 | |
883 | ||
884 | ||
885 | #ifdef __WXPM__ | |
886 | // PM keeps its own type of colour table | |
887 | long* m_palTable; | |
888 | size_t m_nSize; | |
889 | #endif | |
890 | ||
891 | private: | |
892 | // load the database with the built in colour values when called for the | |
893 | // first time, do nothing after this | |
894 | void Initialize(); | |
895 | ||
896 | wxStringToColourHashMap *m_map; | |
897 | }; | |
898 | ||
899 | class WXDLLIMPEXP_CORE wxResourceCache: public wxList | |
900 | { | |
901 | public: | |
902 | wxResourceCache() { } | |
903 | #if !wxUSE_STD_CONTAINERS | |
904 | wxResourceCache(const unsigned int keyType) : wxList(keyType) { } | |
905 | #endif | |
906 | virtual ~wxResourceCache(); | |
907 | }; | |
908 | ||
909 | // --------------------------------------------------------------------------- | |
910 | // global variables | |
911 | // --------------------------------------------------------------------------- | |
912 | ||
913 | ||
914 | /* Stock objects | |
915 | ||
916 | wxStockGDI creates the stock GDI objects on demand. Pointers to the | |
917 | created objects are stored in the ms_stockObject array, which is indexed | |
918 | by the Item enum values. Platorm-specific fonts can be created by | |
919 | implementing a derived class with an override for the GetFont function. | |
920 | wxStockGDI operates as a singleton, accessed through the ms_instance | |
921 | pointer. By default this pointer is set to an instance of wxStockGDI. | |
922 | A derived class must arrange to set this pointer to an instance of itself. | |
923 | */ | |
924 | class WXDLLIMPEXP_CORE wxStockGDI | |
925 | { | |
926 | public: | |
927 | enum Item { | |
928 | BRUSH_BLACK, | |
929 | BRUSH_BLUE, | |
930 | BRUSH_CYAN, | |
931 | BRUSH_GREEN, | |
932 | BRUSH_YELLOW, | |
933 | BRUSH_GREY, | |
934 | BRUSH_LIGHTGREY, | |
935 | BRUSH_MEDIUMGREY, | |
936 | BRUSH_RED, | |
937 | BRUSH_TRANSPARENT, | |
938 | BRUSH_WHITE, | |
939 | COLOUR_BLACK, | |
940 | COLOUR_BLUE, | |
941 | COLOUR_CYAN, | |
942 | COLOUR_GREEN, | |
943 | COLOUR_YELLOW, | |
944 | COLOUR_LIGHTGREY, | |
945 | COLOUR_RED, | |
946 | COLOUR_WHITE, | |
947 | CURSOR_CROSS, | |
948 | CURSOR_HOURGLASS, | |
949 | CURSOR_STANDARD, | |
950 | FONT_ITALIC, | |
951 | FONT_NORMAL, | |
952 | FONT_SMALL, | |
953 | FONT_SWISS, | |
954 | PEN_BLACK, | |
955 | PEN_BLACKDASHED, | |
956 | PEN_BLUE, | |
957 | PEN_CYAN, | |
958 | PEN_GREEN, | |
959 | PEN_YELLOW, | |
960 | PEN_GREY, | |
961 | PEN_LIGHTGREY, | |
962 | PEN_MEDIUMGREY, | |
963 | PEN_RED, | |
964 | PEN_TRANSPARENT, | |
965 | PEN_WHITE, | |
966 | ITEMCOUNT | |
967 | }; | |
968 | ||
969 | wxStockGDI(); | |
970 | virtual ~wxStockGDI(); | |
971 | static void DeleteAll(); | |
972 | ||
973 | static wxStockGDI& instance() { return *ms_instance; } | |
974 | ||
975 | static const wxBrush* GetBrush(Item item); | |
976 | static const wxColour* GetColour(Item item); | |
977 | static const wxCursor* GetCursor(Item item); | |
978 | // Can be overridden by platform-specific derived classes | |
979 | virtual const wxFont* GetFont(Item item); | |
980 | static const wxPen* GetPen(Item item); | |
981 | ||
982 | protected: | |
983 | static wxStockGDI* ms_instance; | |
984 | ||
985 | static wxObject* ms_stockObject[ITEMCOUNT]; | |
986 | ||
987 | wxDECLARE_NO_COPY_CLASS(wxStockGDI); | |
988 | }; | |
989 | ||
990 | #define wxITALIC_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_ITALIC) | |
991 | #define wxNORMAL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_NORMAL) | |
992 | #define wxSMALL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SMALL) | |
993 | #define wxSWISS_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SWISS) | |
994 | ||
995 | #define wxBLACK_DASHED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACKDASHED) | |
996 | #define wxBLACK_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACK) | |
997 | #define wxBLUE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLUE) | |
998 | #define wxCYAN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_CYAN) | |
999 | #define wxGREEN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREEN) | |
1000 | #define wxYELLOW_PEN wxStockGDI::GetPen(wxStockGDI::PEN_YELLOW) | |
1001 | #define wxGREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREY) | |
1002 | #define wxLIGHT_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_LIGHTGREY) | |
1003 | #define wxMEDIUM_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_MEDIUMGREY) | |
1004 | #define wxRED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_RED) | |
1005 | #define wxTRANSPARENT_PEN wxStockGDI::GetPen(wxStockGDI::PEN_TRANSPARENT) | |
1006 | #define wxWHITE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_WHITE) | |
1007 | ||
1008 | #define wxBLACK_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLACK) | |
1009 | #define wxBLUE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLUE) | |
1010 | #define wxCYAN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_CYAN) | |
1011 | #define wxGREEN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREEN) | |
1012 | #define wxYELLOW_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_YELLOW) | |
1013 | #define wxGREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREY) | |
1014 | #define wxLIGHT_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_LIGHTGREY) | |
1015 | #define wxMEDIUM_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_MEDIUMGREY) | |
1016 | #define wxRED_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_RED) | |
1017 | #define wxTRANSPARENT_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_TRANSPARENT) | |
1018 | #define wxWHITE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_WHITE) | |
1019 | ||
1020 | #define wxBLACK wxStockGDI::GetColour(wxStockGDI::COLOUR_BLACK) | |
1021 | #define wxBLUE wxStockGDI::GetColour(wxStockGDI::COLOUR_BLUE) | |
1022 | #define wxCYAN wxStockGDI::GetColour(wxStockGDI::COLOUR_CYAN) | |
1023 | #define wxGREEN wxStockGDI::GetColour(wxStockGDI::COLOUR_GREEN) | |
1024 | #define wxYELLOW wxStockGDI::GetColour(wxStockGDI::COLOUR_YELLOW) | |
1025 | #define wxLIGHT_GREY wxStockGDI::GetColour(wxStockGDI::COLOUR_LIGHTGREY) | |
1026 | #define wxRED wxStockGDI::GetColour(wxStockGDI::COLOUR_RED) | |
1027 | #define wxWHITE wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE) | |
1028 | ||
1029 | #define wxCROSS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_CROSS) | |
1030 | #define wxHOURGLASS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_HOURGLASS) | |
1031 | #define wxSTANDARD_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_STANDARD) | |
1032 | ||
1033 | // 'Null' objects | |
1034 | extern WXDLLIMPEXP_DATA_CORE(wxBitmap) wxNullBitmap; | |
1035 | extern WXDLLIMPEXP_DATA_CORE(wxIcon) wxNullIcon; | |
1036 | extern WXDLLIMPEXP_DATA_CORE(wxCursor) wxNullCursor; | |
1037 | extern WXDLLIMPEXP_DATA_CORE(wxPen) wxNullPen; | |
1038 | extern WXDLLIMPEXP_DATA_CORE(wxBrush) wxNullBrush; | |
1039 | extern WXDLLIMPEXP_DATA_CORE(wxPalette) wxNullPalette; | |
1040 | extern WXDLLIMPEXP_DATA_CORE(wxFont) wxNullFont; | |
1041 | extern WXDLLIMPEXP_DATA_CORE(wxColour) wxNullColour; | |
1042 | extern WXDLLIMPEXP_DATA_CORE(wxIconBundle) wxNullIconBundle; | |
1043 | ||
1044 | extern WXDLLIMPEXP_DATA_CORE(wxColourDatabase*) wxTheColourDatabase; | |
1045 | ||
1046 | extern WXDLLIMPEXP_DATA_CORE(const char) wxPanelNameStr[]; | |
1047 | ||
1048 | extern WXDLLIMPEXP_DATA_CORE(const wxSize) wxDefaultSize; | |
1049 | extern WXDLLIMPEXP_DATA_CORE(const wxPoint) wxDefaultPosition; | |
1050 | ||
1051 | // --------------------------------------------------------------------------- | |
1052 | // global functions | |
1053 | // --------------------------------------------------------------------------- | |
1054 | ||
1055 | // resource management | |
1056 | extern void WXDLLIMPEXP_CORE wxInitializeStockLists(); | |
1057 | extern void WXDLLIMPEXP_CORE wxDeleteStockLists(); | |
1058 | ||
1059 | // is the display colour (or monochrome)? | |
1060 | extern bool WXDLLIMPEXP_CORE wxColourDisplay(); | |
1061 | ||
1062 | // Returns depth of screen | |
1063 | extern int WXDLLIMPEXP_CORE wxDisplayDepth(); | |
1064 | #define wxGetDisplayDepth wxDisplayDepth | |
1065 | ||
1066 | // get the display size | |
1067 | extern void WXDLLIMPEXP_CORE wxDisplaySize(int *width, int *height); | |
1068 | extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySize(); | |
1069 | extern void WXDLLIMPEXP_CORE wxDisplaySizeMM(int *width, int *height); | |
1070 | extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySizeMM(); | |
1071 | extern wxSize WXDLLIMPEXP_CORE wxGetDisplayPPI(); | |
1072 | ||
1073 | // Get position and size of the display workarea | |
1074 | extern void WXDLLIMPEXP_CORE wxClientDisplayRect(int *x, int *y, int *width, int *height); | |
1075 | extern wxRect WXDLLIMPEXP_CORE wxGetClientDisplayRect(); | |
1076 | ||
1077 | // set global cursor | |
1078 | extern void WXDLLIMPEXP_CORE wxSetCursor(const wxCursor& cursor); | |
1079 | ||
1080 | #endif | |
1081 | // _WX_GDICMNH__ |