wxColour(const char *) ctor related modifications

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@886 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-10-20 14:35:22 +00:00
parent 9c1f7241c0
commit e4a81a2e96
35 changed files with 222 additions and 533 deletions

View File

@@ -512,15 +512,6 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
return pen;
}
wxPen *wxPenList::FindOrCreatePen (const wxString& colour, int width, int style)
{
wxColour *the_colour = wxTheColourDatabase->FindColour (colour);
if (the_colour)
return FindOrCreatePen (*the_colour, width, style);
else
return (wxPen *) NULL;
}
wxBrushList::~wxBrushList ()
{
#ifdef __WXMSW__
@@ -562,15 +553,6 @@ wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, int style)
return brush;
}
wxBrush *wxBrushList::FindOrCreateBrush (const wxString& colour, int style)
{
wxColour *the_colour = wxTheColourDatabase->FindColour (colour);
if (the_colour)
return FindOrCreateBrush (*the_colour, style);
else
return (wxBrush *) NULL;
}
void wxBrushList::RemoveBrush (wxBrush * brush)
{
DeleteObject (brush);

View File

@@ -62,15 +62,6 @@ wxBrush::wxBrush( const wxColour &colour, int style )
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
}
wxBrush::wxBrush( const wxString &colourName, int style )
{
m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = style;
M_BRUSHDATA->m_colour = colourName;
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
}
wxBrush::wxBrush( const wxBitmap &stippleBitmap )
{
m_refData = new wxBrushRefData();
@@ -161,12 +152,6 @@ void wxBrush::SetColour( const wxColour& col )
M_BRUSHDATA->m_colour = col;
}
void wxBrush::SetColour( const wxString& col )
{
Unshare();
M_BRUSHDATA->m_colour = col;
}
void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b )
{
Unshare();

View File

@@ -121,28 +121,6 @@ wxColour& wxColour::operator = ( const wxColour& col )
return *this;
}
wxColour& wxColour::operator = ( const wxString& colourName )
{
UnRef();
wxNode *node = (wxNode *) NULL;
if ((wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
{
wxColour *col = (wxColour*)node->Data();
if (col) Ref( *col );
}
else
{
m_refData = new wxColourRefData();
if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
{
wxFAIL_MSG( "wxColour: couldn't find colour" );
delete m_refData;
m_refData = (wxObjectRefData *) NULL;
}
}
return *this;
}
bool wxColour::operator == ( const wxColour& col )
{
return m_refData == col.m_refData;

View File

@@ -351,10 +351,14 @@ bool wxNotebook::AddPage(wxWindow* win, const wxString& text,
{
wxASSERT( m_imageList != NULL );
wxBitmap *bmp = m_imageList->GetBitmap(imageId);
const wxBitmap *bmp = m_imageList->GetBitmap(imageId);
GdkPixmap *pixmap = bmp->GetPixmap();
GdkBitmap *mask = (GdkBitmap*) NULL;
if (bmp->GetMask()) mask = bmp->GetMask()->GetBitmap();
if ( bmp->GetMask() )
{
mask = bmp->GetMask()->GetBitmap();
}
GtkWidget *pixmapwid = gtk_pixmap_new (pixmap, mask );
gtk_box_pack_start(GTK_BOX(page->m_box), pixmapwid, FALSE, FALSE, 3);

View File

@@ -71,16 +71,6 @@ wxPen::wxPen( const wxColour &colour, int width, int style )
if (wxThePenList) wxThePenList->AddPen( this );
}
wxPen::wxPen( const wxString &colourName, int width, int style )
{
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
M_PENDATA->m_style = style;
M_PENDATA->m_colour = colourName;
if (wxThePenList) wxThePenList->AddPen( this );
}
wxPen::wxPen( const wxPen& pen )
{
Ref( pen );
@@ -123,12 +113,6 @@ void wxPen::SetColour( const wxColour &colour )
M_PENDATA->m_colour = colour;
}
void wxPen::SetColour( const wxString &colourName )
{
Unshare();
M_PENDATA->m_colour = colourName;
}
void wxPen::SetColour( int red, int green, int blue )
{
Unshare();

View File

@@ -62,15 +62,6 @@ wxBrush::wxBrush( const wxColour &colour, int style )
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
}
wxBrush::wxBrush( const wxString &colourName, int style )
{
m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = style;
M_BRUSHDATA->m_colour = colourName;
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
}
wxBrush::wxBrush( const wxBitmap &stippleBitmap )
{
m_refData = new wxBrushRefData();
@@ -161,12 +152,6 @@ void wxBrush::SetColour( const wxColour& col )
M_BRUSHDATA->m_colour = col;
}
void wxBrush::SetColour( const wxString& col )
{
Unshare();
M_BRUSHDATA->m_colour = col;
}
void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b )
{
Unshare();

View File

@@ -121,28 +121,6 @@ wxColour& wxColour::operator = ( const wxColour& col )
return *this;
}
wxColour& wxColour::operator = ( const wxString& colourName )
{
UnRef();
wxNode *node = (wxNode *) NULL;
if ((wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
{
wxColour *col = (wxColour*)node->Data();
if (col) Ref( *col );
}
else
{
m_refData = new wxColourRefData();
if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
{
wxFAIL_MSG( "wxColour: couldn't find colour" );
delete m_refData;
m_refData = (wxObjectRefData *) NULL;
}
}
return *this;
}
bool wxColour::operator == ( const wxColour& col )
{
return m_refData == col.m_refData;

View File

@@ -351,10 +351,14 @@ bool wxNotebook::AddPage(wxWindow* win, const wxString& text,
{
wxASSERT( m_imageList != NULL );
wxBitmap *bmp = m_imageList->GetBitmap(imageId);
const wxBitmap *bmp = m_imageList->GetBitmap(imageId);
GdkPixmap *pixmap = bmp->GetPixmap();
GdkBitmap *mask = (GdkBitmap*) NULL;
if (bmp->GetMask()) mask = bmp->GetMask()->GetBitmap();
if ( bmp->GetMask() )
{
mask = bmp->GetMask()->GetBitmap();
}
GtkWidget *pixmapwid = gtk_pixmap_new (pixmap, mask );
gtk_box_pack_start(GTK_BOX(page->m_box), pixmapwid, FALSE, FALSE, 3);

View File

@@ -71,16 +71,6 @@ wxPen::wxPen( const wxColour &colour, int width, int style )
if (wxThePenList) wxThePenList->AddPen( this );
}
wxPen::wxPen( const wxString &colourName, int width, int style )
{
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
M_PENDATA->m_style = style;
M_PENDATA->m_colour = colourName;
if (wxThePenList) wxThePenList->AddPen( this );
}
wxPen::wxPen( const wxPen& pen )
{
Ref( pen );
@@ -123,12 +113,6 @@ void wxPen::SetColour( const wxColour &colour )
M_PENDATA->m_colour = colour;
}
void wxPen::SetColour( const wxString &colourName )
{
Unshare();
M_PENDATA->m_colour = colourName;
}
void wxPen::SetColour( int red, int green, int blue )
{
Unshare();

View File

@@ -63,20 +63,6 @@ wxBrush::wxBrush(const wxColour& col, int Style)
wxTheBrushList->AddBrush(this);
}
wxBrush::wxBrush(const wxString& col, int Style)
{
m_refData = new wxBrushRefData;
// 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)
{
m_refData = new wxBrushRefData;
@@ -114,16 +100,7 @@ void wxBrush::SetColour(const wxColour& col)
RealizeResource();
}
void wxBrush::SetColour(const wxString& col)
{
Unshare();
M_BRUSHDATA->m_colour = col;
RealizeResource();
}
void wxBrush::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
{
Unshare();

View File

@@ -65,7 +65,7 @@ wxColour& wxColour::operator =(const wxColour& col)
return *this;
}
wxColour::wxColour (const wxString& col)
void wxColour::InitFromName(const wxString& col)
{
wxColour *the_colour = wxTheColourDatabase->FindColour (col);
if (the_colour)
@@ -89,28 +89,6 @@ wxColour::~wxColour ()
{
}
wxColour& wxColour::operator = (const wxString& col)
{
wxColour *the_colour = wxTheColourDatabase->FindColour (col);
if (the_colour)
{
m_red = the_colour->Red ();
m_green = the_colour->Green ();
m_blue = the_colour->Blue ();
m_pixel = the_colour->m_pixel;
m_isInit = TRUE;
}
else
{
m_red = 0;
m_green = 0;
m_blue = 0;
m_isInit = FALSE;
}
return (*this);
}
void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
{
m_red = r;

View File

@@ -97,24 +97,6 @@ wxPen::wxPen(const wxBitmap& stipple, int Width)
wxThePenList->AddPen(this);
}
wxPen::wxPen(const wxString& col, int Width, int Style)
{
m_refData = new wxPenRefData;
M_PENDATA->m_colour = col;
M_PENDATA->m_width = Width;
M_PENDATA->m_style = Style;
M_PENDATA->m_join = wxJOIN_ROUND ;
M_PENDATA->m_cap = wxCAP_ROUND ;
M_PENDATA->m_nbDash = 0 ;
M_PENDATA->m_dash = 0 ;
RealizeResource();
if ( wxThePenList )
wxThePenList->AddPen(this);
}
void wxPen::Unshare()
{
// Don't change shared data
@@ -139,16 +121,7 @@ void wxPen::SetColour(const wxColour& col)
RealizeResource();
}
void wxPen::SetColour(const wxString& col)
{
Unshare();
M_PENDATA->m_colour = col;
RealizeResource();
}
void wxPen::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
void wxPen::SetColour(unsigned char r, unsigned char g, unsigned char b)
{
Unshare();
@@ -219,4 +192,3 @@ bool wxPen::RealizeResource()
return TRUE;
}

View File

@@ -84,20 +84,6 @@ wxBrush::wxBrush(const wxColour& col, int Style)
wxTheBrushList->AddBrush(this);
}
wxBrush::wxBrush(const wxString& col, int Style)
{
m_refData = new wxBrushRefData;
M_BRUSHDATA->m_colour = col;
M_BRUSHDATA->m_style = Style;
M_BRUSHDATA->m_hBrush = 0;
RealizeResource();
if ( wxTheBrushList )
wxTheBrushList->AddBrush(this);
}
wxBrush::wxBrush(const wxBitmap& stipple)
{
m_refData = new wxBrushRefData;
@@ -223,16 +209,7 @@ void wxBrush::SetColour(const wxColour& col)
RealizeResource();
}
void wxBrush::SetColour(const wxString& col)
{
Unshare();
M_BRUSHDATA->m_colour = col;
RealizeResource();
}
void wxBrush::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
{
Unshare();

View File

@@ -38,7 +38,7 @@ wxColour::wxColour ()
m_red = m_blue = m_green = 0;
}
wxColour::wxColour (const unsigned char r, const unsigned char g, const unsigned char b)
wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
{
m_red = r;
m_green = g;
@@ -90,27 +90,6 @@ wxColour::~wxColour()
{
}
wxColour& wxColour::operator = (const wxString& col)
{
wxColour *the_colour = wxTheColourDatabase->FindColour (col);
if (the_colour)
{
m_red = the_colour->Red ();
m_green = the_colour->Green ();
m_blue = the_colour->Blue ();
m_isInit = TRUE;
}
else
{
m_red = 0;
m_green = 0;
m_blue = 0;
m_isInit = FALSE;
}
m_pixel = PALETTERGB (m_red, m_green, m_blue);
return (*this);
}
void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
{
m_red = r;

View File

@@ -36,7 +36,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
#endif
wxPenRefData::wxPenRefData(void)
wxPenRefData::wxPenRefData()
{
m_style = wxSOLID;
m_width = 1;
@@ -59,7 +59,7 @@ wxPenRefData::wxPenRefData(const wxPenRefData& data)
m_hPen = 0;
}
wxPenRefData::~wxPenRefData(void)
wxPenRefData::~wxPenRefData()
{
if ( m_hPen )
::DeleteObject((HPEN) m_hPen);
@@ -67,7 +67,7 @@ wxPenRefData::~wxPenRefData(void)
// Pens
wxPen::wxPen(void)
wxPen::wxPen()
{
if ( wxThePenList )
wxThePenList->AddPen(this);
@@ -143,27 +143,7 @@ wxPen::wxPen(const wxBitmap& stipple, int Width)
wxThePenList->AddPen(this);
}
wxPen::wxPen(const wxString& col, int Width, int Style)
{
m_refData = new wxPenRefData;
M_PENDATA->m_colour = col;
// M_PENDATA->m_stipple = NULL ;
M_PENDATA->m_width = Width;
M_PENDATA->m_style = Style;
M_PENDATA->m_join = wxJOIN_ROUND ;
M_PENDATA->m_cap = wxCAP_ROUND ;
M_PENDATA->m_nbDash = 0 ;
M_PENDATA->m_dash = 0 ;
M_PENDATA->m_hPen = 0 ;
RealizeResource();
if ( wxThePenList )
wxThePenList->AddPen(this);
}
bool wxPen::RealizeResource(void)
bool wxPen::RealizeResource()
{
if (M_PENDATA && (M_PENDATA->m_hPen == 0))
{
@@ -280,7 +260,7 @@ bool wxPen::RealizeResource(void)
return FALSE;
}
WXHANDLE wxPen::GetResourceHandle(void)
WXHANDLE wxPen::GetResourceHandle()
{
if ( !M_PENDATA )
return 0;
@@ -299,7 +279,7 @@ bool wxPen::FreeResource(bool force)
else return FALSE;
}
bool wxPen::IsFree(void)
bool wxPen::IsFree() const
{
return (M_PENDATA && M_PENDATA->m_hPen == 0);
}
@@ -328,16 +308,7 @@ void wxPen::SetColour(const wxColour& col)
RealizeResource();
}
void wxPen::SetColour(const wxString& col)
{
Unshare();
M_PENDATA->m_colour = col;
RealizeResource();
}
void wxPen::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
void wxPen::SetColour(unsigned char r, unsigned char g, unsigned char b)
{
Unshare();

View File

@@ -68,20 +68,6 @@ wxBrush::wxBrush(const wxColour& col, int Style)
wxTheBrushList->AddBrush(this);
}
wxBrush::wxBrush(const wxString& col, int Style)
{
m_refData = new wxBrushRefData;
// 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)
{
m_refData = new wxBrushRefData;
@@ -119,16 +105,7 @@ void wxBrush::SetColour(const wxColour& col)
RealizeResource();
}
void wxBrush::SetColour(const wxString& col)
{
Unshare();
M_BRUSHDATA->m_colour = col;
RealizeResource();
}
void wxBrush::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
{
Unshare();

View File

@@ -65,7 +65,7 @@ wxColour& wxColour::operator =(const wxColour& col)
return *this;
}
wxColour::wxColour (const wxString& col)
void wxColour::InitFromName(const wxString& col)
{
wxColour *the_colour = wxTheColourDatabase->FindColour (col);
if (the_colour)
@@ -91,29 +91,6 @@ wxColour::~wxColour ()
{
}
wxColour& wxColour::operator = (const wxString& col)
{
wxColour *the_colour = wxTheColourDatabase->FindColour (col);
if (the_colour)
{
m_red = the_colour->Red ();
m_green = the_colour->Green ();
m_blue = the_colour->Blue ();
m_isInit = TRUE;
}
else
{
m_red = 0;
m_green = 0;
m_blue = 0;
m_isInit = FALSE;
}
/* TODO
m_pixel = PALETTERGB (m_red, m_green, m_blue);
*/
return (*this);
}
void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
{
m_red = r;

View File

@@ -104,24 +104,6 @@ wxPen::wxPen(const wxBitmap& stipple, int Width)
wxThePenList->AddPen(this);
}
wxPen::wxPen(const wxString& col, int Width, int Style)
{
m_refData = new wxPenRefData;
M_PENDATA->m_colour = col;
M_PENDATA->m_width = Width;
M_PENDATA->m_style = Style;
M_PENDATA->m_join = wxJOIN_ROUND ;
M_PENDATA->m_cap = wxCAP_ROUND ;
M_PENDATA->m_nbDash = 0 ;
M_PENDATA->m_dash = 0 ;
RealizeResource();
if ( wxThePenList )
wxThePenList->AddPen(this);
}
void wxPen::Unshare()
{
// Don't change shared data
@@ -146,16 +128,7 @@ void wxPen::SetColour(const wxColour& col)
RealizeResource();
}
void wxPen::SetColour(const wxString& col)
{
Unshare();
M_PENDATA->m_colour = col;
RealizeResource();
}
void wxPen::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
void wxPen::SetColour(unsigned char r, unsigned char g, unsigned char b)
{
Unshare();