]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/brush.h
1. wxShell fixes: now really uses shell (it wasn't different from wxExecute!)
[wxWidgets.git] / include / wx / os2 / brush.h
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: brush.h
3// Purpose: wxBrush class
37f214d5 4// Author: David Webster
0e320a79 5// Modified by:
37f214d5 6// Created: 10/13/99
0e320a79 7// RCS-ID: $Id$
37f214d5
DW
8// Copyright: (c) David Webster
9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_BRUSH_H_
13#define _WX_BRUSH_H_
14
0e320a79
DW
15#include "wx/gdicmn.h"
16#include "wx/gdiobj.h"
17#include "wx/bitmap.h"
18
19class WXDLLEXPORT wxBrush;
20
21class WXDLLEXPORT wxBrushRefData: public wxGDIRefData
22{
23 friend class WXDLLEXPORT wxBrush;
24public:
25 wxBrushRefData();
26 wxBrushRefData(const wxBrushRefData& data);
27 ~wxBrushRefData();
28
29protected:
30 int m_style;
31 wxBitmap m_stipple ;
32 wxColour m_colour;
0e320a79 33 WXHBRUSH m_hBrush;
0e320a79
DW
34};
35
36#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
37
38// Brush
39class WXDLLEXPORT wxBrush: public wxGDIObject
40{
41 DECLARE_DYNAMIC_CLASS(wxBrush)
42
43public:
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
fb9010ed
DW
70 WXHANDLE GetResourceHandle(void) ;
71 bool FreeResource(bool force = FALSE);
72 bool IsFree() const;
73
0e320a79
DW
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_