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