]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/pen.h
safer definitions for wx(U)Int32,16 (taken from intl.cpp)
[wxWidgets.git] / include / wx / os2 / pen.h
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: pen.h
3// Purpose: wxPen class
cdf1e714 4// Author: David Webster
0e320a79 5// Modified by:
cdf1e714 6// Created: 10/10/99
0e320a79 7// RCS-ID: $Id$
cdf1e714
DW
8// Copyright: (c) David Webster
9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_PEN_H_
13#define _WX_PEN_H_
14
0e320a79 15#include "wx/gdiobj.h"
0e320a79
DW
16#include "wx/bitmap.h"
17
236a9de3 18typedef long wxPMDash;
0e320a79
DW
19
20class WXDLLEXPORT wxPen;
21
22class WXDLLEXPORT wxPenRefData: public wxGDIRefData
23{
24 friend class WXDLLEXPORT wxPen;
25public:
26 wxPenRefData();
fd368161 27 wxPenRefData(const wxPenRefData& rData);
0e320a79
DW
28 ~wxPenRefData();
29
30protected:
fd368161
DW
31 int m_nWidth;
32 int m_nStyle;
33 int m_nJoin;
34 int m_nCap;
35 wxBitmap m_vStipple;
36 wxColour m_vColour;
37 WXHPEN m_hPen;// in OS/2 GPI this will be the PS the pen is associated with
0e320a79
DW
38};
39
40#define M_PENDATA ((wxPenRefData *)m_refData)
41
42// Pen
fd368161 43class WXDLLEXPORT wxPen : public wxGDIObject
0e320a79 44{
fd368161 45 DECLARE_DYNAMIC_CLASS(wxPen)
0e320a79 46public:
fd368161
DW
47 wxPen();
48 wxPen( const wxColour& rColour
49 ,int nWidth
50 ,int nStyle
51 );
52 wxPen( const wxBitmap& rStipple
53 ,int nWidth
54 );
55 inline wxPen(const wxPen& rPen) { Ref(rPen); }
56 ~wxPen();
57
58 inline wxPen& operator = (const wxPen& rPen) { if (*this == rPen) return (*this); Ref(rPen); return *this; }
59 inline bool operator == (const wxPen& rPen) { return m_refData == rPen.m_refData; }
60 inline bool operator != (const wxPen& rPen) { return m_refData != rPen.m_refData; }
61
62 virtual bool Ok(void) const { return (m_refData != NULL); }
63
64 //
65 // Override in order to recreate the pen
66 //
67 void SetColour(const wxColour& rColour);
68 void SetColour( unsigned char cRed
69 ,unsigned char cGreen
70 ,unsigned char cBlue
71 );
72
73 void SetWidth(int nWidth);
74 void SetStyle(int nStyle);
75 void SetStipple(const wxBitmap& rStipple);
76 void SetDashes( int nNbDashes
77 ,const wxDash* pDash
78 );
79 void SetJoin(int nJoin);
80 void SetCap(int nCap);
81 void SetPS(HPS hPS);
82
83 inline wxColour& GetColour(void) const { return (M_PENDATA ? M_PENDATA->m_vColour : wxNullColour); };
84 inline int GetWidth(void) const { return (M_PENDATA ? M_PENDATA->m_nWidth : 0); };
85 inline int GetStyle(void) const { return (M_PENDATA ? M_PENDATA->m_nStyle : 0); };
86 inline int GetJoin(void) const { return (M_PENDATA ? M_PENDATA->m_nJoin : 0); };
87 inline int GetCap(void) const { return (M_PENDATA ? M_PENDATA->m_nCap : 0); };
88 inline int GetPS(void) const { return (M_PENDATA ? M_PENDATA->m_hPen : 0); };
89
90 inline wxBitmap* GetStipple(void) const { return (M_PENDATA ? (& M_PENDATA->m_vStipple) : (wxBitmap*) NULL); };
91
92 //
93 // Implementation
94 //
95
96 //
97 // Useful helper: create the brush resource
98 //
99 bool RealizeResource(void);
100 bool FreeResource(bool bForce = FALSE);
101 WXHANDLE GetResourceHandle(void);
102 bool IsFree(void) const;
103 void Unshare(void);
104
105private:
106 LINEBUNDLE m_vLineBundle;
107 AREABUNDLE m_vAreaBundle;
108}; // end of CLASS wxPen
0e320a79 109
bd3e41f6
DW
110extern int wx2os2PenStyle(int nWxStyle);
111
0e320a79
DW
112#endif
113 // _WX_PEN_H_