]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/pen.h
Eliminate comma's after last element in an enum
[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
KB
21
22typedef WXDWORD wxDash ;
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 ;
41 wxDash * m_dash ;
42 wxColour m_colour;
43 WXHPEN m_hPen;
44};
45
46#define M_PENDATA ((wxPenRefData *)m_refData)
47
48// Pen
49class WXDLLEXPORT wxPen: public wxGDIObject
50{
51 DECLARE_DYNAMIC_CLASS(wxPen)
52public:
e4a81a2e 53 wxPen();
debe6624 54 wxPen(const wxColour& col, int width, int style);
debe6624 55 wxPen(const wxBitmap& stipple, int width);
2bda0e17 56 inline wxPen(const wxPen& pen) { Ref(pen); }
e4a81a2e 57 ~wxPen();
2bda0e17
KB
58
59 inline wxPen& operator = (const wxPen& pen) { if (*this == pen) return (*this); Ref(pen); return *this; }
60 inline bool operator == (const wxPen& pen) { return m_refData == pen.m_refData; }
61 inline bool operator != (const wxPen& pen) { return m_refData != pen.m_refData; }
62
e4a81a2e 63 virtual bool Ok() const { return (m_refData != NULL) ; }
2bda0e17
KB
64
65 // Override in order to recreate the pen
66 void SetColour(const wxColour& col) ;
4d947517 67 void SetColour(unsigned char r, unsigned char g, unsigned char b);
2bda0e17 68
debe6624
JS
69 void SetWidth(int width) ;
70 void SetStyle(int style) ;
2bda0e17 71 void SetStipple(const wxBitmap& stipple) ;
debe6624
JS
72 void SetDashes(int nb_dashes, const wxDash *dash) ;
73 void SetJoin(int join) ;
74 void SetCap(int cap) ;
2bda0e17 75
e4a81a2e
VZ
76 inline wxColour& GetColour() const { return (M_PENDATA ? M_PENDATA->m_colour : wxNullColour); };
77 inline int GetWidth() const { return (M_PENDATA ? M_PENDATA->m_width : 0); };
78 inline int GetStyle() const { return (M_PENDATA ? M_PENDATA->m_style : 0); };
79 inline int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); };
80 inline int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); };
2bda0e17 81 inline int GetDashes(wxDash **ptr) const {
57c208c5 82 *ptr = (M_PENDATA ? M_PENDATA->m_dash : (wxDash*) NULL); return (M_PENDATA ? M_PENDATA->m_nbDash : 0);
2bda0e17
KB
83 }
84
57c208c5 85 inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : (wxBitmap*) NULL); };
2bda0e17
KB
86
87 // Internal
e4a81a2e 88 bool RealizeResource();
2bda0e17 89 bool FreeResource(bool force = FALSE);
e4a81a2e
VZ
90 WXHANDLE GetResourceHandle() ;
91 bool IsFree() const;
b823f5a1 92 void Unshare();
2bda0e17
KB
93};
94
95int wx2msPenStyle(int wx_style);
96
97#endif
bbcdf8bc 98 // _WX_PEN_H_