Make GtkTreeView use GtkStyleContext

Expander animation has been replaced by implicit animations
from the style context.

Column headers are also properly themed, GtkContainer::get_path_for_child()
is implemented and the treeview resets column buttons style on columns
being reordered.

The default CSS has changed to theme treeviews sensibly.
This commit is contained in:
Carlos Garnacho 2011-01-12 21:18:07 +01:00
parent 41d6837fa2
commit 08af1783c5
4 changed files with 407 additions and 367 deletions

View File

@ -3630,8 +3630,7 @@ gtk_css_provider_get_default (void)
"@define-color error_fg_color rgb (166, 38, 38);\n"
"@define-color error_bg_color rgb (237, 54, 54);\n"
"\n"
"*,\n"
"GtkTreeView > GtkButton {\n"
"* {\n"
" background-color: @bg_color;\n"
" color: @fg_color;\n"
" border-color: shade (@bg_color, 0.6);\n"
@ -3649,7 +3648,7 @@ gtk_css_provider_get_default (void)
" color: @selected_fg_color;\n"
"}\n"
"\n"
".expander, .view.expander {\n"
".expander, GtkTreeView.view.expander {\n"
" color: #fff;\n"
"}\n"
"\n"
@ -3667,12 +3666,9 @@ gtk_css_provider_get_default (void)
" color: shade (@bg_color, 0.7);\n"
"}\n"
"\n"
"GtkTreeView, GtkIconView {\n"
" background-color: @base_color;\n"
" color: @text_color;\n"
"}\n"
"\n"
".view {\n"
" border-width: 0;\n"
" border-radius: 0;\n"
" background-color: @base_color;\n"
" color: @text_color;\n"
"}\n"
@ -3686,16 +3682,59 @@ gtk_css_provider_get_default (void)
" color: @selected_fg_color;\n"
"}\n"
"\n"
"GtkTreeView > row {\n"
" background-color: @base_color;\n"
" color: @text_color;\n"
" border-width: 0;\n"
".view column:sorted row,\n"
".view column:sorted row:prelight {\n"
" background-color: shade (@bg_color, 0.85);\n"
"}\n"
"\n"
"GtkTreeView > row:nth-child(odd) { \n"
".view column:sorted row:nth-child(odd),\n"
".view column:sorted row:nth-child(odd):prelight {\n"
" background-color: shade (@bg_color, 0.8);\n"
"}\n"
"\n"
".view row,\n"
".view row:prelight {\n"
" background-color: @base_color;\n"
" color: @text_color;\n"
"}\n"
"\n"
".view row:nth-child(odd),\n"
".view row:nth-child(odd):prelight {\n"
" background-color: shade (@base_color, 0.93); \n"
"}\n"
"\n"
".view row:selected:focused {\n"
" background-color: @selected_bg_color;\n"
"}\n"
"\n"
".view row:selected {\n"
" background-color: darker (@bg_color);\n"
" color: @selected_fg_color;\n"
"}\n"
"\n"
".view.cell.trough,\n"
".view.cell.trough:hover,\n"
".view.cell.trough:selected,\n"
".view.cell.trough:selected:focused {\n"
" background-color: @bg_color;\n"
" color: @fg_color;\n"
"}\n"
"\n"
".view.cell.progressbar,\n"
".view.cell.progressbar:hover,\n"
".view.cell.progressbar:selected,\n"
".view.cell.progressbar:selected:focused {\n"
" background-color: @selected_bg_color;\n"
" color: @selected_fg_color;\n"
"}\n"
"\n"
".rubberband {\n"
" background-color: alpha (@fg_color, 0.25);\n"
" border-color: @fg_color;\n"
" border-style: solid;\n"
" border-width: 1;\n"
"}\n"
"\n"
".tooltip {\n"
" background-color: @tooltip_bg_color; \n"
" color: @tooltip_fg_color; \n"
@ -3745,7 +3784,8 @@ gtk_css_provider_get_default (void)
"}\n"
"\n"
".progressbar,\n"
".entry.progressbar {\n"
".entry.progressbar, \n"
".cell.progressbar {\n"
" background-color: @selected_bg_color;\n"
" border-color: shade (@selected_bg_color, 0.7);\n"
" color: @selected_fg_color;\n"
@ -3760,7 +3800,9 @@ gtk_css_provider_get_default (void)
" background-color: shade (@bg_color, 1.05);\n"
"}\n"
"\n"
".check, .radio {\n"
".check, .radio,"
".cell.check, .cell.radio,\n"
".cell.check:hover, .cell.radio:hover {\n"
" border-style: solid;\n"
" border-width: 1;\n"
" background-color: @base_color;\n"
@ -3775,8 +3817,13 @@ gtk_css_provider_get_default (void)
"}\n"
"\n"
".check:selected, .radio:selected {\n"
" background-color: @selected_bg_color;\n"
" background-color: darker (@bg_color);\n"
" color: @selected_fg_color;\n"
" border-color: @selected_fg_color;\n"
"}\n"
"\n"
".check:selected:focused, .radio:selected:focused {\n"
" background-color: @selected_bg_color;\n"
"}\n"
"\n"
".menu.check, .menu.radio {\n"

View File

@ -154,6 +154,8 @@ void _gtk_tree_view_column_set_use_resized_width (GtkTreeViewColumn
gboolean _gtk_tree_view_column_get_use_resized_width (GtkTreeViewColumn *column);
gint _gtk_tree_view_column_get_drag_x (GtkTreeViewColumn *column);
GtkCellAreaContext *_gtk_tree_view_column_get_context (GtkTreeViewColumn *column);
void _gtk_tree_view_reset_header_styles (GtkTreeView *tree_view);
G_END_DECLS

File diff suppressed because it is too large Load Diff

View File

@ -1881,6 +1881,8 @@ gtk_tree_view_column_set_visible (GtkTreeViewColumn *tree_column,
if (priv->visible)
_gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
_gtk_tree_view_reset_header_styles (GTK_TREE_VIEW (priv->tree_view));
gtk_tree_view_column_update_button (tree_column);
g_object_notify (G_OBJECT (tree_column), "visible");
}