]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/pen.h
ReDOS-ified project files
[wxWidgets.git] / include / wx / msw / pen.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: pen.h
3// Purpose: wxPen class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc
JS
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_PEN_H_
13#define _WX_PEN_H_
2bda0e17
KB
14
15#ifdef __GNUG__
16#pragma interface "pen.h"
17#endif
18
19#include "wx/gdiobj.h"
2432b92d 20#include "wx/bitmap.h"
2bda0e17 21
236a9de3 22typedef WXDWORD wxMSWDash;
2bda0e17
KB
23
24class WXDLLEXPORT wxPen;
25
26class WXDLLEXPORT wxPenRefData: public wxGDIRefData
27{
28 friend class WXDLLEXPORT wxPen;
29public:
e4a81a2e 30 wxPenRefData();
b823f5a1 31 wxPenRefData(const wxPenRefData& data);
e4a81a2e 32 ~wxPenRefData();
2bda0e17
KB
33
34protected:
35 int m_width;
36 int m_style;
37 int m_join ;
38 int m_cap ;
39 wxBitmap m_stipple ;
40 int m_nbDash ;
edd97174 41 wxDash * m_dash ;
2bda0e17
KB
42 wxColour m_colour;
43 WXHPEN m_hPen;
22f3361e
VZ
44
45private:
46// Cannot use
47// DECLARE_NO_COPY_CLASS(wxPenRefData)
48// because copy constructor is explicitly declared above;
49// but no copy assignment operator is defined, so declare
50// it private to prevent the compiler from defining it:
51 wxPenRefData& operator=(const wxPenRefData&);
2bda0e17
KB
52};
53
54#define M_PENDATA ((wxPenRefData *)m_refData)
55
56// Pen
57class WXDLLEXPORT wxPen: public wxGDIObject
58{
59 DECLARE_DYNAMIC_CLASS(wxPen)
60public:
e4a81a2e 61 wxPen();
debe6624 62 wxPen(const wxColour& col, int width, int style);
debe6624 63 wxPen(const wxBitmap& stipple, int width);
2bda0e17 64 inline wxPen(const wxPen& pen) { Ref(pen); }
e4a81a2e 65 ~wxPen();
2bda0e17
KB
66
67 inline wxPen& operator = (const wxPen& pen) { if (*this == pen) return (*this); Ref(pen); return *this; }
f6bcfd97
BP
68 inline bool operator == (const wxPen& pen) const { return m_refData == pen.m_refData; }
69 inline bool operator != (const wxPen& pen) const { return m_refData != pen.m_refData; }
2bda0e17 70
e4a81a2e 71 virtual bool Ok() const { return (m_refData != NULL) ; }
2bda0e17
KB
72
73 // Override in order to recreate the pen
74 void SetColour(const wxColour& col) ;
4d947517 75 void SetColour(unsigned char r, unsigned char g, unsigned char b);
2bda0e17 76
debe6624
JS
77 void SetWidth(int width) ;
78 void SetStyle(int style) ;
2bda0e17 79 void SetStipple(const wxBitmap& stipple) ;
debe6624
JS
80 void SetDashes(int nb_dashes, const wxDash *dash) ;
81 void SetJoin(int join) ;
82 void SetCap(int cap) ;
2bda0e17 83
e4a81a2e
VZ
84 inline wxColour& GetColour() const { return (M_PENDATA ? M_PENDATA->m_colour : wxNullColour); };
85 inline int GetWidth() const { return (M_PENDATA ? M_PENDATA->m_width : 0); };
86 inline int GetStyle() const { return (M_PENDATA ? M_PENDATA->m_style : 0); };
87 inline int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); };
88 inline int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); };
236a9de3
RL
89 inline int GetDashes(wxDash **ptr) const
90 {
91 *ptr = (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*) NULL);
92 return (M_PENDATA ? M_PENDATA->m_nbDash : 0);
2bda0e17
KB
93 }
94
57c208c5 95 inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : (wxBitmap*) NULL); };
2bda0e17
KB
96
97 // Internal
e4a81a2e 98 bool RealizeResource();
2bda0e17 99 bool FreeResource(bool force = FALSE);
2b5f62a0 100 WXHANDLE GetResourceHandle() const;
e4a81a2e 101 bool IsFree() const;
b823f5a1 102 void Unshare();
2bda0e17
KB
103};
104
105int wx2msPenStyle(int wx_style);
106
107#endif
bbcdf8bc 108 // _WX_PEN_H_