本文整理汇总了C++中GTK_TREE_VIEW_COLUMN函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_TREE_VIEW_COLUMN函数的具体用法?C++ GTK_TREE_VIEW_COLUMN怎么用?C++ GTK_TREE_VIEW_COLUMN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_TREE_VIEW_COLUMN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: preferences_languages_setup
static void
preferences_languages_setup (EmpathyPreferences *preferences)
{
EmpathyPreferencesPriv *priv = GET_PRIV (preferences);
GtkTreeView *view;
GtkListStore *store;
GtkTreeSelection *selection;
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
guint col_offset;
view = GTK_TREE_VIEW (priv->treeview_spell_checker);
store = gtk_list_store_new (COL_LANG_COUNT,
G_TYPE_BOOLEAN, /* enabled */
G_TYPE_STRING, /* code */
G_TYPE_STRING); /* name */
gtk_tree_view_set_model (view, GTK_TREE_MODEL (store));
selection = gtk_tree_view_get_selection (view);
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
renderer = gtk_cell_renderer_toggle_new ();
g_signal_connect (renderer, "toggled",
G_CALLBACK (preferences_languages_cell_toggled_cb),
preferences);
column = gtk_tree_view_column_new_with_attributes (NULL, renderer,
"active", COL_LANG_ENABLED,
NULL);
gtk_tree_view_append_column (view, column);
renderer = gtk_cell_renderer_text_new ();
col_offset = gtk_tree_view_insert_column_with_attributes (view,
-1, _("Language"),
renderer,
"text", COL_LANG_NAME,
NULL);
g_object_set_data (G_OBJECT (renderer),
"column", GINT_TO_POINTER (COL_LANG_NAME));
column = gtk_tree_view_get_column (view, col_offset - 1);
gtk_tree_view_column_set_sort_column_id (column, COL_LANG_NAME);
gtk_tree_view_column_set_resizable (column, FALSE);
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
g_object_unref (store);
}
示例2: glade_gtk_treeview_set_child_property
void
glade_gtk_treeview_set_child_property (GladeWidgetAdaptor * adaptor,
GObject * container,
GObject * child,
const gchar * property_name,
const GValue * value)
{
if (strcmp (property_name, "position") == 0)
{
gtk_tree_view_remove_column (GTK_TREE_VIEW (container),
GTK_TREE_VIEW_COLUMN (child));
gtk_tree_view_insert_column (GTK_TREE_VIEW (container),
GTK_TREE_VIEW_COLUMN (child),
g_value_get_int (value));
}
else
/* Chain Up */
GWA_GET_CLASS
(GTK_TYPE_CONTAINER)->child_set_property (adaptor,
container, child,
property_name, value);
}
示例3: csv_import_header_on_click
/**
* Triggered when user clicks on a column header. Create and pop up a
* menu to allow CSV config change.
*
* \param button Button placed at the title column.
* \param ev Not used.
* \param no_column Position of the column.
*
* \return FALSE
*/
gboolean csv_import_header_on_click ( GtkWidget * button, gint *no_column )
{
GtkWidget * menu, * col;
col = g_object_get_data ( G_OBJECT ( button ), "column" );
menu = csv_import_fields_menu ( GTK_TREE_VIEW_COLUMN ( col ),
GPOINTER_TO_INT ( no_column ),
g_object_get_data ( G_OBJECT(col), "assistant" ) );
gtk_menu_popup ( GTK_MENU(menu), NULL, NULL, NULL, NULL, 3,
gtk_get_current_event_time());
return FALSE;
}
示例4: gzrt_wmain_tree_generate
/* Generate the tree view */
GtkWidget *
gzrt_wmain_tree_generate ( MAINWIN * c )
{
GtkWidget * menu = menu_generate( c );
GtkWidget * tv = gtk_tree_view_new();
GtkListStore * ls = gtk_list_store_new( sizeof(Cols) / sizeof(struct ColumnSpec), G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, -1 );
/* Right click handler */
g_signal_connect(tv, "button-press-event", G_CALLBACK(click_handler), (gpointer)menu);
/* Create columns */
for( int i = 0; i < sizeof(Cols) / sizeof(struct ColumnSpec); i++ )
{
GtkCellRenderer * r = gtk_cell_renderer_text_new();
GtkTreeViewColumn * col;
/* Font? */
if( Cols[i].font )
g_object_set( G_OBJECT(r), "font", FONT, NULL );
gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(tv),
-1, Cols[i].title, r, "text", i, NULL );
col = gtk_tree_view_get_column( GTK_TREE_VIEW(tv), i );
gtk_tree_view_column_set_resizable( col, TRUE );
if( i == 1 )
gtk_tree_view_column_set_expand( GTK_TREE_VIEW_COLUMN(col), TRUE );
}
/* Generate data */
for( int i = 0; i < z64fs_entries( c->z->fs ); i++ )
{
GtkTreeIter j;
gtk_list_store_append( GTK_LIST_STORE(ls), &j );
for( int k = 0; k < sizeof(Cols) / sizeof(struct ColumnSpec); k++ )
{
char buffer[64];
Cols[k].func( buffer, i, c );
gtk_list_store_set( GTK_LIST_STORE(ls), &j, k, buffer, -1 );
}
}
/* Set model */
gtk_tree_view_set_model( GTK_TREE_VIEW(tv), GTK_TREE_MODEL(ls) );
/* Return it */
return tv;
}
示例5: fx_many_create_all_column
static void fx_many_create_all_column(FxMany* fxmany)
{
GtkCellRenderer* renderer;
GtkTreeViewColumn *col , *col1;
GtkWidget* tree = fxmany->tree;
renderer = gtk_cell_renderer_toggle_new();
g_signal_connect(renderer , "toggled" , G_CALLBACK(fx_many_item_toggled) , fxmany);
col = gtk_tree_view_column_new();
gtk_tree_view_column_pack_start(col , renderer , TRUE);
gtk_tree_view_column_add_attribute(col, renderer, "active", S_CHECK_COL);
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (col)
, GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (col), 40);
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (col), TRUE);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree) , col);
renderer = gtk_cell_renderer_pixbuf_new();
GtkTreeViewColumn* col0 = gtk_tree_view_column_new();
gtk_tree_view_column_pack_start(col0, renderer , FALSE);
gtk_tree_view_column_add_attribute(col0, renderer, "pixbuf", S_PIXBUF_COL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), col0);
renderer = gtk_cell_renderer_text_new();
col1 = gtk_tree_view_column_new();
gtk_tree_view_column_pack_start(col1, renderer , FALSE);
gtk_tree_view_column_set_cell_data_func(col1
, renderer
, fx_many_text_cell_data_func
, NULL
, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), col1);
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (col)
, GTK_TREE_VIEW_COLUMN_FIXED);
}
示例6: init_left_tree
void init_left_tree(void)
{
GtkTreeView *view = GTK_TREE_VIEW(tree1_w);
GtkCellRenderer *renderer;
GtkTreeSelection *sel;
GtkTreeViewColumn *column;
gtk_tree_view_set_model(view, model1);
gtk_tree_view_set_headers_visible(view, TRUE);
gtk_tree_view_set_rules_hint(view, FALSE);
column = gtk_tree_view_column_new();
gtk_tree_view_append_column(view, column);
gtk_tree_view_column_set_title(column, _("Options"));
renderer = gtk_cell_renderer_toggle_new();
gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
renderer, FALSE);
gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column),
renderer,
"active", COL_BTNACT,
"inconsistent", COL_BTNINC,
"visible", COL_BTNVIS,
"radio", COL_BTNRAD, NULL);
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
renderer, FALSE);
gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column),
renderer,
"text", COL_OPTION,
"foreground-gdk",
COL_COLOR, NULL);
sel = gtk_tree_view_get_selection(view);
gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE);
gtk_widget_realize(tree1_w);
}
示例7: bind_chapter_tree_model
// Create and bind the tree model to the tree view for the chapter list
// Also, connect up the signal that lets us know the selection has changed
static void
bind_chapter_tree_model(signal_user_data_t *ud)
{
GtkCellRenderer *cell;
GtkTreeViewColumn *column;
GtkListStore *treestore;
GtkTreeView *treeview;
g_debug("bind_chapter_tree_model()\n");
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "chapters_list"));
treestore = gtk_list_store_new(5, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
cell = ghb_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(
_("Index"), cell, "text", 0, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
cell = ghb_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(
_("Start"), cell, "text", 1, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
cell = ghb_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(
_("Duration"), cell, "text", 2, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
cell = ghb_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(
_("Title"), cell, "text", 3, "editable", 4, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
g_signal_connect(cell, "key-press-event", chapter_keypress_cb, ud);
g_signal_connect(cell, "edited", chapter_edited_cb, ud);
g_debug("Done\n");
}
示例8: refresh_log
static void
refresh_log (GitLogPane *self)
{
Git *plugin;
GtkTreeView *log_view;
GtkTreeViewColumn *graph_column;
plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
log_view = GTK_TREE_VIEW (gtk_builder_get_object (self->priv->builder,
"log_view"));
graph_column = GTK_TREE_VIEW_COLUMN (gtk_builder_get_object (self->priv->builder,
"graph_column"));
/* Unref the previous command if it's still running. */
if (self->priv->log_command)
g_object_unref (self->priv->log_command);
gtk_tree_view_set_model (log_view, NULL);
/* We don't support filters for now */
self->priv->log_command = git_log_command_new (plugin->project_root_directory,
self->priv->selected_branch,
self->priv->path,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
/* Hide the graph column if we're looking at the log of a path. The graph
* won't be correct in this case. */
if (self->priv->path)
gtk_tree_view_column_set_visible (graph_column, FALSE);
else
gtk_tree_view_column_set_visible (graph_column, TRUE);
g_signal_connect_object (G_OBJECT (self->priv->log_command), "command-finished",
G_CALLBACK (on_log_command_finished),
self, 0);
gtk_list_store_clear (self->priv->log_model);
/* Show the loading spinner */
git_log_pane_set_view_mode (self, LOG_VIEW_LOADING);
anjuta_command_start (ANJUTA_COMMAND (self->priv->log_command));
}
示例9: gtk_scrolled_window_new
/* Create the list of "messages" */
static GtkWidget *create_list( void )
{
GtkWidget *scrolled_window;
GtkWidget *tree_view;
GtkListStore *model;
GtkTreeIter iter;
GtkCellRenderer *cell;
GtkTreeViewColumn *column;
int i;
/* Create a new scrolled window, with scrollbars only if needed */
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
model = gtk_list_store_new (1, G_TYPE_STRING);
tree_view = gtk_tree_view_new ();
gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL (model));
gtk_widget_show (tree_view);
/* Add some messages to the window */
for (i = 0; i < 10; i++) {
gchar *msg = g_strdup_printf ("Message #%d", i);
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model),
&iter,
0, msg,
-1);
g_free (msg);
}
cell = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Messages",
cell,
"text", 0,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
GTK_TREE_VIEW_COLUMN (column));
return scrolled_window;
}
示例10: create_tree
/* Technically a list, but if we do go to 80 demos, we may want to move to a tree */
static GtkWidget *
create_tree (void)
{
GtkTreeSelection *selection;
GtkCellRenderer *cell;
GtkWidget *tree_view;
GtkTreeViewColumn *column;
GtkTreeStore *model;
GtkTreeIter iter;
gint i;
model = gtk_tree_store_new_with_types (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
gtk_tree_selection_set_type (GTK_TREE_SELECTION (selection),
GTK_TREE_SELECTION_SINGLE);
gtk_widget_set_usize (tree_view, 200, -1);
for (i=0; i < G_N_ELEMENTS (testgtk_demos); i++)
{
gtk_tree_store_append (GTK_TREE_STORE (model), &iter, NULL);
gtk_tree_store_set (GTK_TREE_STORE (model),
&iter,
TITLE_COLUMN, testgtk_demos[i].title,
FILENAME_COLUMN, testgtk_demos[i].filename,
FUNC_COLUMN, testgtk_demos[i].func,
ITALIC_COLUMN, FALSE,
-1);
}
cell = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Widget",
cell,
"text", TITLE_COLUMN,
"italic", ITALIC_COLUMN,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
GTK_TREE_VIEW_COLUMN (column));
g_signal_connect (selection, "selection-changed", selection_cb, model);
g_signal_connect (tree_view, "button-press-event", G_CALLBACK (button_press_event_cb), model);
return tree_view;
}
示例11: bind_presets_tree_model
// Create and bind the tree model to the tree view for the preset list
// Also, connect up the signal that lets us know the selection has changed
static void
bind_presets_tree_model(signal_user_data_t *ud)
{
GtkCellRenderer *cell;
GtkTreeViewColumn *column;
GtkTreeStore *treestore;
GtkTreeView *treeview;
GtkTreeSelection *selection;
GtkWidget *widget;
GtkTargetEntry SrcEntry;
SrcEntry.target = "DATA";
SrcEntry.flags = GTK_TARGET_SAME_WIDGET;
g_debug("bind_presets_tree_model()\n");
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
selection = gtk_tree_view_get_selection(treeview);
treestore = gtk_tree_store_new(6, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
cell = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(_("Preset Name"), cell,
"text", 0, "weight", 1, "style", 2,
"foreground", 3, "editable", 5, NULL);
g_signal_connect(cell, "edited", preset_edited_cb, ud);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
gtk_tree_view_column_set_expand(column, TRUE);
gtk_tree_view_set_tooltip_column(treeview, 4);
gtk_tree_view_enable_model_drag_dest(treeview, &SrcEntry, 1,
GDK_ACTION_MOVE);
gtk_tree_view_enable_model_drag_source(treeview, GDK_BUTTON1_MASK,
&SrcEntry, 1, GDK_ACTION_MOVE);
g_signal_connect(treeview, "drag_data_received", presets_drag_cb, ud);
g_signal_connect(treeview, "drag_motion", presets_drag_motion_cb, ud);
g_signal_connect(treeview, "row_expanded", presets_row_expanded_cb, ud);
g_signal_connect(treeview, "row_collapsed", presets_row_expanded_cb, ud);
g_signal_connect(selection, "changed", presets_list_selection_changed_cb, ud);
widget = GHB_WIDGET(ud->builder, "presets_remove");
gtk_widget_set_sensitive(widget, FALSE);
g_debug("Done\n");
}
示例12: create_profile_list
/* create a profile list widget */
static GtkWidget*
create_profile_list (void)
{
GtkTreeSelection *selection;
GtkCellRenderer *cell;
GtkWidget *tree_view;
GtkTreeViewColumn *column;
GtkListStore *model;
model = gtk_list_store_new (COLUMN_LAST,
G_TYPE_STRING,
G_TYPE_OBJECT);
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
//terminal_util_set_atk_name_description (tree_view, _("Profile list"), NULL);
g_object_unref (G_OBJECT (model));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection),
GTK_SELECTION_MULTIPLE);
refill_profile_treeview (tree_view);
cell = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (cell),
"xpad", 2,
NULL);
column = gtk_tree_view_column_new_with_attributes (NULL,
cell,
"text", COLUMN_NAME,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
GTK_TREE_VIEW_COLUMN (column));
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE);
return tree_view;
}
示例13: gtk_scrolled_window_new
void ListBox::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const char *text) {
listBox->selection = -1;
object->widget = gtk_scrolled_window_new(0, 0);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(object->widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(object->widget), GTK_SHADOW_ETCHED_IN);
gtk_widget_set_size_request(object->widget, width, height);
lstring list;
list.split("\t", text);
GType *v = (GType*)malloc(list.size() * sizeof(GType));
for(unsigned i = 0; i < list.size(); i++) v[i] = G_TYPE_STRING;
listBox->store = gtk_list_store_newv(list.size(), v);
free(v);
object->subWidget = gtk_tree_view_new_with_model(GTK_TREE_MODEL(listBox->store));
gtk_container_add(GTK_CONTAINER(object->widget), object->subWidget);
g_object_unref(G_OBJECT(listBox->store));
//alternate color of each row if there is more than one column
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(object->subWidget), list.size() >= 2);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(object->subWidget), false);
for(unsigned i = 0; i < list.size(); i++) {
listBox->column[i].renderer = gtk_cell_renderer_text_new();
listBox->column[i].column = gtk_tree_view_column_new_with_attributes(
list[i], listBox->column[i].renderer, "text", i, (void*)0
);
listBox->column[i].label = gtk_label_new(list[i]);
gtk_tree_view_column_set_widget(GTK_TREE_VIEW_COLUMN(listBox->column[i].column), listBox->column[i].label);
gtk_tree_view_append_column(GTK_TREE_VIEW(object->subWidget), listBox->column[i].column);
gtk_widget_show(listBox->column[i].label);
}
g_signal_connect_swapped(G_OBJECT(object->subWidget), "cursor-changed", G_CALLBACK(ListBox_change), (gpointer)this);
g_signal_connect_swapped(G_OBJECT(object->subWidget), "row-activated", G_CALLBACK(ListBox_activate), (gpointer)this);
if(parent.window->defaultFont) setFont(*parent.window->defaultFont);
gtk_fixed_put(GTK_FIXED(parent.object->formContainer), object->widget, x, y);
gtk_widget_show(object->subWidget);
gtk_widget_show(object->widget);
}
示例14: col_edited_helper
static void col_edited_helper(GtkCellRendererText *cell, gchar *path_string,
gchar *new_text, gpointer _s_model)
{
GncOwner *owner;
GtkTreeModel *s_model;
GtkTreeIter s_iter;
GncTreeViewOwnerColumnTextEdited col_edited_cb;
GtkTreeViewColumn *col;
col_edited_cb = g_object_get_data(G_OBJECT(cell),
"column_edited_callback");
col = GTK_TREE_VIEW_COLUMN(g_object_get_data(G_OBJECT(cell),
"column_view"));
s_model = GTK_TREE_MODEL(_s_model);
if (!gtk_tree_model_get_iter_from_string(s_model, &s_iter, path_string))
return;
owner = gnc_tree_view_owner_get_owner_from_iter(s_model, &s_iter);
col_edited_cb(owner, col, new_text);
}
示例15: list_store_set_sort_all
void
list_store_set_sort_all(GtkWidget *tview)
{
GList *list, *ptr;
int i;
GtkTreeViewColumn *column;
list = gtk_tree_view_get_columns(GTK_TREE_VIEW(tview));
if (list == NULL)
return;
for (ptr = list, i = 0; ptr; ptr = ptr->next, i++) {
column = GTK_TREE_VIEW_COLUMN(ptr->data);
gtk_tree_view_column_set_sort_column_id(column, i);
gtk_tree_view_column_set_clickable(column, TRUE);
}
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tview), TRUE);
g_list_free(list);
}