]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/pen.h
fixed centering of top level windows on secondary displays (replaces patch 1267173)
[wxWidgets.git] / include / wx / os2 / pen.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/pen.h
3 // Purpose: wxPen class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/10/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_PEN_H_
13 #define _WX_PEN_H_
14
15 #include "wx/gdiobj.h"
16 #include "wx/bitmap.h"
17
18 typedef long wxPMDash;
19
20 class WXDLLEXPORT wxPen;
21
22 class WXDLLEXPORT wxPenRefData: public wxGDIRefData
23 {
24 friend class WXDLLEXPORT wxPen;
25 public:
26 wxPenRefData();
27 wxPenRefData(const wxPenRefData& rData);
28 ~wxPenRefData();
29
30 protected:
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
38 };
39
40 #define M_PENDATA ((wxPenRefData *)m_refData)
41
42 // Pen
43 class WXDLLEXPORT wxPen : public wxGDIObject
44 {
45 DECLARE_DYNAMIC_CLASS(wxPen)
46 public:
47 wxPen();
48 wxPen( const wxColour& rColour
49 ,int nWidth = 1
50 ,int nStyle = wxSOLID
51 );
52 wxPen( const wxBitmap& rStipple
53 ,int nWidth
54 );
55 ~wxPen();
56
57 inline bool operator == (const wxPen& rPen) const
58 { return m_refData == rPen.m_refData; }
59 inline bool operator != (const wxPen& rPen) const
60 { 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, unsigned char cGreen, unsigned char cBlue);
69
70 void SetWidth(int nWidth);
71 void SetStyle(int nStyle);
72 void SetStipple(const wxBitmap& rStipple);
73 void SetDashes( int nNbDashes
74 ,const wxDash* pDash
75 );
76 void SetJoin(int nJoin);
77 void SetCap(int nCap);
78 void SetPS(HPS hPS);
79
80 inline wxColour& GetColour(void) const { return (M_PENDATA ? M_PENDATA->m_vColour : wxNullColour); };
81 inline int GetWidth(void) const { return (M_PENDATA ? M_PENDATA->m_nWidth : 0); };
82 inline int GetStyle(void) const { return (M_PENDATA ? M_PENDATA->m_nStyle : 0); };
83 inline int GetJoin(void) const { return (M_PENDATA ? M_PENDATA->m_nJoin : 0); };
84 inline int GetCap(void) const { return (M_PENDATA ? M_PENDATA->m_nCap : 0); };
85 inline int GetPS(void) const { return (M_PENDATA ? M_PENDATA->m_hPen : 0); };
86
87 inline wxBitmap* GetStipple(void) const { return (M_PENDATA ? (& M_PENDATA->m_vStipple) : (wxBitmap*) NULL); };
88
89 //
90 // Implementation
91 //
92
93 //
94 // Useful helper: create the brush resource
95 //
96 bool RealizeResource(void);
97 bool FreeResource(bool bForce = false);
98 WXHANDLE GetResourceHandle(void);
99 bool IsFree(void) const;
100 void Unshare(void);
101
102 private:
103 LINEBUNDLE m_vLineBundle;
104 AREABUNDLE m_vAreaBundle;
105 }; // end of CLASS wxPen
106
107 extern int wx2os2PenStyle(int nWxStyle);
108
109 #endif
110 // _WX_PEN_H_