Re: Re: How to set the GtkTreeViewColumn title font



Title: Message
When I tried this the title text dissappears. The buttons were still there but no text.
I tried calling this set function right after creating the treeview, after setting the model and after gtk_widget_show_all() was called on the toplevel window widget with the same results.
 
The modify font on the treeview did successfully set the font for all the cells, thanks
 
Will
 
Olexiy wrote:
  Will Heyman wrote
 
I'm trying to set up a table widget using a GtkTreeView and a GtkListStore.
I'd like to reset the font of the whole table.
I've been able to set the cell fonts by using g_object_set () on the cell renderers but how do I set the font of the column titles?
Also is there a more gracefull way to set the font of the entire GtkTreeView without setting it for each cell and title?

Use gtk_widget_modify_font() function on GtkTreeView. This will set the default font for all cells.
The font for the titles is tricky. The most *correct* way I see is to set your own title widget to GtkTreeViewColumn.
Sample code (must be called after all column are set up and appended to tree view):


static void set_3_font(GtkTreeView *tv, PangoFontDescription *pfd)
{
gint i;
GtkWidget *title;
GtkTreeViewColumn *column;


gtk_widget_modify_font(GTK_WIDGET(tv), pfd);


 for (i=0; (column=gtk_tree_view_get_column(tv, i)) != NULL; i++) {
   title = gtk_label_new(gtk_tree_view_column_get_title(column));
   gtk_widget_show(title);
   gtk_widget_modify_font(title, pfd);
   gtk_tree_view_column_set_widget(column, title);
 }
}

   Olexiy  


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]