1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/gdicmn.cpp
3 // Purpose: Common GDI classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
19 #include "wx/gdicmn.h"
20 #include "wx/gdiobj.h"
26 #include "wx/palette.h"
28 #include "wx/iconbndl.h"
29 #include "wx/cursor.h"
30 #include "wx/settings.h"
31 #include "wx/bitmap.h"
32 #include "wx/colour.h"
37 IMPLEMENT_ABSTRACT_CLASS(wxGDIObject
, wxObject
)
40 WXDLLIMPEXP_DATA_CORE(wxBrushList
*) wxTheBrushList
;
41 WXDLLIMPEXP_DATA_CORE(wxFontList
*) wxTheFontList
;
42 WXDLLIMPEXP_DATA_CORE(wxPenList
*) wxThePenList
;
44 WXDLLIMPEXP_DATA_CORE(wxColourDatabase
*) wxTheColourDatabase
;
46 WXDLLIMPEXP_DATA_CORE(wxBitmap
) wxNullBitmap
;
47 WXDLLIMPEXP_DATA_CORE(wxBrush
) wxNullBrush
;
48 WXDLLIMPEXP_DATA_CORE(wxColour
) wxNullColour
;
49 WXDLLIMPEXP_DATA_CORE(wxCursor
) wxNullCursor
;
50 WXDLLIMPEXP_DATA_CORE(wxFont
) wxNullFont
;
51 WXDLLIMPEXP_DATA_CORE(wxIcon
) wxNullIcon
;
52 WXDLLIMPEXP_DATA_CORE(wxPen
) wxNullPen
;
54 WXDLLIMPEXP_DATA_CORE(wxPalette
) wxNullPalette
;
56 WXDLLIMPEXP_DATA_CORE(wxIconBundle
) wxNullIconBundle
;
58 const wxSize
wxDefaultSize(wxDefaultCoord
, wxDefaultCoord
);
59 const wxPoint
wxDefaultPosition(wxDefaultCoord
, wxDefaultCoord
);
61 #include "wx/listimpl.cpp"
62 WX_DEFINE_LIST(wxPointList
)
65 #if wxUSE_EXTENDED_RTTI
69 template<> void wxStringReadValue(const wxString
&s
, wxPoint
&data
)
71 wxSscanf(s
, wxT("%d,%d"), &data
.x
, &data
.y
) ;
74 template<> void wxStringWriteValue(wxString
&s
, const wxPoint
&data
)
76 s
= wxString::Format(wxT("%d,%d"), data
.x
, data
.y
) ;
79 wxCUSTOM_TYPE_INFO(wxPoint
, wxToStringConverter
<wxPoint
> , wxFromStringConverter
<wxPoint
>)
81 template<> void wxStringReadValue(const wxString
&s
, wxSize
&data
)
83 wxSscanf(s
, wxT("%d,%d"), &data
.x
, &data
.y
) ;
86 template<> void wxStringWriteValue(wxString
&s
, const wxSize
&data
)
88 s
= wxString::Format(wxT("%d,%d"), data
.x
, data
.y
) ;
91 wxCUSTOM_TYPE_INFO(wxSize
, wxToStringConverter
<wxSize
> , wxFromStringConverter
<wxSize
>)
95 wxRect::wxRect(const wxPoint
& point1
, const wxPoint
& point2
)
99 width
= point2
.x
- point1
.x
;
100 height
= point2
.y
- point1
.y
;
117 wxRect
& wxRect::Union(const wxRect
& rect
)
119 // ignore empty rectangles: union with an empty rectangle shouldn't extend
120 // this one to (0, 0)
121 if ( !width
|| !height
)
125 else if ( rect
.width
&& rect
.height
)
127 int x1
= wxMin(x
, rect
.x
);
128 int y1
= wxMin(y
, rect
.y
);
129 int y2
= wxMax(y
+ height
, rect
.height
+ rect
.y
);
130 int x2
= wxMax(x
+ width
, rect
.width
+ rect
.x
);
137 //else: we're not empty and rect is empty
142 wxRect
& wxRect::Inflate(wxCoord dx
, wxCoord dy
)
146 // Don't allow deflate to eat more width than we have,
147 // a well-defined rectangle cannot have negative width.
153 // The inflate is valid.
160 // Don't allow deflate to eat more height than we have,
161 // a well-defined rectangle cannot have negative height.
167 // The inflate is valid.
175 bool wxRect::Contains(int cx
, int cy
) const
177 return ( (cx
>= x
) && (cy
>= y
)
178 && ((cy
- y
) < height
)
179 && ((cx
- x
) < width
)
183 bool wxRect::Contains(const wxRect
& rect
) const
185 return Contains(rect
.GetTopLeft()) && Contains(rect
.GetBottomRight());
188 wxRect
& wxRect::Intersect(const wxRect
& rect
)
197 if ( x2
> rect
.GetRight() )
198 x2
= rect
.GetRight();
199 if ( y2
> rect
.GetBottom() )
200 y2
= rect
.GetBottom();
205 if ( width
<= 0 || height
<= 0 )
214 bool wxRect::Intersects(const wxRect
& rect
) const
216 wxRect r
= Intersect(rect
);
218 // if there is no intersection, both width and height are 0
222 wxRect
& wxRect::operator+=(const wxRect
& rect
)
224 *this = *this + rect
;
229 wxRect
& wxRect::operator*=(const wxRect
& rect
)
231 *this = *this * rect
;
236 wxRect
operator+(const wxRect
& r1
, const wxRect
& r2
)
238 int x1
= wxMin(r1
.x
, r2
.x
);
239 int y1
= wxMin(r1
.y
, r2
.y
);
240 int y2
= wxMax(r1
.y
+r1
.height
, r2
.height
+r2
.y
);
241 int x2
= wxMax(r1
.x
+r1
.width
, r2
.width
+r2
.x
);
242 return wxRect(x1
, y1
, x2
-x1
, y2
-y1
);
245 wxRect
operator*(const wxRect
& r1
, const wxRect
& r2
)
247 int x1
= wxMax(r1
.x
, r2
.x
);
248 int y1
= wxMax(r1
.y
, r2
.y
);
249 int y2
= wxMin(r1
.y
+r1
.height
, r2
.height
+r2
.y
);
250 int x2
= wxMin(r1
.x
+r1
.width
, r2
.width
+r2
.x
);
251 return wxRect(x1
, y1
, x2
-x1
, y2
-y1
);
254 // ============================================================================
256 // ============================================================================
258 // ----------------------------------------------------------------------------
259 // wxColourDatabase ctor/dtor
260 // ----------------------------------------------------------------------------
262 wxColourDatabase::wxColourDatabase ()
264 // will be created on demand in Initialize()
268 wxColourDatabase::~wxColourDatabase ()
272 WX_CLEAR_HASH_MAP(wxStringToColourHashMap
, *m_map
);
278 delete [] m_palTable
;
282 // Colour database stuff
283 void wxColourDatabase::Initialize()
287 // already initialized
291 m_map
= new wxStringToColourHashMap
;
293 static const struct wxColourDesc
300 {wxT("AQUAMARINE"),112, 219, 147},
301 {wxT("BLACK"),0, 0, 0},
302 {wxT("BLUE"), 0, 0, 255},
303 {wxT("BLUE VIOLET"), 159, 95, 159},
304 {wxT("BROWN"), 165, 42, 42},
305 {wxT("CADET BLUE"), 95, 159, 159},
306 {wxT("CORAL"), 255, 127, 0},
307 {wxT("CORNFLOWER BLUE"), 66, 66, 111},
308 {wxT("CYAN"), 0, 255, 255},
309 {wxT("DARK GREY"), 47, 47, 47}, // ?
311 {wxT("DARK GREEN"), 47, 79, 47},
312 {wxT("DARK OLIVE GREEN"), 79, 79, 47},
313 {wxT("DARK ORCHID"), 153, 50, 204},
314 {wxT("DARK SLATE BLUE"), 107, 35, 142},
315 {wxT("DARK SLATE GREY"), 47, 79, 79},
316 {wxT("DARK TURQUOISE"), 112, 147, 219},
317 {wxT("DIM GREY"), 84, 84, 84},
318 {wxT("FIREBRICK"), 142, 35, 35},
319 {wxT("FOREST GREEN"), 35, 142, 35},
320 {wxT("GOLD"), 204, 127, 50},
321 {wxT("GOLDENROD"), 219, 219, 112},
322 {wxT("GREY"), 128, 128, 128},
323 {wxT("GREEN"), 0, 255, 0},
324 {wxT("GREEN YELLOW"), 147, 219, 112},
325 {wxT("INDIAN RED"), 79, 47, 47},
326 {wxT("KHAKI"), 159, 159, 95},
327 {wxT("LIGHT BLUE"), 191, 216, 216},
328 {wxT("LIGHT GREY"), 192, 192, 192},
329 {wxT("LIGHT STEEL BLUE"), 143, 143, 188},
330 {wxT("LIME GREEN"), 50, 204, 50},
331 {wxT("LIGHT MAGENTA"), 255, 0, 255},
332 {wxT("MAGENTA"), 255, 0, 255},
333 {wxT("MAROON"), 142, 35, 107},
334 {wxT("MEDIUM AQUAMARINE"), 50, 204, 153},
335 {wxT("MEDIUM GREY"), 100, 100, 100},
336 {wxT("MEDIUM BLUE"), 50, 50, 204},
337 {wxT("MEDIUM FOREST GREEN"), 107, 142, 35},
338 {wxT("MEDIUM GOLDENROD"), 234, 234, 173},
339 {wxT("MEDIUM ORCHID"), 147, 112, 219},
340 {wxT("MEDIUM SEA GREEN"), 66, 111, 66},
341 {wxT("MEDIUM SLATE BLUE"), 127, 0, 255},
342 {wxT("MEDIUM SPRING GREEN"), 127, 255, 0},
343 {wxT("MEDIUM TURQUOISE"), 112, 219, 219},
344 {wxT("MEDIUM VIOLET RED"), 219, 112, 147},
345 {wxT("MIDNIGHT BLUE"), 47, 47, 79},
346 {wxT("NAVY"), 35, 35, 142},
347 {wxT("ORANGE"), 204, 50, 50},
348 {wxT("ORANGE RED"), 255, 0, 127},
349 {wxT("ORCHID"), 219, 112, 219},
350 {wxT("PALE GREEN"), 143, 188, 143},
351 {wxT("PINK"), 255, 192, 203},
352 {wxT("PLUM"), 234, 173, 234},
353 {wxT("PURPLE"), 176, 0, 255},
354 {wxT("RED"), 255, 0, 0},
355 {wxT("SALMON"), 111, 66, 66},
356 {wxT("SEA GREEN"), 35, 142, 107},
357 {wxT("SIENNA"), 142, 107, 35},
358 {wxT("SKY BLUE"), 50, 153, 204},
359 {wxT("SLATE BLUE"), 0, 127, 255},
360 {wxT("SPRING GREEN"), 0, 255, 127},
361 {wxT("STEEL BLUE"), 35, 107, 142},
362 {wxT("TAN"), 219, 147, 112},
363 {wxT("THISTLE"), 216, 191, 216},
364 {wxT("TURQUOISE"), 173, 234, 234},
365 {wxT("VIOLET"), 79, 47, 79},
366 {wxT("VIOLET RED"), 204, 50, 153},
367 {wxT("WHEAT"), 216, 216, 191},
368 {wxT("WHITE"), 255, 255, 255},
369 {wxT("YELLOW"), 255, 255, 0},
370 {wxT("YELLOW GREEN"), 153, 204, 50}
375 for ( n
= 0; n
< WXSIZEOF(wxColourTable
); n
++ )
377 const wxColourDesc
& cc
= wxColourTable
[n
];
378 (*m_map
)[cc
.name
] = new wxColour(cc
.r
, cc
.g
, cc
.b
);
382 m_palTable
= new long[n
];
383 for ( n
= 0; n
< WXSIZEOF(wxColourTable
); n
++ )
385 const wxColourDesc
& cc
= wxColourTable
[n
];
386 m_palTable
[n
] = OS2RGB(cc
.r
,cc
.g
,cc
.b
);
392 // ----------------------------------------------------------------------------
393 // wxColourDatabase operations
394 // ----------------------------------------------------------------------------
396 void wxColourDatabase::AddColour(const wxString
& name
, const wxColour
& colour
)
400 // canonicalize the colour names before using them as keys: they should be
402 wxString colName
= name
;
405 // ... and we also allow both grey/gray
406 wxString colNameAlt
= colName
;
407 if ( !colNameAlt
.Replace(_T("GRAY"), _T("GREY")) )
409 // but in this case it is not necessary so avoid extra search below
413 wxStringToColourHashMap::iterator it
= m_map
->find(colName
);
414 if ( it
== m_map
->end() && !colNameAlt
.empty() )
415 it
= m_map
->find(colNameAlt
);
416 if ( it
!= m_map
->end() )
418 *(it
->second
) = colour
;
422 (*m_map
)[colName
] = new wxColour(colour
);
426 wxColour
wxColourDatabase::Find(const wxString
& colour
) const
428 wxColourDatabase
* const self
= wxConstCast(this, wxColourDatabase
);
431 // make the comparaison case insensitive and also match both grey and gray
432 wxString colName
= colour
;
434 wxString colNameAlt
= colName
;
435 if ( !colNameAlt
.Replace(_T("GRAY"), _T("GREY")) )
438 wxStringToColourHashMap::iterator it
= m_map
->find(colName
);
439 if ( it
== m_map
->end() && !colNameAlt
.empty() )
440 it
= m_map
->find(colNameAlt
);
441 if ( it
!= m_map
->end() )
442 return *(it
->second
);
444 // we did not find any result in existing colours:
445 // we won't use wxString -> wxColour conversion because the
446 // wxColour::Set(const wxString &) function which does that conversion
447 // internally uses this function (wxColourDatabase::Find) and we want
448 // to avoid infinite recursion !
452 wxString
wxColourDatabase::FindName(const wxColour
& colour
) const
454 wxColourDatabase
* const self
= wxConstCast(this, wxColourDatabase
);
457 typedef wxStringToColourHashMap::iterator iterator
;
459 for ( iterator it
= m_map
->begin(), en
= m_map
->end(); it
!= en
; ++it
)
461 if ( *(it
->second
) == colour
)
465 return wxEmptyString
;
468 // ----------------------------------------------------------------------------
469 // deprecated wxColourDatabase methods
470 // ----------------------------------------------------------------------------
472 #if WXWIN_COMPATIBILITY_2_6
473 wxColour
*wxColourDatabase::FindColour(const wxString
& name
)
475 // This function is deprecated, use Find() instead.
476 // Formerly this function sometimes would return a deletable pointer and
477 // sometimes a non-deletable one (when returning a colour from the database).
478 // Trying to delete the latter anyway results in problems, so probably
479 // nobody ever freed the pointers. Currently it always returns a new
480 // instance, which means there will be memory leaks.
481 wxLogDebug(wxT("wxColourDataBase::FindColour():")
482 wxT(" Please use wxColourDataBase::Find() instead"));
484 // using a static variable here is not the most elegant solution but unless
485 // we want to make wxStringToColourHashMap public (i.e. move it to the
486 // header) so that we could have a member function returning
487 // wxStringToColourHashMap::iterator, there is really no good way to do it
490 // and knowing that this function is going to disappear in the next release
491 // anyhow I don't want to waste time on this
493 static wxColour s_col
;
499 return new wxColour(s_col
);
501 #endif // WXWIN_COMPATIBILITY_2_6
503 // ============================================================================
505 // ============================================================================
507 static wxStockGDI gs_wxStockGDI_instance
;
508 wxStockGDI
* wxStockGDI::ms_instance
= &gs_wxStockGDI_instance
;
509 wxObject
* wxStockGDI::ms_stockObject
[ITEMCOUNT
];
511 wxStockGDI::wxStockGDI()
515 wxStockGDI::~wxStockGDI()
519 void wxStockGDI::DeleteAll()
521 for (unsigned i
= 0; i
< ITEMCOUNT
; i
++)
523 delete ms_stockObject
[i
];
524 ms_stockObject
[i
] = NULL
;
528 const wxBrush
* wxStockGDI::GetBrush(Item item
)
530 wxBrush
* brush
= wx_static_cast(wxBrush
*, ms_stockObject
[item
]);
536 brush
= new wxBrush(*GetColour(COLOUR_BLACK
), wxBRUSHSTYLE_SOLID
);
539 brush
= new wxBrush(*GetColour(COLOUR_BLUE
), wxBRUSHSTYLE_SOLID
);
542 brush
= new wxBrush(*GetColour(COLOUR_CYAN
), wxBRUSHSTYLE_SOLID
);
545 brush
= new wxBrush(*GetColour(COLOUR_GREEN
), wxBRUSHSTYLE_SOLID
);
548 brush
= new wxBrush(wxColour(wxT("GREY")), wxBRUSHSTYLE_SOLID
);
550 case BRUSH_LIGHTGREY
:
551 brush
= new wxBrush(*GetColour(COLOUR_LIGHTGREY
), wxBRUSHSTYLE_SOLID
);
553 case BRUSH_MEDIUMGREY
:
554 brush
= new wxBrush(wxColour(wxT("MEDIUM GREY")), wxBRUSHSTYLE_SOLID
);
557 brush
= new wxBrush(*GetColour(COLOUR_RED
), wxBRUSHSTYLE_SOLID
);
559 case BRUSH_TRANSPARENT
:
560 brush
= new wxBrush(*GetColour(COLOUR_BLACK
), wxBRUSHSTYLE_TRANSPARENT
);
563 brush
= new wxBrush(*GetColour(COLOUR_WHITE
), wxBRUSHSTYLE_SOLID
);
568 ms_stockObject
[item
] = brush
;
573 const wxColour
* wxStockGDI::GetColour(Item item
)
575 wxColour
* colour
= wx_static_cast(wxColour
*, ms_stockObject
[item
]);
581 colour
= new wxColour(0, 0, 0);
584 colour
= new wxColour(0, 0, 255);
587 colour
= new wxColour(wxT("CYAN"));
590 colour
= new wxColour(0, 255, 0);
592 case COLOUR_LIGHTGREY
:
593 colour
= new wxColour(wxT("LIGHT GREY"));
596 colour
= new wxColour(255, 0, 0);
599 colour
= new wxColour(255, 255, 255);
604 ms_stockObject
[item
] = colour
;
609 const wxCursor
* wxStockGDI::GetCursor(Item item
)
611 wxCursor
* cursor
= wx_static_cast(wxCursor
*, ms_stockObject
[item
]);
617 cursor
= new wxCursor(wxCURSOR_CROSS
);
619 case CURSOR_HOURGLASS
:
620 cursor
= new wxCursor(wxCURSOR_WAIT
);
622 case CURSOR_STANDARD
:
623 cursor
= new wxCursor(wxCURSOR_ARROW
);
628 ms_stockObject
[item
] = cursor
;
633 const wxFont
* wxStockGDI::GetFont(Item item
)
635 wxFont
* font
= wx_static_cast(wxFont
*, ms_stockObject
[item
]);
641 font
= new wxFont(GetFont(FONT_NORMAL
)->GetPointSize(), wxROMAN
, wxITALIC
, wxNORMAL
);
644 font
= new wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
));
647 font
= new wxFont(GetFont(FONT_NORMAL
)->GetPointSize() - 2, wxSWISS
, wxNORMAL
, wxNORMAL
);
650 font
= new wxFont(GetFont(FONT_NORMAL
)->GetPointSize(), wxSWISS
, wxNORMAL
, wxNORMAL
);
655 ms_stockObject
[item
] = font
;
660 const wxPen
* wxStockGDI::GetPen(Item item
)
662 wxPen
* pen
= wx_static_cast(wxPen
*, ms_stockObject
[item
]);
668 pen
= new wxPen(*GetColour(COLOUR_BLACK
), 1, wxPENSTYLE_SOLID
);
670 case PEN_BLACKDASHED
:
671 pen
= new wxPen(*GetColour(COLOUR_BLACK
), 1, wxPENSTYLE_SHORT_DASH
);
674 pen
= new wxPen(*GetColour(COLOUR_CYAN
), 1, wxPENSTYLE_SOLID
);
677 pen
= new wxPen(*GetColour(COLOUR_GREEN
), 1, wxPENSTYLE_SOLID
);
680 pen
= new wxPen(wxColour(wxT("GREY")), 1, wxPENSTYLE_SOLID
);
683 pen
= new wxPen(*GetColour(COLOUR_LIGHTGREY
), 1, wxPENSTYLE_SOLID
);
686 pen
= new wxPen(wxColour(wxT("MEDIUM GREY")), 1, wxPENSTYLE_SOLID
);
689 pen
= new wxPen(*GetColour(COLOUR_RED
), 1, wxPENSTYLE_SOLID
);
691 case PEN_TRANSPARENT
:
692 pen
= new wxPen(*GetColour(COLOUR_BLACK
), 1, wxPENSTYLE_TRANSPARENT
);
695 pen
= new wxPen(*GetColour(COLOUR_WHITE
), 1, wxPENSTYLE_SOLID
);
700 ms_stockObject
[item
] = pen
;
705 void wxInitializeStockLists()
707 wxTheColourDatabase
= new wxColourDatabase
;
709 wxTheBrushList
= new wxBrushList
;
710 wxThePenList
= new wxPenList
;
711 wxTheFontList
= new wxFontList
;
714 void wxDeleteStockLists()
716 wxDELETE(wxTheBrushList
);
717 wxDELETE(wxThePenList
);
718 wxDELETE(wxTheFontList
);
721 // ============================================================================
722 // wxTheXXXList stuff (semi-obsolete)
723 // ============================================================================
725 wxGDIObjListBase::wxGDIObjListBase()
729 wxGDIObjListBase::~wxGDIObjListBase()
731 for (wxList::compatibility_iterator node
= list
.GetFirst(); node
; node
= node
->GetNext())
733 delete wx_static_cast(wxObject
*, node
->GetData());
737 wxPen
*wxPenList::FindOrCreatePen (const wxColour
& colour
, int width
, wxPenStyle style
)
739 for ( wxList::compatibility_iterator node
= list
.GetFirst();
741 node
= node
->GetNext() )
743 wxPen
* const pen
= (wxPen
*) node
->GetData();
744 if ( pen
->GetWidth () == width
&&
745 pen
->GetStyle () == style
&&
746 pen
->GetColour() == colour
)
751 wxPen
penTmp(colour
, width
, style
);
754 pen
= new wxPen(penTmp
);
761 wxBrush
*wxBrushList::FindOrCreateBrush (const wxColour
& colour
, wxBrushStyle style
)
763 for ( wxList::compatibility_iterator node
= list
.GetFirst();
765 node
= node
->GetNext() )
767 wxBrush
* const brush
= (wxBrush
*) node
->GetData ();
768 if ( brush
->GetStyle() == style
&& brush
->GetColour() == colour
)
772 wxBrush
* brush
= NULL
;
773 wxBrush
brushTmp(colour
, style
);
776 brush
= new wxBrush(brushTmp
);
783 wxFont
*wxFontList::FindOrCreateFont(int pointSize
,
788 const wxString
& facename
,
789 wxFontEncoding encoding
)
792 wxList::compatibility_iterator node
;
793 for (node
= list
.GetFirst(); node
; node
= node
->GetNext())
795 font
= (wxFont
*)node
->GetData();
797 font
->GetPointSize () == pointSize
&&
798 font
->GetStyle () == style
&&
799 font
->GetWeight () == weight
&&
800 font
->GetUnderlined () == underline
)
802 wxFontFamily fontFamily
= (wxFontFamily
)font
->GetFamily();
804 #if defined(__WXGTK__)
805 // under GTK the default family is wxSWISS, so looking for a font
806 // with wxDEFAULT family should return a wxSWISS one instead of
807 // creating a new one
808 bool same
= (fontFamily
== family
) ||
809 (fontFamily
== wxFONTFAMILY_SWISS
&& family
== wxFONTFAMILY_DEFAULT
);
811 // VZ: but why elsewhere do we require an exact match? mystery...
812 bool same
= fontFamily
== family
;
815 // empty facename matches anything at all: this is bad because
816 // depending on which fonts are already created, we might get back
817 // a different font if we create it with empty facename, but it is
818 // still better than never matching anything in the cache at all
820 if ( same
&& !facename
.empty() )
822 const wxString
& fontFace
= font
->GetFaceName();
824 // empty facename matches everything
825 same
= !fontFace
|| fontFace
== facename
;
828 if ( same
&& (encoding
!= wxFONTENCODING_DEFAULT
) )
830 // have to match the encoding too
831 same
= font
->GetEncoding() == encoding
;
841 // font not found, create the new one
843 wxFont
fontTmp(pointSize
, family
, style
, weight
, underline
, facename
, encoding
);
846 font
= new wxFont(fontTmp
);
853 #if WXWIN_COMPATIBILITY_2_6
854 void wxBrushList::AddBrush(wxBrush
*) { }
855 void wxBrushList::RemoveBrush(wxBrush
*) { }
856 void wxFontList::AddFont(wxFont
*) { }
857 void wxFontList::RemoveFont(wxFont
*) { }
858 void wxPenList::AddPen(wxPen
*) { }
859 void wxPenList::RemovePen(wxPen
*) { }
862 wxSize
wxGetDisplaySize()
865 wxDisplaySize(& x
, & y
);
869 wxRect
wxGetClientDisplayRect()
871 int x
, y
, width
, height
;
872 wxClientDisplayRect(&x
, &y
, &width
, &height
); // call plat-specific version
873 return wxRect(x
, y
, width
, height
);
876 wxSize
wxGetDisplaySizeMM()
879 wxDisplaySizeMM(& x
, & y
);
883 wxSize
wxGetDisplayPPI()
885 const wxSize pixels
= wxGetDisplaySize();
886 const wxSize mm
= wxGetDisplaySizeMM();
888 return wxSize((pixels
.x
* 25.4) / mm
.x
,
889 (pixels
.y
* 25.4) / mm
.y
);
892 wxResourceCache::~wxResourceCache ()
894 wxList::compatibility_iterator node
= GetFirst ();
896 wxObject
*item
= (wxObject
*)node
->GetData();
899 node
= node
->GetNext ();