mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-06 19:00:12 +00:00
css: Privately export a function to get pseudoclass names
This function centralizes the mapping for widget states to pseudoclass names in one place, for easier maintenance.
This commit is contained in:
parent
f0439264aa
commit
33bb1af277
@ -726,11 +726,8 @@ comp_id (const GtkCssSelector *a,
|
|||||||
|
|
||||||
DEFINE_SIMPLE_SELECTOR(id, ID, print_id, match_id, hash_id, comp_id, TRUE, FALSE, FALSE)
|
DEFINE_SIMPLE_SELECTOR(id, ID, print_id, match_id, hash_id, comp_id, TRUE, FALSE, FALSE)
|
||||||
|
|
||||||
/* PSEUDOCLASS FOR STATE */
|
const gchar *
|
||||||
|
gtk_css_pseudoclass_name (GtkStateFlags state)
|
||||||
static void
|
|
||||||
print_pseudoclass_state (const GtkCssSelector *selector,
|
|
||||||
GString *string)
|
|
||||||
{
|
{
|
||||||
static const char * state_names[] = {
|
static const char * state_names[] = {
|
||||||
"active",
|
"active",
|
||||||
@ -749,18 +746,22 @@ print_pseudoclass_state (const GtkCssSelector *selector,
|
|||||||
};
|
};
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
g_string_append_c (string, ':');
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (state_names); i++)
|
for (i = 0; i < G_N_ELEMENTS (state_names); i++)
|
||||||
{
|
{
|
||||||
if (selector->state.state == (1 << i))
|
if (state == (1 << i))
|
||||||
{
|
return state_names[i];
|
||||||
g_string_append (string, state_names[i]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_assert_not_reached ();
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PSEUDOCLASS FOR STATE */
|
||||||
|
static void
|
||||||
|
print_pseudoclass_state (const GtkCssSelector *selector,
|
||||||
|
GString *string)
|
||||||
|
{
|
||||||
|
g_string_append_c (string, ':');
|
||||||
|
g_string_append (string, gtk_css_pseudoclass_name (selector->state.state));
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -57,6 +57,8 @@ void _gtk_css_selector_tree_builder_add (GtkCssSelectorT
|
|||||||
GtkCssSelectorTree * _gtk_css_selector_tree_builder_build (GtkCssSelectorTreeBuilder *builder);
|
GtkCssSelectorTree * _gtk_css_selector_tree_builder_build (GtkCssSelectorTreeBuilder *builder);
|
||||||
void _gtk_css_selector_tree_builder_free (GtkCssSelectorTreeBuilder *builder);
|
void _gtk_css_selector_tree_builder_free (GtkCssSelectorTreeBuilder *builder);
|
||||||
|
|
||||||
|
const char *gtk_css_pseudoclass_name (GtkStateFlags flags);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GTK_CSS_SELECTOR_PRIVATE_H__ */
|
#endif /* __GTK_CSS_SELECTOR_PRIVATE_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user