]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/carbon/pen.h
Forward SetFont, SetBackgroundColour and SetForegroundCOlour to the
[wxWidgets.git] / include / wx / mac / carbon / pen.h
CommitLineData
8cf73271 1/////////////////////////////////////////////////////////////////////////////
46562151 2// Name: wx/mac/carbon/pen.h
8cf73271
SC
3// Purpose: wxPen class
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
65571936 9// Licence: wxWindows licence
8cf73271
SC
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_PEN_H_
13#define _WX_PEN_H_
14
8cf73271
SC
15#include "wx/gdiobj.h"
16#include "wx/colour.h"
17#include "wx/bitmap.h"
18
19class WXDLLEXPORT wxPen;
20
21class WXDLLEXPORT wxPenRefData: public wxGDIRefData
22{
23 friend class WXDLLEXPORT wxPen;
24public:
25 wxPenRefData();
26 wxPenRefData(const wxPenRefData& data);
d3c7fc99 27 virtual ~wxPenRefData();
8cf73271
SC
28
29 wxPenRefData& operator=(const wxPenRefData& data);
30
31protected:
32 int m_width;
33 int m_style;
34 int m_join ;
35 int m_cap ;
36 wxBitmap m_stipple ;
37 int m_nbDash ;
38 wxDash * m_dash ;
39 wxColour m_colour;
40/* TODO: implementation
41 WXHPEN m_hPen;
42*/
43};
44
45#define M_PENDATA ((wxPenRefData *)m_refData)
46
47// Pen
48class WXDLLEXPORT wxPen: public wxGDIObject
49{
50 DECLARE_DYNAMIC_CLASS(wxPen)
51public:
52 wxPen();
53 wxPen(const wxColour& col, int width = 1, int style = wxSOLID);
54 wxPen(const wxBitmap& stipple, int width);
d3c7fc99 55 virtual ~wxPen();
8cf73271 56
fbfb8bcc
VZ
57 inline bool operator == (const wxPen& pen) const { return m_refData == pen.m_refData; }
58 inline bool operator != (const wxPen& pen) const { return m_refData != pen.m_refData; }
8cf73271 59
b7cacb43
VZ
60 virtual bool Ok() const { return IsOk(); }
61 virtual bool IsOk() const { return (m_refData != NULL) ; }
8cf73271
SC
62
63 // Override in order to recreate the pen
64 void SetColour(const wxColour& col) ;
1a1498c0 65 void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
8cf73271
SC
66
67 void SetWidth(int width) ;
68 void SetStyle(int style) ;
69 void SetStipple(const wxBitmap& stipple) ;
70 void SetDashes(int nb_dashes, const wxDash *dash) ;
71 void SetJoin(int join) ;
72 void SetCap(int cap) ;
73
74 inline wxColour& GetColour() const { return (M_PENDATA ? M_PENDATA->m_colour : wxNullColour); };
75 inline int GetWidth() const { return (M_PENDATA ? M_PENDATA->m_width : 0); };
76 inline int GetStyle() const { return (M_PENDATA ? M_PENDATA->m_style : 0); };
77 inline int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); };
78 inline int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); };
79 inline int GetDashes(wxDash **ptr) const {
80 *ptr = (M_PENDATA ? M_PENDATA->m_dash : (wxDash*) NULL); return (M_PENDATA ? M_PENDATA->m_nbDash : 0);
81 }
82
83 inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : (wxBitmap*) NULL); };
84
85// Implementation
86
87 // Useful helper: create the brush resource
88 bool RealizeResource();
89
90 // When setting properties, we must make sure we're not changing
91 // another object
92 void Unshare();
93};
94
95#endif
96 // _WX_PEN_H_