diff --git a/gb.gtk/src/CStyle.cpp b/gb.gtk/src/CStyle.cpp index decba0a73..f6eee4a89 100644 --- a/gb.gtk/src/CStyle.cpp +++ b/gb.gtk/src/CStyle.cpp @@ -523,7 +523,7 @@ static void paint_background(STYLE_T *style, int state, GB_COLOR color, int x, i if (color != GB_COLOR_DEFAULT) { char *css = NULL; - g_stradd(&css, "#se:not(:selected) { background-color:"); + g_stradd(&css, ":not(:active) { background-color:"); gt_add_css_color(&css, color); g_stradd(&css, "; background-image:none; }\n"); gtk_css_provider_load_from_data(GTK_CSS_PROVIDER(_css), css, -1, NULL); @@ -1017,6 +1017,7 @@ GB_DESC StyleDesc[] = GB_STATIC_METHOD("PaintHandle", NULL, Style_PaintHandle, "(X)i(Y)i(Width)i(Height)i[(Vertical)b(Flag)i]"), GB_STATIC_METHOD("PaintBox", NULL, Style_PaintBox, "(X)i(Y)i(Width)i(Height)i[(Flag)i(Color)i]"), + GB_CONSTANT("Default", "i", GB_DRAW_STATE_DEFAULT), GB_CONSTANT("Normal", "i", GB_DRAW_STATE_NORMAL), GB_CONSTANT("Disabled", "i", GB_DRAW_STATE_DISABLED), GB_CONSTANT("HasFocus", "i", GB_DRAW_STATE_FOCUS), diff --git a/gb.qt4/src/CStyle.cpp b/gb.qt4/src/CStyle.cpp index 24e159069..09788a201 100644 --- a/gb.qt4/src/CStyle.cpp +++ b/gb.qt4/src/CStyle.cpp @@ -30,6 +30,7 @@ #include "main.h" #include "gb.draw.h" #include "cpaint_impl.h" +#include "CDraw.h" #include "CPicture.h" #include "CWidget.h" #include "CWindow.h" @@ -102,8 +103,14 @@ static char *get_style_name() static void init_option(QStyleOption &opt, int x, int y, int w, int h, int state, GB_COLOR color = COLOR_DEFAULT, QPalette::ColorRole role = QPalette::Window) { + GB_PAINT *paint = (GB_PAINT *)DRAW.Paint.GetCurrent(); + opt.rect = QRect(x, y, w ,h); - opt.state = QStyle::State_None; + + if (state == GB_DRAW_STATE_DEFAULT && paint) + opt.initFrom(((CWIDGET *)paint->device)->widget); + else + opt.state = QStyle::State_None; if (!(state & GB_DRAW_STATE_DISABLED)) opt.state |= QStyle::State_Enabled; @@ -482,7 +489,7 @@ BEGIN_METHOD(Style_StateOf, GB_OBJECT control) if (CWIDGET_is_visible(control) && control->flag.inside && !design) state |= GB_DRAW_STATE_HOVER; - GB.ReturnInteger(state); + GB.ReturnInteger(state | GB_DRAW_STATE_DEFAULT); END_METHOD @@ -550,6 +557,7 @@ GB_DESC StyleDesc[] = GB_STATIC_METHOD("PaintHandle", NULL, Style_PaintHandle, "(X)i(Y)i(Width)i(Height)i[(Vertical)b(Flag)i]"), GB_STATIC_METHOD("PaintBox", NULL, Style_PaintBox, "(X)i(Y)i(Width)i(Height)i[(Flag)i(Color)i]"), + GB_CONSTANT("Default", "i", GB_DRAW_STATE_DEFAULT), GB_CONSTANT("Normal", "i", GB_DRAW_STATE_NORMAL), GB_CONSTANT("Disabled", "i", GB_DRAW_STATE_DISABLED), GB_CONSTANT("HasFocus", "i", GB_DRAW_STATE_FOCUS), diff --git a/main/lib/draw/gb.draw.h b/main/lib/draw/gb.draw.h index facdc7614..648ffe5df 100644 --- a/main/lib/draw/gb.draw.h +++ b/main/lib/draw/gb.draw.h @@ -35,7 +35,8 @@ enum { GB_DRAW_STATE_DISABLED = 1, GB_DRAW_STATE_FOCUS = 2, GB_DRAW_STATE_HOVER = 4, - GB_DRAW_STATE_ACTIVE = 8 + GB_DRAW_STATE_ACTIVE = 8, + GB_DRAW_STATE_DEFAULT = 256 }; typedef