]> git.saurik.com Git - wxWidgets.git/blame - include/wx/brush.h
wxDialogBase only has one ctor, so just do initialization in ctor instead of Init()
[wxWidgets.git] / include / wx / brush.h
CommitLineData
99d80019
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/brush.h
3// Purpose: Includes platform-specific wxBrush file
4// Author: Julian Smart
5// Modified by:
6// Created:
99d80019
JS
7// Copyright: Julian Smart
8// Licence: wxWindows Licence
9/////////////////////////////////////////////////////////////////////////////
10
34138703
JS
11#ifndef _WX_BRUSH_H_BASE_
12#define _WX_BRUSH_H_BASE_
c801d85f 13
c7dc7711
WS
14#include "wx/defs.h"
15#include "wx/object.h"
16#include "wx/gdiobj.h"
9d7a8e4a 17#include "wx/gdicmn.h" // for wxGDIObjListBase
c7dc7711 18
3e6858cd
FM
19// NOTE: these values cannot be combined together!
20enum wxBrushStyle
21{
ac3688c0 22 wxBRUSHSTYLE_INVALID = -1,
3e6858cd
FM
23
24 wxBRUSHSTYLE_SOLID = wxSOLID,
3e6858cd 25 wxBRUSHSTYLE_TRANSPARENT = wxTRANSPARENT,
3e6858cd 26 wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE,
3e6858cd 27 wxBRUSHSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK,
3e6858cd 28 wxBRUSHSTYLE_STIPPLE = wxSTIPPLE,
c17eafaa
VZ
29 wxBRUSHSTYLE_BDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL,
30 wxBRUSHSTYLE_CROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG,
31 wxBRUSHSTYLE_FDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL,
32 wxBRUSHSTYLE_CROSS_HATCH = wxHATCHSTYLE_CROSS,
33 wxBRUSHSTYLE_HORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL,
34 wxBRUSHSTYLE_VERTICAL_HATCH = wxHATCHSTYLE_VERTICAL,
35 wxBRUSHSTYLE_FIRST_HATCH = wxHATCHSTYLE_FIRST,
36 wxBRUSHSTYLE_LAST_HATCH = wxHATCHSTYLE_LAST
3e6858cd
FM
37};
38
39
cb9d5bd0 40// wxBrushBase
53a2db12 41class WXDLLIMPEXP_CORE wxBrushBase: public wxGDIObject
cb9d5bd0
WS
42{
43public:
44 virtual ~wxBrushBase() { }
45
231b9591
FM
46 virtual void SetColour(const wxColour& col) = 0;
47 virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) = 0;
48 virtual void SetStyle(wxBrushStyle style) = 0;
49 virtual void SetStipple(const wxBitmap& stipple) = 0;
50
51 virtual wxColour GetColour() const = 0;
3e6858cd 52 virtual wxBrushStyle GetStyle() const = 0;
231b9591 53 virtual wxBitmap *GetStipple() const = 0;
cb9d5bd0
WS
54
55 virtual bool IsHatch() const
3e6858cd 56 { return (GetStyle()>=wxBRUSHSTYLE_FIRST_HATCH) && (GetStyle()<=wxBRUSHSTYLE_LAST_HATCH); }
e6777e65
VZ
57
58 // Convenient helpers for testing whether the brush is a transparent one:
59 // unlike GetStyle() == wxBRUSHSTYLE_TRANSPARENT, they work correctly even
60 // if the brush is invalid (they both return false in this case).
61 bool IsTransparent() const
62 {
63 return IsOk() && GetStyle() == wxBRUSHSTYLE_TRANSPARENT;
64 }
65
66 bool IsNonTransparent() const
67 {
68 return IsOk() && GetStyle() != wxBRUSHSTYLE_TRANSPARENT;
69 }
cb9d5bd0
WS
70};
71
bd362275 72#if defined(__WXMSW__)
5b36366c
VZ
73 #include "wx/msw/brush.h"
74#elif defined(__WXMOTIF__) || defined(__WXX11__)
75 #include "wx/x11/brush.h"
1be7a35c 76#elif defined(__WXGTK20__)
5b36366c 77 #include "wx/gtk/brush.h"
1be7a35c
MR
78#elif defined(__WXGTK__)
79 #include "wx/gtk1/brush.h"
b3c86150
VS
80#elif defined(__WXDFB__)
81 #include "wx/dfb/brush.h"
34138703 82#elif defined(__WXMAC__)
ef0e9220 83 #include "wx/osx/brush.h"
e64df9bc 84#elif defined(__WXCOCOA__)
5b36366c 85 #include "wx/cocoa/brush.h"
1777b9bb 86#elif defined(__WXPM__)
5b36366c 87 #include "wx/os2/brush.h"
c801d85f
KB
88#endif
89
82cddbd9
FM
90class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase
91{
92public:
b09cac45
VZ
93 wxBrush *FindOrCreateBrush(const wxColour& colour,
94 wxBrushStyle style = wxBRUSHSTYLE_SOLID);
95
96#if FUTURE_WXWIN_COMPATIBILITY_3_0
97 wxBrush *FindOrCreateBrush(const wxColour& colour, int style)
98 { return FindOrCreateBrush(colour, (wxBrushStyle)style); }
99#endif
100
82cddbd9
FM
101#if WXWIN_COMPATIBILITY_2_6
102 wxDEPRECATED( void AddBrush(wxBrush*) );
103 wxDEPRECATED( void RemoveBrush(wxBrush*) );
104#endif
105};
106
53a2db12 107extern WXDLLIMPEXP_DATA_CORE(wxBrushList*) wxTheBrushList;
82cddbd9 108
8907a7e2
VZ
109// provide comparison operators to allow code such as
110//
111// if ( brush.GetStyle() == wxTRANSPARENT )
112//
113// to compile without warnings which it would otherwise provoke from some
114// compilers as it compares elements of different enums
115#if FUTURE_WXWIN_COMPATIBILITY_3_0
116
25859335
VZ
117// Unfortunately some compilers have ambiguity issues when enum comparisons are
118// overloaded so we have to disable the overloads in this case, see
119// wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details.
120#ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM
121
8907a7e2
VZ
122inline bool operator==(wxBrushStyle s, wxDeprecatedGUIConstants t)
123{
5c33522f 124 return static_cast<int>(s) == static_cast<int>(t);
8907a7e2
VZ
125}
126
127inline bool operator!=(wxBrushStyle s, wxDeprecatedGUIConstants t)
128{
129 return !(s == t);
130}
131
25859335
VZ
132#endif // wxCOMPILER_NO_OVERLOAD_ON_ENUM
133
8907a7e2
VZ
134#endif // FUTURE_WXWIN_COMPATIBILITY_3_0
135
136#endif // _WX_BRUSH_H_BASE_