GTKTreeView + ListStore + fixed column size
- From: neil_dugan froggy com au
- To: gtk-app-devel-list gnome org
- Subject: GTKTreeView + ListStore + fixed column size
- Date: Wed, 07 Apr 2004 11:52:23 +1000
I have an application where I would like to have a GTKListStore with 3 columns.
When resizing horizontaly I would like the middle column to expand (i.e. left and
right columns to stay the same size). I am using 'Glade' for the setup of the
window. I am linking with 'libgtk-x11-2.0.so.0'.
Here is what I am doing for the GTKTreeView.
--- snip ---
list_store = gtk_list_store_new (LIST_COUNT,
G_TYPE_BOOLEAN,
G_TYPE_STRING,
G_TYPE_STRING);
gtk_tree_view_set_model ((GtkTreeView *)tree_view, (GtkTreeModel
*)list_store);
g_object_unref (G_OBJECT (list_store));
// setup the 'Delete' checkbox column
render = gtk_cell_renderer_toggle_new ();
column = gtk_tree_view_column_new_with_attributes ("DELETE",
render,
"active", LIST_CHECKED,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
// setup the 'Name' text column (in red)
render = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (render),
"foreground", "red", // make the text red
NULL);
column = gtk_tree_view_column_new_with_attributes ("Name", render,
"text", LIST_NAME,
NULL);
gtk_tree_view_column_set_sizing (column,
GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_column_set_resizable (column, TRUE);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
// setup the 'Data' text column
render = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (render),
"font", NON_PRO_FONT " " NON_PRO_FONT_SIZE,
NULL);
column = gtk_tree_view_column_new_with_attributes ("Text",
render,
"text", LIST_DATA,
NULL);
gtk_tree_view_column_set_sizing (column,
GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_fixed_width (column, 100);
gtk_tree_view_column_set_resizable (column, FALSE);
gtk_tree_view_column_set_alignment (column, 1.00); // right align the
title
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
--- snip ---
Can anyone tell me why column 3 isn't a fixed size?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]