X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c801d85f158c4cba50b588807daabdcbd0ed3853..c2cde53a09d89e83f1556bd703b1164857cd0e0f:/include/wx/gdicmn.h diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index 36c371c91c..f0719dbe00 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -9,8 +9,8 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef __GDICMNH__ -#define __GDICMNH__ +#ifndef _WX_GDICMNH__ +#define _WX_GDICMNH__ #ifdef __GNUG__ #pragma interface "gdicmn.h" @@ -19,18 +19,13 @@ #include "wx/object.h" #include "wx/list.h" #include "wx/hash.h" +#include "wx/string.h" #include "wx/setup.h" - -#ifdef __WINDOWS__ -#include "wx/msw/colour.h" -#elif defined(__MOTIF__) -#include "wx/xt/colour.h" -#elif defined(__GTK__) -#include "wx/gtk/colour.h" -#endif +#include "wx/colour.h" // Standard cursors typedef enum { + wxCURSOR_NONE = 0, wxCURSOR_ARROW = 1, wxCURSOR_BULLSEYE, wxCURSOR_CHAR, @@ -63,44 +58,56 @@ typedef enum { wxCURSOR_BASED_ARROW_UP, wxCURSOR_BASED_ARROW_DOWN #endif -} _standard_cursors_t; +} wxStockCursor; -class WXDLLEXPORT wxSize: public wxObject +class WXDLLEXPORT wxSize { public: long x; long y; - inline wxSize(void) { x = 0; y = 0; } + inline wxSize() { x = 0; y = 0; } inline wxSize(long xx, long yy) { x = xx; y = yy; } inline wxSize(const wxSize& sz) { x = sz.x; y = sz.y; } inline void operator = (const wxSize& sz) { x = sz.x; y = sz.y; } + inline wxSize operator + (const wxSize& sz) { return wxSize(x + sz.x, y + sz.y); } + inline wxSize operator - (const wxSize& sz) { return wxSize(x - sz.x, y - sz.y); } inline void Set(long xx, long yy) { x = xx; y = yy; } inline long GetX() const { return x; } inline long GetY() const { return y; } }; // Point -class WXDLLEXPORT wxRealPoint: public wxObject +class WXDLLEXPORT wxRealPoint { - DECLARE_DYNAMIC_CLASS(wxRealPoint) public: double x; double y; - inline wxRealPoint(void) { x = 0.0; y = 0.0; }; - inline wxRealPoint(double the_x, double the_y) { x = the_x; y = the_y; }; + inline wxRealPoint() { x = 0.0; y = 0.0; }; + inline wxRealPoint(double _x, double _y) { x = _x; y = _y; }; + inline wxRealPoint operator + (const wxRealPoint& pt) { return wxRealPoint(x + pt.x, y + pt.y); } + inline wxRealPoint operator - (const wxRealPoint& pt) { return wxRealPoint(x - pt.x, y - pt.y); } inline void operator = (const wxRealPoint& pt) { x = pt.x; y = pt.y; } }; -class WXDLLEXPORT wxPoint: public wxObject +class WXDLLEXPORT wxPoint { - DECLARE_DYNAMIC_CLASS(wxPoint) public: +#if defined(__WXMSW__) && !defined(__WIN32__) + int x; + int y; +#else long x; long y; - inline wxPoint(void) { x = 0; y = 0; }; +#endif + + inline wxPoint() { x = 0; y = 0; }; wxPoint(long the_x, long the_y) { x = the_x; y = the_y; }; + wxPoint(const wxPoint& pt) { x = pt.x; y = pt.y; }; + inline void operator = (const wxPoint& pt) { x = pt.x; y = pt.y; } + inline wxPoint operator + (const wxPoint& pt) { return wxPoint(x + pt.x, y + pt.y); } + inline wxPoint operator - (const wxPoint& pt) { return wxPoint(x - pt.x, y - pt.y); } }; #if WXWIN_COMPATIBILITY @@ -108,31 +115,31 @@ class WXDLLEXPORT wxPoint: public wxObject #define wxRectangle wxRect #endif -class WXDLLEXPORT wxRect : public wxObject { - DECLARE_DYNAMIC_CLASS(wxRect) +class WXDLLEXPORT wxRect +{ public: - wxRect(void) ; - wxRect(const long x, const long y, const long w, const long h); + wxRect() ; + wxRect(long x, long y, long w, long h); wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); wxRect(const wxPoint& pos, const wxSize& size); wxRect(const wxRect& rect); - inline long GetX(void) const { return x; } - inline void SetX(const long X) { x = X; } - inline long GetY(void) const { return y; } - inline void SetY(const long Y) { y = Y; } + inline long GetX() const { return x; } + inline void SetX(long X) { x = X; } + inline long GetY() const { return y; } + inline void SetY(long Y) { y = Y; } inline long GetWidth() const { return width; } - inline void SetWidth(const long w) { width = w; } + inline void SetWidth(long w) { width = w; } inline long GetHeight() const { return height; } - inline void SetHeight(const long h) { height = h; } + inline void SetHeight(long h) { height = h; } - inline wxPoint GetPosition(void) { return wxPoint(x, y); } - inline wxSize GetSize(void) { return wxSize(width, height); } + inline wxPoint GetPosition() { return wxPoint(x, y); } + inline wxSize GetSize() { return wxSize(width, height); } - inline long GetLeft(void) const { return x; } - inline long GetTop(void) const { return y; } - inline long GetBottom(void) const { return y + height; } - inline long GetRight(void) const { return x + width; } + inline long GetLeft() const { return x; } + inline long GetTop() const { return y; } + inline long GetBottom() const { return y + height; } + inline long GetRight() const { return x + width; } wxRect& operator = (const wxRect& rect); bool operator == (const wxRect& rect); @@ -178,32 +185,32 @@ class WXDLLEXPORT wxPalette; class WXDLLEXPORT wxBitmap; class WXDLLEXPORT wxCursor; class WXDLLEXPORT wxIcon; +class WXDLLEXPORT wxColour; +class WXDLLEXPORT wxString; // Management of pens, brushes and fonts class WXDLLEXPORT wxPenList: public wxList { DECLARE_DYNAMIC_CLASS(wxPenList) public: - inline wxPenList(void) + inline wxPenList() { } - ~wxPenList(void); + ~wxPenList(); void AddPen(wxPen *pen); void RemovePen(wxPen *pen); - wxPen *FindOrCreatePen(const wxColour& colour, const int width, const int style); - wxPen *FindOrCreatePen(const wxString& colour, const int width, const int style); + wxPen *FindOrCreatePen(const wxColour& colour, int width, int style); }; class WXDLLEXPORT wxBrushList: public wxList { DECLARE_DYNAMIC_CLASS(wxBrushList) public: - inline wxBrushList(void) + inline wxBrushList() { } - ~wxBrushList(void); + ~wxBrushList(); void AddBrush(wxBrush *brush); void RemoveBrush(wxBrush *brush); - wxBrush *FindOrCreateBrush(const wxColour& colour, const int style); - wxBrush *FindOrCreateBrush(const wxString& colour, const int style); + wxBrush *FindOrCreateBrush(const wxColour& colour, int style); }; WXDLLEXPORT_DATA(extern const char*) wxEmptyString; @@ -212,13 +219,13 @@ class WXDLLEXPORT wxFontList: public wxList { DECLARE_DYNAMIC_CLASS(wxFontList) public: - inline wxFontList(void) + inline wxFontList() { } - ~wxFontList(void); + ~wxFontList(); void AddFont(wxFont *font); void RemoveFont(wxFont *font); - wxFont *FindOrCreateFont(const int pointSize, const int family, const int style, const int weight, - const bool underline = FALSE, const wxString& face = wxEmptyString); + wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight, + bool underline = FALSE, const wxString& face = wxEmptyString); }; class WXDLLEXPORT wxColourDatabase: public wxList @@ -226,19 +233,19 @@ class WXDLLEXPORT wxColourDatabase: public wxList DECLARE_CLASS(wxColourDatabase) public: wxColourDatabase(int type); - ~wxColourDatabase(void) ; + ~wxColourDatabase() ; // Not const because it may add a name to the database wxColour *FindColour(const wxString& colour) ; wxString FindName(const wxColour& colour) const; - void Initialize(void); + void Initialize(); }; class WXDLLEXPORT wxBitmapList: public wxList { DECLARE_DYNAMIC_CLASS(wxBitmapList) public: - wxBitmapList(void); - ~wxBitmapList(void); + wxBitmapList(); + ~wxBitmapList(); void AddBitmap(wxBitmap *bitmap); void RemoveBitmap(wxBitmap *bitmap); @@ -302,34 +309,53 @@ WXDLLEXPORT_DATA(extern wxCursor*) wxHOURGLASS_CURSOR; WXDLLEXPORT_DATA(extern wxCursor*) wxCROSS_CURSOR; WXDLLEXPORT_DATA(extern wxColourDatabase*) wxTheColourDatabase; -extern void WXDLLEXPORT wxInitializeStockObjects(void); -extern void WXDLLEXPORT wxDeleteStockObjects(void); +extern void WXDLLEXPORT wxInitializeStockObjects(); +extern void WXDLLEXPORT wxInitializeStockLists(); +extern void WXDLLEXPORT wxDeleteStockObjects(); +extern void WXDLLEXPORT wxDeleteStockLists(); -extern bool WXDLLEXPORT wxColourDisplay(void); +extern bool WXDLLEXPORT wxColourDisplay(); // Returns depth of screen -extern int WXDLLEXPORT wxDisplayDepth(void); +extern int WXDLLEXPORT wxDisplayDepth(); +#define wxGetDisplayDepth wxDisplayDepth extern void WXDLLEXPORT wxDisplaySize(int *width, int *height); +extern wxSize WXDLLEXPORT wxGetDisplaySize(); extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor); -// Useful macro for create icons portably +// Useful macro for creating icons portably -#ifdef __WINDOWS__ -# define wxICON(X) wxIcon(X##_icon); -#elif defined(__X__) -# define wxICON(X) wxIcon(X##_bits, X##_width, X##_height); +#ifdef __WXMSW__ +// Load from a resource +# define wxICON(X) wxIcon("" #X "") + +#elif defined(__WXGTK__) +// Initialize from an included XPM +# define wxICON(X) wxIcon(X##_xpm) #else -# define wxICON wxIcon + +// This will usually mean something on any platform +# define wxICON(X) wxIcon("" #X "") #endif /* Example: - #define wxbuild_icon "wxbuild" - - wxIcon *icon = new wxICON(wxbuild); + wxIcon *icon = new wxICON(mondrian); + expands into: + wxIcon *icon = new wxIcon("mondrian"); // On wxMSW + wxIcon *icon = new wxIcon(mondrian_xpm); // On wxGTK */ +class WXDLLEXPORT wxResourceCache: public wxList +{ + DECLARE_DYNAMIC_CLASS(wxResourceCache) + public: + wxResourceCache(); + wxResourceCache(const unsigned int the_key_type); + ~wxResourceCache(); +}; + #endif - // __GDICMNH__ + // _WX_GDICMNH__