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 wxTheColourDatabase
= new wxColourDatabase
;
440 wxTheColourDatabase
->Initialize();
442 wxTheBrushList
= new wxBrushList
;
443 wxThePenList
= new wxPenList
;
444 wxTheFontList
= new wxFontList
;
445 wxTheBitmapList
= new wxBitmapList
;
448 void wxInitializeStockObjects ()
454 // wxFontPool = new XFontPool;
457 // why under MSW fonts shouldn't have the standard system size?
460 static const int sizeFont = 10;
464 #if defined(__WXMAC__)
471 GetThemeFont(kThemeSystemFont
, GetApplicationScript() , fontName
, &fontSize
, &fontStyle
) ;
472 sizeFont
= fontSize
;
473 wxSWISS_FONT
= new wxFont (fontSize
, wxSWISS
, wxNORMAL
, wxNORMAL
, false , wxMacMakeStringFromPascal(fontName
) );
474 #elif defined(__WXPM__)
475 static const int sizeFont
= 12;
477 wxNORMAL_FONT
= new wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
));
478 static const int sizeFont
= wxNORMAL_FONT
->GetPointSize();
481 #if defined(__WXPM__)
483 // Basic OS/2 has a fairly limited number of fonts and these are as good
484 // as I can do to get something that looks halfway "wx" normal
486 wxNORMAL_FONT
= new wxFont (sizeFont
, wxMODERN
, wxNORMAL
, wxBOLD
);
487 wxSMALL_FONT
= new wxFont (sizeFont
- 4, wxSWISS
, wxNORMAL
, wxNORMAL
); /* Helv */
488 wxITALIC_FONT
= new wxFont (sizeFont
, wxROMAN
, wxITALIC
, wxNORMAL
);
489 wxSWISS_FONT
= new wxFont (sizeFont
, wxSWISS
, wxNORMAL
, wxNORMAL
); /* Helv */
490 #elif defined(__WXMAC__)
491 wxNORMAL_FONT
= new wxFont (sizeFont
, wxMODERN
, wxNORMAL
, wxNORMAL
);
492 wxITALIC_FONT
= new wxFont (sizeFont
, wxROMAN
, wxITALIC
, wxNORMAL
);
493 GetThemeFont(kThemeSmallSystemFont
, GetApplicationScript() , fontName
, &fontSize
, &fontStyle
) ;
494 wxSMALL_FONT
= new wxFont (fontSize
, wxSWISS
, wxNORMAL
, wxNORMAL
, false , wxMacMakeStringFromPascal( fontName
) );
496 wxSMALL_FONT
= new wxFont (sizeFont
- 2, wxSWISS
, wxNORMAL
, wxNORMAL
);
497 wxITALIC_FONT
= new wxFont (sizeFont
, wxROMAN
, wxITALIC
, wxNORMAL
);
498 wxSWISS_FONT
= new wxFont (sizeFont
, wxSWISS
, wxNORMAL
, wxNORMAL
);
501 wxRED_PEN
= new wxPen (wxT("RED"), 1, wxSOLID
);
502 wxCYAN_PEN
= new wxPen (wxT("CYAN"), 1, wxSOLID
);
503 wxGREEN_PEN
= new wxPen (wxT("GREEN"), 1, wxSOLID
);
504 wxBLACK_PEN
= new wxPen (wxT("BLACK"), 1, wxSOLID
);
505 wxWHITE_PEN
= new wxPen (wxT("WHITE"), 1, wxSOLID
);
506 wxTRANSPARENT_PEN
= new wxPen (wxT("BLACK"), 1, wxTRANSPARENT
);
507 wxBLACK_DASHED_PEN
= new wxPen (wxT("BLACK"), 1, wxSHORT_DASH
);
508 wxGREY_PEN
= new wxPen (wxT("GREY"), 1, wxSOLID
);
509 wxMEDIUM_GREY_PEN
= new wxPen (wxT("MEDIUM GREY"), 1, wxSOLID
);
510 wxLIGHT_GREY_PEN
= new wxPen (wxT("LIGHT GREY"), 1, wxSOLID
);
512 wxBLUE_BRUSH
= new wxBrush (wxT("BLUE"), wxSOLID
);
513 wxGREEN_BRUSH
= new wxBrush (wxT("GREEN"), wxSOLID
);
514 wxWHITE_BRUSH
= new wxBrush (wxT("WHITE"), wxSOLID
);
515 wxBLACK_BRUSH
= new wxBrush (wxT("BLACK"), wxSOLID
);
516 wxTRANSPARENT_BRUSH
= new wxBrush (wxT("BLACK"), wxTRANSPARENT
);
517 wxCYAN_BRUSH
= new wxBrush (wxT("CYAN"), wxSOLID
);
518 wxRED_BRUSH
= new wxBrush (wxT("RED"), wxSOLID
);
519 wxGREY_BRUSH
= new wxBrush (wxT("GREY"), wxSOLID
);
520 wxMEDIUM_GREY_BRUSH
= new wxBrush (wxT("MEDIUM GREY"), wxSOLID
);
521 wxLIGHT_GREY_BRUSH
= new wxBrush (wxT("LIGHT GREY"), wxSOLID
);
523 wxBLACK
= new wxColour (wxT("BLACK"));
524 wxWHITE
= new wxColour (wxT("WHITE"));
525 wxRED
= new wxColour (wxT("RED"));
526 wxBLUE
= new wxColour (wxT("BLUE"));
527 wxGREEN
= new wxColour (wxT("GREEN"));
528 wxCYAN
= new wxColour (wxT("CYAN"));
529 wxLIGHT_GREY
= new wxColour (wxT("LIGHT GREY"));
531 wxSTANDARD_CURSOR
= new wxCursor (wxCURSOR_ARROW
);
532 wxHOURGLASS_CURSOR
= new wxCursor (wxCURSOR_WAIT
);
533 wxCROSS_CURSOR
= new wxCursor (wxCURSOR_CROSS
);
536 void wxDeleteStockObjects ()
538 wxDELETE(wxNORMAL_FONT
);
539 wxDELETE(wxSMALL_FONT
);
540 wxDELETE(wxITALIC_FONT
);
541 wxDELETE(wxSWISS_FONT
);
544 wxDELETE(wxCYAN_PEN
);
545 wxDELETE(wxGREEN_PEN
);
546 wxDELETE(wxBLACK_PEN
);
547 wxDELETE(wxWHITE_PEN
);
548 wxDELETE(wxTRANSPARENT_PEN
);
549 wxDELETE(wxBLACK_DASHED_PEN
);
550 wxDELETE(wxGREY_PEN
);
551 wxDELETE(wxMEDIUM_GREY_PEN
);
552 wxDELETE(wxLIGHT_GREY_PEN
);
554 wxDELETE(wxBLUE_BRUSH
);
555 wxDELETE(wxGREEN_BRUSH
);
556 wxDELETE(wxWHITE_BRUSH
);
557 wxDELETE(wxBLACK_BRUSH
);
558 wxDELETE(wxTRANSPARENT_BRUSH
);
559 wxDELETE(wxCYAN_BRUSH
);
560 wxDELETE(wxRED_BRUSH
);
561 wxDELETE(wxGREY_BRUSH
);
562 wxDELETE(wxMEDIUM_GREY_BRUSH
);
563 wxDELETE(wxLIGHT_GREY_BRUSH
);
571 wxDELETE(wxLIGHT_GREY
);
573 wxDELETE(wxSTANDARD_CURSOR
);
574 wxDELETE(wxHOURGLASS_CURSOR
);
575 wxDELETE(wxCROSS_CURSOR
);
578 void wxDeleteStockLists()
580 wxDELETE(wxTheBrushList
);
581 wxDELETE(wxThePenList
);
582 wxDELETE(wxTheFontList
);
583 wxDELETE(wxTheBitmapList
);
586 // ============================================================================
587 // wxTheXXXList stuff (semi-obsolete)
588 // ============================================================================
590 wxBitmapList::wxBitmapList()
594 wxBitmapList::~wxBitmapList ()
596 wxList::compatibility_iterator node
= GetFirst ();
599 wxBitmap
*bitmap
= (wxBitmap
*) node
->GetData ();
600 wxList::compatibility_iterator next
= node
->GetNext ();
601 if (bitmap
->GetVisible())
607 // Pen and Brush lists
608 wxPenList::~wxPenList ()
610 wxList::compatibility_iterator node
= GetFirst ();
613 wxPen
*pen
= (wxPen
*) node
->GetData ();
614 wxList::compatibility_iterator next
= node
->GetNext ();
615 if (pen
->GetVisible())
621 void wxPenList::AddPen (wxPen
* pen
)
626 void wxPenList::RemovePen (wxPen
* pen
)
631 wxPen
*wxPenList::FindOrCreatePen (const wxColour
& colour
, int width
, int style
)
633 for (wxList::compatibility_iterator node
= GetFirst (); node
; node
= node
->GetNext ())
635 wxPen
*each_pen
= (wxPen
*) node
->GetData ();
637 each_pen
->GetVisible() &&
638 each_pen
->GetWidth () == width
&&
639 each_pen
->GetStyle () == style
&&
640 each_pen
->GetColour ().Red () == colour
.Red () &&
641 each_pen
->GetColour ().Green () == colour
.Green () &&
642 each_pen
->GetColour ().Blue () == colour
.Blue ())
646 wxPen
*pen
= new wxPen (colour
, width
, style
);
649 // don't save the invalid pens in the list
657 // we'll delete it ourselves later
658 pen
->SetVisible(TRUE
);
663 wxBrushList::~wxBrushList ()
665 wxList::compatibility_iterator node
= GetFirst ();
668 wxBrush
*brush
= (wxBrush
*) node
->GetData ();
669 wxList::compatibility_iterator next
= node
->GetNext ();
670 if (brush
&& brush
->GetVisible())
676 void wxBrushList::AddBrush (wxBrush
* brush
)
681 wxBrush
*wxBrushList::FindOrCreateBrush (const wxColour
& colour
, int style
)
683 for (wxList::compatibility_iterator node
= GetFirst (); node
; node
= node
->GetNext ())
685 wxBrush
*each_brush
= (wxBrush
*) node
->GetData ();
687 each_brush
->GetVisible() &&
688 each_brush
->GetStyle () == style
&&
689 each_brush
->GetColour ().Red () == colour
.Red () &&
690 each_brush
->GetColour ().Green () == colour
.Green () &&
691 each_brush
->GetColour ().Blue () == colour
.Blue ())
695 wxBrush
*brush
= new wxBrush (colour
, style
);
699 // don't put the brushes we failed to create into the list
707 // we'll delete it ourselves later
708 brush
->SetVisible(TRUE
);
713 void wxBrushList::RemoveBrush (wxBrush
* brush
)
715 DeleteObject (brush
);
718 wxFontList::~wxFontList ()
720 wxList::compatibility_iterator node
= GetFirst ();
723 // Only delete objects that are 'visible', i.e.
724 // that have been created using FindOrCreate...,
725 // where the pointers are expected to be shared
726 // (and therefore not deleted by any one part of an app).
727 wxFont
*font
= (wxFont
*) node
->GetData ();
728 wxList::compatibility_iterator next
= node
->GetNext ();
729 if (font
->GetVisible())
735 void wxFontList::AddFont (wxFont
* font
)
740 void wxFontList::RemoveFont (wxFont
* font
)
745 wxFont
*wxFontList::FindOrCreateFont(int pointSize
,
750 const wxString
& facename
,
751 wxFontEncoding encoding
)
753 wxFont
*font
= (wxFont
*)NULL
;
754 wxList::compatibility_iterator node
;
755 for ( node
= GetFirst(); node
; node
= node
->GetNext() )
757 font
= (wxFont
*)node
->GetData();
758 if ( font
->GetVisible() &&
760 font
->GetPointSize () == pointSize
&&
761 font
->GetStyle () == style
&&
762 font
->GetWeight () == weight
&&
763 font
->GetUnderlined () == underline
)
765 int fontFamily
= font
->GetFamily();
767 #if defined(__WXGTK__)
768 // under GTK the default family is wxSWISS, so looking for a font
769 // with wxDEFAULT family should return a wxSWISS one instead of
770 // creating a new one
771 bool same
= (fontFamily
== family
) ||
772 (fontFamily
== wxSWISS
&& family
== wxDEFAULT
);
774 // VZ: but why elsewhere do we require an exact match? mystery...
775 bool same
= fontFamily
== family
;
778 // empty facename matches anything at all: this is bad because
779 // depending on which fonts are already created, we might get back
780 // a different font if we create it with empty facename, but it is
781 // still better than never matching anything in the cache at all
783 if ( same
&& !!facename
)
785 const wxString
& fontFace
= font
->GetFaceName();
787 // empty facename matches everything
788 same
= !fontFace
|| fontFace
== facename
;
791 if ( same
&& (encoding
!= wxFONTENCODING_DEFAULT
) )
793 // have to match the encoding too
794 same
= font
->GetEncoding() == encoding
;
806 // font not found, create the new one
807 font
= new wxFont(pointSize
, family
, style
, weight
,
808 underline
, facename
, encoding
);
812 // and mark it as being cacheable
813 font
->SetVisible(TRUE
);
819 void wxBitmapList::AddBitmap(wxBitmap
*bitmap
)
824 void wxBitmapList::RemoveBitmap(wxBitmap
*bitmap
)
826 DeleteObject(bitmap
);
829 wxSize
wxGetDisplaySize()
832 wxDisplaySize(& x
, & y
);
836 wxRect
wxGetClientDisplayRect()
838 int x
, y
, width
, height
;
839 wxClientDisplayRect(&x
, &y
, &width
, &height
); // call plat-specific version
840 return wxRect(x
, y
, width
, height
);
843 wxSize
wxGetDisplaySizeMM()
846 wxDisplaySizeMM(& x
, & y
);
850 wxResourceCache::~wxResourceCache ()
852 wxList::compatibility_iterator node
= GetFirst ();
854 wxObject
*item
= (wxObject
*)node
->GetData();
857 node
= node
->GetNext ();