]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/brush.h
XPM updates
[wxWidgets.git] / include / wx / motif / brush.h
CommitLineData
9b6dbb09
JS
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
23class WXDLLEXPORT wxBrush;
24
25class WXDLLEXPORT wxBrushRefData: public wxGDIRefData
26{
27 friend class WXDLLEXPORT wxBrush;
28public:
29 wxBrushRefData();
30 wxBrushRefData(const wxBrushRefData& data);
31 ~wxBrushRefData();
32
33protected:
34 int m_style;
35 wxBitmap m_stipple ;
36 wxColour m_colour;
9b6dbb09
JS
37};
38
39#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
40
41// Brush
42class WXDLLEXPORT wxBrush: public wxGDIObject
43{
44 DECLARE_DYNAMIC_CLASS(wxBrush)
45
46public:
47 wxBrush();
48 wxBrush(const wxColour& col, int style);
9b6dbb09
JS
49 wxBrush(const wxBitmap& stipple);
50 inline wxBrush(const wxBrush& brush) { Ref(brush); }
9b6dbb09
JS
51 ~wxBrush();
52
53 virtual void SetColour(const wxColour& col) ;
9b6dbb09
JS
54 virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
55 virtual void SetStyle(int style) ;
56 virtual void SetStipple(const wxBitmap& stipple) ;
57
58 inline wxBrush& operator = (const wxBrush& brush) { if (*this == brush) return (*this); Ref(brush); return *this; }
f6bcfd97
BP
59 inline bool operator == (const wxBrush& brush) const { return m_refData == brush.m_refData; }
60 inline bool operator != (const wxBrush& brush) const { return m_refData != brush.m_refData; }
9b6dbb09
JS
61
62 inline wxColour& GetColour() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
63 inline int GetStyle() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); };
64 inline wxBitmap *GetStipple() const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); };
65
66 virtual bool Ok() const { return (m_refData != NULL) ; }
67
68// Implementation
69
70 // Useful helper: create the brush resource
dfc54541 71 bool RealizeResource();
9b6dbb09
JS
72
73 // When setting properties, we must make sure we're not changing
74 // another object
75 void Unshare();
76};
77
78#endif
79 // _WX_BRUSH_H_