]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/pen.h
supporting a null cgimage so that we don't get exceptions, only an wxbitmap that...
[wxWidgets.git] / include / wx / msw / pen.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/pen.h
3 // Purpose: wxPen class
4 // Author: Julian Smart
5 // Modified by: Vadim Zeitlin: fixed operator=(), ==(), !=()
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
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/gdicmn.h"
17
18 // ----------------------------------------------------------------------------
19 // Pen
20 // ----------------------------------------------------------------------------
21
22 class WXDLLIMPEXP_CORE wxPen : public wxPenBase
23 {
24 public:
25 wxPen() { }
26 wxPen(const wxColour& col, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID);
27 #if FUTURE_WXWIN_COMPATIBILITY_3_0
28 wxDEPRECATED_FUTURE( wxPen(const wxColour& col, int width, int style) );
29 #endif
30
31 wxPen(const wxBitmap& stipple, int width);
32 virtual ~wxPen() { }
33
34 bool operator==(const wxPen& pen) const;
35 bool operator!=(const wxPen& pen) const { return !(*this == pen); }
36
37 // Override in order to recreate the pen
38 void SetColour(const wxColour& col);
39 void SetColour(unsigned char r, unsigned char g, unsigned char b);
40
41 void SetWidth(int width);
42 void SetStyle(wxPenStyle style);
43 void SetStipple(const wxBitmap& stipple);
44 void SetDashes(int nb_dashes, const wxDash *dash);
45 void SetJoin(wxPenJoin join);
46 void SetCap(wxPenCap cap);
47
48 wxColour GetColour() const;
49 int GetWidth() const;
50 wxPenStyle GetStyle() const;
51 wxPenJoin GetJoin() const;
52 wxPenCap GetCap() const;
53 int GetDashes(wxDash** ptr) const;
54 wxDash* GetDash() const;
55 int GetDashCount() const;
56 wxBitmap* GetStipple() const;
57
58 #if FUTURE_WXWIN_COMPATIBILITY_3_0
59 wxDEPRECATED_FUTURE( void SetStyle(int style) )
60 { SetStyle((wxPenStyle)style); }
61 #endif
62
63 // internal: wxGDIObject methods
64 virtual bool RealizeResource();
65 virtual bool FreeResource(bool force = false);
66 virtual WXHANDLE GetResourceHandle() const;
67 virtual bool IsFree() const;
68
69 protected:
70 virtual wxGDIRefData* CreateGDIRefData() const;
71 virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const;
72
73 // same as FreeResource() + RealizeResource()
74 bool Recreate();
75
76 DECLARE_DYNAMIC_CLASS(wxPen)
77 };
78
79 #endif // _WX_PEN_H_