Chinaunix首页 | 论坛 | 博客
  • 博客访问: 14752
  • 博文数量: 2
  • 博客积分: 50
  • 博客等级: 民兵
  • 技术积分: 30
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-19 20:41
文章分类
文章存档

2012年(2)

我的朋友
最近访客

分类: LINUX

2012-04-05 20:13:03

 如何设置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 );
阅读(2312) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~