X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7c78e7c70271608b076b1dbed201b1204e6898d4..fb20fa43a07ce52feb43a4b26514fc7a6a11a6f5:/include/wx/qt/pen.h diff --git a/include/wx/qt/pen.h b/include/wx/qt/pen.h index a0eaa2a59b..8989d44435 100644 --- a/include/wx/qt/pen.h +++ b/include/wx/qt/pen.h @@ -1,68 +1,105 @@ ///////////////////////////////////////////////////////////////////////////// // Name: pen.h -// Purpose: -// Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Purpose: wxPen class +// Author: AUTHOR +// Modified by: +// Created: ??/??/98 +// RCS-ID: $Id$ +// Copyright: (c) AUTHOR // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// - -#ifndef __GTKPENH__ -#define __GTKPENH__ +#ifndef _WX_PEN_H_ +#define _WX_PEN_H_ #ifdef __GNUG__ -#pragma interface +#pragma interface "pen.h" #endif -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/string.h" #include "wx/gdiobj.h" #include "wx/gdicmn.h" -//----------------------------------------------------------------------------- -// classes -//----------------------------------------------------------------------------- +typedef WXDWORD wxQTDash; + +class WXDLLEXPORT wxPen; -class wxPen; +class WXDLLEXPORT wxPenRefData: public wxGDIRefData +{ + friend class WXDLLEXPORT wxPen; +public: + wxPenRefData(); + wxPenRefData(const wxPenRefData& data); + ~wxPenRefData(); -//----------------------------------------------------------------------------- -// wxPen -//----------------------------------------------------------------------------- +protected: + int m_width; + int m_style; + int m_join ; + int m_cap ; + wxBitmap m_stipple ; + int m_nbDash ; + wxQTDash * m_dash; + wxColour m_colour; +/* TODO: implementation + WXHPEN m_hPen; +*/ +}; -class wxPen: public wxGDIObject +#define M_PENDATA ((wxPenRefData *)m_refData) + +// Pen +class WXDLLEXPORT wxPen: public wxGDIObject { DECLARE_DYNAMIC_CLASS(wxPen) +public: + wxPen(); + wxPen(const wxColour& col, int width, int style); + wxPen(const wxString& col, int width, int style); + wxPen(const wxBitmap& stipple, int width); + inline wxPen(const wxPen& pen) { Ref(pen); } + inline wxPen(const wxPen* pen) { if (pen) Ref(*pen); } + ~wxPen(); + + inline wxPen& operator = (const wxPen& pen) { if (*this == pen) return (*this); Ref(pen); return *this; } + inline bool operator == (const wxPen& pen) { return m_refData == pen.m_refData; } + inline bool operator != (const wxPen& pen) { return m_refData != pen.m_refData; } + + virtual bool Ok() const { return (m_refData != NULL) ; } - public: - - wxPen(void); - wxPen( const wxColour &colour, int width, int style ); - wxPen( const wxString &colourName, int width, int style ); - wxPen( const wxPen& pen ); - wxPen( const wxPen* pen ); - ~wxPen(void); - wxPen& operator = ( const wxPen& pen ); - bool operator == ( const wxPen& pen ); - bool operator != ( const wxPen& pen ); - - void SetColour( const wxColour &colour ); - void SetColour( const wxString &colourName ); - void SetColour( int red, int green, int blue ); - void SetCap( int capStyle ); - void SetJoin( int joinStyle ); - void SetStyle( int style ); - void SetWidth( int width ); - wxColour &GetColour(void) const; - int GetCap(void) const; - int GetJoin(void) const; - int GetStyle(void) const; - int GetWidth(void) const; - bool Ok(void) const; - - // no data :-) + // Override in order to recreate the pen + void SetColour(const wxColour& col) ; + void SetColour(const wxString& col) ; + void SetColour(const unsigned char r, const unsigned char g, const unsigned char b) ; + + void SetWidth(int width) ; + void SetStyle(int style) ; + void SetStipple(const wxBitmap& stipple) ; + void SetDashes(int nb_dashes, const wxDash *dash) ; + void SetJoin(int join) ; + void SetCap(int cap) ; + + inline wxColour& GetColour() const { return (M_PENDATA ? M_PENDATA->m_colour : wxNullColour); }; + inline int GetWidth() const { return (M_PENDATA ? M_PENDATA->m_width : 0); }; + inline int GetStyle() const { return (M_PENDATA ? M_PENDATA->m_style : 0); }; + inline int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); }; + inline int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); }; + inline int GetDashes(wxDash **ptr) const + { + *ptr = (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*)NULL); + return (M_PENDATA ? M_PENDATA->m_nbDash : 0); + } + + inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : NULL); }; + +// Implementation + + // Useful helper: create the brush resource + void RealizeResource(); + + // When setting properties, we must make sure we're not changing + // another object + void Unshare(); }; -#endif // __GTKPENH__ +#endif + // _WX_PEN_H_