GTK 2.2.4.1 Win32: Placing a GtkTreeView in a GtkTextView
- From: <apbell charter net>
- To: <gtk-app-devel-list gnome org>
- Subject: GTK 2.2.4.1 Win32: Placing a GtkTreeView in a GtkTextView
- Date: Wed, 26 May 2004 15:50:43 +0000
I am attempting to place a TreeView into a TextView. I can get the nodes to show up but they are blank. When
I attach this model to a separate treeview it works perfectly.
Is it possible to use a treeview in this manner?
Thanks for the help.
Adam P. Bell
Code:
GtkWidget *treeview = gtk_tree_view_new( );
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW( treeview ), FALSE);
GtkTreeViewColumn *col;
GtkCellRenderer *renderer;
col = gtk_tree_view_column_new( );
gtk_tree_view_append_column( GTK_TREE_VIEW( treeview ), col );
renderer = gtk_cell_renderer_text_new( );
g_object_set(renderer, "editable", TRUE, NULL);
gtk_tree_view_column_set_resizable(col, true );
g_object_set( renderer, "text", "Column 1", NULL );
gtk_tree_view_column_add_attribute(col, renderer, "text", ITEM_COLS);
gtk_tree_selection_set_mode( gtk_tree_view_get_selection( GTK_TREE_VIEW( treeview ) ),
GTK_SELECTION_BROWSE );
col = gtk_tree_view_column_new( );
gtk_tree_view_column_set_title( col, "Info" );
gtk_tree_view_append_column( GTK_TREE_VIEW( GTK_TREE_VIEW( treeview ) ), col );
renderer = gtk_cell_renderer_text_new( );
gtk_tree_view_column_set_resizable(col, true );
gtk_tree_view_column_pack_start( col, renderer, true );
gtk_tree_view_column_add_attribute(col, renderer, "text", HELP_COLS);
GtkTreeModel *model = create_model( );
append_item_treeview( GTK_TREE_VIEW( treeview ), "Testing Top", TOPLEVEL, ITEM_COLS );
append_item_treeview( GTK_TREE_VIEW( treeview ), "Testing", CHILD, ITEM_COLS );
gtk_tree_view_set_model( GTK_TREE_VIEW( treeview ), model );
g_object_unref( model );
GtkTextIter iter = editor.end_iterator( );
editor.insert_widget( treeview, &iter );
*** insert_widget def ***
void Text_View::insert_widget( GtkWidget *widget, GtkTextIter *location )
{
GtkTextChildAnchor *anchor = gtk_text_buffer_create_child_anchor (buffer_, location);
gtk_text_view_add_child_at_anchor (view_, widget, anchor);
gtk_widget_show (widget);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]