本文整理汇总了C++中GTK_IS_TREE_VIEW函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_IS_TREE_VIEW函数的具体用法?C++ GTK_IS_TREE_VIEW怎么用?C++ GTK_IS_TREE_VIEW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_IS_TREE_VIEW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cell_renderer_activatable_activate
static gboolean
cell_renderer_activatable_activate (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
const gchar *path_string,
const GdkRectangle *background_area,
const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
EmpathyCellRendererActivatable *activatable;
gint ex, ey, bx, by, bw, bh;
activatable = EMPATHY_CELL_RENDERER_ACTIVATABLE (cell);
if (!GTK_IS_TREE_VIEW (widget) || event == NULL ||
event->type != GDK_BUTTON_PRESS) {
return FALSE;
}
ex = (gint) ((GdkEventButton *) event)->x;
ey = (gint) ((GdkEventButton *) event)->y;
bx = background_area->x;
by = background_area->y;
bw = background_area->width;
bh = background_area->height;
if (ex < bx || ex > (bx+bw) || ey < by || ey > (by+bh)) {
/* Click wasn't on the icon */
return FALSE;
}
g_signal_emit (activatable, signals[PATH_ACTIVATED], 0, path_string);
return TRUE;
}
示例2: gwy_grain_value_tree_view_select
/**
* gwy_grain_value_tree_view_select:
* @treeview: A tree view with grain values.
* @gvalue: The grain value to select.
*
* Selects a particular grain value in a grain value tree view.
*
* If the @gvalue group is currently unexpanded, it will be expanded to
* show it, and the tree view may scroll to make it visible.
*
* Since: 2.8
**/
void
gwy_grain_value_tree_view_select(GtkTreeView *treeview,
GwyGrainValue *gvalue)
{
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter iter;
g_return_if_fail(GTK_IS_TREE_VIEW(treeview));
g_return_if_fail(GWY_IS_GRAIN_VALUE(gvalue));
g_return_if_fail(priv_quark
&& g_object_get_qdata(G_OBJECT(treeview), priv_quark));
model = gtk_tree_view_get_model(treeview);
if (!find_grain_value(model, gvalue, &iter)) {
g_warning("Grain value not in tree model.");
return;
}
path = gtk_tree_model_get_path(model, &iter);
gtk_tree_view_expand_to_path(treeview, path);
gtk_tree_view_scroll_to_cell(treeview, path, NULL, FALSE, 0.0, 0.0);
gtk_tree_path_free(path);
selection = gtk_tree_view_get_selection(treeview);
gtk_tree_selection_select_iter(selection, &iter);
}
示例3: setup
void
setup(GtkWidget *widget)
{
GtkWidgetProps props(widget);
if (widget && GTK_IS_SCROLLED_WINDOW(widget) &&
!props->scrolledWindowHacked) {
GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(widget);
GtkWidget *child;
if ((child = gtk_scrolled_window_get_hscrollbar(scrolledWindow))) {
setupConnections(child, widget);
}
if ((child = gtk_scrolled_window_get_vscrollbar(scrolledWindow))) {
setupConnections(child, widget);
}
if ((child = gtk_bin_get_child(GTK_BIN(widget)))) {
if (GTK_IS_TREE_VIEW(child) || GTK_IS_TEXT_VIEW(child) ||
GTK_IS_ICON_VIEW(child)) {
setupConnections(child, widget);
} else if (oneOf(gTypeName(child), "ExoIconView",
"FMIconContainer")) {
setupConnections(child, widget);
}
}
props->scrolledWindowHacked = true;
}
}
示例4: on_name_field_changed
static void
on_name_field_changed (GtkEditable *editable,
gpointer user_data)
{
GtkTreeIter iter;
g_return_if_fail(GTK_IS_TREE_VIEW(bookmark_list_widget));
g_return_if_fail(GTK_IS_ENTRY(name_field));
if (!get_selection_exists())
return;
/* Update text displayed in list instantly. Also remember that
* user has changed text so we update real bookmark later.
*/
gtk_tree_selection_get_selected (bookmark_selection,
NULL,
&iter);
gtk_list_store_set (bookmark_list_store,
&iter, BOOKMARK_LIST_COLUMN_NAME,
gtk_entry_get_text (GTK_ENTRY (name_field)),
-1);
text_changed = TRUE;
name_text_changed = TRUE;
}
示例5: tree_view_button_press
static gboolean
tree_view_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
UIMCandWinVerticalGtk *vertical_cwin;
UIMCandWinGtk *cwin;
GtkTreePath *path;
gboolean exist, retval = FALSE;
gint *indicies;
g_return_val_if_fail(GTK_IS_TREE_VIEW(widget), FALSE);
g_return_val_if_fail(UIM_CAND_WIN_VERTICAL_GTK(data), FALSE);
vertical_cwin = UIM_CAND_WIN_VERTICAL_GTK(data);
cwin = UIM_CAND_WIN_GTK(vertical_cwin);
exist = gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
event->x, event->y,
&path, NULL, NULL, NULL);
if (!exist)
return FALSE;
indicies = gtk_tree_path_get_indices(path);
/* don't relay button press event to empty row */
if (cwin->display_limit * cwin->page_index + *indicies >= cwin->nr_candidates)
retval = TRUE;
gtk_tree_path_free(path);
return retval;
}
示例6: qtcTreeViewLeave
static gboolean
qtcTreeViewLeave(GtkWidget *widget, GdkEventMotion *event, void *data)
{
QTC_UNUSED(event);
QTC_UNUSED(data);
if (GTK_IS_TREE_VIEW(widget)) {
QtCTreeView *tv = qtcTreeViewLookupHash(widget, false);
if (tv) {
GtkTreeView *treeView = GTK_TREE_VIEW(widget);
QtcRect rect = {0, 0, -1, -1 };
QtcRect alloc = qtcWidgetGetAllocation(widget);
if (tv->path && tv->column) {
gtk_tree_view_get_background_area(
treeView, tv->path, tv->column, (GdkRectangle*)&rect);
}
if (tv->fullWidth) {
rect.x = 0;
rect.width = alloc.width;
}
if (tv->path) {
gtk_tree_path_free(tv->path);
}
tv->path = NULL;
tv->column = NULL;
gtk_tree_view_convert_bin_window_to_widget_coords(
treeView, rect.x, rect.y, &rect.x, &rect.y);
gtk_widget_queue_draw_area(
widget, rect.x, rect.y, rect.width, rect.height);
}
}
return false;
}
示例7: thumbnail_region
/* Get a new thumbnail region of GtkTreeView widget in which event
falls. It is an error to call this function if !in_thumbnail
(widget, event). */
static GdkRegion *
thumbnail_region (GtkWidget *widget, GdkEventMotion *event)
{
g_assert (GTK_IS_TREE_VIEW (widget));
g_assert (in_thumbnail (widget, event));
GtkTreePath *tp = thumbnail_path (widget, event);
g_assert (tp != NULL);
/* Rectangle of region to be returned. */
GdkRectangle tn_rect;
/* If over the input image thumbnail, return the input thumbnail region, */
GtkTreeViewColumn *tc = NULL; /* Thumbnail column we are over. */
if ( in_input_thumbnail (widget, event) ) {
tc = input_thumbnail_column (widget, event);
}
gtk_tree_view_get_cell_area (GTK_TREE_VIEW (widget), tp, tc, &tn_rect);
/* Here we depend on the fact that the thumbnails are packed at the
beginning of the cell horizontally, and centered in the cell
vertically (FIXME: find a way to verify this with assertions). */
GdkRectangle itn_rect; /* Image thumbnail rectangle. */
/* FIXME: fix this border hackery to be precise somehow. */
itn_rect.x = tn_rect.x + 1; /* There is probably a small border so +1. */
itn_rect.y = tn_rect.y + 1;
itn_rect.width = THUMB_SIZE;
itn_rect.height = THUMB_SIZE;
return gdk_region_rectangle (&itn_rect);
}
示例8: set_role_for_button
static void
set_role_for_button (AtkObject *accessible,
GtkWidget *button)
{
GtkWidget *parent;
AtkRole role;
parent = gtk_widget_get_parent (button);
if (GTK_IS_TREE_VIEW (parent))
{
role = ATK_ROLE_TABLE_COLUMN_HEADER;
/*
* Even though the accessible parent of the column header will
* be reported as the table because the parent widget of the
* GtkTreeViewColumn's button is the GtkTreeView we set
* the accessible parent for column header to be the table
* to ensure that atk_object_get_index_in_parent() returns
* the correct value; see gail_widget_get_index_in_parent().
*/
atk_object_set_parent (accessible, gtk_widget_get_accessible (parent));
}
else
role = ATK_ROLE_PUSH_BUTTON;
accessible->role = role;
}
示例9: gmpc_meta_data_widgets_similar_songs_tree_row_activated
static void gmpc_meta_data_widgets_similar_songs_tree_row_activated (GmpcMetaDataWidgetsSimilarSongs* self, GtkWidget* tree, GtkTreePath* path, GtkTreeViewColumn* column) {
GtkWidget* _tmp0_;
GtkTreeModel* _tmp1_ = NULL;
GtkTreeModel* _tmp2_;
GtkTreeModel* model;
GtkTreeIter iter = {0};
GtkTreeIter _tmp3_ = {0};
gboolean _tmp4_;
g_return_if_fail (self != NULL);
g_return_if_fail (tree != NULL);
g_return_if_fail (path != NULL);
g_return_if_fail (column != NULL);
_tmp0_ = tree;
_tmp1_ = gtk_tree_view_get_model (GTK_IS_TREE_VIEW (_tmp0_) ? ((GtkTreeView*) _tmp0_) : NULL);
_tmp2_ = _g_object_ref0 (_tmp1_);
model = _tmp2_;
_tmp4_ = gtk_tree_model_get_iter (model, &_tmp3_, path);
iter = _tmp3_;
if (_tmp4_) {
const mpd_Song* song;
song = NULL;
gtk_tree_model_get (model, &iter, 0, &song, -1, -1);
if (song != NULL) {
play_path (song->file);
}
}
_g_object_unref0 (model);
}
示例10: bastile_gkr_item_properties_show
void
bastile_gkr_item_properties_show (BastileGkrItem *git, GtkWindow *parent)
{
BastileObject *object = BASTILE_OBJECT (git);
BastileWidget *swidget = NULL;
GtkWidget *widget;
swidget = bastile_object_widget_new ("gkr-item-properties", parent, object);
/* This happens if the window is already open */
if (swidget == NULL)
return;
bastile_object_refresh (object);
widget = GTK_WIDGET (bastile_widget_get_widget (swidget, swidget->name));
g_signal_connect (widget, "response", G_CALLBACK (properties_response), swidget);
/*
* The signals don't need to keep getting connected. Everytime a key changes the
* do_* functions get called. Therefore, seperate functions connect the signals
* have been created
*/
setup_main (swidget);
setup_details (swidget);
setup_application (swidget);
widget = bastile_widget_get_widget (swidget, "application-list");
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)), "changed",
G_CALLBACK (application_selection_changed), swidget);
}
示例11: empathy_cell_renderer_expander_activate
static gboolean
empathy_cell_renderer_expander_activate (GtkCellRenderer *cell,
GdkEvent *event,
GtkWidget *widget,
const gchar *path_string,
const GdkRectangle *background_area,
const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
EmpathyCellRendererExpanderPriv *priv;
GtkTreePath *path;
priv = GET_PRIV (cell);
if (!GTK_IS_TREE_VIEW (widget) || !priv->activatable)
return FALSE;
path = gtk_tree_path_new_from_string (path_string);
if (gtk_tree_path_get_depth (path) > 1) {
gtk_tree_path_free (path);
return TRUE;
}
if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (widget), path)) {
gtk_tree_view_collapse_row (GTK_TREE_VIEW (widget), path);
} else {
gtk_tree_view_expand_row (GTK_TREE_VIEW (widget), path, FALSE);
}
gtk_tree_path_free (path);
return TRUE;
}
示例12: seahorse_key_manager_store_get_selected_object
GObject *
seahorse_key_manager_store_get_selected_object (GtkTreeView *view)
{
SeahorseKeyManagerStore* skstore;
GObject *obj = NULL;
GList *paths = NULL;
GtkTreeSelection *selection;
g_return_val_if_fail (GTK_IS_TREE_VIEW (view), NULL);
skstore = SEAHORSE_KEY_MANAGER_STORE (gtk_tree_view_get_model (view));
g_return_val_if_fail (SEAHORSE_IS_KEY_MANAGER_STORE (skstore), NULL);
selection = gtk_tree_view_get_selection (view);
paths = gtk_tree_selection_get_selected_rows (selection, NULL);
/* choose first object */
if (paths != NULL) {
obj = seahorse_key_manager_store_get_object_from_path (view, paths->data);
/* free selected paths */
g_list_foreach (paths, (GFunc)gtk_tree_path_free, NULL);
g_list_free (paths);
}
return obj;
}
示例13: seahorse_key_manager_store_set_selected_objects
void
seahorse_key_manager_store_set_selected_objects (GtkTreeView *view, GList* objects)
{
SeahorseKeyManagerStore* skstore;
GtkTreeSelection* selection;
gboolean first = TRUE;
GtkTreePath *path;
GList *l;
GtkTreeIter iter;
g_return_if_fail (GTK_IS_TREE_VIEW (view));
selection = gtk_tree_view_get_selection (view);
gtk_tree_selection_unselect_all (selection);
skstore = SEAHORSE_KEY_MANAGER_STORE (gtk_tree_view_get_model (view));
g_return_if_fail (SEAHORSE_IS_KEY_MANAGER_STORE (skstore));
for (l = objects; l; l = g_list_next (l)) {
if (gcr_collection_model_iter_for_object (GCR_COLLECTION_MODEL (skstore),
l->data, &iter)) {
gtk_tree_selection_select_iter (selection, &iter);
/* Scroll the first row selected into view */
if (first) {
path = gtk_tree_model_get_path (gtk_tree_view_get_model (view), &iter);
gtk_tree_view_scroll_to_cell (view, path, NULL, FALSE, 0.0, 0.0);
gtk_tree_path_free (path);
first = FALSE;
}
}
}
}
示例14: cact_providers_list_init_view
/**
* cact_providers_list_init_view:
* @window: the parent #BaseWindow which embeds the view.
* @treeview: the #GtkTreeView.
*
* Connects signals at runtime initialization of the widget, and setup
* current default values.
*/
void
cact_providers_list_init_view( BaseWindow *window, GtkTreeView *treeview )
{
static const gchar *thisfn = "cact_providers_list_init_view";
ProvidersListData *data;
CactApplication *application;
NAUpdater *updater;
g_return_if_fail( BASE_IS_WINDOW( window ));
g_return_if_fail( GTK_IS_TREE_VIEW( treeview ));
g_debug( "%s: treeview=%p, window=%p", thisfn, ( void * ) treeview, ( void * ) window );
g_object_set_data( G_OBJECT( window ), PROVIDERS_LIST_TREEVIEW, treeview );
data = get_providers_list_data( treeview );
data->window = window;
application = CACT_APPLICATION( base_window_get_application( window ));
updater = cact_application_get_updater( application );
data->preferences_locked = na_updater_are_preferences_locked( updater );
init_view_setup_providers( treeview, window );
init_view_connect_signals( treeview, window );
init_view_select_first_row( treeview );
}
示例15: baobab_treeview_show_allocated_size
void
baobab_treeview_show_allocated_size (GtkWidget *tv,
gboolean show_allocated)
{
gint sort_id;
gint new_sort_id;
GtkSortType order;
GtkTreeViewColumn *size_col;
g_return_if_fail (GTK_IS_TREE_VIEW (tv));
gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (baobab.model),
&sort_id, &order);
/* set the sort id for the size column */
size_col = g_object_get_data (G_OBJECT (tv), "baobab_size_col");
new_sort_id = show_allocated ? COL_H_ALLOCSIZE : COL_H_SIZE;
gtk_tree_view_column_set_sort_column_id (size_col, new_sort_id);
/* if we are currently sorted on size or allocated size,
* then trigger a resort (with the same order) */
if (sort_id == COL_H_SIZE || sort_id == COL_H_ALLOCSIZE) {
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (baobab.model),
new_sort_id, order);
}
}