css: Add a :checked pseudoclass
https://bugzilla.gnome.org/show_bug.cgi?id=733967
This commit is contained in:
parent
3f4b9d8164
commit
36a2e7ca8e
@ -1111,7 +1111,8 @@ gtk_css_selector_pseudoclass_state_print (const GtkCssSelector *selector,
|
|||||||
"dir(ltr)",
|
"dir(ltr)",
|
||||||
"dir(rtl)",
|
"dir(rtl)",
|
||||||
"link",
|
"link",
|
||||||
"visited"
|
"visited",
|
||||||
|
"checked"
|
||||||
};
|
};
|
||||||
guint i, state;
|
guint i, state;
|
||||||
|
|
||||||
@ -1831,7 +1832,8 @@ parse_selector_pseudo_class (GtkCssParser *parser,
|
|||||||
{ "dir(ltr)", GTK_STATE_FLAG_DIR_LTR, },
|
{ "dir(ltr)", GTK_STATE_FLAG_DIR_LTR, },
|
||||||
{ "dir(rtl)", GTK_STATE_FLAG_DIR_RTL, },
|
{ "dir(rtl)", GTK_STATE_FLAG_DIR_RTL, },
|
||||||
{ "link", GTK_STATE_FLAG_LINK, },
|
{ "link", GTK_STATE_FLAG_LINK, },
|
||||||
{ "visited", GTK_STATE_FLAG_VISITED, }
|
{ "visited", GTK_STATE_FLAG_VISITED, },
|
||||||
|
{ "checked", GTK_STATE_FLAG_CHECKED, }
|
||||||
};
|
};
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
|
@ -856,6 +856,7 @@ typedef enum
|
|||||||
* @GTK_STATE_FLAG_DIR_RTL: Widget is in right-to-left text direction. Since 3.8
|
* @GTK_STATE_FLAG_DIR_RTL: Widget is in right-to-left text direction. Since 3.8
|
||||||
* @GTK_STATE_FLAG_LINK: Widget is a link. Since 3.12
|
* @GTK_STATE_FLAG_LINK: Widget is a link. Since 3.12
|
||||||
* @GTK_STATE_FLAG_VISITED: The location the widget points to has already been visited. Since 3.12
|
* @GTK_STATE_FLAG_VISITED: The location the widget points to has already been visited. Since 3.12
|
||||||
|
* @GTK_STATE_FLAG_CHECKED: Widget is checked. Since 3.14
|
||||||
*
|
*
|
||||||
* Describes a widget state. Widget states are used to match the widget
|
* Describes a widget state. Widget states are used to match the widget
|
||||||
* against CSS pseudo-classes. Note that GTK extends the regular CSS
|
* against CSS pseudo-classes. Note that GTK extends the regular CSS
|
||||||
@ -874,7 +875,8 @@ typedef enum
|
|||||||
GTK_STATE_FLAG_DIR_LTR = 1 << 7,
|
GTK_STATE_FLAG_DIR_LTR = 1 << 7,
|
||||||
GTK_STATE_FLAG_DIR_RTL = 1 << 8,
|
GTK_STATE_FLAG_DIR_RTL = 1 << 8,
|
||||||
GTK_STATE_FLAG_LINK = 1 << 9,
|
GTK_STATE_FLAG_LINK = 1 << 9,
|
||||||
GTK_STATE_FLAG_VISITED = 1 << 10
|
GTK_STATE_FLAG_VISITED = 1 << 10,
|
||||||
|
GTK_STATE_FLAG_CHECKED = 1 << 11
|
||||||
} GtkStateFlags;
|
} GtkStateFlags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -456,7 +456,7 @@
|
|||||||
|
|
||||||
#define WIDGET_CLASS(w) GTK_WIDGET_GET_CLASS (w)
|
#define WIDGET_CLASS(w) GTK_WIDGET_GET_CLASS (w)
|
||||||
|
|
||||||
#define GTK_STATE_FLAGS_BITS 11
|
#define GTK_STATE_FLAGS_BITS 12
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gchar *name; /* Name of the template automatic child */
|
gchar *name; /* Name of the template automatic child */
|
||||||
|
@ -333,18 +333,14 @@ gtk_widget_path_to_string (const GtkWidgetPath *path)
|
|||||||
{
|
{
|
||||||
GFlagsClass *fclass;
|
GFlagsClass *fclass;
|
||||||
gint i;
|
gint i;
|
||||||
gboolean appended;
|
|
||||||
|
|
||||||
appended = FALSE;
|
|
||||||
fclass = g_type_class_ref (GTK_TYPE_STATE_FLAGS);
|
fclass = g_type_class_ref (GTK_TYPE_STATE_FLAGS);
|
||||||
for (i = 0; i < fclass->n_values; i++)
|
for (i = 0; i < fclass->n_values; i++)
|
||||||
{
|
{
|
||||||
if (elem->state & fclass->values[i].value)
|
if (elem->state & fclass->values[i].value)
|
||||||
{
|
{
|
||||||
if (appended)
|
g_string_append_c (string, ':');
|
||||||
g_string_append_c (string, ':');
|
|
||||||
g_string_append (string, fclass->values[i].value_nick);
|
g_string_append (string, fclass->values[i].value_nick);
|
||||||
appended = TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_type_class_unref (fclass);
|
g_type_class_unref (fclass);
|
||||||
|
@ -49,3 +49,7 @@
|
|||||||
:visited {
|
:visited {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:checked {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
@ -49,3 +49,7 @@
|
|||||||
:visited {
|
:visited {
|
||||||
color: rgb(255,0,0);
|
color: rgb(255,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:checked {
|
||||||
|
color: rgb(255,0,0);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user