- wxRED_PEN = new wxPen (wxT("RED"), 1, wxSOLID);
- wxCYAN_PEN = new wxPen (wxT("CYAN"), 1, wxSOLID);
- wxGREEN_PEN = new wxPen (wxT("GREEN"), 1, wxSOLID);
- wxBLACK_PEN = new wxPen (wxT("BLACK"), 1, wxSOLID);
- wxWHITE_PEN = new wxPen (wxT("WHITE"), 1, wxSOLID);
- wxTRANSPARENT_PEN = new wxPen (wxT("BLACK"), 1, wxTRANSPARENT);
- wxBLACK_DASHED_PEN = new wxPen (wxT("BLACK"), 1, wxSHORT_DASH);
- wxGREY_PEN = new wxPen (wxT("GREY"), 1, wxSOLID);
- wxMEDIUM_GREY_PEN = new wxPen (wxT("MEDIUM GREY"), 1, wxSOLID);
- wxLIGHT_GREY_PEN = new wxPen (wxT("LIGHT GREY"), 1, wxSOLID);
-
- wxBLUE_BRUSH = new wxBrush (wxT("BLUE"), wxSOLID);
- wxGREEN_BRUSH = new wxBrush (wxT("GREEN"), wxSOLID);
- wxWHITE_BRUSH = new wxBrush (wxT("WHITE"), wxSOLID);
- wxBLACK_BRUSH = new wxBrush (wxT("BLACK"), wxSOLID);
- wxTRANSPARENT_BRUSH = new wxBrush (wxT("BLACK"), wxTRANSPARENT);
- wxCYAN_BRUSH = new wxBrush (wxT("CYAN"), wxSOLID);
- wxRED_BRUSH = new wxBrush (wxT("RED"), wxSOLID);
- wxGREY_BRUSH = new wxBrush (wxT("GREY"), wxSOLID);
- wxMEDIUM_GREY_BRUSH = new wxBrush (wxT("MEDIUM GREY"), wxSOLID);
- wxLIGHT_GREY_BRUSH = new wxBrush (wxT("LIGHT GREY"), wxSOLID);
-
- wxBLACK = new wxColour (wxT("BLACK"));
- wxWHITE = new wxColour (wxT("WHITE"));
- wxRED = new wxColour (wxT("RED"));
- wxBLUE = new wxColour (wxT("BLUE"));
- wxGREEN = new wxColour (wxT("GREEN"));
- wxCYAN = new wxColour (wxT("CYAN"));
- wxLIGHT_GREY = new wxColour (wxT("LIGHT GREY"));
-
- wxSTANDARD_CURSOR = new wxCursor (wxCURSOR_ARROW);
- wxHOURGLASS_CURSOR = new wxCursor (wxCURSOR_WAIT);
- wxCROSS_CURSOR = new wxCursor (wxCURSOR_CROSS);
-}
-
-void wxDeleteStockObjects ()
-{
- 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);
+const wxCursor* wxStockGDI::GetCursor(Item item)
+{
+ wxCursor* cursor = wx_static_cast(wxCursor*, ms_stockObject[item]);
+ if (cursor == NULL)
+ {
+ switch (item)
+ {
+ case CURSOR_CROSS:
+ cursor = new wxCursor(wxCURSOR_CROSS);
+ break;
+ case CURSOR_HOURGLASS:
+ cursor = new wxCursor(wxCURSOR_WAIT);
+ break;
+ case CURSOR_STANDARD:
+ cursor = new wxCursor(wxCURSOR_ARROW);
+ break;
+ default:
+ wxFAIL;
+ }
+ ms_stockObject[item] = cursor;
+ }
+ return cursor;
+}
+
+const wxFont* wxStockGDI::GetFont(Item item)
+{
+ wxFont* font = wx_static_cast(wxFont*, ms_stockObject[item]);
+ if (font == NULL)
+ {
+ switch (item)
+ {
+ case FONT_ITALIC:
+ font = new wxFont(GetFont(FONT_NORMAL)->GetPointSize(), wxROMAN, wxITALIC, wxNORMAL);
+ break;
+ case FONT_NORMAL:
+ font = new wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
+ break;
+ case FONT_SMALL:
+ font = new wxFont(GetFont(FONT_NORMAL)->GetPointSize() - 2, wxSWISS, wxNORMAL, wxNORMAL);
+ break;
+ case FONT_SWISS:
+ font = new wxFont(GetFont(FONT_NORMAL)->GetPointSize(), wxSWISS, wxNORMAL, wxNORMAL);
+ break;
+ default:
+ wxFAIL;
+ }
+ ms_stockObject[item] = font;
+ }
+ return font;
+}
+
+const wxPen* wxStockGDI::GetPen(Item item)
+{
+ wxPen* pen = wx_static_cast(wxPen*, ms_stockObject[item]);
+ if (pen == NULL)
+ {
+ switch (item)
+ {
+ case PEN_BLACK:
+ pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxSOLID);
+ break;
+ case PEN_BLACKDASHED:
+ pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxSHORT_DASH);
+ break;
+ case PEN_CYAN:
+ pen = new wxPen(*GetColour(COLOUR_CYAN), 1, wxSOLID);
+ break;
+ case PEN_GREEN:
+ pen = new wxPen(*GetColour(COLOUR_GREEN), 1, wxSOLID);
+ break;
+ case PEN_GREY:
+ pen = new wxPen(wxColour(wxT("GREY")), 1, wxSOLID);
+ break;
+ case PEN_LIGHTGREY:
+ pen = new wxPen(*GetColour(COLOUR_LIGHTGREY), 1, wxSOLID);
+ break;
+ case PEN_MEDIUMGREY:
+ pen = new wxPen(wxColour(wxT("MEDIUM GREY")), 1, wxSOLID);
+ break;
+ case PEN_RED:
+ pen = new wxPen(*GetColour(COLOUR_RED), 1, wxSOLID);
+ break;
+ case PEN_TRANSPARENT:
+ pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxTRANSPARENT);
+ break;
+ case PEN_WHITE:
+ pen = new wxPen(*GetColour(COLOUR_WHITE), 1, wxSOLID);
+ break;
+ default:
+ wxFAIL;
+ }
+ ms_stockObject[item] = pen;
+ }
+ return pen;
+}
+
+void wxInitializeStockLists()
+{
+ wxTheColourDatabase = new wxColourDatabase;
+
+ wxTheBrushList = new wxBrushList;
+ wxThePenList = new wxPenList;
+ wxTheFontList = new wxFontList;