different alignment in columns of GtkTreeView



Hi,

I am trying to build a text table in GTK+ v. 2.8, with one column of
the table being left-aligned, and the other being right-aligned. I can
easily do it for headers, by a call to
gtk_tree_view_column_set_alignment, but as the text in the table
itself goes, I seem to be able to change the alignment only for the
whole table. Is there a way to right-align the first column, and
lift-align the second one. Below is the snippet of my code where I am
creating the table:


shortcuts_store = gtk_list_store_new ( 2, G_TYPE_STRING, G_TYPE_STRING);

shortcuts_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(shortcuts_store)); 

shortcuts_renderer = gtk_cell_renderer_text_new();

shortcuts_column = gtk_tree_view_column_new_with_attributes
("header1", shortcuts_renderer, "text", 0, NULL);

gtk_tree_view_column_set_alignment(shortcuts_column, 1.0);

gtk_tree_view_append_column (GTK_TREE_VIEW (shortcuts_tree), shortcuts_column);

shortcuts_column = gtk_tree_view_column_new_with_attributes
("header2", shortcuts_renderer, "text", 1, NULL);

gtk_tree_view_append_column (GTK_TREE_VIEW (shortcuts_tree), shortcuts_column);

gtk_list_store_append (shortcuts_store, &shortcuts_iter);

gtk_list_store_set (shortcuts_store, &shortcuts_iter, 0, "table text
column 1", 1, " table text column 2 ", -1);

Thanks a lot,

Alexei Kaminski



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