]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/gdicmn.cpp
Added in-place editiging in wxListCtrl
[wxWidgets.git] / src / common / gdicmn.cpp
index 913b36b7b90ec44ba452e3dda05dd230957d7111..e34329304592782a87f71bc951b63366c5702140 100644 (file)
@@ -41,6 +41,7 @@ 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)
 /*
 IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject)
 IMPLEMENT_DYNAMIC_CLASS(wxPoint, wxObject)
@@ -256,6 +257,12 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
   else return NULL;
 #endif
 
+// TODO for other implementations. This should really go into
+// platform-specific directories.
+#ifdef __WXSTUBS__
+  else return NULL;
+#endif
+
 #ifdef __WXGTK__
   else {
     wxColour *col = new wxColour( colour );
@@ -319,14 +326,15 @@ wxString wxColourDatabase::FindName (const wxColour& colour) const
 
 }
 
-void 
-wxInitializeStockObjects ()
-{
+void wxInitializeStockLists () {
   wxTheBrushList = new wxBrushList;
   wxThePenList = new wxPenList;
   wxTheFontList = new wxFontList;
   wxTheBitmapList = new wxBitmapList;
+}
 
+void wxInitializeStockObjects ()
+{
 #ifdef __WXMOTIF__
 #endif
 #ifdef __X__
@@ -376,44 +384,51 @@ wxInitializeStockObjects ()
 void 
 wxDeleteStockObjects ()
 {
-  DELETEP(wxNORMAL_FONT);
-  DELETEP(wxSMALL_FONT);
-  DELETEP(wxITALIC_FONT);
-  DELETEP(wxSWISS_FONT);
-
-  DELETEP(wxRED_PEN);
-  DELETEP(wxCYAN_PEN);
-  DELETEP(wxGREEN_PEN);
-  DELETEP(wxBLACK_PEN);
-  DELETEP(wxWHITE_PEN);
-  DELETEP(wxTRANSPARENT_PEN);
-  DELETEP(wxBLACK_DASHED_PEN);
-  DELETEP(wxGREY_PEN);
-  DELETEP(wxMEDIUM_GREY_PEN);
-  DELETEP(wxLIGHT_GREY_PEN);
-
-  DELETEP(wxBLUE_BRUSH);
-  DELETEP(wxGREEN_BRUSH);
-  DELETEP(wxWHITE_BRUSH);
-  DELETEP(wxBLACK_BRUSH);
-  DELETEP(wxTRANSPARENT_BRUSH);
-  DELETEP(wxCYAN_BRUSH);
-  DELETEP(wxRED_BRUSH);
-  DELETEP(wxGREY_BRUSH);
-  DELETEP(wxMEDIUM_GREY_BRUSH);
-  DELETEP(wxLIGHT_GREY_BRUSH);
-
-  DELETEP(wxBLACK);
-  DELETEP(wxWHITE);
-  DELETEP(wxRED);
-  DELETEP(wxBLUE);
-  DELETEP(wxGREEN);
-  DELETEP(wxCYAN);
-  DELETEP(wxLIGHT_GREY);
-
-  DELETEP(wxSTANDARD_CURSOR);
-  DELETEP(wxHOURGLASS_CURSOR);
-  DELETEP(wxCROSS_CURSOR);
+  wxDELETE(wxNORMAL_FONT);
+  wxDELETE(wxSMALL_FONT);
+  wxDELETE(wxITALIC_FONT);
+  wxDELETE(wxSWISS_FONT);
+
+  wxDELETE(wxRED_PEN);
+  wxDELETE(wxCYAN_PEN);
+  wxDELETE(wxGREEN_PEN);
+  wxDELETE(wxBLACK_PEN);
+  wxDELETE(wxWHITE_PEN);
+  wxDELETE(wxTRANSPARENT_PEN);
+  wxDELETE(wxBLACK_DASHED_PEN);
+  wxDELETE(wxGREY_PEN);
+  wxDELETE(wxMEDIUM_GREY_PEN);
+  wxDELETE(wxLIGHT_GREY_PEN);
+
+  wxDELETE(wxBLUE_BRUSH);
+  wxDELETE(wxGREEN_BRUSH);
+  wxDELETE(wxWHITE_BRUSH);
+  wxDELETE(wxBLACK_BRUSH);
+  wxDELETE(wxTRANSPARENT_BRUSH);
+  wxDELETE(wxCYAN_BRUSH);
+  wxDELETE(wxRED_BRUSH);
+  wxDELETE(wxGREY_BRUSH);
+  wxDELETE(wxMEDIUM_GREY_BRUSH);
+  wxDELETE(wxLIGHT_GREY_BRUSH);
+
+  wxDELETE(wxBLACK);
+  wxDELETE(wxWHITE);
+  wxDELETE(wxRED);
+  wxDELETE(wxBLUE);
+  wxDELETE(wxGREEN);
+  wxDELETE(wxCYAN);
+  wxDELETE(wxLIGHT_GREY);
+
+  wxDELETE(wxSTANDARD_CURSOR);
+  wxDELETE(wxHOURGLASS_CURSOR);
+  wxDELETE(wxCROSS_CURSOR);
+}
+
+void wxDeleteStockLists() {
+  wxDELETE(wxTheBrushList);
+  wxDELETE(wxThePenList);
+  wxDELETE(wxTheFontList);
+  wxDELETE(wxTheBitmapList);
 }
 
 wxBitmapList::wxBitmapList ()
@@ -422,6 +437,8 @@ wxBitmapList::wxBitmapList ()
 
 wxBitmapList::~wxBitmapList ()
 {
+  printf( "Count: %d.\n", Number() );
+
   wxNode *node = First ();
   while (node)
     {
@@ -611,3 +628,38 @@ wxSize wxGetDisplaySize()
     return wxSize(x, y);
 }
 
+wxResourceCache::wxResourceCache () : wxList() {
+}
+
+wxResourceCache::wxResourceCache (const unsigned int the_key_type) : wxList(the_key_type) {
+}
+
+wxResourceCache::~wxResourceCache () {
+  wxNode *node = First ();
+  while (node) {
+    wxGDIObject *item = (wxGDIObject *)node->Data();
+    if (item->IsKindOf(CLASSINFO(wxBrush))) {
+      wxBrush *brush = (wxBrush *)item;
+      delete brush;
+    }
+
+    if (item->IsKindOf(CLASSINFO(wxFont))) {
+      wxFont *font = (wxFont *)item;
+      delete font;
+    }
+
+    if (item->IsKindOf(CLASSINFO(wxBitmap))) {
+      wxBitmap *bitmap = (wxBitmap *)item;
+      delete bitmap;
+    }
+
+    if (item->IsKindOf(CLASSINFO(wxColour))) {
+      wxColour *colour = (wxColour *)item;
+      delete colour;
+    }
+
+    wxNode *next = node->Next ();
+    node = next;
+  }
+}
+