Style: Add 'Default' constant. It tells the Style routine to use the current painted control (if it exists) as a context.
[GB.DRAW] * NEW: Support for 'Style.Default' constant. [GB.GTK] * NEW: Style: Add 'Default' constant. It tells the Style routine to use the current painted control (if it exists) as a context. [GB.GTK3] * NEW: Style: Add 'Default' constant. It tells the Style routine to use the current painted control (if it exists) as a context. * BUG: Style: Painting the backgroud correctly takes the background color into account, unless for active state (i.e. pressed buttons). [GB.QT4] * NEW: Style: Add 'Default' constant. It tells the Style routine to use the current painted control (if it exists) as a context. * NEW: 'Style.StateOf()' always adds the 'Style.Default' constant. [GB.QT5] * NEW: Style: Add 'Default' constant. It tells the Style routine to use the current painted control (if it exists) as a context. * NEW: 'Style.StateOf()' always adds the 'Style.Default' constant.
This commit is contained in:
parent
c9591402a1
commit
f563dd0557
3 changed files with 14 additions and 4 deletions
|
@ -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),
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue