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