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