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