fix also wxPen to use wxPenStyle,wxPenJoin,wxPenCap enums instead of plain int; remove from wxBrushStyle the styles wxPen-specific; add backward-compatible ctor to wxPen; don't include brush.h and pen.h from gdicmn.h, rather move wxPenList,wxBrushList,wxFontList in the relative headers

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2008-03-16 21:11:12 +00:00
parent d36dbec9c6
commit 82cddbd97a
27 changed files with 491 additions and 289 deletions

View File

@@ -173,10 +173,10 @@ Deprecated methods and their replacements
- wxMenuItem::GetText has been deprecated in favour of wxMenuItem::GetItemLabel
- wxMenuItem::GetLabelFromText has been deprecated in favour of wxMenuItem::GetLabelText
- wxMenuItem::SetText has been deprecated in favour of wxMenuItem::SetItemLabel
- wxBrush::SetStyle and wxBrush:GetStyle as well as the wxBrush ctor now take
a wxBrushStyle value instead of a plain "int style".
Use the new wxBrush style names (wxBRUSHSTYLE_XXX) instead of the old deprecated
wxXXX styles (which are still available however).
- wxBrush's, wxPen's SetStyle() and GetStyle() as well as the wxBrush/wxPen ctor now take
respectively a wxBrushStyle and a wxPenStyle value instead of a plain "int style";
use the new wxBrush/wxPen style names (wxBRUSHSTYLE_XXX and wxPENSTYLE_XXX) instead
of the old deprecated wxXXX styles (which however are still available).
Major new features in this release
----------------------------------

View File

