]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/brush.h
Fixes for long to wxCoord
[wxWidgets.git] / include / wx / os2 / brush.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: brush.h
3 // Purpose: wxBrush class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/13/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_BRUSH_H_
13 #define _WX_BRUSH_H_
14
15 #include "wx/gdicmn.h"
16 #include "wx/gdiobj.h"
17 #include "wx/bitmap.h"
18
19 class WXDLLEXPORT wxBrush;
20
21 class WXDLLEXPORT wxBrushRefData: public wxGDIRefData
22 {
23 friend class WXDLLEXPORT wxBrush;
24 public:
25 wxBrushRefData();
26 wxBrushRefData(const wxBrushRefData& data);
27 ~wxBrushRefData();
28
29 protected:
30 int m_style;
31 wxBitmap m_stipple ;
32 wxColour m_colour;
33 WXHBRUSH m_hBrush;
34 };
35
36 #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
37
38 // Brush
39 class WXDLLEXPORT wxBrush: public wxGDIObject
40 {
41 DECLARE_DYNAMIC_CLASS(wxBrush)
42
43 public:
44 wxBrush();
45 wxBrush(const wxColour& col, int style);
46 wxBrush(const wxBitmap& stipple);
47 inline wxBrush(const wxBrush& brush) { Ref(brush); }
48 ~wxBrush();
49
50 virtual void SetColour(const wxColour& col) ;
51 virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
52 virtual void SetStyle(int style) ;
53 virtual void SetStipple(const wxBitmap& stipple) ;
54
55 inline wxBrush& operator = (const wxBrush& brush) { if (*this == brush) return (*this); Ref(brush); return *this; }
56 inline bool operator == (const wxBrush& brush) { return m_refData == brush.m_refData; }
57 inline bool operator != (const wxBrush& brush) { return m_refData != brush.m_refData; }
58
59 inline wxColour& GetColour() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
60 inline int GetStyle() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); };
61 inline wxBitmap *GetStipple() const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); };
62
63 virtual bool Ok() const { return (m_refData != NULL) ; }
64
65 // Implementation
66
67 // Useful helper: create the brush resource
68 bool RealizeResource();
69
70 WXHANDLE GetResourceHandle(void) ;
71 bool FreeResource(bool force = FALSE);
72 bool IsFree() const;
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_