]> git.saurik.com Git - wxWidgets.git/blob - src/common/gdicmn.cpp
second merge of the 2.2 branch (RL)
[wxWidgets.git] / src / common / gdicmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gdicmn.cpp
3 // Purpose: Common GDI classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "gdicmn.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #include "wx/event.h"
24 #include "wx/gdicmn.h"
25 #include "wx/brush.h"
26 #include "wx/pen.h"
27 #include "wx/bitmap.h"
28 #include "wx/icon.h"
29 #include "wx/cursor.h"
30 #include "wx/font.h"
31 #include "wx/palette.h"
32 #include "wx/app.h"
33 #include "wx/dc.h"
34 #include "wx/utils.h"
35
36 #include "wx/log.h"
37 #include <string.h>
38
39 #ifdef __WXMSW__
40 #include <windows.h>
41 #endif
42
43 #ifdef __WXMOTIF__
44 #ifdef __VMS__
45 #pragma message disable nosimpint
46 #endif
47 #include <Xm/Xm.h>
48 #ifdef __VMS__
49 #pragma message enable nosimpint
50 #endif
51 #endif
52
53 IMPLEMENT_CLASS(wxColourDatabase, wxList)
54 IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
55 IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
56 IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
57 IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
58 IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
59
60 IMPLEMENT_ABSTRACT_CLASS(wxDCBase, wxObject)
61
62 wxRect::wxRect(const wxPoint& topLeft, const wxPoint& bottomRight)
63 {
64 x = topLeft.x;
65 y = topLeft.y;
66 width = bottomRight.x - topLeft.x;
67 height = bottomRight.y - topLeft.y;
68
69 if (width < 0)
70 {
71 width = -width;
72 x -= width;
73 }
74
75 if (height < 0)
76 {
77 height = -height;
78 y -= height;
79 }
80 }
81
82 wxRect::wxRect(const wxPoint& point, const wxSize& size)
83 {
84 x = point.x; y = point.y;
85 width = size.x; height = size.y;
86 }
87
88 bool wxRect::operator==(const wxRect& rect) const
89 {
90 return ((x == rect.x) &&
91 (y == rect.y) &&
92 (width == rect.width) &&
93 (height == rect.height));
94 }
95
96 wxRect& wxRect::operator += (const wxRect& rect)
97 {
98 *this = (*this + rect);
99 return ( *this ) ;
100 }
101
102 wxRect wxRect::operator + (const wxRect& rect) const
103 {
104 int x1 = wxMin(this->x, rect.x);
105 int y1 = wxMin(this->y, rect.y);
106 int y2 = wxMax(y+height, rect.height+rect.y);
107 int x2 = wxMax(x+width, rect.width+rect.x);
108 return wxRect(x1, y1, x2-x1, y2-y1);
109 }
110
111 bool wxRect::Inside(int cx, int cy) const
112 {
113 return ( (cx >= x) && (cy >= y)
114 && ((cy - y) < height)
115 && ((cx - x) < width)
116 );
117 }
118
119 wxColourDatabase::wxColourDatabase (int type) : wxList (type)
120 {
121 }
122
123 wxColourDatabase::~wxColourDatabase ()
124 {
125 // Cleanup Colour allocated in Initialize()
126 wxNode *node = First ();
127 while (node)
128 {
129 wxColour *col = (wxColour *) node->Data ();
130 wxNode *next = node->Next ();
131 delete col;
132 node = next;
133 }
134 }
135
136 // Colour database stuff
137 void wxColourDatabase::Initialize ()
138 {
139 static const struct wxColourDesc
140 {
141 const wxChar *name;
142 int r,g,b;
143 }
144 wxColourTable[] =
145 {
146 {wxT("AQUAMARINE"),112, 219, 147},
147 {wxT("BLACK"),0, 0, 0},
148 {wxT("BLUE"), 0, 0, 255},
149 {wxT("BLUE VIOLET"), 159, 95, 159},
150 {wxT("BROWN"), 165, 42, 42},
151 {wxT("CADET BLUE"), 95, 159, 159},
152 {wxT("CORAL"), 255, 127, 0},
153 {wxT("CORNFLOWER BLUE"), 66, 66, 111},
154 {wxT("CYAN"), 0, 255, 255},
155 {wxT("DARK GREY"), 47, 47, 47}, // ?
156
157 {wxT("DARK GREEN"), 47, 79, 47},
158 {wxT("DARK OLIVE GREEN"), 79, 79, 47},
159 {wxT("DARK ORCHID"), 153, 50, 204},
160 {wxT("DARK SLATE BLUE"), 107, 35, 142},
161 {wxT("DARK SLATE GREY"), 47, 79, 79},
162 {wxT("DARK TURQUOISE"), 112, 147, 219},
163 {wxT("DIM GREY"), 84, 84, 84},
164 {wxT("FIREBRICK"), 142, 35, 35},
165 {wxT("FOREST GREEN"), 35, 142, 35},
166 {wxT("GOLD"), 204, 127, 50},
167 {wxT("GOLDENROD"), 219, 219, 112},
168 {wxT("GREY"), 128, 128, 128},
169 {wxT("GREEN"), 0, 255, 0},
170 {wxT("GREEN YELLOW"), 147, 219, 112},
171 {wxT("INDIAN RED"), 79, 47, 47},
172 {wxT("KHAKI"), 159, 159, 95},
173 {wxT("LIGHT BLUE"), 191, 216, 216},
174 {wxT("LIGHT GREY"), 192, 192, 192},
175 {wxT("LIGHT STEEL BLUE"), 143, 143, 188},
176 {wxT("LIME GREEN"), 50, 204, 50},
177 {wxT("LIGHT MAGENTA"), 255, 0, 255},
178 {wxT("MAGENTA"), 255, 0, 255},
179 {wxT("MAROON"), 142, 35, 107},
180 {wxT("MEDIUM AQUAMARINE"), 50, 204, 153},
181 {wxT("MEDIUM GREY"), 100, 100, 100},
182 {wxT("MEDIUM BLUE"), 50, 50, 204},
183 {wxT("MEDIUM FOREST GREEN"), 107, 142, 35},
184 {wxT("MEDIUM GOLDENROD"), 234, 234, 173},
185 {wxT("MEDIUM ORCHID"), 147, 112, 219},
186 {wxT("MEDIUM SEA GREEN"), 66, 111, 66},
187 {wxT("MEDIUM SLATE BLUE"), 127, 0, 255},
188 {wxT("MEDIUM SPRING GREEN"), 127, 255, 0},
189 {wxT("MEDIUM TURQUOISE"), 112, 219, 219},
190 {wxT("MEDIUM VIOLET RED"), 219, 112, 147},
191 {wxT("MIDNIGHT BLUE"), 47, 47, 79},
192 {wxT("NAVY"), 35, 35, 142},
193 {wxT("ORANGE"), 204, 50, 50},
194 {wxT("ORANGE RED"), 255, 0, 127},
195 {wxT("ORCHID"), 219, 112, 219},
196 {wxT("PALE GREEN"), 143, 188, 143},
197 {wxT("PINK"), 188, 143, 234},
198 {wxT("PLUM"), 234, 173, 234},
199 {wxT("PURPLE"), 176, 0, 255},
200 {wxT("RED"), 255, 0, 0},
201 {wxT("SALMON"), 111, 66, 66},
202 {wxT("SEA GREEN"), 35, 142, 107},
203 {wxT("SIENNA"), 142, 107, 35},
204 {wxT("SKY BLUE"), 50, 153, 204},
205 {wxT("SLATE BLUE"), 0, 127, 255},
206 {wxT("SPRING GREEN"), 0, 255, 127},
207 {wxT("STEEL BLUE"), 35, 107, 142},
208 {wxT("TAN"), 219, 147, 112},
209 {wxT("THISTLE"), 216, 191, 216},
210 {wxT("TURQUOISE"), 173, 234, 234},
211 {wxT("VIOLET"), 79, 47, 79},
212 {wxT("VIOLET RED"), 204, 50, 153},
213 {wxT("WHEAT"), 216, 216, 191},
214 {wxT("WHITE"), 255, 255, 255},
215 {wxT("YELLOW"), 255, 255, 0},
216 {wxT("YELLOW GREEN"), 153, 204, 50},
217 {wxT("MEDIUM GOLDENROD"), 234, 234, 173},
218 {wxT("MEDIUM FOREST GREEN"), 107, 142, 35},
219 {wxT("LIGHT MAGENTA"), 255, 0, 255},
220 {wxT("MEDIUM GREY"), 100, 100, 100},
221 };
222
223 for ( size_t n = 0; n < WXSIZEOF(wxColourTable); n++ )
224 {
225 const wxColourDesc& cc = wxColourTable[n];
226 Append(cc.name, new wxColour(cc.r,cc.g,cc.b));
227 }
228 }
229
230 /*
231 * Changed by Ian Brown, July 1994.
232 *
233 * When running under X, the Colour Database starts off empty. The X server
234 * is queried for the colour first time after which it is entered into the
235 * database. This allows our client to use the server colour database which
236 * is hopefully gamma corrected for the display being used.
237 */
238
239 wxColour *wxColourDatabase::FindColour(const wxString& colour)
240 {
241 // VZ: make the comparaison case insensitive and also match both grey and
242 // gray
243 wxString colName = colour;
244 colName.MakeUpper();
245 wxString colName2 = colName;
246 if ( !colName2.Replace(_T("GRAY"), _T("GREY")) )
247 colName2.clear();
248
249 wxNode *node = First();
250 while ( node )
251 {
252 const wxChar *key = node->GetKeyString();
253 if ( colName == key || colName2 == key )
254 {
255 return (wxColour *)node->Data();
256 }
257
258 node = node->Next();
259 }
260
261 #ifdef __WXMSW__
262 return NULL;
263 #endif
264 #ifdef __WXPM__
265 return NULL;
266 #endif
267
268 // TODO for other implementations. This should really go into
269 // platform-specific directories.
270 #ifdef __WXMAC__
271 return NULL;
272 #endif
273 #ifdef __WXSTUBS__
274 return NULL;
275 #endif
276
277 #ifdef __WXGTK__
278 wxColour *col = new wxColour( colour );
279
280 if (!(col->Ok())) {
281 delete col;
282 return (wxColour *) NULL;
283 }
284 Append( colour, col );
285 return col;
286 #endif
287
288 #ifdef __X__
289 XColor xcolour;
290
291 #ifdef __WXMOTIF__
292 Display *display = XtDisplay((Widget) wxTheApp->GetTopLevelWidget()) ;
293 #endif
294 #ifdef __XVIEW__
295 Xv_Screen screen = xv_get(xview_server, SERVER_NTH_SCREEN, 0);
296 Xv_opaque root_window = xv_get(screen, XV_ROOT);
297 Display *display = (Display *)xv_get(root_window, XV_DISPLAY);
298 #endif
299
300 /* MATTHEW: [4] Use wxGetMainColormap */
301 if (!XParseColor(display, (Colormap) wxTheApp->GetMainColormap((WXDisplay*) display), colour,&xcolour))
302 return NULL;
303
304 unsigned char r = (unsigned char)(xcolour.red >> 8);
305 unsigned char g = (unsigned char)(xcolour.green >> 8);
306 unsigned char b = (unsigned char)(xcolour.blue >> 8);
307
308 wxColour *col = new wxColour(r, g, b);
309 Append(colour, col);
310
311 return col;
312 #endif // __X__
313 }
314
315 wxString wxColourDatabase::FindName (const wxColour& colour) const
316 {
317 wxString name;
318
319 unsigned char red = colour.Red ();
320 unsigned char green = colour.Green ();
321 unsigned char blue = colour.Blue ();
322
323 for (wxNode * node = First (); node; node = node->Next ())
324 {
325 wxColour *col = (wxColour *) node->Data ();
326
327 if (col->Red () == red && col->Green () == green && col->Blue () == blue)
328 {
329 const wxChar *found = node->GetKeyString();
330 if ( found )
331 {
332 name = found;
333
334 break;
335 }
336 }
337 }
338
339 return name;
340 }
341
342 void wxInitializeStockLists () {
343 wxTheBrushList = new wxBrushList;
344 wxThePenList = new wxPenList;
345 wxTheFontList = new wxFontList;
346 wxTheBitmapList = new wxBitmapList;
347 }
348
349 void wxInitializeStockObjects ()
350 {
351 #ifdef __WXMOTIF__
352 #endif
353 #ifdef __X__
354 // TODO
355 // wxFontPool = new XFontPool;
356 #endif
357
358 // why under MSW fonts shouldn't have the standard system size?
359 #ifdef __WXMSW__
360 static const int sizeFont = 10;
361 #else
362 static const int sizeFont = 12;
363 #endif
364
365 wxNORMAL_FONT = new wxFont (sizeFont, wxMODERN, wxNORMAL, wxNORMAL);
366 wxSMALL_FONT = new wxFont (sizeFont - 2, wxSWISS, wxNORMAL, wxNORMAL);
367 wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL);
368 wxSWISS_FONT = new wxFont (sizeFont, wxSWISS, wxNORMAL, wxNORMAL);
369
370 wxRED_PEN = new wxPen ("RED", 1, wxSOLID);
371 wxCYAN_PEN = new wxPen ("CYAN", 1, wxSOLID);
372 wxGREEN_PEN = new wxPen ("GREEN", 1, wxSOLID);
373 wxBLACK_PEN = new wxPen ("BLACK", 1, wxSOLID);
374 wxWHITE_PEN = new wxPen ("WHITE", 1, wxSOLID);
375 wxTRANSPARENT_PEN = new wxPen ("BLACK", 1, wxTRANSPARENT);
376 wxBLACK_DASHED_PEN = new wxPen ("BLACK", 1, wxSHORT_DASH);
377 wxGREY_PEN = new wxPen ("GREY", 1, wxSOLID);
378 wxMEDIUM_GREY_PEN = new wxPen ("MEDIUM GREY", 1, wxSOLID);
379 wxLIGHT_GREY_PEN = new wxPen ("LIGHT GREY", 1, wxSOLID);
380
381 wxBLUE_BRUSH = new wxBrush ("BLUE", wxSOLID);
382 wxGREEN_BRUSH = new wxBrush ("GREEN", wxSOLID);
383 wxWHITE_BRUSH = new wxBrush ("WHITE", wxSOLID);
384 wxBLACK_BRUSH = new wxBrush ("BLACK", wxSOLID);
385 wxTRANSPARENT_BRUSH = new wxBrush ("BLACK", wxTRANSPARENT);
386 wxCYAN_BRUSH = new wxBrush ("CYAN", wxSOLID);
387 wxRED_BRUSH = new wxBrush ("RED", wxSOLID);
388 wxGREY_BRUSH = new wxBrush ("GREY", wxSOLID);
389 wxMEDIUM_GREY_BRUSH = new wxBrush ("MEDIUM GREY", wxSOLID);
390 wxLIGHT_GREY_BRUSH = new wxBrush ("LIGHT GREY", wxSOLID);
391
392 wxBLACK = new wxColour ("BLACK");
393 wxWHITE = new wxColour ("WHITE");
394 wxRED = new wxColour ("RED");
395 wxBLUE = new wxColour ("BLUE");
396 wxGREEN = new wxColour ("GREEN");
397 wxCYAN = new wxColour ("CYAN");
398 wxLIGHT_GREY = new wxColour ("LIGHT GREY");
399
400 wxSTANDARD_CURSOR = new wxCursor (wxCURSOR_ARROW);
401 wxHOURGLASS_CURSOR = new wxCursor (wxCURSOR_WAIT);
402 wxCROSS_CURSOR = new wxCursor (wxCURSOR_CROSS);
403 }
404
405 void wxDeleteStockObjects ()
406 {
407 wxDELETE(wxNORMAL_FONT);
408 wxDELETE(wxSMALL_FONT);
409 wxDELETE(wxITALIC_FONT);
410 wxDELETE(wxSWISS_FONT);
411
412 wxDELETE(wxRED_PEN);
413 wxDELETE(wxCYAN_PEN);
414 wxDELETE(wxGREEN_PEN);
415 wxDELETE(wxBLACK_PEN);
416 wxDELETE(wxWHITE_PEN);
417 wxDELETE(wxTRANSPARENT_PEN);
418 wxDELETE(wxBLACK_DASHED_PEN);
419 wxDELETE(wxGREY_PEN);
420 wxDELETE(wxMEDIUM_GREY_PEN);
421 wxDELETE(wxLIGHT_GREY_PEN);
422
423 wxDELETE(wxBLUE_BRUSH);
424 wxDELETE(wxGREEN_BRUSH);
425 wxDELETE(wxWHITE_BRUSH);
426 wxDELETE(wxBLACK_BRUSH);
427 wxDELETE(wxTRANSPARENT_BRUSH);
428 wxDELETE(wxCYAN_BRUSH);
429 wxDELETE(wxRED_BRUSH);
430 wxDELETE(wxGREY_BRUSH);
431 wxDELETE(wxMEDIUM_GREY_BRUSH);
432 wxDELETE(wxLIGHT_GREY_BRUSH);
433
434 wxDELETE(wxBLACK);
435 wxDELETE(wxWHITE);
436 wxDELETE(wxRED);
437 wxDELETE(wxBLUE);
438 wxDELETE(wxGREEN);
439 wxDELETE(wxCYAN);
440 wxDELETE(wxLIGHT_GREY);
441
442 wxDELETE(wxSTANDARD_CURSOR);
443 wxDELETE(wxHOURGLASS_CURSOR);
444 wxDELETE(wxCROSS_CURSOR);
445 }
446
447 void wxDeleteStockLists() {
448 wxDELETE(wxTheBrushList);
449 wxDELETE(wxThePenList);
450 wxDELETE(wxTheFontList);
451 wxDELETE(wxTheBitmapList);
452 }
453
454 wxBitmapList::wxBitmapList ()
455 {
456 }
457
458 wxBitmapList::~wxBitmapList ()
459 {
460 wxNode *node = First ();
461 while (node)
462 {
463 wxBitmap *bitmap = (wxBitmap *) node->Data ();
464 wxNode *next = node->Next ();
465 if (bitmap->GetVisible())
466 delete bitmap;
467 node = next;
468 }
469 }
470
471 // Pen and Brush lists
472 wxPenList::~wxPenList ()
473 {
474 wxNode *node = First ();
475 while (node)
476 {
477 wxPen *pen = (wxPen *) node->Data ();
478 wxNode *next = node->Next ();
479 if (pen->GetVisible())
480 delete pen;
481 node = next;
482 }
483 }
484
485 void wxPenList::AddPen (wxPen * pen)
486 {
487 Append (pen);
488 }
489
490 void wxPenList::RemovePen (wxPen * pen)
491 {
492 DeleteObject (pen);
493 }
494
495 wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
496 {
497 for (wxNode * node = First (); node; node = node->Next ())
498 {
499 wxPen *each_pen = (wxPen *) node->Data ();
500 if (each_pen &&
501 each_pen->GetVisible() &&
502 each_pen->GetWidth () == width &&
503 each_pen->GetStyle () == style &&
504 each_pen->GetColour ().Red () == colour.Red () &&
505 each_pen->GetColour ().Green () == colour.Green () &&
506 each_pen->GetColour ().Blue () == colour.Blue ())
507 return each_pen;
508 }
509 wxPen *pen = new wxPen (colour, width, style);
510
511 // Yes, we can return a pointer to this in a later FindOrCreatePen call,
512 // because we created it within FindOrCreatePen. Safeguards against
513 // returning a pointer to an automatic variable and hanging on to it
514 // (dangling pointer).
515 pen->SetVisible(TRUE);
516
517 return pen;
518 }
519
520 wxBrushList::~wxBrushList ()
521 {
522 wxNode *node = First ();
523 while (node)
524 {
525 wxBrush *brush = (wxBrush *) node->Data ();
526 wxNode *next = node->Next ();
527 if (brush->GetVisible())
528 delete brush;
529 node = next;
530 }
531 }
532
533 void wxBrushList::AddBrush (wxBrush * brush)
534 {
535 Append (brush);
536 }
537
538 wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, int style)
539 {
540 for (wxNode * node = First (); node; node = node->Next ())
541 {
542 wxBrush *each_brush = (wxBrush *) node->Data ();
543 if (each_brush &&
544 each_brush->GetVisible() &&
545 each_brush->GetStyle () == style &&
546 each_brush->GetColour ().Red () == colour.Red () &&
547 each_brush->GetColour ().Green () == colour.Green () &&
548 each_brush->GetColour ().Blue () == colour.Blue ())
549 return each_brush;
550 }
551
552 // Yes, we can return a pointer to this in a later FindOrCreateBrush call,
553 // because we created it within FindOrCreateBrush. Safeguards against
554 // returning a pointer to an automatic variable and hanging on to it
555 // (dangling pointer).
556 wxBrush *brush = new wxBrush (colour, style);
557
558 brush->SetVisible(TRUE);
559
560 return brush;
561 }
562
563 void wxBrushList::RemoveBrush (wxBrush * brush)
564 {
565 DeleteObject (brush);
566 }
567
568 wxFontList::~wxFontList ()
569 {
570 wxNode *node = First ();
571 while (node)
572 {
573 // Only delete objects that are 'visible', i.e.
574 // that have been created using FindOrCreate...,
575 // where the pointers are expected to be shared
576 // (and therefore not deleted by any one part of an app).
577 wxFont *font = (wxFont *) node->Data ();
578 wxNode *next = node->Next ();
579 if (font->GetVisible())
580 delete font;
581 node = next;
582 }
583 }
584
585 void wxFontList::AddFont (wxFont * font)
586 {
587 Append (font);
588 }
589
590 void wxFontList::RemoveFont (wxFont * font)
591 {
592 DeleteObject (font);
593 }
594
595 wxFont *wxFontList::FindOrCreateFont(int pointSize,
596 int family,
597 int style,
598 int weight,
599 bool underline,
600 const wxString& facename,
601 wxFontEncoding encoding)
602 {
603 wxFont *font = (wxFont *)NULL;
604 wxNode *node;
605 for ( node = First(); node; node = node->Next() )
606 {
607 font = (wxFont *)node->Data();
608 if ( font->GetVisible() &&
609 font->Ok() &&
610 font->GetPointSize () == pointSize &&
611 font->GetStyle () == style &&
612 font->GetWeight () == weight &&
613 font->GetUnderlined () == underline )
614 {
615 int fontFamily = font->GetFamily();
616
617 #if defined(__WXGTK__)
618 // under GTK the default family is wxSWISS, so looking for a font
619 // with wxDEFAULT family should return a wxSWISS one instead of
620 // creating a new one
621 bool same = (fontFamily == family) ||
622 (fontFamily == wxSWISS && family == wxDEFAULT);
623 #else // !GTK
624 // VZ: but why elsewhere do we require an exact match? mystery...
625 bool same = fontFamily == family;
626 #endif // GTK/!GTK
627
628 // empty facename matches anything at all: this is bad because
629 // depending on which fonts are already created, we might get back
630 // a different font if we create it with empty facename, but it is
631 // still better than never matching anything in the cache at all
632 // in this case
633 if ( same && !!facename )
634 {
635 const wxString& fontFace = font->GetFaceName();
636
637 // empty facename matches everything
638 same = !fontFace || fontFace == facename;
639 }
640
641 if ( same && (encoding != wxFONTENCODING_DEFAULT) )
642 {
643 // have to match the encoding too
644 same = font->GetEncoding() == encoding;
645 }
646
647 if ( same )
648 {
649 return font;
650 }
651 }
652 }
653
654 if ( !node )
655 {
656 // font not found, create the new one
657 font = new wxFont(pointSize, family, style, weight,
658 underline, facename, encoding);
659
660 // and mark it as being cacheable
661 font->SetVisible(TRUE);
662 }
663
664 return font;
665 }
666
667 void wxBitmapList::AddBitmap(wxBitmap *bitmap)
668 {
669 Append(bitmap);
670 }
671
672 void wxBitmapList::RemoveBitmap(wxBitmap *bitmap)
673 {
674 DeleteObject(bitmap);
675 }
676
677 wxSize wxGetDisplaySize()
678 {
679 int x, y;
680 wxDisplaySize(& x, & y);
681 return wxSize(x, y);
682 }
683
684 wxResourceCache::~wxResourceCache ()
685 {
686 wxNode *node = First ();
687 while (node) {
688 wxObject *item = (wxObject *)node->Data();
689 delete item;
690
691 node = node->Next ();
692 }
693 }
694