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

@@ -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,
wxSOLID = 100,
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;