create stock GDI objects on demand; use const with GDI objects appropriately (patch 1445355)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38765 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-04-16 22:18:29 +00:00
parent c4edcd7c86
commit f516d98637
35 changed files with 486 additions and 280 deletions

View File

@@ -553,41 +553,116 @@ extern WXDLLEXPORT_DATA(wxBrushList*) wxTheBrushList;
extern WXDLLEXPORT_DATA(wxFontList*) wxTheFontList; extern WXDLLEXPORT_DATA(wxFontList*) wxTheFontList;
extern WXDLLEXPORT_DATA(wxBitmapList*) wxTheBitmapList; extern WXDLLEXPORT_DATA(wxBitmapList*) wxTheBitmapList;
// Stock objects /* Stock objects
extern WXDLLEXPORT_DATA(wxFont*) wxNORMAL_FONT;
extern WXDLLEXPORT_DATA(wxFont*) wxSMALL_FONT;
extern WXDLLEXPORT_DATA(wxFont*) wxITALIC_FONT;
extern WXDLLEXPORT_DATA(wxFont*) wxSWISS_FONT;
extern WXDLLEXPORT_DATA(wxPen*) wxRED_PEN; wxStockGDI creates the stock GDI objects on demand. Pointers to the
extern WXDLLEXPORT_DATA(wxPen*) wxCYAN_PEN; created objects are stored in the ms_stockObject array, which is indexed
extern WXDLLEXPORT_DATA(wxPen*) wxGREEN_PEN; by the Item enum values. Platorm-specific fonts can be created by
extern WXDLLEXPORT_DATA(wxPen*) wxBLACK_PEN; implementing a derived class with an override for the GetFont function.
extern WXDLLEXPORT_DATA(wxPen*) wxWHITE_PEN; wxStockGDI operates as a singleton, accessed through the ms_instance
extern WXDLLEXPORT_DATA(wxPen*) wxTRANSPARENT_PEN; pointer. By default this pointer is set to an instance of wxStockGDI.
extern WXDLLEXPORT_DATA(wxPen*) wxBLACK_DASHED_PEN; A derived class must arrange to set this pointer to an instance of itself.
extern WXDLLEXPORT_DATA(wxPen*) wxGREY_PEN; */
extern WXDLLEXPORT_DATA(wxPen*) wxMEDIUM_GREY_PEN; class WXDLLIMPEXP_CORE wxStockGDI
extern WXDLLEXPORT_DATA(wxPen*) wxLIGHT_GREY_PEN; {
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
};
extern WXDLLEXPORT_DATA(wxBrush*) wxBLUE_BRUSH; wxStockGDI();
extern WXDLLEXPORT_DATA(wxBrush*) wxGREEN_BRUSH; virtual ~wxStockGDI();
extern WXDLLEXPORT_DATA(wxBrush*) wxWHITE_BRUSH; static void DeleteAll();
extern WXDLLEXPORT_DATA(wxBrush*) wxBLACK_BRUSH;
extern WXDLLEXPORT_DATA(wxBrush*) wxGREY_BRUSH;
extern WXDLLEXPORT_DATA(wxBrush*) wxMEDIUM_GREY_BRUSH;
extern WXDLLEXPORT_DATA(wxBrush*) wxLIGHT_GREY_BRUSH;
extern WXDLLEXPORT_DATA(wxBrush*) wxTRANSPARENT_BRUSH;
extern WXDLLEXPORT_DATA(wxBrush*) wxCYAN_BRUSH;
extern WXDLLEXPORT_DATA(wxBrush*) wxRED_BRUSH;
extern WXDLLEXPORT_DATA(wxColour*) wxBLACK; static wxStockGDI& instance() { return *ms_instance; }
extern WXDLLEXPORT_DATA(wxColour*) wxWHITE;
extern WXDLLEXPORT_DATA(wxColour*) wxRED; static const wxBrush* GetBrush(Item item);
extern WXDLLEXPORT_DATA(wxColour*) wxBLUE; static const wxColour* GetColour(Item item);
extern WXDLLEXPORT_DATA(wxColour*) wxGREEN; static const wxCursor* GetCursor(Item item);
extern WXDLLEXPORT_DATA(wxColour*) wxCYAN; // Can be overridden by platform-specific derived classes
extern WXDLLEXPORT_DATA(wxColour*) wxLIGHT_GREY; 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)
};
#define wxITALIC_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_ITALIC)
#define wxNORMAL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_NORMAL)
#define wxSMALL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SMALL)
#define wxSWISS_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SWISS)
#define wxBLACK_DASHED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACKDASHED)
#define wxBLACK_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACK)
#define wxCYAN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_CYAN)
#define wxGREEN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREEN)
#define wxGREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREY)
#define wxLIGHT_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_LIGHTGREY)
#define wxMEDIUM_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_MEDIUMGREY)
#define wxRED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_RED)
#define wxTRANSPARENT_PEN wxStockGDI::GetPen(wxStockGDI::PEN_TRANSPARENT)
#define wxWHITE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_WHITE)
#define wxBLACK_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLACK)
#define wxBLUE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLUE)
#define wxCYAN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_CYAN)
#define wxGREEN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREEN)
#define wxGREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREY)
#define wxLIGHT_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_LIGHTGREY)
#define wxMEDIUM_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_MEDIUMGREY)
#define wxRED_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_RED)
#define wxTRANSPARENT_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_TRANSPARENT)
#define wxWHITE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_WHITE)
#define wxBLACK wxStockGDI::GetColour(wxStockGDI::COLOUR_BLACK)
#define wxBLUE wxStockGDI::GetColour(wxStockGDI::COLOUR_BLUE)
#define wxCYAN wxStockGDI::GetColour(wxStockGDI::COLOUR_CYAN)
#define wxGREEN wxStockGDI::GetColour(wxStockGDI::COLOUR_GREEN)
#define wxLIGHT_GREY wxStockGDI::GetColour(wxStockGDI::COLOUR_LIGHTGREY)
#define wxRED wxStockGDI::GetColour(wxStockGDI::COLOUR_RED)
#define wxWHITE wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE)
#define wxCROSS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_CROSS)
#define wxHOURGLASS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_HOURGLASS)
#define wxSTANDARD_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_STANDARD)
// 'Null' objects // 'Null' objects
extern WXDLLEXPORT_DATA(wxBitmap) wxNullBitmap; extern WXDLLEXPORT_DATA(wxBitmap) wxNullBitmap;
@@ -599,11 +674,6 @@ extern WXDLLEXPORT_DATA(wxPalette) wxNullPalette;
extern WXDLLEXPORT_DATA(wxFont) wxNullFont; extern WXDLLEXPORT_DATA(wxFont) wxNullFont;
extern WXDLLEXPORT_DATA(wxColour) wxNullColour; extern WXDLLEXPORT_DATA(wxColour) wxNullColour;
// Stock cursors types
extern WXDLLEXPORT_DATA(wxCursor*) wxSTANDARD_CURSOR;
extern WXDLLEXPORT_DATA(wxCursor*) wxHOURGLASS_CURSOR;
extern WXDLLEXPORT_DATA(wxCursor*) wxCROSS_CURSOR;
extern WXDLLEXPORT_DATA(wxColourDatabase*) wxTheColourDatabase; extern WXDLLEXPORT_DATA(wxColourDatabase*) wxTheColourDatabase;
extern WXDLLEXPORT_DATA(const wxChar) wxPanelNameStr[]; extern WXDLLEXPORT_DATA(const wxChar) wxPanelNameStr[];
@@ -619,9 +689,7 @@ extern WXDLLEXPORT_DATA(wxList) wxPendingDelete;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// resource management // resource management
extern void WXDLLEXPORT wxInitializeStockObjects();
extern void WXDLLEXPORT wxInitializeStockLists(); extern void WXDLLEXPORT wxInitializeStockLists();
extern void WXDLLEXPORT wxDeleteStockObjects();
extern void WXDLLEXPORT wxDeleteStockLists(); extern void WXDLLEXPORT wxDeleteStockLists();
// is the display colour (or monochrome)? // is the display colour (or monochrome)?

