-WXDLLEXPORT_DATA(extern wxPenList*) wxThePenList;
-WXDLLEXPORT_DATA(extern wxBrushList*) wxTheBrushList;
-WXDLLEXPORT_DATA(extern wxFontList*) wxTheFontList;
-WXDLLEXPORT_DATA(extern wxBitmapList*) wxTheBitmapList;
-
-// Stock objects
-WXDLLEXPORT_DATA(extern wxFont*) wxNORMAL_FONT;
-WXDLLEXPORT_DATA(extern wxFont*) wxSMALL_FONT;
-WXDLLEXPORT_DATA(extern wxFont*) wxITALIC_FONT;
-WXDLLEXPORT_DATA(extern wxFont*) wxSWISS_FONT;
-
-WXDLLEXPORT_DATA(extern wxPen*) wxRED_PEN;
-WXDLLEXPORT_DATA(extern wxPen*) wxCYAN_PEN;
-WXDLLEXPORT_DATA(extern wxPen*) wxGREEN_PEN;
-WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_PEN;
-WXDLLEXPORT_DATA(extern wxPen*) wxWHITE_PEN;
-WXDLLEXPORT_DATA(extern wxPen*) wxTRANSPARENT_PEN;
-WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_DASHED_PEN;
-WXDLLEXPORT_DATA(extern wxPen*) wxGREY_PEN;
-WXDLLEXPORT_DATA(extern wxPen*) wxMEDIUM_GREY_PEN;
-WXDLLEXPORT_DATA(extern wxPen*) wxLIGHT_GREY_PEN;
-
-WXDLLEXPORT_DATA(extern wxBrush*) wxBLUE_BRUSH;
-WXDLLEXPORT_DATA(extern wxBrush*) wxGREEN_BRUSH;
-WXDLLEXPORT_DATA(extern wxBrush*) wxWHITE_BRUSH;
-WXDLLEXPORT_DATA(extern wxBrush*) wxBLACK_BRUSH;
-WXDLLEXPORT_DATA(extern wxBrush*) wxGREY_BRUSH;
-WXDLLEXPORT_DATA(extern wxBrush*) wxMEDIUM_GREY_BRUSH;
-WXDLLEXPORT_DATA(extern wxBrush*) wxLIGHT_GREY_BRUSH;
-WXDLLEXPORT_DATA(extern wxBrush*) wxTRANSPARENT_BRUSH;
-WXDLLEXPORT_DATA(extern wxBrush*) wxCYAN_BRUSH;
-WXDLLEXPORT_DATA(extern wxBrush*) wxRED_BRUSH;
-
-WXDLLEXPORT_DATA(extern wxColour*) wxBLACK;
-WXDLLEXPORT_DATA(extern wxColour*) wxWHITE;
-WXDLLEXPORT_DATA(extern wxColour*) wxRED;
-WXDLLEXPORT_DATA(extern wxColour*) wxBLUE;
-WXDLLEXPORT_DATA(extern wxColour*) wxGREEN;
-WXDLLEXPORT_DATA(extern wxColour*) wxCYAN;
-WXDLLEXPORT_DATA(extern wxColour*) wxLIGHT_GREY;
-
-// 'Null' objects
-WXDLLEXPORT_DATA(extern wxBitmap) wxNullBitmap;
-WXDLLEXPORT_DATA(extern wxIcon) wxNullIcon;
-WXDLLEXPORT_DATA(extern wxCursor) wxNullCursor;
-WXDLLEXPORT_DATA(extern wxPen) wxNullPen;
-WXDLLEXPORT_DATA(extern wxBrush) wxNullBrush;
-WXDLLEXPORT_DATA(extern wxPalette) wxNullPalette;
-WXDLLEXPORT_DATA(extern wxFont) wxNullFont;
-WXDLLEXPORT_DATA(extern wxColour) wxNullColour;
+extern WXDLLEXPORT_DATA(wxPenList*) wxThePenList;
+extern WXDLLEXPORT_DATA(wxBrushList*) wxTheBrushList;
+extern WXDLLEXPORT_DATA(wxFontList*) wxTheFontList;
+
+/* Stock objects
+
+ wxStockGDI creates the stock GDI objects on demand. Pointers to the
+ created objects are stored in the ms_stockObject array, which is indexed
+ by the Item enum values. Platorm-specific fonts can be created by
+ implementing a derived class with an override for the GetFont function.
+ wxStockGDI operates as a singleton, accessed through the ms_instance
+ pointer. By default this pointer is set to an instance of wxStockGDI.
+ A derived class must arrange to set this pointer to an instance of itself.
+*/
+class WXDLLIMPEXP_CORE wxStockGDI
+{
+public:
+ enum Item {
+ BRUSH_BLACK,
+ BRUSH_BLUE,
+ BRUSH_CYAN,
+ BRUSH_GREEN,
+ BRUSH_GREY,
+ BRUSH_LIGHTGREY,
+ BRUSH_MEDIUMGREY,
+ BRUSH_RED,
+ BRUSH_TRANSPARENT,
+ BRUSH_WHITE,
+ COLOUR_BLACK,
+ COLOUR_BLUE,
+ COLOUR_CYAN,
+ COLOUR_GREEN,
+ COLOUR_LIGHTGREY,
+ COLOUR_RED,
+ COLOUR_WHITE,
+ CURSOR_CROSS,
+ CURSOR_HOURGLASS,
+ CURSOR_STANDARD,
+ FONT_ITALIC,
+ FONT_NORMAL,
+ FONT_SMALL,
+ FONT_SWISS,
+ PEN_BLACK,
+ PEN_BLACKDASHED,
+ PEN_CYAN,
+ PEN_GREEN,
+ PEN_GREY,
+ PEN_LIGHTGREY,
+ PEN_MEDIUMGREY,
+ PEN_RED,
+ PEN_TRANSPARENT,
+ PEN_WHITE,
+ ITEMCOUNT
+ };
+
+ wxStockGDI();
+ virtual ~wxStockGDI();
+ static void DeleteAll();
+
+ static wxStockGDI& instance() { return *ms_instance; }
+
+ static const wxBrush* GetBrush(Item item);
+ static const wxColour* GetColour(Item item);
+ static const wxCursor* GetCursor(Item item);
+ // Can be overridden by platform-specific derived classes
+ virtual const wxFont* GetFont(Item item);
+ static const wxPen* GetPen(Item item);
+
+protected:
+ static wxStockGDI* ms_instance;
+
+ static wxObject* ms_stockObject[ITEMCOUNT];
+
+ DECLARE_NO_COPY_CLASS(wxStockGDI)
+};