diff --git a/gb.gtk/src/CColor.cpp b/gb.gtk/src/CColor.cpp index 89ba03577..cdd705bc6 100644 --- a/gb.gtk/src/CColor.cpp +++ b/gb.gtk/src/CColor.cpp @@ -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), diff --git a/gb.gtk/src/CStyle.cpp b/gb.gtk/src/CStyle.cpp index aca8a0a1d..be113f37d 100644 --- a/gb.gtk/src/CStyle.cpp +++ b/gb.gtk/src/CStyle.cpp @@ -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 diff --git a/gb.gtk/src/cpaint_impl.cpp b/gb.gtk/src/cpaint_impl.cpp index 565a7e6fe..8b49a9612 100644 --- a/gb.gtk/src/cpaint_impl.cpp +++ b/gb.gtk/src/cpaint_impl.cpp @@ -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; } diff --git a/gb.gtk/src/gcontainer.cpp b/gb.gtk/src/gcontainer.cpp index 025da8a28..749e3ba5a 100644 --- a/gb.gtk/src/gcontainer.cpp +++ b/gb.gtk/src/gcontainer.cpp @@ -555,7 +555,7 @@ void gContainer::setBackground(gColor color) gControl *ch; gControl::setBackground(color); - + for (i = 0; i < childCount(); i++) { ch = gContainer::child(i); diff --git a/gb.gtk/src/gcontrol.cpp b/gb.gtk/src/gcontrol.cpp index 6c4e76ce4..43c53cc10 100644 --- a/gb.gtk/src/gcontrol.cpp +++ b/gb.gtk/src/gcontrol.cpp @@ -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) diff --git a/gb.gtk/src/gcontrol.h b/gb.gtk/src/gcontrol.h index b05eadcaa..5b9d760bc 100644 --- a/gb.gtk/src/gcontrol.h +++ b/gb.gtk/src/gcontrol.h @@ -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); diff --git a/gb.gtk/src/gdrawingarea.cpp b/gb.gtk/src/gdrawingarea.cpp index 8db92b70f..88ccb5f00 100644 --- a/gb.gtk/src/gdrawingarea.cpp +++ b/gb.gtk/src/gdrawingarea.cpp @@ -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); } diff --git a/gb.gtk/src/glabel.cpp b/gb.gtk/src/glabel.cpp index a5b9b72aa..18303a509 100644 --- a/gb.gtk/src/glabel.cpp +++ b/gb.gtk/src/glabel.cpp @@ -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)