]> git.saurik.com Git - wxWidgets.git/blame - include/wx/pen.h
use static functions instead of static variables for critical sections to avoid crash...
[wxWidgets.git] / include / wx / pen.h
CommitLineData
99d80019
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/pen.h
3// Purpose: Base header for wxPen
4// Author: Julian Smart
5// Modified by:
6// Created:
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows Licence
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_PEN_H_BASE_
13#define _WX_PEN_H_BASE_
c801d85f 14
04ee05f9
PC
15#include "wx/gdiobj.h"
16#include "wx/gdicmn.h"
e45689df 17
6cef0db2
FM
18#if WXWIN_COMPATIBILITY_2_8
19#include "wx/brush.h" // needed for some deprecated declarations
20#endif
21
82cddbd9
FM
22enum wxPenStyle
23{
24#if WXWIN_COMPATIBILITY_2_8
25 /* start of deprecated values */
26 /* wxSOLID, wxTRANSPARENT, wxSTIPPLE are already defined in wxBrushStyle */
27 wxDOT = 101,
28 wxLONG_DASH = 102,
29 wxSHORT_DASH = 103,
30 wxDOT_DASH = 104,
31 wxUSER_DASH = 105,
32 /* end of deprecated values */
33
34 wxPENSTYLE_SOLID = wxSOLID,
35 wxPENSTYLE_DOT = wxDOT,
36 wxPENSTYLE_LONG_DASH = wxLONG_DASH,
37 wxPENSTYLE_SHORT_DASH = wxSHORT_DASH,
38 wxPENSTYLE_DOT_DASH = wxDOT_DASH,
777819af 39 wxPENSTYLE_USER_DASH = wxUSER_DASH,
82cddbd9
FM
40
41 wxPENSTYLE_TRANSPARENT = wxTRANSPARENT,
42
43 wxPENSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE,
44 wxPENSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK,
45 wxPENSTYLE_STIPPLE = wxSTIPPLE,
46
47 wxPENSTYLE_BDIAGONAL_HATCH = wxBDIAGONAL_HATCH,
48 wxPENSTYLE_CROSSDIAG_HATCH = wxCROSSDIAG_HATCH,
49 wxPENSTYLE_FDIAGONAL_HATCH = wxFDIAGONAL_HATCH,
50 wxPENSTYLE_CROSS_HATCH = wxCROSS_HATCH,
51 wxPENSTYLE_HORIZONTAL_HATCH = wxHORIZONTAL_HATCH,
52 wxPENSTYLE_VERTICAL_HATCH = wxVERTICAL_HATCH,
53
54 wxPENSTYLE_FIRST_HATCH = wxFIRST_HATCH,
55 wxPENSTYLE_LAST_HATCH = wxLAST_HATCH,
56
57 wxPENSTYLE_MAX
58#else
59 wxPENSTYLE_SOLID,
60 wxPENSTYLE_DOT,
61 wxPENSTYLE_LONG_DASH,
62 wxPENSTYLE_SHORT_DASH,
63 wxPENSTYLE_DOT_DASH,
777819af 64 wxPENSTYLE_USER_DASH,
82cddbd9
FM
65
66 wxPENSTYLE_TRANSPARENT,
67
68 /* Pen Stippling. */
69 wxPENSTYLE_STIPPLE_MASK_OPAQUE,
70 /* mask is used for blitting monochrome using text fore and back ground colors */
71
72 wxPENSTYLE_STIPPLE_MASK,
73 /* mask is used for masking areas in the stipple bitmap (TO DO) */
74
75 wxPENSTYLE_STIPPLE,
76 /* drawn with a Pen, and without any Brush -- and it can be stippled. */
77
78 /* In wxWidgets < 2.6 use WX_HATCH macro */
79 /* to verify these wx*_HATCH are in style */
80 /* of wxBrush. In wxWidgets >= 2.6 use */
81 /* wxBrush::IsHatch() instead. */
82 wxPENSTYLE_BDIAGONAL_HATCH,
83 wxPENSTYLE_CROSSDIAG_HATCH,
84 wxPENSTYLE_FDIAGONAL_HATCH,
85 wxPENSTYLE_CROSS_HATCH,
86 wxPENSTYLE_HORIZONTAL_HATCH,
87 wxPENSTYLE_VERTICAL_HATCH,
88
89 wxPENSTYLE_FIRST_HATCH = wxPENSTYLE_BDIAGONAL_HATCH,
90 wxPENSTYLE_LAST_HATCH = wxPENSTYLE_VERTICAL_HATCH,
91
92 wxPENSTYLE_MAX
93#endif
94};
95
96enum wxPenJoin
97{
98 wxJOIN_INVALID = -1,
99
100 wxJOIN_BEVEL = 120,
101 wxJOIN_MITER,
102 wxJOIN_ROUND,
103};
104
105enum wxPenCap
106{
107 wxCAP_INVALID = -1,
108
109 wxCAP_ROUND = 130,
110 wxCAP_PROJECTING,
111 wxCAP_BUTT
112};
113
114
115class WXDLLEXPORT wxPenBase : public wxGDIObject
116{
117public:
118 virtual ~wxPenBase() { }
119
120 virtual void SetColour(const wxColour& col) = 0;
121 virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) = 0;
122
123 virtual void SetWidth(int width) = 0;
124 virtual void SetStyle(wxPenStyle style) = 0;
125 virtual void SetStipple(const wxBitmap& stipple) = 0;
126 virtual void SetDashes(int nb_dashes, const wxDash *dash) = 0;
127 virtual void SetJoin(wxPenJoin join) = 0;
128 virtual void SetCap(wxPenCap cap) = 0;
129
130 virtual wxColour& GetColour() const = 0;
131 virtual wxBitmap *GetStipple() const = 0;
132 virtual wxPenStyle GetStyle() const = 0;
133 virtual wxPenJoin GetJoin() const = 0;
134 virtual wxPenCap GetCap() const = 0;
135 virtual int GetWidth() const = 0;
136 virtual int GetDashes(wxDash **ptr) const = 0;
137
138#if WXWIN_COMPATIBILITY_2_8
139 void SetStyle(wxBrushStyle style)
140 { SetStyle((wxPenStyle)style); }
141#endif
142};
143
4055ed82 144#if defined(__WXPALMOS__)
ffecfa5a
JS
145#include "wx/palmos/pen.h"
146#elif defined(__WXMSW__)
c801d85f 147#include "wx/msw/pen.h"
4f535231 148#elif defined(__WXMOTIF__) || defined(__WXX11__)
69c44812 149#include "wx/x11/pen.h"
1be7a35c 150#elif defined(__WXGTK20__)
c801d85f 151#include "wx/gtk/pen.h"
1be7a35c
MR
152#elif defined(__WXGTK__)
153#include "wx/gtk1/pen.h"
b2a19d94
VS
154#elif defined(__WXMGL__)
155#include "wx/mgl/pen.h"
b3c86150
VS
156#elif defined(__WXDFB__)
157#include "wx/dfb/pen.h"
34138703
JS
158#elif defined(__WXMAC__)
159#include "wx/mac/pen.h"
e64df9bc
DE
160#elif defined(__WXCOCOA__)
161#include "wx/cocoa/pen.h"
1777b9bb
DW
162#elif defined(__WXPM__)
163#include "wx/os2/pen.h"
c801d85f
KB
164#endif
165
82cddbd9
FM
166class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase
167{
168public:
169 wxPen *FindOrCreatePen(const wxColour& colour, int width, wxPenStyle style);
170#if WXWIN_COMPATIBILITY_2_6
171 wxDEPRECATED( void AddPen(wxPen*) );
172 wxDEPRECATED( void RemovePen(wxPen*) );
173#endif
174};
175
176extern WXDLLEXPORT_DATA(wxPenList*) wxThePenList;
177
c801d85f 178#endif
34138703 179 // _WX_PEN_H_BASE_