replaced by stubs files
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
212
src/qt/brush.cpp
212
src/qt/brush.cpp
@@ -1,10 +1,11 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: brush.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Purpose: wxBrush
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -12,121 +13,150 @@
|
||||
#pragma implementation "brush.h"
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/brush.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxBrush
|
||||
//-----------------------------------------------------------------------------
|
||||
#if !USE_SHARED_LIBRARIES
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
|
||||
#endif
|
||||
|
||||
class wxBrushRefData: public wxObjectRefData
|
||||
wxBrushRefData::wxBrushRefData()
|
||||
{
|
||||
public:
|
||||
|
||||
wxBrushRefData(void);
|
||||
|
||||
int m_style;
|
||||
wxBitmap m_stipple;
|
||||
wxColour m_colour;
|
||||
};
|
||||
m_style = wxSOLID;
|
||||
// TODO: null data
|
||||
}
|
||||
|
||||
wxBrushRefData::wxBrushRefData(void)
|
||||
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
|
||||
{
|
||||
m_style = 0;
|
||||
};
|
||||
m_style = data.m_style;
|
||||
m_stipple = data.m_stipple;
|
||||
m_colour = data.m_colour;
|
||||
/* TODO: null data
|
||||
m_hBrush = 0;
|
||||
*/
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
|
||||
|
||||
wxBrush::wxBrush(void)
|
||||
wxBrushRefData::~wxBrushRefData()
|
||||
{
|
||||
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
|
||||
};
|
||||
// TODO: delete data
|
||||
}
|
||||
|
||||
wxBrush::wxBrush( const wxColour &colour, int style )
|
||||
// Brushes
|
||||
wxBrush::wxBrush()
|
||||
{
|
||||
m_refData = new wxBrushRefData();
|
||||
M_BRUSHDATA->m_style = style;
|
||||
M_BRUSHDATA->m_colour = colour;
|
||||
|
||||
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
|
||||
};
|
||||
if ( wxTheBrushList )
|
||||
wxTheBrushList->AddBrush(this);
|
||||
}
|
||||
|
||||
wxBrush::wxBrush( const wxString &colourName, int style )
|
||||
wxBrush::~wxBrush()
|
||||
{
|
||||
m_refData = new wxBrushRefData();
|
||||
M_BRUSHDATA->m_style = style;
|
||||
M_BRUSHDATA->m_colour = colourName;
|
||||
|
||||
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
|
||||
};
|
||||
if ( wxTheBrushList )
|
||||
wxTheBrushList->RemoveBrush(this);
|
||||
}
|
||||
|
||||
wxBrush::wxBrush( const wxBitmap &stippleBitmap )
|
||||
wxBrush::wxBrush(const wxColour& col, int Style)
|
||||
{
|
||||
m_refData = new wxBrushRefData();
|
||||
M_BRUSHDATA->m_style = wxSTIPPLE;
|
||||
M_BRUSHDATA->m_colour = *wxBLACK;
|
||||
M_BRUSHDATA->m_stipple = stippleBitmap;
|
||||
|
||||
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
|
||||
};
|
||||
m_refData = new wxBrushRefData;
|
||||
|
||||
wxBrush::wxBrush( const wxBrush &brush )
|
||||
M_BRUSHDATA->m_colour = col;
|
||||
M_BRUSHDATA->m_style = Style;
|
||||
|
||||
RealizeResource();
|
||||
|
||||
if ( wxTheBrushList )
|
||||
wxTheBrushList->AddBrush(this);
|
||||
}
|
||||
|
||||
wxBrush::wxBrush(const wxString& col, int Style)
|
||||
{
|
||||
Ref( brush );
|
||||
|
||||
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
|
||||
};
|
||||
m_refData = new wxBrushRefData;
|
||||
|
||||
wxBrush::wxBrush( const wxBrush *brush )
|
||||
// Implicit conversion from string to wxColour via colour database
|
||||
M_BRUSHDATA->m_colour = col;
|
||||
M_BRUSHDATA->m_style = Style;
|
||||
|
||||
RealizeResource();
|
||||
|
||||
if ( wxTheBrushList )
|
||||
wxTheBrushList->AddBrush(this);
|
||||
}
|
||||
|
||||
wxBrush::wxBrush(const wxBitmap& stipple)
|
||||
{
|
||||
if (brush) Ref( *brush );
|
||||
|
||||
if (wxTheBrushList) wxTheBrushList->Append( this );
|
||||
};
|
||||
m_refData = new wxBrushRefData;
|
||||
|
||||
wxBrush::~wxBrush(void)
|
||||
M_BRUSHDATA->m_style = wxSTIPPLE;
|
||||
M_BRUSHDATA->m_stipple = stipple;
|
||||
|
||||
RealizeResource();
|
||||
|
||||
if ( wxTheBrushList )
|
||||
wxTheBrushList->AddBrush(this);
|
||||
}
|
||||
|
||||
void wxBrush::Unshare()
|
||||
{
|
||||
if (wxTheBrushList) wxTheBrushList->RemoveBrush( this );
|
||||
};
|
||||
// Don't change shared data
|
||||
if (!m_refData)
|
||||
{
|
||||
m_refData = new wxBrushRefData();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
|
||||
UnRef();
|
||||
m_refData = ref;
|
||||
}
|
||||
}
|
||||
|
||||
wxBrush& wxBrush::operator = ( const wxBrush& brush )
|
||||
void wxBrush::SetColour(const wxColour& col)
|
||||
{
|
||||
if (*this == brush) return (*this);
|
||||
Ref( brush );
|
||||
return *this;
|
||||
};
|
||||
|
||||
bool wxBrush::operator == ( const wxBrush& brush )
|
||||
Unshare();
|
||||
|
||||
M_BRUSHDATA->m_colour = col;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxBrush::SetColour(const wxString& col)
|
||||
{
|
||||
return m_refData == brush.m_refData;
|
||||
};
|
||||
Unshare();
|
||||
|
||||
bool wxBrush::operator != ( const wxBrush& brush )
|
||||
M_BRUSHDATA->m_colour = col;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxBrush::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
|
||||
{
|
||||
return m_refData != brush.m_refData;
|
||||
};
|
||||
Unshare();
|
||||
|
||||
bool wxBrush::Ok(void) const
|
||||
M_BRUSHDATA->m_colour.Set(r, g, b);
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxBrush::SetStyle(int Style)
|
||||
{
|
||||
return ((m_refData) && M_BRUSHDATA->m_colour.Ok());
|
||||
};
|
||||
Unshare();
|
||||
|
||||
int wxBrush::GetStyle(void) const
|
||||
M_BRUSHDATA->m_style = Style;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxBrush::SetStipple(const wxBitmap& Stipple)
|
||||
{
|
||||
return M_BRUSHDATA->m_style;
|
||||
};
|
||||
Unshare();
|
||||
|
||||
wxColour &wxBrush::GetColour(void) const
|
||||
M_BRUSHDATA->m_stipple = Stipple;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxBrush::RealizeResource()
|
||||
{
|
||||
return M_BRUSHDATA->m_colour;
|
||||
};
|
||||
|
||||
wxBitmap *wxBrush::GetStipple(void) const
|
||||
{
|
||||
return &M_BRUSHDATA->m_stipple;
|
||||
};
|
||||
|
||||
// TODO: create the brush
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user