1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Common GDI classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "gdicmn.h"
17 #define XtDisplay XTDISPLAY
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
28 #include "wx/gdicmn.h"
31 #include "wx/bitmap.h"
33 #include "wx/cursor.h"
35 #include "wx/palette.h"
39 #include "wx/settings.h"
40 #include "wx/hashmap.h"
51 #pragma message disable nosimpint
55 #pragma message enable nosimpint
64 #include "wx/mac/private.h"
65 #include "wx/mac/uma.h"
67 //IMPLEMENT_CLASS(wxColourDatabase, wxList)
68 //IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
69 //IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
70 //IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
71 //IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
72 //IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
74 IMPLEMENT_ABSTRACT_CLASS(wxDCBase
, wxObject
)
76 wxRect::wxRect(const wxPoint
& topLeft
, const wxPoint
& bottomRight
)
80 width
= bottomRight
.x
- topLeft
.x
+ 1;
81 height
= bottomRight
.y
- topLeft
.y
+ 1;
96 wxRect::wxRect(const wxPoint
& point
, const wxSize
& size
)
98 x
= point
.x
; y
= point
.y
;
99 width
= size
.x
; height
= size
.y
;
102 bool wxRect::operator==(const wxRect
& rect
) const
104 return ((x
== rect
.x
) &&
106 (width
== rect
.width
) &&
107 (height
== rect
.height
));
110 wxRect
& wxRect::operator += (const wxRect
& rect
)
112 *this = (*this + rect
);
116 wxRect
wxRect::operator + (const wxRect
& rect
) const
118 int x1
= wxMin(this->x
, rect
.x
);
119 int y1
= wxMin(this->y
, rect
.y
);
120 int y2
= wxMax(y
+height
, rect
.height
+rect
.y
);
121 int x2
= wxMax(x
+width
, rect
.width
+rect
.x
);
122 return wxRect(x1
, y1
, x2
-x1
, y2
-y1
);
125 wxRect
& wxRect::Inflate(wxCoord dx
, wxCoord dy
)
132 // check that we didn't make the rectangle invalid by accident (you almost
133 // never want to have negative coords and never want negative size)
139 // what else can we do?
148 bool wxRect::Inside(int cx
, int cy
) const
150 return ( (cx
>= x
) && (cy
>= y
)
151 && ((cy
- y
) < height
)
152 && ((cx
- x
) < width
)
156 wxRect
& wxRect::Intersect(const wxRect
& rect
)
165 if ( x2
> rect
.GetRight() )
166 x2
= rect
.GetRight();
167 if ( y2
> rect
.GetBottom() )
168 y2
= rect
.GetBottom();
173 if ( width
<= 0 || height
<= 0 )
182 bool wxRect::Intersects(const wxRect
& rect
) const
184 wxRect r
= Intersect(rect
);
186 // if there is no intersection, both width and height are 0
190 WX_DECLARE_STRING_HASH_MAP( wxColour
*, wxStringToColourHashMap
);
192 wxColourDatabase::wxColourDatabase ()
194 m_map
= new wxStringToColourHashMap
;
197 wxColourDatabase::~wxColourDatabase ()
199 typedef wxStringToColourHashMap::iterator iterator
;
201 for( iterator it
= m_map
->begin(), en
= m_map
->end(); it
!= en
; ++it
)
207 delete [] m_palTable
;
211 // Colour database stuff
212 void wxColourDatabase::Initialize ()
214 static const struct wxColourDesc
221 {wxT("AQUAMARINE"),112, 219, 147},
222 {wxT("BLACK"),0, 0, 0},
223 {wxT("BLUE"), 0, 0, 255},
224 {wxT("BLUE VIOLET"), 159, 95, 159},
225 {wxT("BROWN"), 165, 42, 42},
226 {wxT("CADET BLUE"), 95, 159, 159},
227 {wxT("CORAL"), 255, 127, 0},
228 {wxT("CORNFLOWER BLUE"), 66, 66, 111},
229 {wxT("CYAN"), 0, 255, 255},
230 {wxT("DARK GREY"), 47, 47, 47}, // ?
232 {wxT("DARK GREEN"), 47, 79, 47},
233 {wxT("DARK OLIVE GREEN"), 79, 79, 47},
234 {wxT("DARK ORCHID"), 153, 50, 204},
235 {wxT("DARK SLATE BLUE"), 107, 35, 142},
236 {wxT("DARK SLATE GREY"), 47, 79, 79},
237 {wxT("DARK TURQUOISE"), 112, 147, 219},
238 {wxT("DIM GREY"), 84, 84, 84},
239 {wxT("FIREBRICK"), 142, 35, 35},
240 {wxT("FOREST GREEN"), 35, 142, 35},
241 {wxT("GOLD"), 204, 127, 50},
242 {wxT("GOLDENROD"), 219, 219, 112},
243 {wxT("GREY"), 128, 128, 128},
244 {wxT("GREEN"), 0, 255, 0},
245 {wxT("GREEN YELLOW"), 147, 219, 112},
246 {wxT("INDIAN RED"), 79, 47, 47},
247 {wxT("KHAKI"), 159, 159, 95},
248 {wxT("LIGHT BLUE"), 191, 216, 216},
249 {wxT("LIGHT GREY"), 192, 192, 192},
250 {wxT("LIGHT STEEL BLUE"), 143, 143, 188},
251 {wxT("LIME GREEN"), 50, 204, 50},
252 {wxT("LIGHT MAGENTA"), 255, 0, 255},
253 {wxT("MAGENTA"), 255, 0, 255},
254 {wxT("MAROON"), 142, 35, 107},
255 {wxT("MEDIUM AQUAMARINE"), 50, 204, 153},
256 {wxT("MEDIUM GREY"), 100, 100, 100},
257 {wxT("MEDIUM BLUE"), 50, 50, 204},
258 {wxT("MEDIUM FOREST GREEN"), 107, 142, 35},
259 {wxT("MEDIUM GOLDENROD"), 234, 234, 173},
260 {wxT("MEDIUM ORCHID"), 147, 112, 219},
261 {wxT("MEDIUM SEA GREEN"), 66, 111, 66},
262 {wxT("MEDIUM SLATE BLUE"), 127, 0, 255},
263 {wxT("MEDIUM SPRING GREEN"), 127, 255, 0},
264 {wxT("MEDIUM TURQUOISE"), 112, 219, 219},
265 {wxT("MEDIUM VIOLET RED"), 219, 112, 147},
266 {wxT("MIDNIGHT BLUE"), 47, 47, 79},
267 {wxT("NAVY"), 35, 35, 142},
268 {wxT("ORANGE"), 204, 50, 50},
269 {wxT("ORANGE RED"), 255, 0, 127},
270 {wxT("ORCHID"), 219, 112, 219},
271 {wxT("PALE GREEN"), 143, 188, 143},
272 {wxT("PINK"), 188, 143, 234},
273 {wxT("PLUM"), 234, 173, 234},
274 {wxT("PURPLE"), 176, 0, 255},
275 {wxT("RED"), 255, 0, 0},
276 {wxT("SALMON"), 111, 66, 66},
277 {wxT("SEA GREEN"), 35, 142, 107},
278 {wxT("SIENNA"), 142, 107, 35},
279 {wxT("SKY BLUE"), 50, 153, 204},
280 {wxT("SLATE BLUE"), 0, 127, 255},
281 {wxT("SPRING GREEN"), 0, 255, 127},
282 {wxT("STEEL BLUE"), 35, 107, 142},
283 {wxT("TAN"), 219, 147, 112},
284 {wxT("THISTLE"), 216, 191, 216},
285 {wxT("TURQUOISE"), 173, 234, 234},
286 {wxT("VIOLET"), 79, 47, 79},
287 {wxT("VIOLET RED"), 204, 50, 153},
288 {wxT("WHEAT"), 216, 216, 191},
289 {wxT("WHITE"), 255, 255, 255},
290 {wxT("YELLOW"), 255, 255, 0},
291 {wxT("YELLOW GREEN"), 153, 204, 50},
292 {wxT("MEDIUM GOLDENROD"), 234, 234, 173},
293 {wxT("MEDIUM FOREST GREEN"), 107, 142, 35},
294 {wxT("LIGHT MAGENTA"), 255, 0, 255},
295 {wxT("MEDIUM GREY"), 100, 100, 100},
300 for ( n
= 0; n
< WXSIZEOF(wxColourTable
); n
++ )
302 const wxColourDesc
& cc
= wxColourTable
[n
];
303 (*m_map
)[cc
.name
] = new wxColour(cc
.r
,cc
.g
,cc
.b
);
306 m_palTable
= new long[n
];
307 for ( n
= 0; n
< WXSIZEOF(wxColourTable
); n
++ )
309 const wxColourDesc
& cc
= wxColourTable
[n
];
310 m_palTable
[n
] = OS2RGB(cc
.r
,cc
.g
,cc
.b
);
317 * Changed by Ian Brown, July 1994.
319 * When running under X, the Colour Database starts off empty. The X server
320 * is queried for the colour first time after which it is entered into the
321 * database. This allows our client to use the server colour database which
322 * is hopefully gamma corrected for the display being used.
325 wxColour
*wxColourDatabase::FindColour(const wxString
& colour
)
327 return FindColour(colour
, true);
330 wxColour
*wxColourDatabase::FindColourNoAdd(const wxString
& colour
) const
332 return ((wxColourDatabase
*)this)->FindColour(colour
, false);
335 wxColour
*wxColourDatabase::FindColour(const wxString
& colour
, bool add
)
337 // VZ: make the comparaison case insensitive and also match both grey and
339 wxString colName
= colour
;
341 wxString colName2
= colName
;
342 if ( !colName2
.Replace(_T("GRAY"), _T("GREY")) )
345 wxStringToColourHashMap::iterator it
= m_map
->find(colName
);
346 if ( it
== m_map
->end() )
347 it
= m_map
->find(colName2
);
348 if ( it
!= m_map
->end() )
364 // TODO for other implementations. This should really go into
365 // platform-specific directories.
377 wxColour
*col
= new wxColour( colour
);
382 return (wxColour
*) NULL
;
384 (*m_map
)[colour
] = col
;
392 Display
*display
= XtDisplay((Widget
) wxTheApp
->GetTopLevelWidget()) ;
395 Display
* display
= (Display
*) wxGetDisplay();
397 /* MATTHEW: [4] Use wxGetMainColormap */
398 if (!XParseColor(display
, (Colormap
) wxTheApp
->GetMainColormap((WXDisplay
*) display
), colour
.ToAscii() ,&xcolour
))
402 unsigned char r
= (unsigned char)(xcolour
.red
);
403 unsigned char g
= (unsigned char)(xcolour
.green
);
404 unsigned char b
= (unsigned char)(xcolour
.blue
);
406 unsigned char r
= (unsigned char)(xcolour
.red
>> 8);
407 unsigned char g
= (unsigned char)(xcolour
.green
>> 8);
408 unsigned char b
= (unsigned char)(xcolour
.blue
>> 8);
411 wxColour
*col
= new wxColour(r
, g
, b
);
412 (*m_map
)[colour
] = col
;
418 wxString
wxColourDatabase::FindName (const wxColour
& colour
) const
420 unsigned char red
= colour
.Red ();
421 unsigned char green
= colour
.Green ();
422 unsigned char blue
= colour
.Blue ();
424 typedef wxStringToColourHashMap::iterator iterator
;
426 for (iterator it
= m_map
->begin(), en
= m_map
->end(); it
!= en
; ++it
)
428 wxColour
*col
= it
->second
;
430 if (col
->Red () == red
&& col
->Green () == green
&& col
->Blue () == blue
)
434 return wxEmptyString
;
437 void wxInitializeStockLists()
439 wxTheBrushList
= new wxBrushList
;
440 wxThePenList
= new wxPenList
;
441 wxTheFontList
= new wxFontList
;
442 wxTheBitmapList
= new wxBitmapList
;
445 void wxInitializeStockObjects ()
451 // wxFontPool = new XFontPool;
454 // why under MSW fonts shouldn't have the standard system size?
457 static const int sizeFont = 10;
461 #if defined(__WXMAC__)
468 GetThemeFont(kThemeSystemFont
, GetApplicationScript() , fontName
, &fontSize
, &fontStyle
) ;
469 sizeFont
= fontSize
;
470 wxSWISS_FONT
= new wxFont (fontSize
, wxSWISS
, wxNORMAL
, wxNORMAL
, false , wxMacMakeStringFromPascal(fontName
) );
471 #elif defined(__WXPM__)
472 static const int sizeFont
= 12;
474 wxNORMAL_FONT
= new wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
));
475 static const int sizeFont
= wxNORMAL_FONT
->GetPointSize();
478 #if defined(__WXPM__)
480 // Basic OS/2 has a fairly limited number of fonts and these are as good
481 // as I can do to get something that looks halfway "wx" normal
483 wxNORMAL_FONT
= new wxFont (sizeFont
, wxMODERN
, wxNORMAL
, wxBOLD
);
484 wxSMALL_FONT
= new wxFont (sizeFont
- 4, wxSWISS
, wxNORMAL
, wxNORMAL
); /* Helv */
485 wxITALIC_FONT
= new wxFont (sizeFont
, wxROMAN
, wxITALIC
, wxNORMAL
);
486 wxSWISS_FONT
= new wxFont (sizeFont
, wxSWISS
, wxNORMAL
, wxNORMAL
); /* Helv */
487 #elif defined(__WXMAC__)
488 wxNORMAL_FONT
= new wxFont (sizeFont
, wxMODERN
, wxNORMAL
, wxNORMAL
);
489 wxITALIC_FONT
= new wxFont (sizeFont
, wxROMAN
, wxITALIC
, wxNORMAL
);
490 GetThemeFont(kThemeSmallSystemFont
, GetApplicationScript() , fontName
, &fontSize
, &fontStyle
) ;
491 wxSMALL_FONT
= new wxFont (fontSize
, wxSWISS
, wxNORMAL
, wxNORMAL
, false , wxMacMakeStringFromPascal( fontName
) );
493 wxSMALL_FONT
= new wxFont (sizeFont
- 2, wxSWISS
, wxNORMAL
, wxNORMAL
);
494 wxITALIC_FONT
= new wxFont (sizeFont
, wxROMAN
, wxITALIC
, wxNORMAL
);
495 wxSWISS_FONT
= new wxFont (sizeFont
, wxSWISS
, wxNORMAL
, wxNORMAL
);
498 wxRED_PEN
= new wxPen (wxT("RED"), 1, wxSOLID
);
499 wxCYAN_PEN
= new wxPen (wxT("CYAN"), 1, wxSOLID
);
500 wxGREEN_PEN
= new wxPen (wxT("GREEN"), 1, wxSOLID
);
501 wxBLACK_PEN
= new wxPen (wxT("BLACK"), 1, wxSOLID
);
502 wxWHITE_PEN
= new wxPen (wxT("WHITE"), 1, wxSOLID
);
503 wxTRANSPARENT_PEN
= new wxPen (wxT("BLACK"), 1, wxTRANSPARENT
);
504 wxBLACK_DASHED_PEN
= new wxPen (wxT("BLACK"), 1, wxSHORT_DASH
);
505 wxGREY_PEN
= new wxPen (wxT("GREY"), 1, wxSOLID
);
506 wxMEDIUM_GREY_PEN
= new wxPen (wxT("MEDIUM GREY"), 1, wxSOLID
);
507 wxLIGHT_GREY_PEN
= new wxPen (wxT("LIGHT GREY"), 1, wxSOLID
);
509 wxBLUE_BRUSH
= new wxBrush (wxT("BLUE"), wxSOLID
);
510 wxGREEN_BRUSH
= new wxBrush (wxT("GREEN"), wxSOLID
);
511 wxWHITE_BRUSH
= new wxBrush (wxT("WHITE"), wxSOLID
);
512 wxBLACK_BRUSH
= new wxBrush (wxT("BLACK"), wxSOLID
);
513 wxTRANSPARENT_BRUSH
= new wxBrush (wxT("BLACK"), wxTRANSPARENT
);
514 wxCYAN_BRUSH
= new wxBrush (wxT("CYAN"), wxSOLID
);
515 wxRED_BRUSH
= new wxBrush (wxT("RED"), wxSOLID
);
516 wxGREY_BRUSH
= new wxBrush (wxT("GREY"), wxSOLID
);
517 wxMEDIUM_GREY_BRUSH
= new wxBrush (wxT("MEDIUM GREY"), wxSOLID
);
518 wxLIGHT_GREY_BRUSH
= new wxBrush (wxT("LIGHT GREY"), wxSOLID
);
520 wxBLACK
= new wxColour (wxT("BLACK"));
521 wxWHITE
= new wxColour (wxT("WHITE"));
522 wxRED
= new wxColour (wxT("RED"));
523 wxBLUE
= new wxColour (wxT("BLUE"));
524 wxGREEN
= new wxColour (wxT("GREEN"));
525 wxCYAN
= new wxColour (wxT("CYAN"));
526 wxLIGHT_GREY
= new wxColour (wxT("LIGHT GREY"));
528 wxSTANDARD_CURSOR
= new wxCursor (wxCURSOR_ARROW
);
529 wxHOURGLASS_CURSOR
= new wxCursor (wxCURSOR_WAIT
);
530 wxCROSS_CURSOR
= new wxCursor (wxCURSOR_CROSS
);
533 void wxDeleteStockObjects ()
535 wxDELETE(wxNORMAL_FONT
);
536 wxDELETE(wxSMALL_FONT
);
537 wxDELETE(wxITALIC_FONT
);
538 wxDELETE(wxSWISS_FONT
);
541 wxDELETE(wxCYAN_PEN
);
542 wxDELETE(wxGREEN_PEN
);
543 wxDELETE(wxBLACK_PEN
);
544 wxDELETE(wxWHITE_PEN
);
545 wxDELETE(wxTRANSPARENT_PEN
);
546 wxDELETE(wxBLACK_DASHED_PEN
);
547 wxDELETE(wxGREY_PEN
);
548 wxDELETE(wxMEDIUM_GREY_PEN
);
549 wxDELETE(wxLIGHT_GREY_PEN
);
551 wxDELETE(wxBLUE_BRUSH
);
552 wxDELETE(wxGREEN_BRUSH
);
553 wxDELETE(wxWHITE_BRUSH
);
554 wxDELETE(wxBLACK_BRUSH
);
555 wxDELETE(wxTRANSPARENT_BRUSH
);
556 wxDELETE(wxCYAN_BRUSH
);
557 wxDELETE(wxRED_BRUSH
);
558 wxDELETE(wxGREY_BRUSH
);
559 wxDELETE(wxMEDIUM_GREY_BRUSH
);
560 wxDELETE(wxLIGHT_GREY_BRUSH
);
568 wxDELETE(wxLIGHT_GREY
);
570 wxDELETE(wxSTANDARD_CURSOR
);
571 wxDELETE(wxHOURGLASS_CURSOR
);
572 wxDELETE(wxCROSS_CURSOR
);
575 void wxDeleteStockLists()
577 wxDELETE(wxTheBrushList
);
578 wxDELETE(wxThePenList
);
579 wxDELETE(wxTheFontList
);
580 wxDELETE(wxTheBitmapList
);
583 // ============================================================================
584 // wxTheXXXList stuff (semi-obsolete)
585 // ============================================================================
587 wxBitmapList::wxBitmapList()
591 wxBitmapList::~wxBitmapList ()
593 wxList::compatibility_iterator node
= GetFirst ();
596 wxBitmap
*bitmap
= (wxBitmap
*) node
->GetData ();
597 wxList::compatibility_iterator next
= node
->GetNext ();
598 if (bitmap
->GetVisible())
604 // Pen and Brush lists
605 wxPenList::~wxPenList ()
607 wxList::compatibility_iterator node
= GetFirst ();
610 wxPen
*pen
= (wxPen
*) node
->GetData ();
611 wxList::compatibility_iterator next
= node
->GetNext ();
612 if (pen
->GetVisible())
618 void wxPenList::AddPen (wxPen
* pen
)
623 void wxPenList::RemovePen (wxPen
* pen
)
628 wxPen
*wxPenList::FindOrCreatePen (const wxColour
& colour
, int width
, int style
)
630 for (wxList::compatibility_iterator node
= GetFirst (); node
; node
= node
->GetNext ())
632 wxPen
*each_pen
= (wxPen
*) node
->GetData ();
634 each_pen
->GetVisible() &&
635 each_pen
->GetWidth () == width
&&
636 each_pen
->GetStyle () == style
&&
637 each_pen
->GetColour ().Red () == colour
.Red () &&
638 each_pen
->GetColour ().Green () == colour
.Green () &&
639 each_pen
->GetColour ().Blue () == colour
.Blue ())
643 wxPen
*pen
= new wxPen (colour
, width
, style
);
646 // don't save the invalid pens in the list
654 // we'll delete it ourselves later
655 pen
->SetVisible(TRUE
);
660 wxBrushList::~wxBrushList ()
662 wxList::compatibility_iterator node
= GetFirst ();
665 wxBrush
*brush
= (wxBrush
*) node
->GetData ();
666 wxList::compatibility_iterator next
= node
->GetNext ();
667 if (brush
&& brush
->GetVisible())
673 void wxBrushList::AddBrush (wxBrush
* brush
)
678 wxBrush
*wxBrushList::FindOrCreateBrush (const wxColour
& colour
, int style
)
680 for (wxList::compatibility_iterator node
= GetFirst (); node
; node
= node
->GetNext ())
682 wxBrush
*each_brush
= (wxBrush
*) node
->GetData ();
684 each_brush
->GetVisible() &&
685 each_brush
->GetStyle () == style
&&
686 each_brush
->GetColour ().Red () == colour
.Red () &&
687 each_brush
->GetColour ().Green () == colour
.Green () &&
688 each_brush
->GetColour ().Blue () == colour
.Blue ())
692 wxBrush
*brush
= new wxBrush (colour
, style
);
696 // don't put the brushes we failed to create into the list
704 // we'll delete it ourselves later
705 brush
->SetVisible(TRUE
);
710 void wxBrushList::RemoveBrush (wxBrush
* brush
)
712 DeleteObject (brush
);
715 wxFontList::~wxFontList ()
717 wxList::compatibility_iterator node
= GetFirst ();
720 // Only delete objects that are 'visible', i.e.
721 // that have been created using FindOrCreate...,
722 // where the pointers are expected to be shared
723 // (and therefore not deleted by any one part of an app).
724 wxFont
*font
= (wxFont
*) node
->GetData ();
725 wxList::compatibility_iterator next
= node
->GetNext ();
726 if (font
->GetVisible())
732 void wxFontList::AddFont (wxFont
* font
)
737 void wxFontList::RemoveFont (wxFont
* font
)
742 wxFont
*wxFontList::FindOrCreateFont(int pointSize
,
747 const wxString
& facename
,
748 wxFontEncoding encoding
)
750 wxFont
*font
= (wxFont
*)NULL
;
751 wxList::compatibility_iterator node
;
752 for ( node
= GetFirst(); node
; node
= node
->GetNext() )
754 font
= (wxFont
*)node
->GetData();
755 if ( font
->GetVisible() &&
757 font
->GetPointSize () == pointSize
&&
758 font
->GetStyle () == style
&&
759 font
->GetWeight () == weight
&&
760 font
->GetUnderlined () == underline
)
762 int fontFamily
= font
->GetFamily();
764 #if defined(__WXGTK__)
765 // under GTK the default family is wxSWISS, so looking for a font
766 // with wxDEFAULT family should return a wxSWISS one instead of
767 // creating a new one
768 bool same
= (fontFamily
== family
) ||
769 (fontFamily
== wxSWISS
&& family
== wxDEFAULT
);
771 // VZ: but why elsewhere do we require an exact match? mystery...
772 bool same
= fontFamily
== family
;
775 // empty facename matches anything at all: this is bad because
776 // depending on which fonts are already created, we might get back
777 // a different font if we create it with empty facename, but it is
778 // still better than never matching anything in the cache at all
780 if ( same
&& !!facename
)
782 const wxString
& fontFace
= font
->GetFaceName();
784 // empty facename matches everything
785 same
= !fontFace
|| fontFace
== facename
;
788 if ( same
&& (encoding
!= wxFONTENCODING_DEFAULT
) )
790 // have to match the encoding too
791 same
= font
->GetEncoding() == encoding
;
803 // font not found, create the new one
804 font
= new wxFont(pointSize
, family
, style
, weight
,
805 underline
, facename
, encoding
);
809 // and mark it as being cacheable
810 font
->SetVisible(TRUE
);
816 void wxBitmapList::AddBitmap(wxBitmap
*bitmap
)
821 void wxBitmapList::RemoveBitmap(wxBitmap
*bitmap
)
823 DeleteObject(bitmap
);
826 wxSize
wxGetDisplaySize()
829 wxDisplaySize(& x
, & y
);
833 wxRect
wxGetClientDisplayRect()
835 int x
, y
, width
, height
;
836 wxClientDisplayRect(&x
, &y
, &width
, &height
); // call plat-specific version
837 return wxRect(x
, y
, width
, height
);
840 wxSize
wxGetDisplaySizeMM()
843 wxDisplaySizeMM(& x
, & y
);
847 wxResourceCache::~wxResourceCache ()
849 wxList::compatibility_iterator node
= GetFirst ();
851 wxObject
*item
= (wxObject
*)node
->GetData();
854 node
= node
->GetNext ();