// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "gdicmn.h"
#endif
#include <string.h>
#ifdef __WXMSW__
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
#endif
#ifdef __WXMOTIF__
#include "wx/mac/private.h"
#include "wx/mac/uma.h"
#endif
-//IMPLEMENT_CLASS(wxColourDatabase, wxList)
-//IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
-//IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
-//IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
-//IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
-//IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
+
+#if wxUSE_EXTENDED_RTTI
+
+// wxPoint
+
+template<> void wxStringReadValue(const wxString &s , wxPoint &data )
+{
+ wxSscanf(s, wxT("%d,%d"), &data.x , &data.y ) ;
+}
+
+template<> void wxStringWriteValue(wxString &s , const wxPoint &data )
+{
+ s = wxString::Format(wxT("%d,%d"), data.x , data.y ) ;
+}
+
+WX_CUSTOM_TYPE_INFO(wxPoint, wxToStringConverter<wxPoint> , wxFromStringConverter<wxPoint>)
+
+template<> void wxStringReadValue(const wxString &s , wxSize &data )
+{
+ wxSscanf(s, wxT("%d,%d"), &data.x , &data.y ) ;
+}
+
+template<> void wxStringWriteValue(wxString &s , const wxSize &data )
+{
+ s = wxString::Format(wxT("%d,%d"), data.x , data.y ) ;
+}
+
+WX_CUSTOM_TYPE_INFO(wxSize, wxToStringConverter<wxSize> , wxFromStringConverter<wxSize>)
+
+#endif
IMPLEMENT_ABSTRACT_CLASS(wxDCBase, wxObject)
wxColourDatabase::~wxColourDatabase ()
{
- typedef wxStringToColourHashMap::iterator iterator;
-
- for( iterator it = m_map->begin(), en = m_map->end(); it != en; ++it )
- delete it->second;
+ WX_CLEAR_HASH_MAP(wxStringToColourHashMap, *m_map);
delete m_map;
m_map = NULL;
{wxT("WHITE"), 255, 255, 255},
{wxT("YELLOW"), 255, 255, 0},
{wxT("YELLOW GREEN"), 153, 204, 50},
+ {wxT("YELLOW GREEN"), 153, 204, 50}
};
size_t n;
for ( n = 0; n < WXSIZEOF(wxColourTable); n++ )
{
const wxColourDesc& cc = wxColourTable[n];
- (*m_map)[cc.name] = new wxColour(cc.r,cc.g,cc.b);
+ AddColour(cc.name, new wxColour(cc.r,cc.g,cc.b));
}
#ifdef __WXPM__
m_palTable = new long[n];
return ((wxColourDatabase*)this)->FindColour(colour, false);
}
+void wxColourDatabase::AddColour (const wxString& name, wxColour* colour)
+{
+ wxString colName = name;
+ colName.MakeUpper();
+ wxString colName2 = colName;
+ if ( !colName2.Replace(_T("GRAY"), _T("GREY")) )
+ colName2.clear();
+
+ wxStringToColourHashMap::iterator it = m_map->find(colName);
+ if ( it == m_map->end() )
+ it = m_map->find(colName2);
+ if ( it != m_map->end() )
+ {
+ delete it->second;
+ it->second = colour;
+ }
+
+ (*m_map)[name] = colour;
+}
+
wxColour *wxColourDatabase::FindColour(const wxString& colour, bool add)
{
// VZ: make the comparaison case insensitive and also match both grey and
delete col;
return (wxColour *) NULL;
}
- (*m_map)[colour] = col;
+ AddColour(colour, col);
return col;
#endif
#endif
wxColour *col = new wxColour(r, g, b);
- (*m_map)[colour] = col;
+ AddColour(colour, col);
return col;
#endif // __X__