如何设置Treeview各标头列的背景或前景色
whyglinux
GtkTreeView* view;
GtkTreeViewColumn *col;
GtkWidget* label;
GdkColor color_fg;
GdkColor color_bg;
/* Create the tree view */
view = gtk_tree_view_new();
/* Create a new column */
col = gtk_tree_view_column_new();
/* gtk_tree_view_column_set_title(col, "First Column"); */
label = gtk_label_new( "First Column" );
/* Set the widget in the header of the column */
gtk_tree_view_column_set_widget( col, label );
gtk_widget_show( label );
/* Pack tree view column into tree view */
gtk_tree_view_append_column( view, col );
/* Changing foreground and background colors of the header */
gdk_color_parse( "red", &color_fg );
gdk_color_parse( "yellow", &color_bg );
gtk_widget_modify_fg( label, GTK_STATE_NORMAL, &color_fg );
gtk_widget_modify_bg( label->parent->parent->parent, GTK_STATE_NORMAL, &color_bg );
阅读(2332) | 评论(0) | 转发(0) |