@@ -19,73 +19,43 @@
// NOTE: these values cannot be combined together!
enum wxBrushStyle
{
#ifdef WXWIN_COMPATIBILITY_2_8
#if WXWIN_COMPATIBILITY_2_8
/* start of deprecated values */
wxSOLID = 100,
wxDOT,
wxLONG_DASH,
wxSHORT_DASH,
wxDOT_DASH,
wxUSER_DASH,
wxTRANSPARENT,
wxSTIPPLE_MASK_OPAQUE,
wxSTIPPLE_MASK,
wxSTIPPLE,
wxBDIAGONAL_HATCH,
wxCROSSDIAG_HATCH,
wxFDIAGONAL_HATCH,
wxCROSS_HATCH,
wxHORIZONTAL_HATCH,
wxVERTICAL_HATCH,
wxTRANSPARENT = 106,
wxSTIPPLE_MASK_OPAQUE = 107,
wxSTIPPLE_MASK = 108,
wxSTIPPLE = 109,
wxBDIAGONAL_HATCH = 110,
wxCROSSDIAG_HATCH = 111,
wxFDIAGONAL_HATCH = 112,
wxCROSS_HATCH = 113,
wxHORIZONTAL_HATCH = 114,
wxVERTICAL_HATCH = 115,
wxFIRST_HATCH = wxBDIAGONAL_HATCH,
wxLAST_HATCH = wxVERTICAL_HATCH,
/* end of deprecated values */
wxBRUSHSTYLE_SOLID = wxSOLID,
wxBRUSHSTYLE_DOT = wxDOT,
wxBRUSHSTYLE_LONG_DASH = wxLONG_DASH,
wxBRUSHSTYLE_SHORT_DASH = wxSHORT_DASH,
wxBRUSHSTYLE_DOT_DASH = wxDOT_DASH,
wxBRUSHSTYLE_USER_DOT = wxUSER_DASH,
wxBRUSHSTYLE_TRANSPARENT = wxTRANSPARENT,
/* Brush Stippling. */
wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE,
/* mask is used for blitting monochrome using text fore and back ground colors */
wxBRUSHSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK,
/* mask is used for masking areas in the stipple bitmap (TO DO) */
wxBRUSHSTYLE_STIPPLE = wxSTIPPLE,
/* drawn with a Pen, and without any Brush -- and it can be stippled. */
/* In wxWidgets < 2.6 use WX_HATCH macro */
/* to verify these wx*_HATCH are in style */
/* of wxBrush. In wxWidgets >= 2.6 use */
/* wxBrush::IsHatch() instead. */
wxBRUSHSTYLE_BDIAGONAL_HATCH = wxBDIAGONAL_HATCH,
wxBRUSHSTYLE_CROSSDIAG_HATCH = wxCROSSDIAG_HATCH,
wxBRUSHSTYLE_FDIAGONAL_HATCH = wxFDIAGONAL_HATCH,
wxBRUSHSTYLE_CROSS_HATCH = wxCROSS_HATCH,
wxBRUSHSTYLE_HORIZONTAL_HATCH = wxHORIZONTAL_HATCH,
wxBRUSHSTYLE_VERTICAL_HATCH = wxVERTICAL_HATCH,
wxBRUSHSTYLE_FIRST_HATCH = wxFIRST_HATCH,
wxBRUSHSTYLE_LAST_HATCH = wxLAST_HATCH,
wxBRUSHSTYLE_MAX
#else
wxBRUSHSTYLE_SOLID,
wxBRUSHSTYLE_DOT,
wxBRUSHSTYLE_LONG_DASH,
wxBRUSHSTYLE_SHORT_DASH,
wxBRUSHSTYLE_DOT_DASH,
wxBRUSHSTYLE_USER_DOT,
wxBRUSHSTYLE_TRANSPARENT,
/* Brush Stippling. */
wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE,
/* mask is used for blitting monochrome using text fore and back ground colors */
@@ -148,5 +118,17 @@ public:
#include "wx/os2/brush.h"
#endif
class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase
{
public:
wxBrush *FindOrCreateBrush(const wxColour& colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID);
#if WXWIN_COMPATIBILITY_2_6
wxDEPRECATED( void AddBrush(wxBrush*) );
wxDEPRECATED( void RemoveBrush(wxBrush*) );
#endif
};
extern WXDLLEXPORT_DATA(wxBrushList*) wxTheBrushList;
#endif
// _WX_BRUSH_H_BASE_

View File

@@ -34,9 +34,11 @@
// wxButton specific flags
// ----------------------------------------------------------------------------
#if WXWIN_COMPATIBILITY_2_8
// These two flags are obsolete
#define wxBU_NOAUTODRAW 0x0000
#define wxBU_AUTODRAW 0x0004
#endif
// by default, the buttons will be created with some (system dependent)
// minimal size to make them look nicer, giving this style will make them as

View File

@@ -25,7 +25,10 @@ class WXDLLEXPORT wxPen: public wxGDIObject
{
public:
wxPen();
wxPen(const wxColour& col, int width = 1, int style = wxSOLID);
wxPen(const wxColour& col, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID);
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( wxPen(const wxColour& col, int width, wxBrushStyle style) );
#endif
wxPen(const wxBitmap& stipple, int width);
virtual ~wxPen();
@@ -37,17 +40,17 @@ public:
void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
void SetWidth(int width);
void SetStyle(int style);
void SetStyle(wxPenStyle style);
void SetStipple(const wxBitmap& stipple);
void SetDashes(int nb_dashes, const wxDash *dash);
void SetJoin(int join);
void SetCap(int cap);
void SetJoin(wxPenJoin join);
void SetCap(wxPenCap cap);
wxColour& GetColour() const;
int GetWidth() const;
int GetStyle() const;
int GetJoin() const;
int GetCap() const;
wxPenStyle GetStyle() const;
wxPenJoin GetJoin() const;
wxPenCap GetCap() const;
int GetDashes(wxDash **ptr) const;
wxBitmap *GetStipple() const;

View File

@@ -2099,14 +2099,6 @@ enum
/* Also wxNORMAL for normal (non-italic text) */
wxITALIC,
wxSLANT,
wxJOIN_BEVEL = 120,
wxJOIN_MITER,
wxJOIN_ROUND,
wxCAP_ROUND = 130,
wxCAP_PROJECTING,
wxCAP_BUTT
};
/* Logical ops */

View File

@@ -28,11 +28,15 @@ class WXDLLIMPEXP_FWD_CORE wxPen;
// wxPen
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPen: public wxGDIObject
class WXDLLIMPEXP_CORE wxPen: public wxPenBase
{
public:
wxPen() {}
wxPen(const wxColour &colour, int width = 1, int style = wxSOLID);
wxPen(const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID);
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( wxPen(const wxColour& col, int width, wxBrushStyle style) );
#endif
wxPen(const wxBitmap& stipple, int width);
bool operator==(const wxPen& pen) const;
@@ -40,17 +44,17 @@ public:
void SetColour(const wxColour &colour);
void SetColour(unsigned char red, unsigned char green, unsigned char blue);
void SetCap(int capStyle);
void SetJoin(int joinStyle);
void SetStyle(int style);
void SetCap(wxPenCap capStyle);
void SetJoin(wxPenJoin joinStyle);
void SetStyle(wxPenStyle style);
void SetWidth(int width);
void SetDashes(int number_of_dashes, const wxDash *dash);
void SetStipple(const wxBitmap& stipple);
wxColour &GetColour() const;
int GetCap() const;
int GetJoin() const;
int GetStyle() const;
wxPenCap GetCap() const;
wxPenJoin GetJoin() const;
wxPenStyle GetStyle() const;
int GetWidth() const;
int GetDashes(wxDash **ptr) const;
int GetDashCount() const;

View File

@@ -249,5 +249,23 @@ WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font);
#include "wx/os2/font.h"
#endif
class WXDLLIMPEXP_CORE wxFontList: public wxGDIObjListBase
{
public:
wxFont *FindOrCreateFont(int pointSize,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underline = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
#if WXWIN_COMPATIBILITY_2_6
wxDEPRECATED( void AddFont(wxFont*) );
wxDEPRECATED( void RemoveFont(wxFont*) );
#endif
};
extern WXDLLEXPORT_DATA(wxFontList*) wxTheFontList;
#endif
// _WX_FONT_H_BASE_

View File

@@ -22,7 +22,6 @@
#include "wx/fontenc.h"
#include "wx/hashmap.h"
#include "wx/math.h"
#include "wx/brush.h"
// ---------------------------------------------------------------------------
// forward declarations
@@ -619,39 +618,6 @@ protected:
wxList list;
};
class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase
{
public:
wxPen *FindOrCreatePen(const wxColour& colour, int width, int style);
#if WXWIN_COMPATIBILITY_2_6
wxDEPRECATED( void AddPen(wxPen*) );
wxDEPRECATED( void RemovePen(wxPen*) );
#endif
};
class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase
{
public:
wxBrush *FindOrCreateBrush(const wxColour& colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID);
#if WXWIN_COMPATIBILITY_2_6
wxDEPRECATED( void AddBrush(wxBrush*) );
wxDEPRECATED( void RemoveBrush(wxBrush*) );
#endif
};
class WXDLLIMPEXP_CORE wxFontList: public wxGDIObjListBase
{
public:
wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight,
bool underline = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
#if WXWIN_COMPATIBILITY_2_6
wxDEPRECATED( void AddFont(wxFont*) );
wxDEPRECATED( void RemoveFont(wxFont*) );
#endif
};
WX_DECLARE_STRING_HASH_MAP(wxColour*, wxStringToColourHashMap);
class WXDLLEXPORT wxColourDatabase
@@ -701,10 +667,6 @@ public:
// global variables
// ---------------------------------------------------------------------------
// Lists of GDI objects
extern WXDLLEXPORT_DATA(wxPenList*) wxThePenList;
extern WXDLLEXPORT_DATA(wxBrushList*) wxTheBrushList;
extern WXDLLEXPORT_DATA(wxFontList*) wxTheFontList;
/* Stock objects

View File

@@ -19,12 +19,16 @@ typedef gint8 wxGTKDash;
// wxPen
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPen: public wxGDIObject
class WXDLLIMPEXP_CORE wxPen: public wxPenBase
{
public:
wxPen() { }
wxPen( const wxColour &colour, int width = 1, int style = wxSOLID );
wxPen( const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID );
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( wxPen(const wxColour& col, int width, wxBrushStyle style) );
#endif
virtual ~wxPen();
bool operator==(const wxPen& pen) const;
@@ -32,20 +36,22 @@ public:
void SetColour( const wxColour &colour );
void SetColour( unsigned char red, unsigned char green, unsigned char blue );
void SetCap( int capStyle );
void SetJoin( int joinStyle );
void SetStyle( int style );
void SetCap( wxPenCap capStyle );
void SetJoin( wxPenJoin joinStyle );
void SetStyle( wxPenStyle style );
void SetWidth( int width );
void SetDashes( int number_of_dashes, const wxDash *dash );
void SetStipple(const wxBitmap& stipple);
wxColour &GetColour() const;
int GetCap() const;
int GetJoin() const;
int GetStyle() const;
wxPenCap GetCap() const;
wxPenJoin GetJoin() const;
wxPenStyle GetStyle() const;
int GetWidth() const;
int GetDashes(wxDash **ptr) const;
int GetDashCount() const;
wxDash* GetDash() const;
wxBitmap *GetStipple() const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const;

View File

@@ -32,12 +32,16 @@ typedef gchar wxGTKDash;
// wxPen
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPen: public wxGDIObject
class WXDLLIMPEXP_CORE wxPen: public wxPenBase
{
public:
wxPen() { }
wxPen( const wxColour &colour, int width = 1, int style = wxSOLID );
wxPen( const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID );
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( wxPen(const wxColour& col, int width, wxBrushStyle style) );
#endif
virtual ~wxPen();
bool operator==(const wxPen& pen) const;
@@ -45,16 +49,16 @@ public:
void SetColour( const wxColour &colour );
void SetColour( unsigned char red, unsigned char green, unsigned char blue );
void SetCap( int capStyle );
void SetJoin( int joinStyle );
void SetStyle( int style );
void SetCap( wxPenCap capStyle );
void SetJoin( wxPenJoin joinStyle );
void SetStyle( wxPenStyle style );
void SetWidth( int width );
void SetDashes( int number_of_dashes, const wxDash *dash );
wxColour &GetColour() const;
int GetCap() const;
int GetJoin() const;
int GetStyle() const;
wxPenCap GetCap() const;
wxPenJoin GetJoin() const;
wxPenStyle GetStyle() const;
int GetWidth() const;
int GetDashes(wxDash **ptr) const;
int GetDashCount() const;

View File

@@ -17,11 +17,15 @@
#include "wx/bitmap.h"
// Pen
class WXDLLEXPORT wxPen : public wxGDIObject
class WXDLLEXPORT wxPen : public wxPenBase
{
public:
wxPen();
wxPen(const wxColour& col, int width = 1, int style = wxSOLID);
wxPen(const wxColour& col, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID);
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( wxPen(const wxColour& col, int width, wxBrushStyle style) );
#endif
wxPen(const wxBitmap& stipple, int width);
virtual ~wxPen();
@@ -33,17 +37,17 @@ public:
void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
void SetWidth(int width) ;
void SetStyle(int style) ;
void SetStyle(wxPenStyle style) ;
void SetStipple(const wxBitmap& stipple) ;
void SetDashes(int nb_dashes, const wxDash *dash) ;
void SetJoin(int join) ;
void SetCap(int cap) ;
void SetJoin(wxPenJoin join) ;
void SetCap(wxPenCap cap) ;
wxColour& GetColour() const ;
int GetWidth() const;
int GetStyle() const;
int GetJoin() const;
int GetCap() const;
wxPenStyle GetStyle() const;
wxPenJoin GetJoin() const;
wxPenCap GetCap() const;
int GetDashes(wxDash **ptr) const;
wxBitmap *GetStipple() const ;

View File

@@ -27,11 +27,15 @@ class WXDLLIMPEXP_FWD_CORE wxPen;
// wxPen
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxPen : public wxGDIObject
class WXDLLEXPORT wxPen : public wxPenBase
{
public:
wxPen() {}
wxPen(const wxColour &colour, int width = 1, int style = wxSOLID);
wxPen(const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID);
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( wxPen(const wxColour& col, int width, wxBrushStyle style) );
#endif
wxPen(const wxBitmap& stipple, int width);
virtual ~wxPen() {}
bool operator == (const wxPen& pen) const;
@@ -39,17 +43,17 @@ public:
void SetColour(const wxColour &colour);
void SetColour(unsigned char red, unsigned char green, unsigned char blue);
void SetCap(int capStyle);
void SetJoin(int joinStyle);
void SetStyle(int style);
void SetCap(wxPenCap capStyle);
void SetJoin(wxPenJoin joinStyle);
void SetStyle(wxPenStyle style);
void SetWidth(int width);
void SetDashes(int number_of_dashes, const wxDash *dash);
void SetStipple(const wxBitmap& stipple);
wxColour &GetColour() const;
int GetCap() const;
int GetJoin() const;
int GetStyle() const;
wxPenCap GetCap() const;
wxPenJoin GetJoin() const;
wxPenStyle GetStyle() const;
int GetWidth() const;
int GetDashes(wxDash **ptr) const;
int GetDashCount() const;

View File

@@ -19,11 +19,15 @@
// Pen
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxPen : public wxGDIObject
class WXDLLEXPORT wxPen : public wxPenBase
{
public:
wxPen() { }
wxPen(const wxColour& col, int width = 1, int style = wxSOLID);
wxPen(const wxColour& col, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID);
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( wxPen(const wxColour& col, int width, wxBrushStyle style) );
#endif
wxPen(const wxBitmap& stipple, int width);
virtual ~wxPen() { }
@@ -35,17 +39,17 @@ public:
void SetColour(unsigned char r, unsigned char g, unsigned char b);
void SetWidth(int width);
void SetStyle(int style);
void SetStyle(wxPenStyle style);
void SetStipple(const wxBitmap& stipple);
void SetDashes(int nb_dashes, const wxDash *dash);
void SetJoin(int join);
void SetCap(int cap);
void SetJoin(wxPenJoin join);
void SetCap(wxPenCap cap);
wxColour& GetColour() const;
int GetWidth() const;
int GetStyle() const;
int GetJoin() const;
int GetCap() const;
wxPenStyle GetStyle() const;
wxPenJoin GetJoin() const;
wxPenCap GetCap() const;
int GetDashes(wxDash** ptr) const;
wxDash* GetDash() const;
int GetDashCount() const;

View File

@@ -43,9 +43,9 @@ public:
protected:
int m_nWidth;
int m_nStyle;
int m_nJoin;
int m_nCap;
wxPenStyle m_nStyle;
wxPenJoin m_nJoin;
wxPenCap m_nCap;
wxBitmap m_vStipple;
int m_nbDash;
wxDash * m_dash;
@@ -56,14 +56,18 @@ protected:
#define M_PENDATA ((wxPenRefData *)m_refData)
// Pen
class WXDLLEXPORT wxPen : public wxGDIObject
class WXDLLEXPORT wxPen : public wxPenBase
{
public:
wxPen();
wxPen( const wxColour& rColour
,int nWidth = 1
,int nStyle = wxSOLID
,wxPenStyle nStyle = wxPENSTYLE_SOLID
);
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( wxPen(const wxColour& col, int width, wxBrushStyle style) );
#endif
wxPen( const wxBitmap& rStipple
,int nWidth
);
@@ -87,20 +91,20 @@ public:
void SetColour(unsigned char cRed, unsigned char cGreen, unsigned char cBlue);
void SetWidth(int nWidth);
void SetStyle(int nStyle);
void SetStyle(wxPenStyle nStyle);
void SetStipple(const wxBitmap& rStipple);
void SetDashes( int nNbDashes
,const wxDash* pDash
);
void SetJoin(int nJoin);
void SetCap(int nCap);
void SetJoin(wxPenJoin nJoin);
void SetCap(wxPenCap nCap);
void SetPS(HPS hPS);
inline wxColour& GetColour(void) const { return (M_PENDATA ? M_PENDATA->m_vColour : wxNullColour); };
inline int GetWidth(void) const { return (M_PENDATA ? M_PENDATA->m_nWidth : 0); };
inline int GetStyle(void) const { return (M_PENDATA ? M_PENDATA->m_nStyle : 0); };
inline int GetJoin(void) const { return (M_PENDATA ? M_PENDATA->m_nJoin : 0); };
inline int GetCap(void) const { return (M_PENDATA ? M_PENDATA->m_nCap : 0); };
inline wxPenStyle GetStyle(void) const { return (M_PENDATA ? M_PENDATA->m_nStyle : 0); };
inline wxPenJoin GetJoin(void) const { return (M_PENDATA ? M_PENDATA->m_nJoin : 0); };
inline wxPenCap GetCap(void) const { return (M_PENDATA ? M_PENDATA->m_nCap : 0); };
inline int GetPS(void) const { return (M_PENDATA ? M_PENDATA->m_hPen : 0); };
inline int GetDashes(wxDash **ptr) const
{
@@ -138,7 +142,7 @@ protected:
DECLARE_DYNAMIC_CLASS(wxPen)
}; // end of CLASS wxPen
extern int wx2os2PenStyle(int nWxStyle);
extern int wx2os2PenStyle(wxPenStyle nWxStyle);
#endif
// _WX_PEN_H_

View File

@@ -44,7 +44,7 @@ public:
protected:
int m_width;
int m_style;
wxPenStyle m_style;
int m_join;
int m_cap;
wxBitmap m_stipple;
@@ -71,11 +71,15 @@ private:
// Pen
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxPen : public wxGDIObject
class WXDLLEXPORT wxPen : public wxPenBase
{
public:
wxPen();
wxPen(const wxColour& col, int width = 1, int style = wxSOLID);
wxPen(const wxColour& col, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID);
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( wxPen(const wxColour& col, int width, wxBrushStyle style) );
#endif
wxPen(const wxBitmap& stipple, int width);
virtual ~wxPen();
@@ -94,17 +98,17 @@ public:
void SetColour(unsigned char r, unsigned char g, unsigned char b);
void SetWidth(int width);
void SetStyle(int style);
void SetStyle(wxPenStyle style);
void SetStipple(const wxBitmap& stipple);
void SetDashes(int nb_dashes, const wxDash *dash);
void SetJoin(int join);
void SetCap(int cap);
void SetJoin(wxPenJoin join);
void SetCap(wxPenCap cap);
wxColour& GetColour() const { return (M_PENDATA ? M_PENDATA->m_colour : wxNullColour); };
int GetWidth() const { return (M_PENDATA ? M_PENDATA->m_width : 0); };
int GetStyle() const { return (M_PENDATA ? M_PENDATA->m_style : 0); };
int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); };
int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); };
wxPenStyle GetStyle() const { return (M_PENDATA ? M_PENDATA->m_style : 0); };
wxPenJoin GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); };
wxPenCap GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); };
int GetDashes(wxDash **ptr) const
{
*ptr = (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*) NULL);

View File

@@ -14,6 +14,128 @@
#include "wx/defs.h"
enum wxPenStyle
{
#if WXWIN_COMPATIBILITY_2_8
/* start of deprecated values */
/* wxSOLID, wxTRANSPARENT, wxSTIPPLE are already defined in wxBrushStyle */
wxDOT = 101,
wxLONG_DASH = 102,
wxSHORT_DASH = 103,
wxDOT_DASH = 104,
wxUSER_DASH = 105,
/* end of deprecated values */
wxPENSTYLE_SOLID = wxSOLID,
wxPENSTYLE_DOT = wxDOT,
wxPENSTYLE_LONG_DASH = wxLONG_DASH,
wxPENSTYLE_SHORT_DASH = wxSHORT_DASH,
wxPENSTYLE_DOT_DASH = wxDOT_DASH,
wxPENSTYLE_USER_DOT = wxUSER_DASH,
wxPENSTYLE_TRANSPARENT = wxTRANSPARENT,
wxPENSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE,
wxPENSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK,
wxPENSTYLE_STIPPLE = wxSTIPPLE,
wxPENSTYLE_BDIAGONAL_HATCH = wxBDIAGONAL_HATCH,
wxPENSTYLE_CROSSDIAG_HATCH = wxCROSSDIAG_HATCH,
wxPENSTYLE_FDIAGONAL_HATCH = wxFDIAGONAL_HATCH,
wxPENSTYLE_CROSS_HATCH = wxCROSS_HATCH,
wxPENSTYLE_HORIZONTAL_HATCH = wxHORIZONTAL_HATCH,
wxPENSTYLE_VERTICAL_HATCH = wxVERTICAL_HATCH,
wxPENSTYLE_FIRST_HATCH = wxFIRST_HATCH,
wxPENSTYLE_LAST_HATCH = wxLAST_HATCH,
wxPENSTYLE_MAX
#else
wxPENSTYLE_SOLID,
wxPENSTYLE_DOT,
wxPENSTYLE_LONG_DASH,
wxPENSTYLE_SHORT_DASH,
wxPENSTYLE_DOT_DASH,
wxPENSTYLE_USER_DOT,
wxPENSTYLE_TRANSPARENT,
/* Pen Stippling. */
wxPENSTYLE_STIPPLE_MASK_OPAQUE,
/* mask is used for blitting monochrome using text fore and back ground colors */
wxPENSTYLE_STIPPLE_MASK,
/* mask is used for masking areas in the stipple bitmap (TO DO) */
wxPENSTYLE_STIPPLE,
/* drawn with a Pen, and without any Brush -- and it can be stippled. */
/* In wxWidgets < 2.6 use WX_HATCH macro */
/* to verify these wx*_HATCH are in style */
/* of wxBrush. In wxWidgets >= 2.6 use */
/* wxBrush::IsHatch() instead. */
wxPENSTYLE_BDIAGONAL_HATCH,
wxPENSTYLE_CROSSDIAG_HATCH,
wxPENSTYLE_FDIAGONAL_HATCH,
wxPENSTYLE_CROSS_HATCH,
wxPENSTYLE_HORIZONTAL_HATCH,
wxPENSTYLE_VERTICAL_HATCH,
wxPENSTYLE_FIRST_HATCH = wxPENSTYLE_BDIAGONAL_HATCH,
wxPENSTYLE_LAST_HATCH = wxPENSTYLE_VERTICAL_HATCH,
wxPENSTYLE_MAX
#endif
};
enum wxPenJoin
{
wxJOIN_INVALID = -1,
wxJOIN_BEVEL = 120,
wxJOIN_MITER,
wxJOIN_ROUND,
};
enum wxPenCap
{
wxCAP_INVALID = -1,
wxCAP_ROUND = 130,
wxCAP_PROJECTING,
wxCAP_BUTT
};
class WXDLLEXPORT wxPenBase : public wxGDIObject
{
public:
virtual ~wxPenBase() { }
virtual void SetColour(const wxColour& col) = 0;
virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) = 0;
virtual void SetWidth(int width) = 0;
virtual void SetStyle(wxPenStyle style) = 0;
virtual void SetStipple(const wxBitmap& stipple) = 0;
virtual void SetDashes(int nb_dashes, const wxDash *dash) = 0;
virtual void SetJoin(wxPenJoin join) = 0;
virtual void SetCap(wxPenCap cap) = 0;
virtual wxColour& GetColour() const = 0;
virtual wxBitmap *GetStipple() const = 0;
virtual wxPenStyle GetStyle() const = 0;
virtual wxPenJoin GetJoin() const = 0;
virtual wxPenCap GetCap() const = 0;
virtual int GetWidth() const = 0;
virtual int GetDashes(wxDash **ptr) const = 0;
#if WXWIN_COMPATIBILITY_2_8
void SetStyle(wxBrushStyle style)
{ SetStyle((wxPenStyle)style); }
#endif
};
#if defined(__WXPALMOS__)
#include "wx/palmos/pen.h"
#elif defined(__WXMSW__)
@@ -36,5 +158,17 @@
#include "wx/os2/pen.h"
#endif
class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase
{
public:
wxPen *FindOrCreatePen(const wxColour& colour, int width, wxPenStyle style);
#if WXWIN_COMPATIBILITY_2_6
wxDEPRECATED( void AddPen(wxPen*) );
wxDEPRECATED( void RemovePen(wxPen*) );
#endif
};
extern WXDLLEXPORT_DATA(wxPenList*) wxThePenList;
#endif
// _WX_PEN_H_BASE_

