projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add support for IEC and SI size units to wxFileName::GetHumanReadableSize().
[wxWidgets.git]
/
src
/
mgl
/
brush.cpp
diff --git
a/src/mgl/brush.cpp
b/src/mgl/brush.cpp
index 9415eea4487c04f8494e6deb4a316aacaa1d1cdc..a03abbfb1cd586ea5f3f9143d1dae0d52672238a 100644
(file)
--- a/
src/mgl/brush.cpp
+++ b/
src/mgl/brush.cpp
@@
-16,7
+16,7
@@
#include "wx/brush.h"
#include "wx/mgl/private.h"
#include "wx/brush.h"
#include "wx/mgl/private.h"
-#include "wx/
mgl/
dcmemory.h"
+#include "wx/dcmemory.h"
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
@@
-35,7
+35,7
@@
void wxBitmapToPixPattern(const wxBitmap& bitmap,
if ( pix != NULL )
{
if ( pix != NULL )
{
- mem.SelectObject(bitmap);
+ mem.SelectObject
AsSource
(bitmap);
dc = mem.GetMGLDC();
wxCurrentDCSwitcher curDC(dc);
dc->beginPixel();
dc = mem.GetMGLDC();
wxCurrentDCSwitcher curDC(dc);
dc->beginPixel();
@@
-50,7
+50,7
@@
void wxBitmapToPixPattern(const wxBitmap& bitmap,
if ( mask && bitmap.GetMask() )
{
if ( mask && bitmap.GetMask() )
{
- mem.SelectObject(bitmap.GetMask()->GetBitmap());
+ mem.SelectObject
AsSource
(bitmap.GetMask()->GetBitmap());
dc = mem.GetMGLDC();
wxCurrentDCSwitcher curDC(dc);
dc->beginPixel();
dc = mem.GetMGLDC();
wxCurrentDCSwitcher curDC(dc);
dc->beginPixel();
@@
-70,13
+70,22
@@
void wxBitmapToPixPattern(const wxBitmap& bitmap,
// wxBrush
//-----------------------------------------------------------------------------
// wxBrush
//-----------------------------------------------------------------------------
-class wxBrushRefData
: public wxObject
RefData
+class wxBrushRefData
: public wxGDI
RefData
{
public:
wxBrushRefData();
wxBrushRefData(const wxBrushRefData& data);
{
public:
wxBrushRefData();
wxBrushRefData(const wxBrushRefData& data);
- int m_style;
+ virtual bool IsOk() const { return m_colour.IsOk(); }
+
+ bool operator==(const wxBrushRefData& data) const
+ {
+ return (m_style == data.m_style &&
+ m_stipple.IsSameAs(data.m_stipple) &&
+ m_colour == data.m_colour);
+ }
+
+ wxBrushStyle m_style;
wxColour m_colour;
wxBitmap m_stipple;
pixpattern24_t m_pixPattern;
wxColour m_colour;
wxBitmap m_stipple;
pixpattern24_t m_pixPattern;
@@
-117,18
+126,27
@@
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
-wxBrush::wxBrush(const wxColour &colour,
int
style)
+wxBrush::wxBrush(const wxColour &colour,
wxBrushStyle
style)
{
m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = style;
M_BRUSHDATA->m_colour = colour;
}
{
m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = style;
M_BRUSHDATA->m_colour = colour;
}
+#if FUTURE_WXWIN_COMPATIBILITY_3_0
+wxBrush::wxBrush(const wxColour& col, int style)
+{
+ m_refData = new wxBrushRefData;
+ M_BRUSHDATA->m_style = (wxBrushStyle)style;
+ M_BRUSHDATA->m_colour = colour;
+}
+#endif
+
wxBrush::wxBrush(const wxBitmap &stippleBitmap)
{
wxBrush::wxBrush(const wxBitmap &stippleBitmap)
{
- wxCHECK_RET( stippleBitmap.Ok(),
_
T("invalid bitmap") );
+ wxCHECK_RET( stippleBitmap.Ok(),
wx
T("invalid bitmap") );
wxCHECK_RET( stippleBitmap.GetWidth() == 8 && stippleBitmap.GetHeight() == 8,
wxCHECK_RET( stippleBitmap.GetWidth() == 8 && stippleBitmap.GetHeight() == 8,
-
_
T("stipple bitmap must be 8x8") );
+
wx
T("stipple bitmap must be 8x8") );
m_refData = new wxBrushRefData();
M_BRUSHDATA->m_colour = *wxBLACK;
m_refData = new wxBrushRefData();
M_BRUSHDATA->m_colour = *wxBLACK;
@@
-145,7
+163,11
@@
wxBrush::wxBrush(const wxBitmap &stippleBitmap)
bool wxBrush::operator == (const wxBrush& brush) const
{
bool wxBrush::operator == (const wxBrush& brush) const
{
- return m_refData == brush.m_refData;
+ if (m_refData == brush.m_refData) return true;
+
+ if (!m_refData || !brush.m_refData) return false;
+
+ return *(wxBrushRefData*)m_refData == *(wxBrushRefData*)brush.m_refData;
}
bool wxBrush::operator != (const wxBrush& brush) const
}
bool wxBrush::operator != (const wxBrush& brush) const
@@
-153,40
+175,23
@@
bool wxBrush::operator != (const wxBrush& brush) const
return m_refData != brush.m_refData;
}
return m_refData != brush.m_refData;
}
-
bool wxBrush::IsOk
() const
+
wxBrushStyle wxBrush::GetStyle
() const
{
{
- return ((m_refData) && M_BRUSHDATA->m_colour.Ok());
-}
-
-int wxBrush::GetStyle() const
-{
- if (m_refData == NULL)
- {
- wxFAIL_MSG( wxT("invalid brush") );
- return 0;
- }
+ wxCHECK_MSG( Ok(), wxBRUSHSTYLE_INVALID, wxT("invalid brush") );
return M_BRUSHDATA->m_style;
}
return M_BRUSHDATA->m_style;
}
-wxColour
&
wxBrush::GetColour() const
+wxColour wxBrush::GetColour() const
{
{
- if (m_refData == NULL)
- {
- wxFAIL_MSG( wxT("invalid brush") );
- return wxNullColour;
- }
+ wxCHECK_MSG( Ok(), wxNullColour, wxT("invalid brush") );
return M_BRUSHDATA->m_colour;
}
wxBitmap *wxBrush::GetStipple() const
{
return M_BRUSHDATA->m_colour;
}
wxBitmap *wxBrush::GetStipple() const
{
- if (m_refData == NULL)
- {
- wxFAIL_MSG( wxT("invalid brush") );
- return &wxNullBitmap;
- }
+ wxCHECK_MSG( Ok(), NULL, wxT("invalid brush") );
return &M_BRUSHDATA->m_stipple;
}
return &M_BRUSHDATA->m_stipple;
}
@@
-217,7
+222,7
@@
void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
M_BRUSHDATA->m_colour.Set(r, g, b);
}
M_BRUSHDATA->m_colour.Set(r, g, b);
}
-void wxBrush::SetStyle(
int
style )
+void wxBrush::SetStyle(
wxBrushStyle
style )
{
AllocExclusive();
M_BRUSHDATA->m_style = style;
{
AllocExclusive();
M_BRUSHDATA->m_style = style;
@@
-227,9
+232,9
@@
void wxBrush::SetStipple(const wxBitmap& stipple)
{
AllocExclusive();
{
AllocExclusive();
- wxCHECK_RET( stipple.Ok(),
_
T("invalid bitmap") );
+ wxCHECK_RET( stipple.Ok(),
wx
T("invalid bitmap") );
wxCHECK_RET( stipple.GetWidth() == 8 && stipple.GetHeight() == 8,
wxCHECK_RET( stipple.GetWidth() == 8 && stipple.GetHeight() == 8,
-
_
T("stipple bitmap must be 8x8") );
+
wx
T("stipple bitmap must be 8x8") );
M_BRUSHDATA->m_stipple = stipple;
wxBitmapToPixPattern(stipple, &(M_BRUSHDATA->m_pixPattern),
M_BRUSHDATA->m_stipple = stipple;
wxBitmapToPixPattern(stipple, &(M_BRUSHDATA->m_pixPattern),
@@
-241,12
+246,12
@@
void wxBrush::SetStipple(const wxBitmap& stipple)
M_BRUSHDATA->m_style = wxSTIPPLE;
}
M_BRUSHDATA->m_style = wxSTIPPLE;
}
-wx
ObjectRefData *wxBrush::Create
RefData() const
+wx
GDIRefData *wxBrush::CreateGDI
RefData() const
{
return new wxBrushRefData;
}
{
return new wxBrushRefData;
}
-wx
ObjectRefData *wxBrush::CloneRefData(const wxObject
RefData *data) const
+wx
GDIRefData *wxBrush::CloneGDIRefData(const wxGDI
RefData *data) const
{
return new wxBrushRefData(*(wxBrushRefData *)data);
}
{
return new wxBrushRefData(*(wxBrushRefData *)data);
}