]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/brush.h
don't define _CRTDBG_MAP_ALLOC as it is apparently unnecessary (patch 995135)
[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 8// Copyright: (c) David Webster
65571936 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();
15f03b25 26 wxBrushRefData(const wxBrushRefData& rData);
0e320a79
DW
27 ~wxBrushRefData();
28
29protected:
15f03b25
DW
30 int m_nStyle;
31 wxBitmap m_vStipple ;
32 wxColour m_vColour;
33 WXHBRUSH m_hBrush; // in OS/2 GPI this will be the PS the pen is associated with
34 AREABUNDLE m_vBundle;
0e320a79
DW
35};
36
37#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
38
39// Brush
40class WXDLLEXPORT wxBrush: public wxGDIObject
41{
15f03b25 42 DECLARE_DYNAMIC_CLASS(wxBrush)
0e320a79
DW
43
44public:
15f03b25
DW
45 wxBrush();
46 wxBrush( const wxColour& rCol
5b36366c 47 ,int nStyle = wxSOLID
15f03b25
DW
48 );
49 wxBrush(const wxBitmap& rStipple);
50 inline wxBrush(const wxBrush& rBrush) { Ref(rBrush); }
51 ~wxBrush();
52
53 inline wxBrush& operator = (const wxBrush& rBrush) { if (*this == rBrush) return (*this); Ref(rBrush); return *this; }
ba2de0a1
SN
54 inline bool operator == (const wxBrush& rBrush) const { return m_refData == rBrush.m_refData; }
55 inline bool operator != (const wxBrush& rBrush) const { return m_refData != rBrush.m_refData; }
15f03b25
DW
56
57 virtual void SetColour(const wxColour& rColour);
58 virtual void SetColour( unsigned char cRed
59 ,unsigned char cGreen
60 ,unsigned char cBrush
61 );
62 virtual void SetPS(HPS hPS);
63 virtual void SetStyle(int nStyle) ;
64 virtual void SetStipple(const wxBitmap& rStipple);
65
66 inline wxColour& GetColour(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_vColour : wxNullColour); };
67 inline int GetStyle(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_nStyle : 0); };
68 inline wxBitmap* GetStipple(void) const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_vStipple : 0); };
69 inline int GetPS(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_hBrush : 0); };
70
71 inline virtual bool Ok(void) const { return (m_refData != NULL) ; }
72
73 //
74 // Implementation
75 //
76
77 //
78 // Useful helper: create the brush resource
79 //
80 bool RealizeResource(void);
81 WXHANDLE GetResourceHandle(void) ;
82 bool FreeResource(bool bForce = FALSE);
83 bool IsFree(void) const;
84 void Unshare(void);
85}; // end of CLASS wxBrush
0e320a79
DW
86
87#endif
88 // _WX_BRUSH_H_