| 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 WXDLLEXPORT wxPen : public wxGDIObject |
| 23 | { |
| 24 | public: |
| 25 | wxPen() { } |
| 26 | wxPen(const wxColour& col, int width = 1, int style = wxSOLID); |
| 27 | wxPen(const wxBitmap& stipple, int width); |
| 28 | virtual ~wxPen() { } |
| 29 | |
| 30 | bool operator==(const wxPen& pen) const; |
| 31 | bool operator!=(const wxPen& pen) const { return !(*this == pen); } |
| 32 | |
| 33 | virtual bool Ok() const { return IsOk(); } |
| 34 | virtual bool IsOk() const { return (m_refData != NULL); } |
| 35 | |
| 36 | // Override in order to recreate the pen |
| 37 | void SetColour(const wxColour& col); |
| 38 | void SetColour(unsigned char r, unsigned char g, unsigned char b); |
| 39 | |
| 40 | void SetWidth(int width); |
| 41 | void SetStyle(int style); |
| 42 | void SetStipple(const wxBitmap& stipple); |
| 43 | void SetDashes(int nb_dashes, const wxDash *dash); |
| 44 | void SetJoin(int join); |
| 45 | void SetCap(int cap); |
| 46 | |
| 47 | wxColour& GetColour() const; |
| 48 | int GetWidth() const; |
| 49 | int GetStyle() const; |
| 50 | int GetJoin() const; |
| 51 | int GetCap() const; |
| 52 | int GetDashes(wxDash** ptr) const; |
| 53 | wxDash* GetDash() const; |
| 54 | int GetDashCount() const; |
| 55 | wxBitmap* GetStipple() const; |
| 56 | |
| 57 | // internal: wxGDIObject methods |
| 58 | virtual bool RealizeResource(); |
| 59 | virtual bool FreeResource(bool force = false); |
| 60 | virtual WXHANDLE GetResourceHandle() const; |
| 61 | virtual bool IsFree() const; |
| 62 | |
| 63 | protected: |
| 64 | virtual wxObjectRefData* CreateRefData() const; |
| 65 | virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const; |
| 66 | |
| 67 | // same as FreeResource() + RealizeResource() |
| 68 | bool Recreate(); |
| 69 | |
| 70 | DECLARE_DYNAMIC_CLASS(wxPen) |
| 71 | }; |
| 72 | |
| 73 | #endif // _WX_PEN_H_ |