* BUG: A reparented control does not lose its default foreground or 
  background color anymore.


git-svn-id: svn://localhost/gambas/trunk@6457 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2014-09-07 20:27:04 +00:00
parent ec80bb3ce5
commit 06c736add7
8 changed files with 19 additions and 23 deletions

View File

@ -115,7 +115,7 @@ END_PROPERTY
GB_DESC CColorDesc[] =
{
GB_DECLARE("Color", 0), GB_VIRTUAL_CLASS(),
GB_DECLARE_STATIC("Color"),
GB_STATIC_PROPERTY("Background", "i", Color_Background),
GB_STATIC_PROPERTY("SelectedBackground", "i", Color_SelectedBackground),

View File

@ -834,7 +834,7 @@ BEGIN_METHOD(Style_BackgroundOf, GB_OBJECT control)
if (GB.CheckObject(control))
return;
GB.ReturnInteger(control->widget->realBackground());
GB.ReturnInteger(control->widget->realBackground(true));
END_METHOD
@ -845,7 +845,7 @@ BEGIN_METHOD(Style_ForegroundOf, GB_OBJECT control)
if (GB.CheckObject(control))
return;
GB.ReturnInteger(control->widget->realForeground());
GB.ReturnInteger(control->widget->realForeground(true));
END_METHOD

View File

@ -79,7 +79,7 @@ static GB_COLOR get_color(GB_PAINT *d, GB_COLOR col)
if (col == GB_COLOR_DEFAULT)
{
if (GB.Is(d->device, CLASS_DrawingArea))
col = (((CWIDGET *)d->device)->widget)->realBackground();
col = (((CWIDGET *)d->device)->widget)->realBackground(true);
else
col = 0xFFFFFF;
}

View File

@ -555,7 +555,7 @@ void gContainer::setBackground(gColor color)
gControl *ch;
gControl::setBackground(color);
for (i = 0; i < childCount(); i++)
{
ch = gContainer::child(i);

View File

@ -1755,14 +1755,14 @@ void gControl::setName(char *name)
#ifdef GTK3
gColor gControl::realBackground()
gColor gControl::realBackground(bool no_default)
{
if (_bg != COLOR_DEFAULT)
return _bg;
else if (pr)
return pr->realBackground();
else
return gDesktop::bgColor();
return no_default ? gDesktop::bgColor() : COLOR_DEFAULT;
}
gColor gControl::background()
@ -1781,14 +1781,14 @@ void gControl::setBackground(gColor color)
updateColor();
}
gColor gControl::realForeground()
gColor gControl::realForeground(bool no_default)
{
if (_fg != COLOR_DEFAULT)
return _fg;
else if (pr)
return pr->realForeground();
return pr->realForeground(no_default);
else
return gDesktop::fgColor();
return no_default ? gDesktop::fgColor() : COLOR_DEFAULT;
}
gColor gControl::foreground()
@ -1809,14 +1809,14 @@ void gControl::setForeground(gColor color)
#else
gColor gControl::realBackground()
gColor gControl::realBackground(bool no_default)
{
if (_bg_set)
return use_base ? get_gdk_base_color(widget, isEnabled()) : get_gdk_bg_color(widget, isEnabled());
else if (pr)
return pr->realBackground();
return pr->realBackground(no_default);
else
return gDesktop::bgColor();
return no_default ? gDesktop::bgColor() : COLOR_DEFAULT;
}
gColor gControl::background()
@ -1855,14 +1855,14 @@ void gControl::setBackground(gColor color)
setRealBackground(color);
}
gColor gControl::realForeground()
gColor gControl::realForeground(bool no_default)
{
if (_fg_set)
return use_base ? get_gdk_text_color(widget, isEnabled()) : get_gdk_fg_color(widget, isEnabled());
else if (pr)
return pr->realForeground();
else
return gDesktop::fgColor();
return no_default ? gDesktop::fgColor() : COLOR_DEFAULT;
}
gColor gControl::foreground()
@ -1881,10 +1881,6 @@ static void set_foreground(GtkWidget *widget, gColor color, bool use_base)
void gControl::setRealForeground(gColor color)
{
set_foreground(widget, color, use_base);
/*set_foreground(border, color, use_base);
if (border != frame && GTK_IS_WIDGET(frame))
set_foreground(frame, color, use_base);
if (frame != widget)*/
}
void gControl::setForeground(gColor color)

View File

@ -109,8 +109,8 @@ public:
gColor foreground();
virtual void setBackground(gColor color = COLOR_DEFAULT);
virtual void setForeground(gColor color = COLOR_DEFAULT);
gColor realBackground();
gColor realForeground();
gColor realBackground(bool no_default = false);
gColor realForeground(bool no_default = false);
virtual void setRealBackground(gColor color);
virtual void setRealForeground(gColor color);

View File

@ -298,7 +298,7 @@ void gDrawingArea::resizeCache()
if (w > bw || h > bh || !buffer)
{
gt_cairo_set_source_color(cr, realBackground());
gt_cairo_set_source_color(cr, realBackground(true));
cairo_rectangle(cr, 0, 0, w, h);
cairo_fill(cr);
}

View File

@ -35,7 +35,7 @@ static gboolean cb_draw(GtkWidget *draw, cairo_t *cr, gLabel *d)
//d->drawBackground(cr);
d->drawBorder(cr);
gt_from_color(d->realForeground(), &rgba);
gt_from_color(d->realForeground(true), &rgba);
gdk_cairo_set_source_rgba(cr, &rgba);
if (xa == 3)