]> git.saurik.com Git - wxWidgets.git/blob - include/wx/brush.h
extracted GUI-specific part of utilsunx.cpp to a new unix/apptraits.cpp file and...
[wxWidgets.git] / include / wx / brush.h
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
12 #ifndef _WX_BRUSH_H_BASE_
13 #define _WX_BRUSH_H_BASE_
14
15 #include "wx/defs.h"
16 #include "wx/object.h"
17 #include "wx/gdiobj.h"
18 #include "wx/gdicmn.h" // for wxGDIObjListBase
19
20 // NOTE: these values cannot be combined together!
21 enum wxBrushStyle
22 {
23 wxBRUSHSTYLE_INVALID = -1,
24
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,
38 };
39
40
41 // wxBrushBase
42 class WXDLLEXPORT wxBrushBase: public wxGDIObject
43 {
44 public:
45 virtual ~wxBrushBase() { }
46
47 virtual wxBrushStyle GetStyle() const = 0;
48
49 virtual bool IsHatch() const
50 { return (GetStyle()>=wxBRUSHSTYLE_FIRST_HATCH) && (GetStyle()<=wxBRUSHSTYLE_LAST_HATCH); }
51
52 #if FUTURE_WXWIN_COMPATIBILITY_3_0
53 wxDEPRECATED_FUTURE( void SetStyle(int style) )
54 { SetStyle((wxBrushStyle)style); }
55 #endif
56 };
57
58 #if defined(__WXPALMOS__)
59 #include "wx/palmos/brush.h"
60 #elif defined(__WXMSW__)
61 #include "wx/msw/brush.h"
62 #elif defined(__WXMOTIF__) || defined(__WXX11__)
63 #include "wx/x11/brush.h"
64 #elif defined(__WXGTK20__)
65 #include "wx/gtk/brush.h"
66 #elif defined(__WXGTK__)
67 #include "wx/gtk1/brush.h"
68 #elif defined(__WXMGL__)
69 #include "wx/mgl/brush.h"
70 #elif defined(__WXDFB__)
71 #include "wx/dfb/brush.h"
72 #elif defined(__WXMAC__)
73 #include "wx/mac/brush.h"
74 #elif defined(__WXCOCOA__)
75 #include "wx/cocoa/brush.h"
76 #elif defined(__WXPM__)
77 #include "wx/os2/brush.h"
78 #endif
79
80 class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase
81 {
82 public:
83 wxBrush *FindOrCreateBrush(const wxColour& colour,
84 wxBrushStyle style = wxBRUSHSTYLE_SOLID);
85
86 #if FUTURE_WXWIN_COMPATIBILITY_3_0
87 wxBrush *FindOrCreateBrush(const wxColour& colour, int style)
88 { return FindOrCreateBrush(colour, (wxBrushStyle)style); }
89 #endif
90
91 #if WXWIN_COMPATIBILITY_2_6
92 wxDEPRECATED( void AddBrush(wxBrush*) );
93 wxDEPRECATED( void RemoveBrush(wxBrush*) );
94 #endif
95 };
96
97 extern WXDLLEXPORT_DATA(wxBrushList*) wxTheBrushList;
98
99 // provide comparison operators to allow code such as
100 //
101 // if ( brush.GetStyle() == wxTRANSPARENT )
102 //
103 // to compile without warnings which it would otherwise provoke from some
104 // compilers as it compares elements of different enums
105 #if FUTURE_WXWIN_COMPATIBILITY_3_0
106
107 inline bool operator==(wxBrushStyle s, wxDeprecatedGUIConstants t)
108 {
109 return wx_static_cast(int, s) == wx_static_cast(int, t);
110 }
111
112 inline bool operator!=(wxBrushStyle s, wxDeprecatedGUIConstants t)
113 {
114 return !(s == t);
115 }
116
117 #endif // FUTURE_WXWIN_COMPATIBILITY_3_0
118
119 #endif // _WX_BRUSH_H_BASE_