View File

@@ -261,7 +261,7 @@ private:
// OnPaint helper-methods // OnPaint helper-methods
// Highlight the [fromdate : todate] range using pen and brush // Highlight the [fromdate : todate] range using pen and brush
void HighlightRange(wxPaintDC* dc, const wxDateTime& fromdate, const wxDateTime& todate, wxPen* pen, wxBrush* brush); void HighlightRange(wxPaintDC* dc, const wxDateTime& fromdate, const wxDateTime& todate, const wxPen* pen, const wxBrush* brush);
// Get the "coordinates" for the date relative to the month currently displayed. // Get the "coordinates" for the date relative to the month currently displayed.
// using (day, week): upper left coord is (1, 1), lower right coord is (7, 6) // using (day, week): upper left coord is (1, 1), lower right coord is (7, 6)

View File

@@ -148,10 +148,10 @@ public:
inline wxColour GetShadowColour(void) const { return m_shadowColour; } inline wxColour GetShadowColour(void) const { return m_shadowColour; }
inline wxColour GetBackgroundColour(void) const { return m_backgroundColour; } inline wxColour GetBackgroundColour(void) const { return m_backgroundColour; }
inline wxColour GetTextColour(void) const { return m_textColour; } inline wxColour GetTextColour(void) const { return m_textColour; }
inline wxPen *GetHighlightPen(void) const { return m_highlightPen; } inline const wxPen *GetHighlightPen(void) const { return m_highlightPen; }
inline wxPen *GetShadowPen(void) const { return m_shadowPen; } inline const wxPen *GetShadowPen(void) const { return m_shadowPen; }
inline wxPen *GetBackgroundPen(void) const { return m_backgroundPen; } inline const wxPen *GetBackgroundPen(void) const { return m_backgroundPen; }
inline wxBrush *GetBackgroundBrush(void) const { return m_backgroundBrush; } inline const wxBrush *GetBackgroundBrush(void) const { return m_backgroundBrush; }
inline void SetViewRect(const wxRect& rect) { m_tabViewRect = rect; } inline void SetViewRect(const wxRect& rect) { m_tabViewRect = rect; }
inline wxRect GetViewRect(void) const { return m_tabViewRect; } inline wxRect GetViewRect(void) const { return m_tabViewRect; }
@@ -253,10 +253,10 @@ protected:
wxColour m_textColour; wxColour m_textColour;
// Pen and brush cache // Pen and brush cache
wxPen* m_highlightPen; const wxPen* m_highlightPen;
wxPen* m_shadowPen; const wxPen* m_shadowPen;
wxPen* m_backgroundPen; const wxPen* m_backgroundPen;
wxBrush* m_backgroundBrush; const wxBrush* m_backgroundBrush;
wxFont m_tabFont; wxFont m_tabFont;
wxFont m_tabSelectedFont; wxFont m_tabSelectedFont;

View File

@@ -33,7 +33,7 @@ public:
#endif #endif
wxCursor( const char bits[], int width, int height, wxCursor( const char bits[], int width, int height,
int hotSpotX=-1, int hotSpotY=-1, int hotSpotX=-1, int hotSpotY=-1,
const char maskBits[]=0, wxColour *fg=0, wxColour *bg=0 ); const char maskBits[] = NULL, const wxColour *fg = NULL, const wxColour *bg = NULL );
~wxCursor(); ~wxCursor();
bool operator == ( const wxCursor& cursor ) const; bool operator == ( const wxCursor& cursor ) const;
bool operator != ( const wxCursor& cursor ) const; bool operator != ( const wxCursor& cursor ) const;

View File

@@ -33,7 +33,7 @@ public:
#endif #endif
wxCursor( const char bits[], int width, int height, wxCursor( const char bits[], int width, int height,
int hotSpotX=-1, int hotSpotY=-1, int hotSpotX=-1, int hotSpotY=-1,
const char maskBits[]=0, wxColour *fg=0, wxColour *bg=0 ); const char maskBits[] = NULL, const wxColour *fg = NULL, const wxColour *bg = NULL );
~wxCursor(); ~wxCursor();
bool operator == ( const wxCursor& cursor ) const; bool operator == ( const wxCursor& cursor ) const;
bool operator != ( const wxCursor& cursor ) const; bool operator != ( const wxCursor& cursor ) const;

View File

@@ -99,7 +99,7 @@ extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win,
extern void wxDoChangeForegroundColour(WXWidget widget, extern void wxDoChangeForegroundColour(WXWidget widget,
wxColour& foregroundColour); wxColour& foregroundColour);
extern void wxDoChangeBackgroundColour(WXWidget widget, extern void wxDoChangeBackgroundColour(WXWidget widget,
wxColour& backgroundColour, const wxColour& backgroundColour,
bool changeArmColour = false); bool changeArmColour = false);
extern void wxDoChangeFont(WXWidget widget, const wxFont& font); extern void wxDoChangeFont(WXWidget widget, const wxFont& font);
extern void wxGetTextExtent(WXDisplay* display, const wxFont& font, extern void wxGetTextExtent(WXDisplay* display, const wxFont& font,

View File

@@ -19,6 +19,9 @@
#include "wx/object.h" #include "wx/object.h"
#include "wx/list.h" #include "wx/list.h"
#include "wx/filefn.h" #include "wx/filefn.h"
#if wxUSE_GUI
#include "wx/gdicmn.h"
#endif
class WXDLLIMPEXP_BASE wxArrayString; class WXDLLIMPEXP_BASE wxArrayString;
class WXDLLIMPEXP_BASE wxArrayInt; class WXDLLIMPEXP_BASE wxArrayInt;
@@ -44,7 +47,6 @@ class WXDLLIMPEXP_CORE wxProcess;
class WXDLLIMPEXP_CORE wxFrame; class WXDLLIMPEXP_CORE wxFrame;
class WXDLLIMPEXP_CORE wxWindow; class WXDLLIMPEXP_CORE wxWindow;
class WXDLLIMPEXP_CORE wxWindowList; class WXDLLIMPEXP_CORE wxWindowList;
class WXDLLIMPEXP_CORE wxPoint;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Macros // Macros
@@ -614,9 +616,7 @@ private:
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Set the cursor to the busy cursor for all windows // Set the cursor to the busy cursor for all windows
class WXDLLEXPORT wxCursor; WXDLLIMPEXP_CORE void wxBeginBusyCursor(const wxCursor *cursor = wxHOURGLASS_CURSOR);
extern WXDLLEXPORT_DATA(wxCursor*) wxHOURGLASS_CURSOR;
WXDLLEXPORT void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
// Restore cursor to normal // Restore cursor to normal
WXDLLEXPORT void wxEndBusyCursor(); WXDLLEXPORT void wxEndBusyCursor();
@@ -628,7 +628,7 @@ WXDLLEXPORT bool wxIsBusy();
class WXDLLEXPORT wxBusyCursor class WXDLLEXPORT wxBusyCursor
{ {
public: public:
wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR) wxBusyCursor(const wxCursor* cursor = wxHOURGLASS_CURSOR)
{ wxBeginBusyCursor(cursor); } { wxBeginBusyCursor(cursor); }
~wxBusyCursor() ~wxBusyCursor()
{ wxEndBusyCursor(); } { wxEndBusyCursor(); }

View File

@@ -42,7 +42,7 @@ int wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap
Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap ); Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
extern XColor g_itemColors[]; extern XColor g_itemColors[];
extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore); extern int wxComputeColours (Display *display, const wxColour * back, const wxColour * fore);
// For convenience // For convenience
inline Display* wxGlobalDisplay() { return (Display*) wxGetDisplay(); } inline Display* wxGlobalDisplay() { return (Display*) wxGetDisplay(); }

View File

@@ -424,7 +424,7 @@ void wxSetCursor(const wxCursor& cursor)
static int wxBusyCursorCount = 0; static int wxBusyCursorCount = 0;
// Set the cursor to the busy cursor for all windows // Set the cursor to the busy cursor for all windows
void wxBeginBusyCursor(wxCursor *cursor) void wxBeginBusyCursor(const wxCursor *cursor)
{ {
wxBusyCursorCount ++; wxBusyCursorCount ++;
if (wxBusyCursorCount == 1) if (wxBusyCursorCount == 1)

View File

@@ -104,7 +104,6 @@ bool wxAppBase::Initialize(int& argcOrig, wxChar **argvOrig)
#endif #endif
wxInitializeStockLists(); wxInitializeStockLists();
wxInitializeStockObjects();
wxBitmap::InitStandardHandlers(); wxBitmap::InitStandardHandlers();
@@ -137,7 +136,7 @@ void wxAppBase::CleanUp()
// undo everything we did in Initialize() above // undo everything we did in Initialize() above
wxBitmap::CleanUpHandlers(); wxBitmap::CleanUpHandlers();
wxDeleteStockObjects(); wxStockGDI::DeleteAll();
wxDeleteStockLists(); wxDeleteStockLists();

View File

@@ -51,46 +51,6 @@ wxBrushList *wxTheBrushList = NULL;
wxBitmapList *wxTheBitmapList = NULL; wxBitmapList *wxTheBitmapList = NULL;
wxColourDatabase *wxTheColourDatabase = NULL; wxColourDatabase *wxTheColourDatabase = NULL;
// Stock objects
wxFont *wxNORMAL_FONT;
wxFont *wxSMALL_FONT;
wxFont *wxITALIC_FONT;
wxFont *wxSWISS_FONT;
wxPen *wxRED_PEN;
wxPen *wxCYAN_PEN;
wxPen *wxGREEN_PEN;
wxPen *wxBLACK_PEN;
wxPen *wxWHITE_PEN;
wxPen *wxTRANSPARENT_PEN;
wxPen *wxBLACK_DASHED_PEN;
wxPen *wxGREY_PEN;
wxPen *wxMEDIUM_GREY_PEN;
wxPen *wxLIGHT_GREY_PEN;
wxBrush *wxBLUE_BRUSH;
wxBrush *wxGREEN_BRUSH;
wxBrush *wxWHITE_BRUSH;
wxBrush *wxBLACK_BRUSH;
wxBrush *wxTRANSPARENT_BRUSH;
wxBrush *wxCYAN_BRUSH;
wxBrush *wxRED_BRUSH;
wxBrush *wxGREY_BRUSH;
wxBrush *wxMEDIUM_GREY_BRUSH;
wxBrush *wxLIGHT_GREY_BRUSH;
wxColour *wxBLACK;
wxColour *wxWHITE;
wxColour *wxRED;
wxColour *wxBLUE;
wxColour *wxGREEN;
wxColour *wxCYAN;
wxColour *wxLIGHT_GREY;
wxCursor *wxSTANDARD_CURSOR = NULL;
wxCursor *wxHOURGLASS_CURSOR = NULL;
wxCursor *wxCROSS_CURSOR = NULL;
// 'Null' objects // 'Null' objects
#if wxUSE_ACCEL #if wxUSE_ACCEL
wxAcceleratorTable wxNullAcceleratorTable; wxAcceleratorTable wxNullAcceleratorTable;

View File

@@ -38,10 +38,6 @@
#include "wx/log.h" #include "wx/log.h"
#include <string.h> #include <string.h>
#if defined(__WXMSW__)
#include "wx/msw/wrapwin.h"
#endif
#ifdef __WXMOTIF__ #ifdef __WXMOTIF__
#ifdef __VMS__ #ifdef __VMS__
#pragma message disable nosimpint #pragma message disable nosimpint
@@ -56,11 +52,6 @@
#include "X11/Xlib.h" #include "X11/Xlib.h"
#endif #endif
#ifdef __WXMAC__
#include "wx/mac/private.h"
#include "wx/mac/uma.h"
#endif
#if wxUSE_EXTENDED_RTTI #if wxUSE_EXTENDED_RTTI
// wxPoint // wxPoint
@@ -523,6 +514,204 @@ wxColour *wxColourDatabase::FindColour(const wxString& name)
// stock objects // stock objects
// ============================================================================ // ============================================================================
static wxStockGDI gs_wxStockGDI_instance;
wxStockGDI* wxStockGDI::ms_instance = &gs_wxStockGDI_instance;
wxObject* wxStockGDI::ms_stockObject[ITEMCOUNT];
wxStockGDI::wxStockGDI()
{
}
wxStockGDI::~wxStockGDI()
{
}
void wxStockGDI::DeleteAll()
{
for (unsigned i = 0; i < ITEMCOUNT; i++)
{
delete ms_stockObject[i];
ms_stockObject[i] = NULL;
}
}
const wxBrush* wxStockGDI::GetBrush(Item item)
{
wxBrush* brush = wx_static_cast(wxBrush*, ms_stockObject[item]);
if (brush == NULL)
{
switch (item)
{
case BRUSH_BLACK:
brush = new wxBrush(*GetColour(COLOUR_BLACK), wxSOLID);
break;
case BRUSH_BLUE:
brush = new wxBrush(*GetColour(COLOUR_BLUE), wxSOLID);
break;
case BRUSH_CYAN:
brush = new wxBrush(*GetColour(COLOUR_CYAN), wxSOLID);
break;
case BRUSH_GREEN:
brush = new wxBrush(*GetColour(COLOUR_GREEN), wxSOLID);
break;
case BRUSH_GREY:
brush = new wxBrush(wxColour(wxT("GREY")), wxSOLID);
break;
case BRUSH_LIGHTGREY:
brush = new wxBrush(*GetColour(COLOUR_LIGHTGREY), wxSOLID);
break;
case BRUSH_MEDIUMGREY:
brush = new wxBrush(wxColour(wxT("MEDIUM GREY")), wxSOLID);
break;
case BRUSH_RED:
brush = new wxBrush(*GetColour(COLOUR_RED), wxSOLID);
break;
case BRUSH_TRANSPARENT:
brush = new wxBrush(*GetColour(COLOUR_BLACK), wxTRANSPARENT);
break;
case BRUSH_WHITE:
brush = new wxBrush(*GetColour(COLOUR_WHITE), wxSOLID);
break;
default:
wxFAIL;
}
ms_stockObject[item] = brush;
}
return brush;
}
const wxColour* wxStockGDI::GetColour(Item item)
{
wxColour* colour = wx_static_cast(wxColour*, ms_stockObject[item]);
if (colour == NULL)
{
switch (item)
{
case COLOUR_BLACK:
colour = new wxColour(0, 0, 0);
break;
case COLOUR_BLUE:
colour = new wxColour(0, 0, 255);
break;
case COLOUR_CYAN:
colour = new wxColour(wxT("CYAN"));
break;
case COLOUR_GREEN:
colour = new wxColour(0, 255, 0);
break;
case COLOUR_LIGHTGREY:
colour = new wxColour(wxT("LIGHT GREY"));
break;
case COLOUR_RED:
colour = new wxColour(255, 0, 0);
break;
case COLOUR_WHITE:
colour = new wxColour(255, 255, 255);
break;
default:
wxFAIL;
}
ms_stockObject[item] = colour;
}
return colour;
}
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() void wxInitializeStockLists()
{ {
wxTheColourDatabase = new wxColourDatabase; wxTheColourDatabase = new wxColourDatabase;
@@ -533,147 +722,6 @@ void wxInitializeStockLists()
wxTheBitmapList = new wxBitmapList; wxTheBitmapList = new wxBitmapList;
} }
void wxInitializeStockObjects ()
{
#ifdef __WXMOTIF__
#endif
#ifdef __X__
// TODO
// wxFontPool = new XFontPool;
#endif
// why under MSW fonts shouldn't have the standard system size?
/*
#ifdef __WXMSW__
static const int sizeFont = 10;
#else
#endif
*/
#if defined(__WXMAC__)
// retrieve size of system font for all stock fonts
int sizeFont = 12;
Str255 fontName ;
SInt16 fontSize ;
Style fontStyle ;
GetThemeFont(kThemeSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
sizeFont = fontSize ;
#ifdef __WXMAC_CLASSIC__
wxNORMAL_FONT = new wxFont (fontSize, wxMODERN, wxNORMAL, wxNORMAL , false , wxMacMakeStringFromPascal(fontName) );
#else
wxNORMAL_FONT = new wxFont () ;
wxNORMAL_FONT->MacCreateThemeFont( kThemeSystemFont );
#endif
#elif defined(__WXPM__)
static const int sizeFont = 12;
#else
wxNORMAL_FONT = new wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
static const int sizeFont = wxNORMAL_FONT->GetPointSize();
#endif
#if defined(__WXPM__)
/*
// Basic OS/2 has a fairly limited number of fonts and these are as good
// as I can do to get something that looks halfway "wx" normal
*/
wxNORMAL_FONT = new wxFont (sizeFont, wxMODERN, wxNORMAL, wxBOLD);
wxSMALL_FONT = new wxFont (sizeFont - 4, wxSWISS, wxNORMAL, wxNORMAL); /* Helv */
wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL);
wxSWISS_FONT = new wxFont (sizeFont, wxSWISS, wxNORMAL, wxNORMAL); /* Helv */
#elif defined(__WXMAC__)
wxSWISS_FONT = new wxFont (sizeFont, wxSWISS, wxNORMAL, wxNORMAL); /* Helv */
wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL);
#ifdef __WXMAC_CLASSIC__
GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
wxSMALL_FONT = new wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , wxMacMakeStringFromPascal( fontName ) );
#else
wxSMALL_FONT = new wxFont () ;
wxSMALL_FONT->MacCreateThemeFont( kThemeSmallSystemFont );
#endif
#else
wxSMALL_FONT = new wxFont (sizeFont - 2, wxSWISS, wxNORMAL, wxNORMAL);
wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL);
wxSWISS_FONT = new wxFont (sizeFont, wxSWISS, wxNORMAL, wxNORMAL);
#endif
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);
}
void wxDeleteStockLists() void wxDeleteStockLists()
{ {
wxDELETE(wxTheBrushList); wxDELETE(wxTheBrushList);

View File

@@ -1211,7 +1211,7 @@ void wxCalendarCtrl::RefreshDate(const wxDateTime& date)
Refresh(true, &rect); Refresh(true, &rect);
} }
void wxCalendarCtrl::HighlightRange(wxPaintDC* pDC, const wxDateTime& fromdate, const wxDateTime& todate, wxPen* pPen, wxBrush* pBrush) void wxCalendarCtrl::HighlightRange(wxPaintDC* pDC, const wxDateTime& fromdate, const wxDateTime& todate, const wxPen* pPen, const wxBrush* pBrush)
{ {
// Highlights the given range using pen and brush // Highlights the given range using pen and brush
// Does nothing if todate < fromdate // Does nothing if todate < fromdate

View File

@@ -412,8 +412,8 @@ class WXDLLEXPORT wxListHeaderWindow : public wxWindow
{ {
protected: protected:
wxListMainWindow *m_owner; wxListMainWindow *m_owner;
wxCursor *m_currentCursor; const wxCursor *m_currentCursor;
wxCursor *m_resizeCursor; const wxCursor *m_resizeCursor;
bool m_isDragging; bool m_isDragging;
// column being resized or -1 // column being resized or -1

View File

@@ -2323,7 +2323,7 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
if (IsExposed(exposed_x, exposed_y, 10000, h)) // 10000 = very much if (IsExposed(exposed_x, exposed_y, 10000, h)) // 10000 = very much
{ {
wxPen *pen = const wxPen *pen =
#ifndef __WXMAC__ #ifndef __WXMAC__
// don't draw rect outline if we already have the // don't draw rect outline if we already have the
// background color under Mac // background color under Mac

View File

@@ -123,7 +123,7 @@ extern GtkWidget *wxGetRootWindow();
wxCursor::wxCursor(const char bits[], int width, int height, wxCursor::wxCursor(const char bits[], int width, int height,
int hotSpotX, int hotSpotY, int hotSpotX, int hotSpotY,
const char maskBits[], wxColour *fg, wxColour *bg) const char maskBits[], const wxColour *fg, const wxColour *bg)
{ {
if (!maskBits) if (!maskBits)
maskBits = bits; maskBits = bits;
@@ -359,7 +359,7 @@ void wxEndBusyCursor()
wxTheApp->ProcessIdle(); wxTheApp->ProcessIdle();
} }
void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) ) void wxBeginBusyCursor( const wxCursor *WXUNUSED(cursor) )
{ {
if (gs_busyCount++ > 0) if (gs_busyCount++ > 0)
return; return;

View File

@@ -4135,7 +4135,7 @@ void wxWindowGTK::DoCaptureMouse()
wxCHECK_RET( window, _T("CaptureMouse() failed") ); wxCHECK_RET( window, _T("CaptureMouse() failed") );
wxCursor* cursor = & m_cursor; const wxCursor* cursor = &m_cursor;
if (!cursor->Ok()) if (!cursor->Ok())
cursor = wxSTANDARD_CURSOR; cursor = wxSTANDARD_CURSOR;

View File

@@ -128,7 +128,7 @@ extern GtkWidget *wxGetRootWindow();
wxCursor::wxCursor(const char bits[], int width, int height, wxCursor::wxCursor(const char bits[], int width, int height,
int hotSpotX, int hotSpotY, int hotSpotX, int hotSpotY,
const char maskBits[], wxColour *fg, wxColour *bg) const char maskBits[], const wxColour *fg, const wxColour *bg)
{ {
if (!maskBits) if (!maskBits)
maskBits = bits; maskBits = bits;
@@ -364,7 +364,7 @@ void wxEndBusyCursor()
wxTheApp->ProcessIdle(); wxTheApp->ProcessIdle();
} }
void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) ) void wxBeginBusyCursor( const wxCursor *WXUNUSED(cursor) )
{ {
if (gs_busyCount++ > 0) if (gs_busyCount++ > 0)
return; return;

View File

@@ -3928,7 +3928,7 @@ void wxWindowGTK::DoCaptureMouse()
wxCHECK_RET( window, _T("CaptureMouse() failed") ); wxCHECK_RET( window, _T("CaptureMouse() failed") );
wxCursor* cursor = & m_cursor; const wxCursor* cursor = &m_cursor;
if (!cursor->Ok()) if (!cursor->Ok())
cursor = wxSTANDARD_CURSOR; cursor = wxSTANDARD_CURSOR;

View File

@@ -12,7 +12,50 @@
#include "wx/wxprec.h" #include "wx/wxprec.h"
#include "wx/gdiobj.h" #include "wx/gdiobj.h"
#include "wx/gdicmn.h"
#include "wx/mac/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
// TODO: Nothing to do, unless you want to. class wxStockGDIMac: public wxStockGDI
{
public:
wxStockGDIMac();
virtual const wxFont* GetFont(Item item);
private:
typedef wxStockGDI super;
};
static wxStockGDIMac gs_wxStockGDIMac_instance;
wxStockGDIMac::wxStockGDIMac()
{
// Override default instance
ms_instance = this;
}
const wxFont* wxStockGDIMac::GetFont(Item item)
{
wxFont* font = static_cast<wxFont*>(ms_stockObject[item]);
if (font == NULL)
{
switch (item)
{
case FONT_NORMAL:
font = new wxFont;
font->MacCreateThemeFont(kThemeSystemFont);
break;
case FONT_SMALL:
font = new wxFont;
font->MacCreateThemeFont(kThemeSmallSystemFont);
break;
default:
font = const_cast<wxFont*>(super::GetFont(item));
break;
}
ms_stockObject[item] = font;
}
return font;
}

View File

@@ -488,7 +488,7 @@ extern wxCursor gMacCurrentCursor ;
wxCursor gMacStoredActiveCursor ; wxCursor gMacStoredActiveCursor ;
// Set the cursor to the busy cursor for all windows // Set the cursor to the busy cursor for all windows
void wxBeginBusyCursor(wxCursor *cursor) void wxBeginBusyCursor(const wxCursor *cursor)
{ {
if (gs_wxBusyCursorCount++ == 0) if (gs_wxBusyCursorCount++ == 0)
{ {

View File

@@ -10,7 +10,53 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#include "wx/gdiobj.h" #include "wx/gdiobj.h"
#include "wx/gdicmn.h"
#include "wx/mac/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
// TODO: Nothing to do, unless you want to. class wxStockGDIMac: public wxStockGDI
{
public:
wxStockGDIMac();
virtual const wxFont* GetFont(Item item);
private:
typedef wxStockGDI super;
};
static wxStockGDIMac gs_wxStockGDIMac_instance;
wxStockGDIMac::wxStockGDIMac()
{
// Override default instance
ms_instance = this;
}
const wxFont* wxStockGDIMac::GetFont(Item item)
{
wxFont* font = wx_static_cast(wxFont*, ms_stockObject[item]);
if (font == NULL)
{
Str255 fontName;
SInt16 fontSize;
Style fontStyle;
switch (item)
{
case FONT_NORMAL:
GetThemeFont(kThemeSystemFont, GetApplicationScript(), fontName, &fontSize, &fontStyle);
font = new wxFont(fontSize, wxMODERN, wxNORMAL, wxNORMAL, false, wxMacMakeStringFromPascal(fontName));
break;
case FONT_SMALL:
GetThemeFont(kThemeSmallSystemFont, GetApplicationScript(), fontName, &fontSize, &fontStyle);
font = new wxFont(fontSize, wxSWISS, wxNORMAL, wxNORMAL, false, wxMacMakeStringFromPascal(fontName));
break;
default:
font = wx_const_cast(wxFont*, super::GetFont(item));
break;
}
ms_stockObject[item] = font;
}
return font;
}

View File

@@ -339,7 +339,7 @@ extern wxCursor gMacCurrentCursor ;
wxCursor gMacStoredActiveCursor ; wxCursor gMacStoredActiveCursor ;
// Set the cursor to the busy cursor for all windows // Set the cursor to the busy cursor for all windows
void wxBeginBusyCursor(wxCursor *cursor) void wxBeginBusyCursor(const wxCursor *cursor)
{ {
if (gs_wxBusyCursorCount++ == 0) if (gs_wxBusyCursorCount++ == 0)
{ {

View File

@@ -243,7 +243,7 @@ void wxEndBusyCursor()
gs_savedCursor = wxNullCursor; gs_savedCursor = wxNullCursor;
} }
void wxBeginBusyCursor(wxCursor *cursor) void wxBeginBusyCursor(const wxCursor *cursor)
{ {
if ( gs_busyCount++ > 0 ) return; if ( gs_busyCount++ > 0 ) return;

View File

@@ -153,7 +153,8 @@ void wxCheckBox::ChangeBackgroundColour()
XmNforeground, g_itemColors[wxFORE_INDEX].pixel, XmNforeground, g_itemColors[wxFORE_INDEX].pixel,
NULL); NULL);
int selectPixel = wxBLACK->AllocColour(XtDisplay((Widget)m_mainWidget)); wxColour colour = *wxBLACK;
int selectPixel = colour.AllocColour(XtDisplay((Widget)m_mainWidget));
// Better to have the checkbox selection in black, or it's // Better to have the checkbox selection in black, or it's
// hard to determine what state it is in. // hard to determine what state it is in.

View File

@@ -426,7 +426,7 @@ static int wxBusyCursorCount = 0;
// Helper function // Helper function
static void static void
wxXSetBusyCursor (wxWindow * win, wxCursor * cursor) wxXSetBusyCursor (wxWindow * win, const wxCursor * cursor)
{ {
Display *display = (Display*) win->GetXDisplay(); Display *display = (Display*) win->GetXDisplay();
@@ -462,7 +462,7 @@ wxXSetBusyCursor (wxWindow * win, wxCursor * cursor)
} }
// Set the cursor to the busy cursor for all windows // Set the cursor to the busy cursor for all windows
void wxBeginBusyCursor(wxCursor *cursor) void wxBeginBusyCursor(const wxCursor *cursor)
{ {
wxBusyCursorCount++; wxBusyCursorCount++;
if (wxBusyCursorCount == 1) if (wxBusyCursorCount == 1)

View File

@@ -347,7 +347,8 @@ void wxRadioBox::ChangeBackgroundColour()
{ {
wxWindow::ChangeBackgroundColour(); wxWindow::ChangeBackgroundColour();
int selectPixel = wxBLACK->AllocColour(XtDisplay((Widget)m_mainWidget)); wxColour colour = *wxBLACK;
int selectPixel = colour.AllocColour(XtDisplay((Widget)m_mainWidget));
for (unsigned int i = 0; i < m_noItems; i++) for (unsigned int i = 0; i < m_noItems; i++)
{ {

View File

@@ -140,7 +140,8 @@ void wxRadioButton::ChangeBackgroundColour()
wxWindow::ChangeBackgroundColour(); wxWindow::ChangeBackgroundColour();
// What colour should this be? // What colour should this be?
int selectPixel = wxBLACK->AllocColour(XtDisplay((Widget)m_mainWidget)); wxColour colour = *wxBLACK;
int selectPixel = colour.AllocColour(XtDisplay((Widget)m_mainWidget));
XtVaSetValues ((Widget) GetMainWidget(), XtVaSetValues ((Widget) GetMainWidget(),
XmNselectColor, selectPixel, XmNselectColor, selectPixel,

View File

@@ -909,7 +909,7 @@ void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour)
NULL); NULL);
} }
void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour) void wxDoChangeBackgroundColour(WXWidget widget, const wxColour& backgroundColour, bool changeArmColour)
{ {
wxComputeColours (XtDisplay((Widget) widget), & backgroundColour, wxComputeColours (XtDisplay((Widget) widget), & backgroundColour,
(wxColour*) NULL); (wxColour*) NULL);

View File

@@ -693,7 +693,7 @@ bool wxWindow::SetCursor(const wxCursor& cursor)
// wxASSERT_MSG( m_cursor.Ok(), // wxASSERT_MSG( m_cursor.Ok(),
// wxT("cursor must be valid after call to the base version")); // wxT("cursor must be valid after call to the base version"));
wxCursor* cursor2 = NULL; const wxCursor* cursor2 = NULL;
if (m_cursor.Ok()) if (m_cursor.Ok())
cursor2 = & m_cursor; cursor2 = & m_cursor;
else else
@@ -2377,7 +2377,7 @@ bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win,
#define YAllocColor XAllocColor #define YAllocColor XAllocColor
XColor g_itemColors[5]; XColor g_itemColors[5];
int wxComputeColours (Display *display, wxColour * back, wxColour * fore) int wxComputeColours (Display *display, const wxColour * back, const wxColour * fore)
{ {
int result; int result;
static XmColorProc colorProc; static XmColorProc colorProc;

View File

@@ -157,7 +157,7 @@ extern HCURSOR wxGetCurrentBusyCursor()
} }
// Set the cursor to the busy cursor for all windows // Set the cursor to the busy cursor for all windows
void wxBeginBusyCursor(wxCursor *cursor) void wxBeginBusyCursor(const wxCursor *cursor)
{ {
if ( gs_wxBusyCursorCount++ == 0 ) if ( gs_wxBusyCursorCount++ == 0 )
{ {

View File

@@ -12,7 +12,48 @@
#include "wx/wxprec.h" #include "wx/wxprec.h"
#include "wx/gdiobj.h" #include "wx/gdiobj.h"
#include "wx/gdicmn.h"
IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
// TODO: Nothing to do, unless you want to. class wxStockGDIPM: public wxStockGDI
{
public:
wxStockGDIPM();
virtual const wxFont* GetFont(Item item);
private:
typedef wxStockGDI super;
};
static wxStockGDIPM gs_wxStockGDIPM_instance;
wxStockGDIPM::wxStockGDIPM()
{
// Override default instance
ms_instance = this;
}
const wxFont* wxStockGDIPM::GetFont(Item item)
{
wxFont* font = wx_static_cast(wxFont*, ms_stockObject[item]);
if (font == NULL)
{
const int fontSize = 12;
switch (item)
{
case FONT_NORMAL:
font = new wxFont(fontSize, wxMODERN, wxNORMAL, wxBOLD);
break;
case FONT_SMALL:
font = new wxFont(fontSize - 4, wxSWISS, wxNORMAL, wxNORMAL);
break;
default:
font = wx_const_cast(wxFont*, super::GetFont(item));
break;
}
ms_stockObject[item] = font;
}
return font;
}

View File

@@ -289,9 +289,7 @@ HCURSOR gs_wxBusyCursorOld = 0; // old cursor
static int gs_wxBusyCursorCount = 0; static int gs_wxBusyCursorCount = 0;
// Set the cursor to the busy cursor for all windows // Set the cursor to the busy cursor for all windows
void wxBeginBusyCursor( void wxBeginBusyCursor(const wxCursor* pCursor)
wxCursor* pCursor
)
{ {
if ( gs_wxBusyCursorCount++ == 0 ) if ( gs_wxBusyCursorCount++ == 0 )
{ {

View File

@@ -88,7 +88,7 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c
static int gs_wxBusyCursorCount = 0; static int gs_wxBusyCursorCount = 0;
// Set the cursor to the busy cursor for all windows // Set the cursor to the busy cursor for all windows
void wxBeginBusyCursor(wxCursor *cursor) void wxBeginBusyCursor(const wxCursor *cursor)
{ {
} }

View File

@@ -186,7 +186,7 @@ void wxEndBusyCursor()
wxTheApp->ProcessIdle(); wxTheApp->ProcessIdle();
} }
void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) ) void wxBeginBusyCursor( const wxCursor *WXUNUSED(cursor) )
{ {
if (gs_busyCount++ > 0) if (gs_busyCount++ > 0)
return; return;