Updated brush/pen implementation for OS/2 to current implementation style.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52739 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -12,36 +12,8 @@
|
||||
#ifndef _WX_BRUSH_H_
|
||||
#define _WX_BRUSH_H_
|
||||
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/gdiobj.h"
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxBrush;
|
||||
|
||||
class WXDLLEXPORT wxBrushRefData: public wxGDIRefData
|
||||
{
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxBrush;
|
||||
public:
|
||||
wxBrushRefData();
|
||||
wxBrushRefData(const wxBrushRefData& rData);
|
||||
virtual ~wxBrushRefData();
|
||||
|
||||
bool operator == (const wxBrushRefData& data) const
|
||||
{
|
||||
return (m_nStyle == data.m_nStyle &&
|
||||
m_vStipple.IsSameAs(data.m_vStipple) &&
|
||||
m_vColour == data.m_vColour);
|
||||
}
|
||||
|
||||
protected:
|
||||
wxBrushStyle m_nStyle;
|
||||
wxBitmap m_vStipple;
|
||||
wxColour m_vColour;
|
||||
WXHBRUSH m_hBrush; // in OS/2 GPI this will be the PS the pen is associated with
|
||||
AREABUNDLE m_vBundle;
|
||||
};
|
||||
|
||||
#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
|
||||
class WXDLLIMPEXP_FWD_CORE wxColour;
|
||||
class WXDLLIMPEXP_FWD_CORE wxBitmap;
|
||||
|
||||
// Brush
|
||||
class WXDLLEXPORT wxBrush: public wxBrushBase
|
||||
@@ -64,10 +36,10 @@ public:
|
||||
virtual void SetStyle(wxBrushStyle nStyle);
|
||||
virtual void SetStipple(const wxBitmap& rStipple);
|
||||
|
||||
inline wxColour& GetColour(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_vColour : wxNullColour); };
|
||||
virtual wxBrushStyle GetStyle(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_nStyle : wxBRUSHSTYLE_INVALID); };
|
||||
inline wxBitmap* GetStipple(void) const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_vStipple : NULL); };
|
||||
inline int GetPS(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_hBrush : 0); };
|
||||
wxColour GetColour(void) const;
|
||||
virtual wxBrushStyle GetStyle(void) const;
|
||||
wxBitmap* GetStipple(void) const;
|
||||
int GetPS(void) const;
|
||||
|
||||
//
|
||||
// Implementation
|
||||
|
@@ -17,49 +17,14 @@
|
||||
|
||||
typedef long wxPMDash;
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxPen;
|
||||
|
||||
class WXDLLEXPORT wxPenRefData: public wxGDIRefData
|
||||
{
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxPen;
|
||||
public:
|
||||
wxPenRefData();
|
||||
wxPenRefData(const wxPenRefData& rData);
|
||||
virtual ~wxPenRefData();
|
||||
|
||||
bool operator==(const wxPenRefData& data) const
|
||||
{
|
||||
// we intentionally don't compare m_hPen fields here
|
||||
return m_nStyle == data.m_nStyle &&
|
||||
m_nWidth == data.m_nWidth &&
|
||||
m_nJoin == data.m_nJoin &&
|
||||
m_nCap == data.m_nCap &&
|
||||
m_vColour == data.m_vColour &&
|
||||
(m_nStyle != wxPENSTYLE_STIPPLE || m_vStipple.IsSameAs(data.m_vStipple)) &&
|
||||
(m_nStyle != wxPENSTYLE_USER_DASH ||
|
||||
(m_dash == data.m_dash &&
|
||||
memcmp(m_dash, data.m_dash, m_nbDash*sizeof(wxDash)) == 0));
|
||||
}
|
||||
|
||||
protected:
|
||||
int m_nWidth;
|
||||
wxPenStyle m_nStyle;
|
||||
wxPenJoin m_nJoin;
|
||||
wxPenCap m_nCap;
|
||||
wxBitmap m_vStipple;
|
||||
int m_nbDash;
|
||||
wxDash * m_dash;
|
||||
wxColour m_vColour;
|
||||
WXHPEN m_hPen;// in OS/2 GPI this will be the PS the pen is associated with
|
||||
};
|
||||
|
||||
#define M_PENDATA ((wxPenRefData *)m_refData)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Pen
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPen : public wxPenBase
|
||||
{
|
||||
public:
|
||||
wxPen();
|
||||
wxPen() { }
|
||||
wxPen( const wxColour& rColour
|
||||
,int nWidth = 1
|
||||
,wxPenStyle nStyle = wxPENSTYLE_SOLID
|
||||
@@ -71,16 +36,9 @@ public:
|
||||
wxPen( const wxBitmap& rStipple
|
||||
,int nWidth
|
||||
);
|
||||
virtual ~wxPen();
|
||||
|
||||
inline bool operator == (const wxPen& rPen) const
|
||||
{
|
||||
const wxPenRefData *penData = (wxPenRefData *)rPen.m_refData;
|
||||
|
||||
// an invalid pen is only equal to another invalid pen
|
||||
return m_refData ? penData && *M_PENDATA == *penData : !penData;
|
||||
}
|
||||
virtual ~wxPen() { }
|
||||
|
||||
bool operator == (const wxPen& rPen) const;
|
||||
inline bool operator != (const wxPen& rPen) const
|
||||
{ return !(*this == rPen); }
|
||||
|
||||
@@ -100,21 +58,16 @@ public:
|
||||
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 : -1); };
|
||||
inline wxPenStyle GetStyle(void) const { return (M_PENDATA ? M_PENDATA->m_nStyle : wxPENSTYLE_INVALID); };
|
||||
inline wxPenJoin GetJoin(void) const { return (M_PENDATA ? M_PENDATA->m_nJoin : wxJOIN_INVALID); };
|
||||
inline wxPenCap GetCap(void) const { return (M_PENDATA ? M_PENDATA->m_nCap : wxCAP_INVALID); };
|
||||
inline int GetPS(void) const { return (M_PENDATA ? M_PENDATA->m_hPen : 0); };
|
||||
inline int GetDashes(wxDash **ptr) const
|
||||
{
|
||||
*ptr = (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*) NULL);
|
||||
return (M_PENDATA ? M_PENDATA->m_nbDash : -1);
|
||||
}
|
||||
inline wxDash* GetDash() const { return (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*)NULL); };
|
||||
inline int GetDashCount() const { return (M_PENDATA ? M_PENDATA->m_nbDash : 0); };
|
||||
|
||||
inline wxBitmap* GetStipple(void) const { return (M_PENDATA ? (& M_PENDATA->m_vStipple) : (wxBitmap*) NULL); };
|
||||
wxColour& GetColour(void) const;
|
||||
int GetWidth(void) const;
|
||||
wxPenStyle GetStyle(void) const;
|
||||
wxPenJoin GetJoin(void) const;
|
||||
wxPenCap GetCap(void) const;
|
||||
int GetPS(void) const;
|
||||
int GetDashes(wxDash **ptr) const;
|
||||
wxDash* GetDash() const;
|
||||
int GetDashCount() const;
|
||||
wxBitmap* GetStipple(void) const;
|
||||
|
||||
//
|
||||
// Implementation
|
||||
|
@@ -23,22 +23,66 @@
|
||||
|
||||
#include "wx/os2/private.h"
|
||||
|
||||
#include "assert.h"
|
||||
class WXDLLEXPORT wxBrushRefData: public wxGDIRefData
|
||||
{
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxBrush;
|
||||
public:
|
||||
wxBrushRefData(const wxColour& colour = wxNullColour, wxBrushStyle style = wxBRUSHSTYLE_SOLID);
|
||||
wxBrushRefData(const wxBitmap& stipple);
|
||||
wxBrushRefData(const wxBrushRefData& rData);
|
||||
virtual ~wxBrushRefData();
|
||||
|
||||
bool operator == (const wxBrushRefData& data) const
|
||||
{
|
||||
return (m_nStyle == data.m_nStyle &&
|
||||
m_vStipple.IsSameAs(data.m_vStipple) &&
|
||||
m_vColour == data.m_vColour);
|
||||
}
|
||||
|
||||
protected:
|
||||
wxBrushStyle m_nStyle;
|
||||
wxBitmap m_vStipple;
|
||||
wxColour m_vColour;
|
||||
WXHBRUSH m_hBrush; // in OS/2 GPI this will be the PS the pen is associated with
|
||||
AREABUNDLE m_vBundle;
|
||||
};
|
||||
|
||||
#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
|
||||
|
||||
// ============================================================================
|
||||
// wxBrushRefData implementation
|
||||
// ============================================================================
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
|
||||
|
||||
wxBrushRefData::wxBrushRefData()
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBrushRefData ctors/dtor
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBrushRefData::wxBrushRefData(const wxColour& colour, wxBrushStyle style)
|
||||
: m_vColour(colour)
|
||||
{
|
||||
m_nStyle = wxSOLID;
|
||||
m_nStyle = style;
|
||||
m_hBrush = 0;
|
||||
memset(&m_vBundle, '\0', sizeof(AREABUNDLE));
|
||||
} // end of wxBrushRefData::wxBrushRefData
|
||||
|
||||
wxBrushRefData::wxBrushRefData(const wxBitmap& stipple)
|
||||
{
|
||||
m_vStipple = stipple;
|
||||
m_nStyle = stipple.GetMask() ? wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE
|
||||
: wxBRUSHSTYLE_STIPPLE;
|
||||
|
||||
m_hBrush = NULL;
|
||||
memset(&m_vBundle, '\0', sizeof(AREABUNDLE));
|
||||
}
|
||||
|
||||
wxBrushRefData::wxBrushRefData(const wxBrushRefData& rData)
|
||||
: wxGDIRefData(),
|
||||
m_vStipple(rData.m_vStipple),
|
||||
m_vColour(rData.m_vColour)
|
||||
{
|
||||
m_nStyle = rData.m_nStyle;
|
||||
m_vStipple = rData.m_vStipple;
|
||||
m_vColour = rData.m_vColour;
|
||||
m_hBrush = 0;
|
||||
memcpy(&m_vBundle, &rData.m_vBundle, sizeof(AREABUNDLE));
|
||||
} // end of wxBrushRefData::wxBrushRefData
|
||||
@@ -47,9 +91,14 @@ wxBrushRefData::~wxBrushRefData()
|
||||
{
|
||||
} // end of wxBrushRefData::~wxBrushRefData
|
||||
|
||||
//
|
||||
// Brushes
|
||||
//
|
||||
// ============================================================================
|
||||
// wxBrush implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBrush ctors/dtor
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBrush::wxBrush()
|
||||
{
|
||||
} // end of wxBrush::wxBrush
|
||||
@@ -63,12 +112,7 @@ wxBrush::wxBrush(
|
||||
, wxBrushStyle nStyle
|
||||
)
|
||||
{
|
||||
m_refData = new wxBrushRefData;
|
||||
|
||||
M_BRUSHDATA->m_vColour = rColour;
|
||||
M_BRUSHDATA->m_nStyle = nStyle;
|
||||
M_BRUSHDATA->m_hBrush = 0;
|
||||
memset(&M_BRUSHDATA->m_vBundle, '\0', sizeof(AREABUNDLE));
|
||||
m_refData = new wxBrushRefData(rColour, nStyle);
|
||||
|
||||
RealizeResource();
|
||||
} // end of wxBrush::wxBrush
|
||||
@@ -76,12 +120,7 @@ wxBrush::wxBrush(
|
||||
#if FUTURE_WXWIN_COMPATIBILITY_3_0
|
||||
wxBrush::wxBrush(const wxColour& col, int style)
|
||||
{
|
||||
m_refData = new wxBrushRefData;
|
||||
|
||||
M_BRUSHDATA->m_vColour = col;
|
||||
M_BRUSHDATA->m_nStyle = (wxBrushStyle)style;
|
||||
M_BRUSHDATA->m_hBrush = 0;
|
||||
memset(&M_BRUSHDATA->m_vBundle, '\0', sizeof(AREABUNDLE));
|
||||
m_refData = new wxBrushRefData(col, (wxBrushStyle)style);
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
@@ -89,12 +128,7 @@ wxBrush::wxBrush(const wxColour& col, int style)
|
||||
|
||||
wxBrush::wxBrush(const wxBitmap& rStipple)
|
||||
{
|
||||
m_refData = new wxBrushRefData;
|
||||
|
||||
M_BRUSHDATA->m_nStyle = wxSTIPPLE;
|
||||
M_BRUSHDATA->m_vStipple = rStipple;
|
||||
M_BRUSHDATA->m_hBrush = 0;
|
||||
memset(&M_BRUSHDATA->m_vBundle, '\0', sizeof(AREABUNDLE));
|
||||
m_refData = new wxBrushRefData(rStipple);
|
||||
|
||||
RealizeResource();
|
||||
} // end of wxBrush::wxBrush
|
||||
@@ -226,10 +260,42 @@ bool wxBrush::RealizeResource()
|
||||
return false;
|
||||
} // end of wxBrush::RealizeResource
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBrush accessors
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxColour wxBrush::GetColour() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), wxNullColour, _T("invalid brush") );
|
||||
|
||||
return M_BRUSHDATA->m_vColour;
|
||||
}
|
||||
|
||||
wxBrushStyle wxBrush::GetStyle() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), wxBRUSHSTYLE_INVALID, _T("invalid brush") );
|
||||
|
||||
return M_BRUSHDATA->m_nStyle;
|
||||
}
|
||||
|
||||
wxBitmap *wxBrush::GetStipple() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), NULL, _T("invalid brush") );
|
||||
|
||||
return &(M_BRUSHDATA->m_vStipple);
|
||||
}
|
||||
|
||||
int wxBrush::GetPS() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, _T("invalid brush") );
|
||||
|
||||
return M_BRUSHDATA->m_hBrush;
|
||||
}
|
||||
|
||||
WXHANDLE wxBrush::GetResourceHandle() const
|
||||
{
|
||||
if (!M_BRUSHDATA)
|
||||
return 0;
|
||||
wxCHECK_MSG( Ok(), 0, _T("invalid brush") );
|
||||
|
||||
return (WXHANDLE)M_BRUSHDATA->m_hBrush;
|
||||
} // end of wxBrush::GetResourceHandle
|
||||
|
||||
@@ -248,6 +314,10 @@ bool wxBrush::IsFree() const
|
||||
return (M_BRUSHDATA && (M_BRUSHDATA->m_hBrush == 0));
|
||||
} // end of wxBrush::IsFree
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBrush setters
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxBrush::SetColour( const wxColour& rColour )
|
||||
{
|
||||
AllocExclusive();
|
||||
@@ -289,6 +359,9 @@ void wxBrush::SetPS(
|
||||
RealizeResource();
|
||||
} // end of WxWinGdi_CPen::SetPS
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBrush house keeping stuff
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxBrush::operator == (
|
||||
const wxBrush& brush
|
||||
|
204
src/os2/pen.cpp
204
src/os2/pen.cpp
@@ -23,19 +23,75 @@
|
||||
#endif
|
||||
|
||||
#include "wx/os2/private.h"
|
||||
#include "assert.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
|
||||
class WXDLLIMPEXP_FWD_CORE wxPen;
|
||||
|
||||
wxPenRefData::wxPenRefData()
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxPenRefData: contains information about an HPEN and its handle
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPenRefData: public wxGDIRefData
|
||||
{
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxPen;
|
||||
public:
|
||||
wxPenRefData();
|
||||
wxPenRefData(const wxPenRefData& rData);
|
||||
wxPenRefData(const wxColour& col, int width, wxPenStyle style);
|
||||
wxPenRefData(const wxBitmap& stipple, int width);
|
||||
virtual ~wxPenRefData();
|
||||
|
||||
bool operator==(const wxPenRefData& data) const
|
||||
{
|
||||
// we intentionally don't compare m_hPen fields here
|
||||
return m_nStyle == data.m_nStyle &&
|
||||
m_nWidth == data.m_nWidth &&
|
||||
m_nJoin == data.m_nJoin &&
|
||||
m_nCap == data.m_nCap &&
|
||||
m_vColour == data.m_vColour &&
|
||||
(m_nStyle != wxPENSTYLE_STIPPLE || m_vStipple.IsSameAs(data.m_vStipple)) &&
|
||||
(m_nStyle != wxPENSTYLE_USER_DASH ||
|
||||
(m_dash == data.m_dash &&
|
||||
memcmp(m_dash, data.m_dash, m_nbDash*sizeof(wxDash)) == 0));
|
||||
}
|
||||
|
||||
private:
|
||||
// initialize the fields which have reasonable default values
|
||||
//
|
||||
// doesn't initialize m_width and m_style which must be initialize in ctor
|
||||
void Init()
|
||||
{
|
||||
m_nStyle = wxPENSTYLE_SOLID;
|
||||
m_nWidth = 1;
|
||||
m_nJoin = wxJOIN_ROUND;
|
||||
m_nCap = wxCAP_ROUND;
|
||||
m_nbDash = 0;
|
||||
m_dash = (wxDash*)NULL;
|
||||
m_hPen = 0L;
|
||||
m_dash = NULL;
|
||||
m_hPen = 0;
|
||||
}
|
||||
|
||||
int m_nWidth;
|
||||
wxPenStyle m_nStyle;
|
||||
wxPenJoin m_nJoin;
|
||||
wxPenCap m_nCap;
|
||||
wxBitmap m_vStipple;
|
||||
int m_nbDash;
|
||||
wxDash * m_dash;
|
||||
wxColour m_vColour;
|
||||
WXHPEN m_hPen;// in OS/2 GPI this will be the PS the pen is associated with
|
||||
|
||||
DECLARE_NO_ASSIGN_CLASS(wxPenRefData)
|
||||
};
|
||||
|
||||
#define M_PENDATA ((wxPenRefData *)m_refData)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxPenRefData ctors/dtor
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxPenRefData::wxPenRefData()
|
||||
{
|
||||
Init();
|
||||
|
||||
m_nStyle = wxPENSTYLE_SOLID;
|
||||
m_nWidth = 1;
|
||||
} // end of wxPenRefData::wxPenRefData
|
||||
|
||||
wxPenRefData::wxPenRefData(
|
||||
@@ -52,36 +108,43 @@ wxPenRefData::wxPenRefData(
|
||||
m_hPen = 0L;
|
||||
} // end of wxPenRefData::wxPenRefData
|
||||
|
||||
wxPenRefData::wxPenRefData(const wxColour& col, int width, wxPenStyle style)
|
||||
{
|
||||
Init();
|
||||
|
||||
m_nStyle = style;
|
||||
m_nWidth = width;
|
||||
|
||||
m_vColour = col;
|
||||
}
|
||||
|
||||
wxPenRefData::wxPenRefData(const wxBitmap& stipple, int width)
|
||||
{
|
||||
Init();
|
||||
|
||||
m_nStyle = wxPENSTYLE_STIPPLE;
|
||||
m_nWidth = width;
|
||||
|
||||
m_vStipple = stipple;
|
||||
}
|
||||
|
||||
wxPenRefData::~wxPenRefData()
|
||||
{
|
||||
} // end of wxPenRefData::~wxPenRefData
|
||||
|
||||
//
|
||||
// Pens
|
||||
//
|
||||
wxPen::wxPen()
|
||||
{
|
||||
} // end of wxPen::wxPen
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxPen
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxPen::~wxPen()
|
||||
{
|
||||
} // end of wxPen::wxPen
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
|
||||
|
||||
// Should implement Create
|
||||
wxPen::wxPen(
|
||||
const wxColour& rColour
|
||||
, int nWidth
|
||||
, wxPenStyle nStyle
|
||||
)
|
||||
{
|
||||
m_refData = new wxPenRefData;
|
||||
|
||||
M_PENDATA->m_vColour = rColour;
|
||||
M_PENDATA->m_nWidth = nWidth;
|
||||
M_PENDATA->m_nStyle = nStyle;
|
||||
M_PENDATA->m_nJoin = wxJOIN_ROUND ;
|
||||
M_PENDATA->m_nCap = wxCAP_ROUND ;
|
||||
M_PENDATA->m_hPen = 0L;
|
||||
m_refData = new wxPenRefData(rColour, nWidth, nStyle);
|
||||
|
||||
RealizeResource();
|
||||
} // end of wxPen::wxPen
|
||||
@@ -89,14 +152,7 @@ wxPen::wxPen(
|
||||
#if FUTURE_WXWIN_COMPATIBILITY_3_0
|
||||
wxPen::wxPen(const wxColour& colour, int width, int 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;
|
||||
m_refData = new wxPenRefData(colour, width, (wxPenStyle)style);
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
@@ -107,14 +163,7 @@ wxPen::wxPen(
|
||||
, int nWidth
|
||||
)
|
||||
{
|
||||
m_refData = new wxPenRefData;
|
||||
|
||||
M_PENDATA->m_vStipple = rStipple;
|
||||
M_PENDATA->m_nWidth = nWidth;
|
||||
M_PENDATA->m_nStyle = wxSTIPPLE;
|
||||
M_PENDATA->m_nJoin = wxJOIN_ROUND ;
|
||||
M_PENDATA->m_nCap = wxCAP_ROUND ;
|
||||
M_PENDATA->m_hPen = 0;
|
||||
m_refData = new wxPenRefData (rStipple, nWidth);
|
||||
|
||||
RealizeResource();
|
||||
} // end of wxPen::wxPen
|
||||
@@ -400,7 +449,7 @@ void wxPen::SetStipple(
|
||||
{
|
||||
AllocExclusive();
|
||||
M_PENDATA->m_vStipple = rStipple;
|
||||
M_PENDATA->m_nStyle = wxSTIPPLE;
|
||||
M_PENDATA->m_nStyle = wxPENSTYLE_STIPPLE;
|
||||
RealizeResource();
|
||||
} // end of wxPen::SetStipple
|
||||
|
||||
@@ -430,6 +479,77 @@ void wxPen::SetCap(
|
||||
RealizeResource();
|
||||
} // end of wxPen::SetCap
|
||||
|
||||
wxColour& wxPen::GetColour() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), wxNullColour, wxT("invalid pen") );
|
||||
|
||||
return M_PENDATA->m_vColour;
|
||||
}
|
||||
|
||||
int wxPen::GetWidth() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
|
||||
|
||||
return M_PENDATA->m_nWidth;
|
||||
}
|
||||
|
||||
wxPenStyle wxPen::GetStyle() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), wxPENSTYLE_INVALID, wxT("invalid pen") );
|
||||
|
||||
return M_PENDATA->m_nStyle;
|
||||
}
|
||||
|
||||
wxPenJoin wxPen::GetJoin() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), wxJOIN_INVALID, wxT("invalid pen") );
|
||||
|
||||
return M_PENDATA->m_nJoin;
|
||||
}
|
||||
|
||||
wxPenCap wxPen::GetCap() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), wxCAP_INVALID, wxT("invalid pen") );
|
||||
|
||||
return M_PENDATA->m_nCap;
|
||||
}
|
||||
|
||||
int wxPen::GetPS() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, wxT("invalid pen") );
|
||||
|
||||
return M_PENDATA->m_hPen;
|
||||
}
|
||||
|
||||
int wxPen::GetDashes(wxDash** ptr) const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
|
||||
|
||||
*ptr = M_PENDATA->m_dash;
|
||||
return M_PENDATA->m_nbDash;
|
||||
}
|
||||
|
||||
wxDash* wxPen::GetDash() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), NULL, wxT("invalid pen") );
|
||||
|
||||
return M_PENDATA->m_dash;
|
||||
}
|
||||
|
||||
int wxPen::GetDashCount() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), -1, wxT("invalid pen") );
|
||||
|
||||
return M_PENDATA->m_nbDash;
|
||||
}
|
||||
|
||||
wxBitmap* wxPen::GetStipple() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), NULL, wxT("invalid pen") );
|
||||
|
||||
return &(M_PENDATA->m_vStipple);
|
||||
}
|
||||
|
||||
int wx2os2PenStyle(
|
||||
wxPenStyle nWxStyle
|
||||
)
|
||||
|
Reference in New Issue
Block a user