View File

@@ -29,12 +29,16 @@ typedef char wxX11Dash;
// wxPen
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPen: public wxGDIObject
class WXDLLIMPEXP_CORE wxPen: public wxPenBase
{
public:
wxPen() { }
wxPen( const wxColour &colour, int width = 1, int style = wxSOLID );
wxPen( const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID );
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( wxPen(const wxColour& col, int width, wxBrushStyle style) );
#endif
wxPen( const wxBitmap &stipple, int width );
virtual ~wxPen();
@@ -43,17 +47,17 @@ public:
void SetColour( const wxColour &colour );
void SetColour( unsigned char red, unsigned char green, unsigned char blue );
void SetCap( int capStyle );
void SetJoin( int joinStyle );
void SetStyle( int style );
void SetCap( wxPenCap capStyle );
void SetJoin( wxPenJoin joinStyle );
void SetStyle( wxPenStyle style );
void SetWidth( int width );
void SetDashes( int number_of_dashes, const wxDash *dash );
void SetStipple( wxBitmap *stipple );
wxColour &GetColour() const;
int GetCap() const;
int GetJoin() const;
int GetStyle() const;
wxPenCap GetCap() const;
wxPenJoin GetJoin() const;
wxPenStyle GetStyle() const;
int GetWidth() const;
int GetDashes(wxDash **ptr) const;
int GetDashCount() const;

View File

@@ -665,34 +665,34 @@ const wxPen* wxStockGDI::GetPen(Item item)
switch (item)
{
case PEN_BLACK:
pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxSOLID);
pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxPENSTYLE_SOLID);
break;
case PEN_BLACKDASHED:
pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxSHORT_DASH);
pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxPENSTYLE_SHORT_DASH);
break;
case PEN_CYAN:
pen = new wxPen(*GetColour(COLOUR_CYAN), 1, wxSOLID);
pen = new wxPen(*GetColour(COLOUR_CYAN), 1, wxPENSTYLE_SOLID);
break;
case PEN_GREEN:
pen = new wxPen(*GetColour(COLOUR_GREEN), 1, wxSOLID);
pen = new wxPen(*GetColour(COLOUR_GREEN), 1, wxPENSTYLE_SOLID);
break;
case PEN_GREY:
pen = new wxPen(wxColour(wxT("GREY")), 1, wxSOLID);
pen = new wxPen(wxColour(wxT("GREY")), 1, wxPENSTYLE_SOLID);
break;
case PEN_LIGHTGREY:
pen = new wxPen(*GetColour(COLOUR_LIGHTGREY), 1, wxSOLID);
pen = new wxPen(*GetColour(COLOUR_LIGHTGREY), 1, wxPENSTYLE_SOLID);
break;
case PEN_MEDIUMGREY:
pen = new wxPen(wxColour(wxT("MEDIUM GREY")), 1, wxSOLID);
pen = new wxPen(wxColour(wxT("MEDIUM GREY")), 1, wxPENSTYLE_SOLID);
break;
case PEN_RED:
pen = new wxPen(*GetColour(COLOUR_RED), 1, wxSOLID);
pen = new wxPen(*GetColour(COLOUR_RED), 1, wxPENSTYLE_SOLID);
break;
case PEN_TRANSPARENT:
pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxTRANSPARENT);
pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxPENSTYLE_TRANSPARENT);
break;
case PEN_WHITE:
pen = new wxPen(*GetColour(COLOUR_WHITE), 1, wxSOLID);
pen = new wxPen(*GetColour(COLOUR_WHITE), 1, wxPENSTYLE_SOLID);
break;
default:
wxFAIL;
@@ -734,7 +734,7 @@ wxGDIObjListBase::~wxGDIObjListBase()
}
}
wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, wxPenStyle style)
{
for ( wxList::compatibility_iterator node = list.GetFirst();
node;
@@ -781,9 +781,9 @@ wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, wxBrushStyle st
}
wxFont *wxFontList::FindOrCreateFont(int pointSize,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underline,
const wxString& facename,
wxFontEncoding encoding)
@@ -799,7 +799,7 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize,
font->GetWeight () == weight &&
font->GetUnderlined () == underline )
{
int fontFamily = font->GetFamily();
wxFontFamily fontFamily = font->GetFamily();
#if defined(__WXGTK__)
// under GTK the default family is wxSWISS, so looking for a font

View File

@@ -29,7 +29,7 @@
class wxPenRefData : public wxGDIRefData
{
public:
wxPenRefData(const wxColour& clr = wxNullColour, int style = wxSOLID)
wxPenRefData(const wxColour& clr = wxNullColour, wxPenStyle style = wxPENSTYLE_SOLID)
{
m_colour = clr;
SetStyle(style);
@@ -51,7 +51,7 @@ public:
m_style = style;
}
int m_style;
wxPenStyle m_style;
wxColour m_colour;
};
@@ -61,13 +61,18 @@ public:
IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
wxPen::wxPen(const wxColour &colour, int width, int style)
wxPen::wxPen(const wxColour &colour, int width, wxPenStyle style)
{
wxASSERT_MSG( width <= 1, "only width=0,1 are supported" );
m_refData = new wxPenRefData(colour, style);
}
wxPen::wxPen(const wxColour& col, int width, wxBrushStyle style)
{
m_refData = new wxPenRefData(col, (wxPenStyle)style);
}
wxPen::wxPen(const wxBitmap& WXUNUSED(stipple), int WXUNUSED(width))
{
wxFAIL_MSG( "stipple pens not supported" );
@@ -98,17 +103,17 @@ void wxPen::SetColour(unsigned char red, unsigned char green, unsigned char blue
M_PENDATA->m_colour.Set(red, green, blue);
}
void wxPen::SetCap(int WXUNUSED(capStyle))
void wxPen::SetCap(wxPenCap WXUNUSED(capStyle))
{
wxFAIL_MSG( "SetCap not implemented" );
}
void wxPen::SetJoin(int WXUNUSED(joinStyle))
void wxPen::SetJoin(wxPenJoin WXUNUSED(joinStyle))
{
wxFAIL_MSG( "SetJoin not implemented" );
}
void wxPen::SetStyle(int style)
void wxPen::SetStyle(wxPenStyle style)
{
AllocExclusive();
M_PENDATA->SetStyle(style);
@@ -146,23 +151,23 @@ wxDash* wxPen::GetDash() const
return NULL;
}
int wxPen::GetCap() const
wxPenCap wxPen::GetCap() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
wxCHECK_MSG( Ok(), wxCAP_INVALID, wxT("invalid pen") );
wxFAIL_MSG( "GetCap not implemented" );
return -1;
return wxCAP_INVALID;
}
int wxPen::GetJoin() const
wxPenJoin wxPen::GetJoin() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
wxCHECK_MSG( Ok(), wxJOIN_INVALID, wxT("invalid pen") );
wxFAIL_MSG( "GetJoin not implemented" );
return -1;
return wxJOIN_INVALID;
}
int wxPen::GetStyle() const
wxPenStyle wxPen::GetStyle() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );

