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