GtkListBox: Add style classes for lists and rows

This commit is contained in:
Alexander Larsson
2013-06-12 12:00:11 +02:00
parent 3bb2d15195
commit 1dd0b468a7
2 changed files with 26 additions and 0 deletions

View File

@ -221,6 +221,7 @@ static void
gtk_list_box_init (GtkListBox *list_box)
{
GtkListBoxPrivate *priv;
GtkStyleContext *context;
list_box->priv = priv =
G_TYPE_INSTANCE_GET_PRIVATE (list_box, GTK_TYPE_LIST_BOX, GtkListBoxPrivate);
@ -232,6 +233,9 @@ gtk_list_box_init (GtkListBox *list_box)
priv->children = g_sequence_new (NULL);
priv->header_hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
context = gtk_widget_get_style_context (GTK_WIDGET (list_box));
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LIST);
}
static void
@ -2208,12 +2212,16 @@ static void
gtk_list_box_row_init (GtkListBoxRow *row)
{
GtkListBoxRowPrivate *priv;
GtkStyleContext *context;
row->priv = priv =
G_TYPE_INSTANCE_GET_PRIVATE (row, GTK_TYPE_LIST_BOX_ROW, GtkListBoxRowPrivate);
gtk_widget_set_can_focus (GTK_WIDGET (row), TRUE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (row), TRUE);
context = gtk_widget_get_style_context (GTK_WIDGET (row));
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LIST_ROW);
}
static void

View File

@ -196,6 +196,24 @@ struct _GtkStyleContextClass
*/
#define GTK_STYLE_CLASS_BUTTON "button"
/**
* GTK_STYLE_CLASS_LIST:
*
* A CSS class to match lists.
*
* This is used by #GtkListBox.
*/
#define GTK_STYLE_CLASS_LIST "list"
/**
* GTK_STYLE_CLASS_LIST_ROW:
*
* A CSS class to match list rowss.
*
* This is used by #GtkListBoxRow.
*/
#define GTK_STYLE_CLASS_LIST_ROW "list-row"
/**
* GTK_STYLE_CLASS_CALENDAR:
*