]> git.saurik.com Git - wxWidgets.git/blame - include/wx/pen.h
Make default keyboard handling available in wxVarScrollHelperEvtHandler too.
[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:
99d80019
JS
7// Copyright: (c) Julian Smart
8// Licence: wxWindows Licence
9/////////////////////////////////////////////////////////////////////////////
10
34138703
JS
11#ifndef _WX_PEN_H_BASE_
12#define _WX_PEN_H_BASE_
c801d85f 13
04ee05f9
PC
14#include "wx/gdiobj.h"
15#include "wx/gdicmn.h"
e45689df 16
82cddbd9
FM
17enum wxPenStyle
18{
ac3688c0 19 wxPENSTYLE_INVALID = -1,
82cddbd9
FM
20
21 wxPENSTYLE_SOLID = wxSOLID,
22 wxPENSTYLE_DOT = wxDOT,
23 wxPENSTYLE_LONG_DASH = wxLONG_DASH,
24 wxPENSTYLE_SHORT_DASH = wxSHORT_DASH,
25 wxPENSTYLE_DOT_DASH = wxDOT_DASH,
777819af 26 wxPENSTYLE_USER_DASH = wxUSER_DASH,
82cddbd9
FM
27
28 wxPENSTYLE_TRANSPARENT = wxTRANSPARENT,
29
30 wxPENSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE,
31 wxPENSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK,
32 wxPENSTYLE_STIPPLE = wxSTIPPLE,
33
c17eafaa
VZ
34 wxPENSTYLE_BDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL,
35 wxPENSTYLE_CROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG,
36 wxPENSTYLE_FDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL,
37 wxPENSTYLE_CROSS_HATCH = wxHATCHSTYLE_CROSS,
38 wxPENSTYLE_HORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL,
39 wxPENSTYLE_VERTICAL_HATCH = wxHATCHSTYLE_VERTICAL,
40 wxPENSTYLE_FIRST_HATCH = wxHATCHSTYLE_FIRST,
41 wxPENSTYLE_LAST_HATCH = wxHATCHSTYLE_LAST
82cddbd9
FM
42};
43
44enum wxPenJoin
45{
46 wxJOIN_INVALID = -1,
47
48 wxJOIN_BEVEL = 120,
49 wxJOIN_MITER,
1f2e5667 50 wxJOIN_ROUND
82cddbd9
FM
51};
52
53enum wxPenCap
54{
55 wxCAP_INVALID = -1,
56
57 wxCAP_ROUND = 130,
58 wxCAP_PROJECTING,
59 wxCAP_BUTT
60};
61
62
53a2db12 63class WXDLLIMPEXP_CORE wxPenBase : public wxGDIObject
82cddbd9
FM
64{
65public:
66 virtual ~wxPenBase() { }
67
68 virtual void SetColour(const wxColour& col) = 0;
69 virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) = 0;
70
71 virtual void SetWidth(int width) = 0;
72 virtual void SetStyle(wxPenStyle style) = 0;
73 virtual void SetStipple(const wxBitmap& stipple) = 0;
74 virtual void SetDashes(int nb_dashes, const wxDash *dash) = 0;
75 virtual void SetJoin(wxPenJoin join) = 0;
76 virtual void SetCap(wxPenCap cap) = 0;
77
231b9591 78 virtual wxColour GetColour() const = 0;
82cddbd9
FM
79 virtual wxBitmap *GetStipple() const = 0;
80 virtual wxPenStyle GetStyle() const = 0;
81 virtual wxPenJoin GetJoin() const = 0;
82 virtual wxPenCap GetCap() const = 0;
83 virtual int GetWidth() const = 0;
84 virtual int GetDashes(wxDash **ptr) const = 0;
e6777e65
VZ
85
86 // Convenient helpers for testing whether the pen is a transparent one:
87 // unlike GetStyle() == wxPENSTYLE_TRANSPARENT, they work correctly even if
88 // the pen is invalid (they both return false in this case).
89 bool IsTransparent() const
90 {
91 return IsOk() && GetStyle() == wxPENSTYLE_TRANSPARENT;
92 }
93
94 bool IsNonTransparent() const
95 {
96 return IsOk() && GetStyle() != wxPENSTYLE_TRANSPARENT;
97 }
82cddbd9
FM
98};
99
bd362275 100#if defined(__WXMSW__)
bc735a68 101 #include "wx/msw/pen.h"
4f535231 102#elif defined(__WXMOTIF__) || defined(__WXX11__)
bc735a68 103 #include "wx/x11/pen.h"
1be7a35c 104#elif defined(__WXGTK20__)
bc735a68 105 #include "wx/gtk/pen.h"
1be7a35c 106#elif defined(__WXGTK__)
bc735a68 107 #include "wx/gtk1/pen.h"
b3c86150 108#elif defined(__WXDFB__)
bc735a68 109 #include "wx/dfb/pen.h"
34138703 110#elif defined(__WXMAC__)
bc735a68 111 #include "wx/osx/pen.h"
e64df9bc 112#elif defined(__WXCOCOA__)
bc735a68 113 #include "wx/cocoa/pen.h"
1777b9bb 114#elif defined(__WXPM__)
bc735a68 115 #include "wx/os2/pen.h"
c801d85f
KB
116#endif
117
82cddbd9
FM
118class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase
119{
120public:
5d2d8f6a
VZ
121 wxPen *FindOrCreatePen(const wxColour& colour,
122 int width = 1,
123 wxPenStyle style = wxPENSTYLE_SOLID);
ac3688c0
FM
124
125#if FUTURE_WXWIN_COMPATIBILITY_3_0
126 wxPen *FindOrCreatePen(const wxColour& colour, int width, int style)
127 { return FindOrCreatePen(colour, width, (wxPenStyle)style); }
128#endif
82cddbd9
FM
129#if WXWIN_COMPATIBILITY_2_6
130 wxDEPRECATED( void AddPen(wxPen*) );
131 wxDEPRECATED( void RemovePen(wxPen*) );
132#endif
133};
134
53a2db12 135extern WXDLLIMPEXP_DATA_CORE(wxPenList*) wxThePenList;
82cddbd9 136
8907a7e2
VZ
137// provide comparison operators to allow code such as
138//
139// if ( pen.GetStyle() == wxTRANSPARENT )
140//
141// to compile without warnings which it would otherwise provoke from some
142// compilers as it compares elements of different enums
143#if FUTURE_WXWIN_COMPATIBILITY_3_0
144
25859335
VZ
145// Unfortunately some compilers have ambiguity issues when enum comparisons are
146// overloaded so we have to disable the overloads in this case, see
147// wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details.
148#ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM
149
8907a7e2
VZ
150inline bool operator==(wxPenStyle s, wxDeprecatedGUIConstants t)
151{
5c33522f 152 return static_cast<int>(s) == static_cast<int>(t);
8907a7e2
VZ
153}
154
155inline bool operator!=(wxPenStyle s, wxDeprecatedGUIConstants t)
156{
157 return !(s == t);
158}
159
25859335
VZ
160#endif // wxCOMPILER_NO_OVERLOAD_ON_ENUM
161
8907a7e2
VZ
162#endif // FUTURE_WXWIN_COMPATIBILITY_3_0
163
164#endif // _WX_PEN_H_BASE_