- implemented alignment for wxGrid bool editor and renderer
- support wxListCtrl columns alignment for all platforms and not just MSW
- added wxToolBar Add/InsertTool(tool) (Janusz Piwowarski)
+- fixed user dash handling for MSW and GTK (Ken Edwards)
- WXR resources can now be used in Unicode builds
- it is now possible to use several wxFileHistory objects in the same menu
by giving them different base IDs (Dimitri Schoolwerth)
};
#define M_PENDATA ((wxPenRefData *)m_refData)
+#define wxPENDATA(x) ((wxPenRefData *)(x).m_refData)
// Pen
class WXDLLEXPORT wxPen: public wxGDIObject
~wxPen();
inline wxPen& operator = (const wxPen& pen) { if (*this == pen) return (*this); Ref(pen); return *this; }
- inline bool operator == (const wxPen& pen) const { return m_refData == pen.m_refData; }
- inline bool operator != (const wxPen& pen) const { return m_refData != pen.m_refData; }
+ inline bool operator == (const wxPen& pen) const
+ {
+ // It is impossible to know if the user dashes have changed,
+ // so we must assume that they have
+ if ( m_refData && pen.m_refData )
+ {
+ if ( M_PENDATA->m_nbDash != 0 || wxPENDATA(pen)->m_nbDash != 0 )
+ return false;
+ }
+ return m_refData == pen.m_refData;
+ }
+ inline bool operator != (const wxPen& pen) const
+ {
+ // It is impossible to know if the user dashes have changed,
+ // so we must assume that they have
+ if ( m_refData && pen.m_refData )
+ {
+ if ( M_PENDATA->m_nbDash != 0 || wxPENDATA(pen)->m_nbDash != 0 )
+ return true;
+ }
+ return m_refData != pen.m_refData;
+ }
virtual bool Ok() const { return (m_refData != NULL) ; }
dc.DrawText(_T("User dash"), x + 150, y + 140);
wxPen ud( wxT("black"), width, wxUSER_DASH );
- wxDash dash1[1];
- dash1[0] = 0;
- ud.SetDashes( 1, dash1 );
+ wxDash dash1[6];
+ dash1[0] = 8; // Long dash <---------+
+ dash1[1] = 2; // Short gap |
+ dash1[2] = 3; // Short dash |
+ dash1[3] = 2; // Short gap |
+ dash1[4] = 3; // Short dash |
+ dash1[5] = 2; // Short gap and repeat +
+ ud.SetDashes( 6, dash1 );
+ dc.SetPen( ud );
dc.DrawLine( x+20, y+140, 100, y+140 );
- dash1[0] = 1;
- ud.SetDashes( 1, dash1 );
+ dash1[0] = 5; // Make first dash shorter
+ ud.SetDashes( 6, dash1 );
+ dc.SetPen( ud );
dc.DrawLine( x+20, y+150, 100, y+150 );
- dash1[0] = 2;
- ud.SetDashes( 1, dash1 );
+ dash1[2] = 5; // Make second dash longer
+ ud.SetDashes( 6, dash1 );
+ dc.SetPen( ud );
dc.DrawLine( x+20, y+160, 100, y+160 );
- dash1[0] = 0x7F;
- ud.SetDashes( 1, dash1 );
+ dash1[4] = 5; // Make third dash longer
+ ud.SetDashes( 6, dash1 );
+ dc.SetPen( ud );
dc.DrawLine( x+20, y+170, 100, y+170 );
}
bool operator == (const wxPenRefData& data) const
{
+ // It is impossible to tell if the dashes have changed
+ // so the only thing to do is assume they have
+ if (m_countDashes != 0 || data.m_countDashes != 0)
+ return false;
+
return (m_style == data.m_style &&
m_width == data.m_width &&
m_joinStyle == data.m_joinStyle &&
bool operator == (const wxPenRefData& data) const
{
+ // It is impossible to tell if the dashes have changed
+ // so the only thing to do is assume they have
+ if (m_countDashes != 0 || data.m_countDashes != 0)
+ return false;
+
return (m_style == data.m_style &&
m_width == data.m_width &&
m_joinStyle == data.m_joinStyle &&
if (M_PENDATA->m_style==wxUSER_DASH && M_PENDATA->m_nbDash && M_PENDATA->m_dash)
{
real_dash = new wxMSWDash[M_PENDATA->m_nbDash];
+ int rw = M_PENDATA->m_width > 1 ? M_PENDATA->m_width : 1;
for ( int i = 0; i < M_PENDATA->m_nbDash; i++ )
- real_dash[i] = M_PENDATA->m_dash[i] * M_PENDATA->m_width;
+ real_dash[i] = M_PENDATA->m_dash[i] * rw;
}
else
{