当前位置: 首页>>代码示例>>C++>>正文


C++ GTK_IS_TREE_VIEW函数代码示例

本文整理汇总了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;
}
开发者ID:raluca-elena,项目名称:empathy-cheese,代码行数:35,代码来源:empathy-cell-renderer-activatable.c

示例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);
}
开发者ID:cbuehler,项目名称:gwyddion,代码行数:40,代码来源:gwygrainvaluemenu.c

示例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;
    }
}
开发者ID:KDE,项目名称:qtcurve,代码行数:27,代码来源:scrolledwindow.cpp

示例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;
}
开发者ID:kleopatra999,项目名称:nautilus,代码行数:25,代码来源:nautilus-bookmarks-window.c

示例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;
}
开发者ID:DirtYiCE,项目名称:uim,代码行数:31,代码来源:uim-cand-win-vertical-gtk.c

示例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;
}
开发者ID:Kermit,项目名称:qtcurve,代码行数:34,代码来源:treeview.c

示例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);
}
开发者ID:glshort,项目名称:MapReady,代码行数:36,代码来源:blow_up_in.c

示例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;
}
开发者ID:BYC,项目名称:gtk,代码行数:26,代码来源:gailbutton.c

示例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);
}
开发者ID:emillon,项目名称:gmpc,代码行数:28,代码来源:gmpc-metadata-similarsongs.c

示例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);
}
开发者ID:gfunkmonk2,项目名称:bastile,代码行数:34,代码来源:bastile-gkr-item-properties.c

示例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;
}
开发者ID:Dhinihan,项目名称:empathy,代码行数:34,代码来源:empathy-cell-renderer-expander.c

示例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;
}
开发者ID:atulhjp,项目名称:seahorse,代码行数:26,代码来源:seahorse-key-manager-store.c

示例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;
			}
		}
	}
}
开发者ID:atulhjp,项目名称:seahorse,代码行数:32,代码来源:seahorse-key-manager-store.c

示例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 );
}
开发者ID:nmbooker,项目名称:caja-actions,代码行数:34,代码来源:cact-providers-list.c

示例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);
	}
}
开发者ID:5Ecur1ty,项目名称:baobab,代码行数:26,代码来源:baobab-treeview.c


注:本文中的GTK_IS_TREE_VIEW函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。