]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/brush.h
Send the wxWindowDestroyEvent for all ports
[wxWidgets.git] / include / wx / motif / brush.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: brush.h
3 // Purpose: wxBrush class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_BRUSH_H_
13 #define _WX_BRUSH_H_
14
15 #ifdef __GNUG__
16 #pragma interface "brush.h"
17 #endif
18
19 #include "wx/gdicmn.h"
20 #include "wx/gdiobj.h"
21 #include "wx/bitmap.h"
22 #include "wx/colour.h"
23
24 class WXDLLEXPORT wxBrush;
25
26 class WXDLLEXPORT wxBrushRefData: public wxGDIRefData
27 {
28 friend class WXDLLEXPORT wxBrush;
29 public:
30 wxBrushRefData();
31 wxBrushRefData(const wxBrushRefData& data);
32 ~wxBrushRefData();
33
34 protected:
35 int m_style;
36 wxBitmap m_stipple ;
37 wxColour m_colour;
38 };
39
40 #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
41
42 // Brush
43 class WXDLLEXPORT wxBrush: public wxGDIObject
44 {
45 DECLARE_DYNAMIC_CLASS(wxBrush)
46
47 public:
48 wxBrush();
49 wxBrush(const wxColour& col, int style);
50 wxBrush(const wxBitmap& stipple);
51 inline wxBrush(const wxBrush& brush) { Ref(brush); }
52 ~wxBrush();
53
54 virtual void SetColour(const wxColour& col) ;
55 virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
56 virtual void SetStyle(int style) ;
57 virtual void SetStipple(const wxBitmap& stipple) ;
58
59 inline wxBrush& operator = (const wxBrush& brush) { if (*this == brush) return (*this); Ref(brush); return *this; }
60 inline bool operator == (const wxBrush& brush) const { return m_refData == brush.m_refData; }
61 inline bool operator != (const wxBrush& brush) const { return m_refData != brush.m_refData; }
62
63 inline wxColour& GetColour() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
64 inline int GetStyle() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); };
65 inline wxBitmap *GetStipple() const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); };
66
67 virtual bool Ok() const { return (m_refData != NULL) ; }
68
69 // Implementation
70
71 // Useful helper: create the brush resource
72 bool RealizeResource();
73
74 // When setting properties, we must make sure we're not changing
75 // another object
76 void Unshare();
77 };
78
79 #endif
80 // _WX_BRUSH_H_