css: Add a :dnd pseudoclass

This will be used for drag highlighting.
This commit is contained in:
Matthias Clasen
2015-12-02 23:23:36 -05:00
parent 574246a3d8
commit cbde3ee01f
5 changed files with 16 additions and 4 deletions

View File

@ -744,7 +744,8 @@ print_pseudoclass_state (const GtkCssSelector *selector,
"dir(rtl)", "dir(rtl)",
"link", "link",
"visited", "visited",
"checked" "checked",
"dnd"
}; };
guint i; guint i;
@ -1188,7 +1189,8 @@ parse_selector_pseudo_class (GtkCssParser *parser,
{ "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, } { "checked", GTK_STATE_FLAG_CHECKED, },
{ "dnd" , GTK_STATE_FLAG_DND, }
}; };
guint i; guint i;

View File

@ -857,6 +857,7 @@ typedef enum
* @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 * @GTK_STATE_FLAG_CHECKED: Widget is checked. Since 3.14
* @GTK_STATE_FLAG_DND: Widget is highlighted as a drop target for DND. Since 3.20
* *
* 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
@ -876,7 +877,8 @@ typedef enum
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 GTK_STATE_FLAG_CHECKED = 1 << 11,
GTK_STATE_FLAG_DND = 1 << 12
} GtkStateFlags; } GtkStateFlags;
/** /**

View File

@ -34,7 +34,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define GTK_STATE_FLAGS_BITS 12 #define GTK_STATE_FLAGS_BITS 13
struct _GtkWidgetPrivate struct _GtkWidgetPrivate
{ {

View File

@ -53,3 +53,7 @@
:checked { :checked {
color: red; color: red;
} }
:dnd {
color: red;
}

View File

@ -53,3 +53,7 @@
:checked { :checked {
color: rgb(255,0,0); color: rgb(255,0,0);
} }
:dnd {
color: rgb(255,0,0);
}