View File

@@ -28,7 +28,7 @@ public:
wxPenRefData()
{
m_width = 1;
m_style = wxSOLID;
m_style = wxPENSTYLE_SOLID;
m_joinStyle = wxJOIN_ROUND;
m_capStyle = wxCAP_ROUND;
m_dash = (wxGTKDash*) NULL;
@@ -74,9 +74,9 @@ public:
}
int m_width;
int m_style;
int m_joinStyle;
int m_capStyle;
wxPenStyle m_style;
wxPenJoin m_joinStyle;
wxPenCap m_capStyle;
wxColour m_colour;
int m_countDashes;
wxGTKDash *m_dash;
@@ -88,7 +88,7 @@ public:
IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject)
wxPen::wxPen( const wxColour &colour, int width, int style )
wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style )
{
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
@@ -96,6 +96,14 @@ wxPen::wxPen( const wxColour &colour, int width, int style )
M_PENDATA->m_colour = colour;
}
wxPen::wxPen(const wxColour& colour, int width, wxBrushStyle style)
{
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
M_PENDATA->m_style = (wxPenStyle)style;
M_PENDATA->m_colour = colour;
}
wxPen::~wxPen()
{
// m_refData unrefed in ~wxObject
@@ -142,21 +150,21 @@ void wxPen::SetColour( unsigned char red, unsigned char green, unsigned char blu
M_PENDATA->m_colour.Set( red, green, blue );
}
void wxPen::SetCap( int capStyle )
void wxPen::SetCap( wxPenCap capStyle )
{
AllocExclusive();
M_PENDATA->m_capStyle = capStyle;
}
void wxPen::SetJoin( int joinStyle )
void wxPen::SetJoin( wxPenJoin joinStyle )
{
AllocExclusive();
M_PENDATA->m_joinStyle = joinStyle;
}
void wxPen::SetStyle( int style )
void wxPen::SetStyle( wxPenStyle style )
{
AllocExclusive();
@@ -186,23 +194,23 @@ wxDash* wxPen::GetDash() const
return (wxDash*)M_PENDATA->m_dash;
}
int wxPen::GetCap() const
wxPenCap wxPen::GetCap() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
wxCHECK_MSG( Ok(), wxCAP_INVALID, wxT("invalid pen") );
return M_PENDATA->m_capStyle;
}
int wxPen::GetJoin() const
wxPenJoin wxPen::GetJoin() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
wxCHECK_MSG( Ok(), wxJOIN_INVALID, wxT("invalid pen") );
return M_PENDATA->m_joinStyle;
}
int wxPen::GetStyle() const
wxPenStyle wxPen::GetStyle() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
wxCHECK_MSG( Ok(), wxPENSTYLE_MAX, wxT("invalid pen") );
return M_PENDATA->m_style;
}

