X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1de8d512b7c844d67b2dab36addc89868e68c9b6..cc1487e53905bd534dba2099d33ac2142cec7818:/src/common/gdicmn.cpp?ds=sidebyside diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index cbc45edf1f..617a8d344b 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -9,49 +9,48 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __VMS -#define XtDisplay XTDISPLAY -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif -#include "wx/event.h" #include "wx/gdicmn.h" -#include "wx/brush.h" -#include "wx/pen.h" -#include "wx/bitmap.h" -#include "wx/icon.h" -#include "wx/cursor.h" -#include "wx/font.h" -#include "wx/palette.h" -#include "wx/app.h" -#include "wx/dc.h" -#include "wx/utils.h" -#include "wx/settings.h" -#include "wx/hashmap.h" - -#include "wx/log.h" -#include - -#ifdef __WXMOTIF__ -#ifdef __VMS__ -#pragma message disable nosimpint -#endif -#include -#ifdef __VMS__ -#pragma message enable nosimpint -#endif + +#ifndef WX_PRECOMP + #include "wx/log.h" + #include "wx/pen.h" + #include "wx/brush.h" + #include "wx/palette.h" + #include "wx/icon.h" + #include "wx/cursor.h" + #include "wx/settings.h" + #include "wx/bitmap.h" + #include "wx/colour.h" + #include "wx/font.h" #endif -#ifdef __WXX11__ -#include "X11/Xlib.h" +WXDLLIMPEXP_DATA_CORE(wxBrushList*) wxTheBrushList; +WXDLLIMPEXP_DATA_CORE(wxFontList*) wxTheFontList; +WXDLLIMPEXP_DATA_CORE(wxPenList*) wxThePenList; + +WXDLLIMPEXP_DATA_CORE(wxColourDatabase*) wxTheColourDatabase; + +WXDLLIMPEXP_DATA_CORE(wxBitmap) wxNullBitmap; +WXDLLIMPEXP_DATA_CORE(wxBrush) wxNullBrush; +WXDLLIMPEXP_DATA_CORE(wxColour) wxNullColour; +WXDLLIMPEXP_DATA_CORE(wxCursor) wxNullCursor; +WXDLLIMPEXP_DATA_CORE(wxFont) wxNullFont; +WXDLLIMPEXP_DATA_CORE(wxIcon) wxNullIcon; +WXDLLIMPEXP_DATA_CORE(wxPen) wxNullPen; +#if wxUSE_PALETTE +WXDLLIMPEXP_DATA_CORE(wxPalette) wxNullPalette; #endif +const wxSize wxDefaultSize(wxDefaultCoord, wxDefaultCoord); +const wxPoint wxDefaultPosition(wxDefaultCoord, wxDefaultCoord); + #if wxUSE_EXTENDED_RTTI // wxPoint @@ -82,8 +81,6 @@ wxCUSTOM_TYPE_INFO(wxSize, wxToStringConverter , wxFromStringConverterInitialize(); - // first look among the existing colours - // make the comparaison case insensitive and also match both grey and gray wxString colName = colour; colName.MakeUpper(); @@ -415,48 +410,12 @@ wxColour wxColourDatabase::Find(const wxString& colour) const if ( it != m_map->end() ) return *(it->second); - // if we didn't find it, query the system, maybe it knows about it -#if defined(__WXGTK__) || defined(__X__) - wxColour col = wxColour::CreateByName(colour); - - if ( col.Ok() ) - { - // cache it - self->AddColour(colour, col); - } - - return col; -#elif defined(__X__) - // TODO: move this to wxColour::CreateByName() - XColor xcolour; - -#ifdef __WXMOTIF__ - Display *display = XtDisplay((Widget) wxTheApp->GetTopLevelWidget()) ; -#endif -#ifdef __WXX11__ - Display* display = (Display*) wxGetDisplay(); -#endif - /* MATTHEW: [4] Use wxGetMainColormap */ - if (!XParseColor(display, (Colormap) wxTheApp->GetMainColormap((WXDisplay*) display), colour.ToAscii() ,&xcolour)) - return NULL; - -#if wxUSE_NANOX - unsigned char r = (unsigned char)(xcolour.red); - unsigned char g = (unsigned char)(xcolour.green); - unsigned char b = (unsigned char)(xcolour.blue); -#else - unsigned char r = (unsigned char)(xcolour.red >> 8); - unsigned char g = (unsigned char)(xcolour.green >> 8); - unsigned char b = (unsigned char)(xcolour.blue >> 8); -#endif - - wxColour col(r, g, b); - AddColour(colour, col); - - return col; -#else // other platform + // we did not find any result in existing colours: + // we won't use wxString -> wxColour conversion because the + // wxColour::Set(const wxString &) function which does that conversion + // internally uses this function (wxColourDatabase::Find) and we want + // to avoid infinite recursion ! return wxNullColour; -#endif // platforms } wxString wxColourDatabase::FindName(const wxColour& colour) const