1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Includes platform-specific wxBrush file
4 // Author: Julian Smart
8 // Copyright: Julian Smart
9 // Licence: wxWindows Licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_BRUSH_H_BASE_
13 #define _WX_BRUSH_H_BASE_
16 #include "wx/object.h"
17 #include "wx/gdiobj.h"
18 #include "wx/gdicmn.h" // for wxGDIObjListBase
20 // NOTE: these values cannot be combined together!
23 wxBRUSHSTYLE_INVALID
= -1,
25 wxBRUSHSTYLE_SOLID
= wxSOLID
,
26 wxBRUSHSTYLE_TRANSPARENT
= wxTRANSPARENT
,
27 wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE
= wxSTIPPLE_MASK_OPAQUE
,
28 wxBRUSHSTYLE_STIPPLE_MASK
= wxSTIPPLE_MASK
,
29 wxBRUSHSTYLE_STIPPLE
= wxSTIPPLE
,
30 wxBRUSHSTYLE_BDIAGONAL_HATCH
= wxBDIAGONAL_HATCH
,
31 wxBRUSHSTYLE_CROSSDIAG_HATCH
= wxCROSSDIAG_HATCH
,
32 wxBRUSHSTYLE_FDIAGONAL_HATCH
= wxFDIAGONAL_HATCH
,
33 wxBRUSHSTYLE_CROSS_HATCH
= wxCROSS_HATCH
,
34 wxBRUSHSTYLE_HORIZONTAL_HATCH
= wxHORIZONTAL_HATCH
,
35 wxBRUSHSTYLE_VERTICAL_HATCH
= wxVERTICAL_HATCH
,
36 wxBRUSHSTYLE_FIRST_HATCH
= wxFIRST_HATCH
,
37 wxBRUSHSTYLE_LAST_HATCH
= wxLAST_HATCH
42 class WXDLLIMPEXP_CORE wxBrushBase
: public wxGDIObject
45 virtual ~wxBrushBase() { }
47 virtual void SetColour(const wxColour
& col
) = 0;
48 virtual void SetColour(unsigned char r
, unsigned char g
, unsigned char b
) = 0;
49 virtual void SetStyle(wxBrushStyle style
) = 0;
50 virtual void SetStipple(const wxBitmap
& stipple
) = 0;
52 virtual wxColour
GetColour() const = 0;
53 virtual wxBrushStyle
GetStyle() const = 0;
54 virtual wxBitmap
*GetStipple() const = 0;
56 virtual bool IsHatch() const
57 { return (GetStyle()>=wxBRUSHSTYLE_FIRST_HATCH
) && (GetStyle()<=wxBRUSHSTYLE_LAST_HATCH
); }
59 // Convenient helpers for testing whether the brush is a transparent one:
60 // unlike GetStyle() == wxBRUSHSTYLE_TRANSPARENT, they work correctly even
61 // if the brush is invalid (they both return false in this case).
62 bool IsTransparent() const
64 return IsOk() && GetStyle() == wxBRUSHSTYLE_TRANSPARENT
;
67 bool IsNonTransparent() const
69 return IsOk() && GetStyle() != wxBRUSHSTYLE_TRANSPARENT
;
73 #if defined(__WXPALMOS__)
74 #include "wx/palmos/brush.h"
75 #elif defined(__WXMSW__)
76 #include "wx/msw/brush.h"
77 #elif defined(__WXMOTIF__) || defined(__WXX11__)
78 #include "wx/x11/brush.h"
79 #elif defined(__WXGTK20__)
80 #include "wx/gtk/brush.h"
81 #elif defined(__WXGTK__)
82 #include "wx/gtk1/brush.h"
83 #elif defined(__WXMGL__)
84 #include "wx/mgl/brush.h"
85 #elif defined(__WXDFB__)
86 #include "wx/dfb/brush.h"
87 #elif defined(__WXMAC__)
88 #include "wx/osx/brush.h"
89 #elif defined(__WXCOCOA__)
90 #include "wx/cocoa/brush.h"
91 #elif defined(__WXPM__)
92 #include "wx/os2/brush.h"
95 class WXDLLIMPEXP_CORE wxBrushList
: public wxGDIObjListBase
98 wxBrush
*FindOrCreateBrush(const wxColour
& colour
,
99 wxBrushStyle style
= wxBRUSHSTYLE_SOLID
);
101 #if FUTURE_WXWIN_COMPATIBILITY_3_0
102 wxBrush
*FindOrCreateBrush(const wxColour
& colour
, int style
)
103 { return FindOrCreateBrush(colour
, (wxBrushStyle
)style
); }
106 #if WXWIN_COMPATIBILITY_2_6
107 wxDEPRECATED( void AddBrush(wxBrush
*) );
108 wxDEPRECATED( void RemoveBrush(wxBrush
*) );
112 extern WXDLLIMPEXP_DATA_CORE(wxBrushList
*) wxTheBrushList
;
114 // provide comparison operators to allow code such as
116 // if ( brush.GetStyle() == wxTRANSPARENT )
118 // to compile without warnings which it would otherwise provoke from some
119 // compilers as it compares elements of different enums
120 #if FUTURE_WXWIN_COMPATIBILITY_3_0
122 // Unfortunately some compilers have ambiguity issues when enum comparisons are
123 // overloaded so we have to disable the overloads in this case, see
124 // wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details.
125 #ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM
127 inline bool operator==(wxBrushStyle s
, wxDeprecatedGUIConstants t
)
129 return static_cast<int>(s
) == static_cast<int>(t
);
132 inline bool operator!=(wxBrushStyle s
, wxDeprecatedGUIConstants t
)
137 #endif // wxCOMPILER_NO_OVERLOAD_ON_ENUM
139 #endif // FUTURE_WXWIN_COMPATIBILITY_3_0
141 #endif // _WX_BRUSH_H_BASE_