View File

@@ -74,9 +74,9 @@ public:
}
int m_width;
int m_style;
int m_joinStyle;
int m_capStyle;
wxPenStyle m_style;
wxPenJoin m_joinStyle;
wxPenCap m_capStyle;
wxColour m_colour;
int m_countDashes;
wxGTKDash *m_dash;
@@ -88,7 +88,7 @@ public:
IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject)
wxPen::wxPen( const wxColour &colour, int width, int style )
wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style )
{
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
@@ -96,6 +96,14 @@ wxPen::wxPen( const wxColour &colour, int width, int style )
M_PENDATA->m_colour = colour;
}
wxPen::wxPen(const wxColour& colour, int width, wxBrushStyle style)
{
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
M_PENDATA->m_style = (wxPenStyle)style;
M_PENDATA->m_colour = colour;
}
wxPen::~wxPen()
{
// m_refData unrefed in ~wxObject
@@ -142,21 +150,21 @@ void wxPen::SetColour( unsigned char red, unsigned char green, unsigned char blu
M_PENDATA->m_colour.Set( red, green, blue );
}
void wxPen::SetCap( int capStyle )
void wxPen::SetCap( wxPenCap capStyle )
{
AllocExclusive();
M_PENDATA->m_capStyle = capStyle;
}
void wxPen::SetJoin( int joinStyle )
void wxPen::SetJoin( wxPenJoin joinStyle )
{
AllocExclusive();
M_PENDATA->m_joinStyle = joinStyle;
}
void wxPen::SetStyle( int style )
void wxPen::SetStyle( wxPenStyle style )
{
AllocExclusive();
@@ -186,21 +194,21 @@ wxDash* wxPen::GetDash() const
return (wxDash*)M_PENDATA->m_dash;
}
int wxPen::GetCap() const
wxPenCap wxPen::GetCap() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
return M_PENDATA->m_capStyle;
}
int wxPen::GetJoin() const
wxPenJoin wxPen::GetJoin() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
return M_PENDATA->m_joinStyle;
}
int wxPen::GetStyle() const
wxPenStyle wxPen::GetStyle() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );

View File

@@ -44,9 +44,9 @@ public:
protected:
int m_width;
int m_style;
int m_join ;
int m_cap ;
wxPenStyle m_style;
wxPenJoin m_join ;
wxPenCap m_cap ;
wxBitmap m_stipple ;
int m_nbDash ;
wxDash * m_dash ;
@@ -97,7 +97,7 @@ wxPen::~wxPen()
}
// Should implement Create
wxPen::wxPen(const wxColour& col, int Width, int Style)
wxPen::wxPen(const wxColour& col, int Width, wxPenStyle Style)
{
m_refData = new wxPenRefData;
@@ -112,6 +112,21 @@ wxPen::wxPen(const wxColour& col, int Width, int Style)
RealizeResource();
}
wxPen::wxPen(const wxColour& col, int Width, wxBrushStyle Style)
{
m_refData = new wxPenRefData;
M_PENDATA->m_colour = col;
M_PENDATA->m_width = Width;
M_PENDATA->m_style = (wxPenStyle)Style;
M_PENDATA->m_join = wxJOIN_ROUND ;
M_PENDATA->m_cap = wxCAP_ROUND ;
M_PENDATA->m_nbDash = 0 ;
M_PENDATA->m_dash = 0 ;
RealizeResource();
}
wxPen::wxPen(const wxBitmap& stipple, int Width)
{
m_refData = new wxPenRefData;
@@ -155,17 +170,17 @@ int wxPen::GetWidth() const
return (M_PENDATA ? M_PENDATA->m_width : 0);
}
int wxPen::GetStyle() const
wxPenStyle wxPen::GetStyle() const
{
return (M_PENDATA ? M_PENDATA->m_style : 0);
}
int wxPen::GetJoin() const
wxPenJoin wxPen::GetJoin() const
{
return (M_PENDATA ? M_PENDATA->m_join : 0);
}
int wxPen::GetCap() const
wxPenCap wxPen::GetCap() const
{
return (M_PENDATA ? M_PENDATA->m_cap : 0);
}
@@ -222,7 +237,7 @@ void wxPen::SetWidth(int Width)
RealizeResource();
}
void wxPen::SetStyle(int Style)
void wxPen::SetStyle(wxPenStyle Style)
{
Unshare();
@@ -251,7 +266,7 @@ void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
RealizeResource();
}
void wxPen::SetJoin(int Join)
void wxPen::SetJoin(wxPenJoin Join)
{
Unshare();
@@ -260,7 +275,7 @@ void wxPen::SetJoin(int Join)
RealizeResource();
}
void wxPen::SetCap(int Cap)
void wxPen::SetCap(wxPenCap Cap)
{
Unshare();

View File

@@ -50,14 +50,14 @@ public:
}
int m_width;
int m_style;
wxPenStyle m_style;
wxColour m_colour;
wxBitmap m_stipple;
pixpattern24_t m_pixPattern;
// not used by wxMGL, but we want to preserve values
int m_joinStyle;
int m_capStyle;
wxPenJoin m_joinStyle;
wxPenCap m_capStyle;
int m_countDashes;
wxDash *m_dash;
};
@@ -102,7 +102,7 @@ wxPenRefData::wxPenRefData(const wxPenRefData& data)
IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject)
wxPen::wxPen(const wxColour &colour, int width, int style)
wxPen::wxPen(const wxColour &colour, int width, wxPenStyle style)
{
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
@@ -110,6 +110,14 @@ wxPen::wxPen(const wxColour &colour, int width, int style)
M_PENDATA->m_colour = colour;
}
wxPen::wxPen(const wxColour& colour, int width, wxBrushStyle style)
{
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
M_PENDATA->m_style = (wxPenStyle)style;
M_PENDATA->m_colour = colour;
}
wxPen::wxPen(const wxBitmap& stipple, int width)
{
wxCHECK_RET( stipple.Ok(), _T("invalid bitmap") );
@@ -156,19 +164,19 @@ void wxPen::SetColour(unsigned char red, unsigned char green, unsigned char blue
M_PENDATA->m_colour.Set(red, green, blue);
}
void wxPen::SetCap(int capStyle)
void wxPen::SetCap(wxPenCap capStyle)
{
AllocExclusive();
M_PENDATA->m_capStyle = capStyle;
}
void wxPen::SetJoin(int joinStyle)
void wxPen::SetJoin(wxPenJoin joinStyle)
{
AllocExclusive();
M_PENDATA->m_joinStyle = joinStyle;
}
void wxPen::SetStyle(int style)
void wxPen::SetStyle(wxPenStyle style)
{
AllocExclusive();
M_PENDATA->m_style = style;
@@ -207,21 +215,21 @@ wxDash* wxPen::GetDash() const
return (wxDash*)M_PENDATA->m_dash;
}
int wxPen::GetCap() const
wxPenCap wxPen::GetCap() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
return M_PENDATA->m_capStyle;
}
int wxPen::GetJoin() const
wxPenJoin wxPen::GetJoin() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
return M_PENDATA->m_joinStyle;
}
int wxPen::GetStyle() const
wxPenStyle wxPen::GetStyle() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );

View File

@@ -52,7 +52,7 @@ public:
wxPenRefData();
wxPenRefData(const wxPenRefData& data);
wxPenRefData(const wxColour& col, int width, int style);
wxPenRefData(const wxColour& col, int width, wxPenStyle style);
wxPenRefData(const wxBitmap& stipple, int width);
virtual ~wxPenRefData();
@@ -76,16 +76,16 @@ public:
wxColour& GetColour() const { return wx_const_cast(wxColour&, m_colour); }
int GetWidth() const { return m_width; }
int GetStyle() const { return m_style; }
int GetJoin() const { return m_join; }
int GetCap() const { return m_cap; }
wxPenStyle GetStyle() const { return m_style; }
wxPenJoin GetJoin() const { return m_join; }
wxPenCap GetCap() const { return m_cap; }
wxDash* GetDash() const { return m_dash; }
int GetDashCount() const { return m_nbDash; }
wxBitmap* GetStipple() const { return wx_const_cast(wxBitmap *, &m_stipple); }
void SetColour(const wxColour& col) { Free(); m_colour = col; }
void SetWidth(int width) { Free(); m_width = width; }
void SetStyle(int style) { Free(); m_style = style; }
void SetStyle(wxPenStyle style) { Free(); m_style = style; }
void SetStipple(const wxBitmap& stipple)
{
Free();
@@ -102,8 +102,8 @@ public:
m_dash = wx_const_cast(wxDash *, dash);
}
void SetJoin(int join) { Free(); m_join = join; }
void SetCap(int cap) { Free(); m_cap = cap; }
void SetJoin(wxPenJoin join) { Free(); m_join = join; }
void SetCap(wxPenCap cap) { Free(); m_cap = cap; }
// HPEN management
@@ -135,9 +135,9 @@ private:
}
int m_width;
int m_style;
int m_join;
int m_cap;
wxPenStyle m_style;
wxPenJoin m_join;
wxPenCap m_cap;
wxBitmap m_stipple;
int m_nbDash;
wxDash * m_dash;
@@ -176,7 +176,7 @@ wxPenRefData::wxPenRefData(const wxPenRefData& data)
m_hPen = 0;
}
wxPenRefData::wxPenRefData(const wxColour& col, int width, int style)
wxPenRefData::wxPenRefData(const wxColour& col, int width, wxPenStyle style)
{
Init();
@@ -206,7 +206,7 @@ wxPenRefData::~wxPenRefData()
// wxPenRefData HPEN management
// ----------------------------------------------------------------------------
static int ConvertPenStyle(int style)
static int ConvertPenStyle(wxPenStyle style)
{
switch ( style )
{
@@ -247,7 +247,7 @@ static int ConvertPenStyle(int style)
#ifdef wxHAVE_EXT_CREATE_PEN
static int ConvertJoinStyle(int join)
static int ConvertJoinStyle(wxPenJoin join)
{
switch( join )
{
@@ -266,7 +266,7 @@ static int ConvertJoinStyle(int join)
}
}
static int ConvertCapStyle(int cap)
static int ConvertCapStyle(wxPenCap cap)
{
switch ( cap )
{
@@ -435,6 +435,11 @@ wxPen::wxPen(const wxColour& col, int width, int style)
m_refData = new wxPenRefData(col, width, style);
}
wxPen::wxPen(const wxColour& colour, int width, wxBrushStyle style)
{
m_refData = new wxPenRefData(col, width, (wxPenStyle)style);
}
wxPen::wxPen(const wxBitmap& stipple, int width)
{
m_refData = new wxPenRefData(stipple, width);
@@ -498,7 +503,7 @@ void wxPen::SetWidth(int width)
M_PENDATA->SetWidth(width);
}
void wxPen::SetStyle(int style)
void wxPen::SetStyle(wxPenStyle style)
{
AllocExclusive();
@@ -519,14 +524,14 @@ void wxPen::SetDashes(int nb_dashes, const wxDash *dash)
M_PENDATA->SetDashes(nb_dashes, dash);
}
void wxPen::SetJoin(int join)
void wxPen::SetJoin(wxPenJoin join)
{
AllocExclusive();
M_PENDATA->SetJoin(join);
}
void wxPen::SetCap(int cap)
void wxPen::SetCap(wxPenCap cap)
{
AllocExclusive();
@@ -543,17 +548,17 @@ int wxPen::GetWidth() const
return m_refData ? M_PENDATA->GetWidth() : 0;
}
int wxPen::GetStyle() const
wxPenStyle wxPen::GetStyle() const
{
return m_refData ? M_PENDATA->GetStyle() : 0;
}
int wxPen::GetJoin() const
wxPenJoin wxPen::GetJoin() const
{
return m_refData ? M_PENDATA->GetJoin() : 0;
}
int wxPen::GetCap() const
wxPenCap wxPen::GetCap() const
{
return m_refData ? M_PENDATA->GetCap() : 0;
}

View File

@@ -71,7 +71,7 @@ wxPen::~wxPen()
wxPen::wxPen(
const wxColour& rColour
, int nWidth
, int nStyle
, wxPenStyle nStyle
)
{
m_refData = new wxPenRefData;
@@ -86,6 +86,20 @@ wxPen::wxPen(
RealizeResource();
} // end of wxPen::wxPen
wxPen::wxPen(const wxColour& colour, int width, wxBrushStyle style)
{
m_refData = new wxPenRefData;
M_PENDATA->m_vColour = colour;
M_PENDATA->m_nWidth = width;
M_PENDATA->m_nStyle = (wxPenStyle)nStyle;
M_PENDATA->m_nJoin = wxJOIN_ROUND ;
M_PENDATA->m_nCap = wxCAP_ROUND ;
M_PENDATA->m_hPen = 0L;
RealizeResource();
}
wxPen::wxPen(
const wxBitmap& rStipple
, int nWidth
@@ -104,7 +118,7 @@ wxPen::wxPen(
} // end of wxPen::wxPen
int wx2os2PenStyle(
int nWxStyle
wxPenStyle nWxStyle
);
bool wxPen::RealizeResource()
@@ -370,7 +384,7 @@ void wxPen::SetWidth(
} // end of wxPen::SetWidth
void wxPen::SetStyle(
int nStyle
wxPenStyle nStyle
)
{
AllocExclusive();
@@ -397,7 +411,7 @@ void wxPen::SetDashes( int WXUNUSED(nNbDashes),
} // end of wxPen::SetDashes
void wxPen::SetJoin(
int nJoin
wxPenJoin nJoin
)
{
AllocExclusive();
@@ -406,7 +420,7 @@ void wxPen::SetJoin(
} // end of wxPen::SetJoin
void wxPen::SetCap(
int nCap
wxPenCap nCap
)
{
AllocExclusive();
@@ -415,7 +429,7 @@ void wxPen::SetCap(
} // end of wxPen::SetCap
int wx2os2PenStyle(
int nWxStyle
wxPenStyle nWxStyle
)
{
int nPMStyle = 0;

View File

@@ -52,7 +52,7 @@ wxPen::~wxPen()
}
// Should implement Create
wxPen::wxPen(const wxColour& col, int Width, int Style)
wxPen::wxPen(const wxColour& col, int Width, wxPenStyle Style)
{
}
@@ -92,7 +92,7 @@ void wxPen::SetWidth(int Width)
{
}
void wxPen::SetStyle(int Style)
void wxPen::SetStyle(wxPenStyle Style)
{
}
@@ -104,11 +104,11 @@ void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
{
}
void wxPen::SetJoin(int Join)
void wxPen::SetJoin(wxPenJoin Join)
{
}
void wxPen::SetCap(int Cap)
void wxPen::SetCap(wxPenCap Cap)
{
}

View File

@@ -63,9 +63,9 @@ public:
}
int m_width;
int m_style;
int m_joinStyle;
int m_capStyle;
wxPenStyle m_style;
wxPenJoin m_joinStyle;
wxPenCap m_capStyle;
wxColour m_colour;
int m_countDashes;
wxBitmap m_stipple;
@@ -78,7 +78,7 @@ public:
IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject)
wxPen::wxPen( const wxColour &colour, int width, int style )
wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style )
{
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
@@ -86,6 +86,14 @@ wxPen::wxPen( const wxColour &colour, int width, int style )
M_PENDATA->m_colour = colour;
}
wxPen::wxPen(const wxColour& colour, int width, wxBrushStyle style)
{
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
M_PENDATA->m_style = (wxPenStyle)style;
M_PENDATA->m_colour = colour;
}
wxPen::~wxPen()
{
// m_refData unrefed in ~wxObject
@@ -132,14 +140,14 @@ void wxPen::SetColour( unsigned char red, unsigned char green, unsigned char blu
M_PENDATA->m_colour.Set( red, green, blue );
}
void wxPen::SetCap( int capStyle )
void wxPen::SetCap( wxPenCap capStyle )
{
AllocExclusive();
M_PENDATA->m_capStyle = capStyle;
}
void wxPen::SetJoin( int joinStyle )
void wxPen::SetJoin( wxPenJoin joinStyle )
{
AllocExclusive();
@@ -153,7 +161,7 @@ void wxPen::SetStipple( wxBitmap *stipple )
M_PENDATA->m_stipple = *stipple;
}
void wxPen::SetStyle( int style )
void wxPen::SetStyle( wxPenStyle style )
{
AllocExclusive();
@@ -183,21 +191,21 @@ wxDash* wxPen::GetDash() const
return (wxDash*)M_PENDATA->m_dash;
}
int wxPen::GetCap() const
wxPenCap wxPen::GetCap() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
return M_PENDATA->m_capStyle;
}
int wxPen::GetJoin() const
wxPenJoin wxPen::GetJoin() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
return M_PENDATA->m_joinStyle;
}
int wxPen::GetStyle() const
wxPenStyle wxPen::GetStyle() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );