• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GTK_SCROLLABLE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GTK_SCROLLABLE函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_SCROLLABLE函数的具体用法?C++ GTK_SCROLLABLE怎么用?C++ GTK_SCROLLABLE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GTK_SCROLLABLE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: nemo_icon_dnd_begin_drag

void
nemo_icon_dnd_begin_drag (NemoIconContainer *container,
			      GdkDragAction actions,
			      int button,
			      GdkEventMotion *event,
			      int                    start_x,
			      int                    start_y)
{
	NemoIconDndInfo *dnd_info;
	
	g_return_if_fail (NEMO_IS_ICON_CONTAINER (container));
	g_return_if_fail (event != NULL);

	dnd_info = container->details->dnd_info;
	g_return_if_fail (dnd_info != NULL);
	
	/* Notice that the event is in bin_window coordinates, because of
           the way the canvas handles events.
	*/
	dnd_info->drag_info.start_x = start_x -
		gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
	dnd_info->drag_info.start_y = start_y -
		gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)));	

	/* start the drag */
	gtk_drag_begin (GTK_WIDGET (container),
			dnd_info->drag_info.target_list,
			actions,
			button,
			(GdkEvent *) event);
}
开发者ID:Ahmed-Developer,项目名称:nemo,代码行数:31,代码来源:nemo-icon-dnd.c


示例2: e_canvas_show_area

static void
e_canvas_show_area (GnomeCanvas *canvas,
                    gdouble x1,
                    gdouble y1,
                    gdouble x2,
                    gdouble y2)
{
	GtkAdjustment *h, *v;
	gint dx = 0, dy = 0;
	gdouble page_size;
	gdouble lower;
	gdouble upper;
	gdouble value;

	g_return_if_fail (canvas != NULL);
	g_return_if_fail (GNOME_IS_CANVAS (canvas));

	h = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas));
	page_size = gtk_adjustment_get_page_size (h);
	lower = gtk_adjustment_get_lower (h);
	upper = gtk_adjustment_get_upper (h);
	value = gtk_adjustment_get_value (h);
	dx = compute_offset (x1, x2, value, value + page_size);
	if (dx)
		gtk_adjustment_set_value (h, CLAMP (value + dx, lower, upper - page_size));

	v = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas));
	page_size = gtk_adjustment_get_page_size (v);
	lower = gtk_adjustment_get_lower (v);
	upper = gtk_adjustment_get_upper (v);
	value = gtk_adjustment_get_value (v);
	dy = compute_offset (y1, y2, value, value + page_size);
	if (dy)
		gtk_adjustment_set_value (v, CLAMP (value + dy, lower, upper - page_size));
}
开发者ID:Distrotech,项目名称:evolution,代码行数:35,代码来源:e-canvas-utils.c


示例3: nemo_icon_container_receive_dropped_icons

static void
nemo_icon_container_receive_dropped_icons (NemoIconContainer *container,
					       GdkDragContext *context,
					       int x, int y)
{
	char *drop_target;
	gboolean local_move_only;
	double world_x, world_y;
	gboolean icon_hit;
	GdkDragAction action, real_action;

	drop_target = NULL;

	if (container->details->dnd_info->drag_info.selection_list == NULL) {
		return;
	}

	real_action = gdk_drag_context_get_selected_action (context);

	if (real_action == GDK_ACTION_ASK) {
		/* FIXME bugzilla.gnome.org 42485: This belongs in FMDirectoryView, not here. */
		/* Check for special case items in selection list */
		if (nemo_drag_selection_includes_special_link (container->details->dnd_info->drag_info.selection_list)) {
			/* We only want to move the trash */
			action = GDK_ACTION_MOVE;
		} else {
			action = GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK;
		}
		real_action = nemo_drag_drop_action_ask (GTK_WIDGET (container), action);
	}

	if (real_action > 0) {
		eel_canvas_window_to_world (EEL_CANVAS (container),
					    x + gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container))),
					    y + gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container))),
					    &world_x, &world_y);

		drop_target = nemo_icon_container_find_drop_target (container, 
									context, x, y, &icon_hit, FALSE);

		local_move_only = FALSE;
		if (!icon_hit && real_action == GDK_ACTION_MOVE) {
			/* we can just move the icon positions if the move ended up in
			 * the item's parent container
			 */
			local_move_only = nemo_icon_container_selection_items_local
				(container, container->details->dnd_info->drag_info.selection_list);
		}

		if (local_move_only) {
			handle_local_move (container, world_x, world_y);
		} else {
			handle_nonlocal_move (container, real_action, world_x, world_y, drop_target, icon_hit);
		}
	}

	g_free (drop_target);
	nemo_drag_destroy_selection_list (container->details->dnd_info->drag_info.selection_list);
	container->details->dnd_info->drag_info.selection_list = NULL;
}
开发者ID:Acidburn0zzz,项目名称:nemo,代码行数:60,代码来源:nemo-icon-dnd.c


示例4: drag_begin_callback

static void
drag_begin_callback (GtkWidget      *widget,
		     GdkDragContext *context,
		     gpointer        data)
{
	NemoIconContainer *container;
	cairo_surface_t *surface;
	double x1, y1, x2, y2, winx, winy;
	int x_offset, y_offset;
	int start_x, start_y;

	container = NEMO_ICON_CONTAINER (widget);

	start_x = container->details->dnd_info->drag_info.start_x +
		gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
	start_y = container->details->dnd_info->drag_info.start_y +
		gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)));

        /* create a pixmap and mask to drag with */
        surface = nemo_icon_canvas_item_get_drag_surface (container->details->drag_icon->item);

        /* compute the image's offset */
	eel_canvas_item_get_bounds (EEL_CANVAS_ITEM (container->details->drag_icon->item),
				    &x1, &y1, &x2, &y2);
	eel_canvas_world_to_window (EEL_CANVAS (container), 
				    x1, y1,  &winx, &winy);
        x_offset = start_x - winx;
        y_offset = start_y - winy;

        cairo_surface_set_device_offset (surface, -x_offset, -y_offset);
        gtk_drag_set_icon_surface (context, surface);
        cairo_surface_destroy (surface);
}
开发者ID:Ahmed-Developer,项目名称:nemo,代码行数:33,代码来源:nemo-icon-dnd.c


示例5: wrap_table_child_focus_in

static gboolean
wrap_table_child_focus_in (GtkWidget *widget,
                           GdkEventFocus *event,
                           gpointer data)
{
    gint x, y;
    GtkWidget *container, *viewport = NULL;

    container = gtk_widget_get_parent (widget);
    if (container)
    {
        viewport = gtk_widget_get_parent (container);
    }
    g_assert (container && viewport);
    g_assert (GTK_IS_VIEWPORT (viewport));
    g_return_val_if_fail (gtk_widget_get_realized (viewport), FALSE);

    if (!wrap_table_child_visible_in (widget, viewport))
    {
        GtkAdjustment *hadj, *vadj;

        hadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (viewport));
        vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (viewport));

        gtk_widget_translate_coordinates (widget, container, 0, 0, &x, &y);

        gtk_adjustment_set_value (hadj, MIN (x, gtk_adjustment_get_upper(hadj) - gtk_adjustment_get_page_size(hadj)));
        gtk_adjustment_set_value (vadj, MIN (y, gtk_adjustment_get_upper(vadj) - gtk_adjustment_get_page_size(vadj)));
    }

    return FALSE;
}
开发者ID:mate-desktop,项目名称:caja,代码行数:32,代码来源:eel-wrap-table.c


示例6: get_adjustments

static void
get_adjustments (SoliPrintPreview  *preview,
		 GtkAdjustment     **hadj,
		 GtkAdjustment     **vadj)
{
	*hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (preview->layout));
	*vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (preview->layout));
}
开发者ID:dluco,项目名称:Soli,代码行数:8,代码来源:soli-print-preview.c


示例7: canvas_widget_to_world

static void
canvas_widget_to_world (EelCanvas *canvas,
			double widget_x, double widget_y,
			double *world_x, double *world_y)
{
	eel_canvas_window_to_world (canvas,
				    widget_x + gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas))),
				    widget_y + gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas))),
				    world_x, world_y);
}
开发者ID:Ahmed-Developer,项目名称:nemo,代码行数:10,代码来源:nemo-icon-dnd.c


示例8: ide_terminal_page_connect_terminal

static void
ide_terminal_page_connect_terminal (IdeTerminalPage *self,
                                    VteTerminal     *terminal)
{
  GtkAdjustment *vadj;

  vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (terminal));

  gtk_range_set_adjustment (GTK_RANGE (self->top_scrollbar), vadj);

  g_signal_connect_object (terminal,
                           "focus-in-event",
                           G_CALLBACK (focus_in_event_cb),
                           self,
                           0);

  g_signal_connect_object (terminal,
                           "window-title-changed",
                           G_CALLBACK (window_title_changed_cb),
                           self,
                           0);

  if (terminal_has_notification_signal ())
    {
      g_signal_connect_object (terminal,
                               "notification-received",
                               G_CALLBACK (notification_received_cb),
                               self,
                               0);
    }
}
开发者ID:GNOME,项目名称:gnome-builder,代码行数:31,代码来源:ide-terminal-page.c


示例9: cainteoir_document_view_get_property

static void
cainteoir_document_view_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
	CainteoirDocumentViewPrivate *priv = CAINTEOIR_DOCUMENT_VIEW_PRIVATE(object);
	GtkScrollable *scroll = GTK_SCROLLABLE(priv->text_view);
	switch (prop_id)
	{
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
		break;
	// GtkScrollable interface:
	case PROP_HADJUSTMENT:
		g_value_set_object(value, gtk_scrollable_get_hadjustment(scroll));
		break;
	case PROP_VADJUSTMENT:
		g_value_set_object(value, gtk_scrollable_get_vadjustment(scroll));
		break;
	case PROP_HSCROLL_POLICY:
		g_value_set_enum(value, gtk_scrollable_get_hscroll_policy(scroll));
		break;
	case PROP_VSCROLL_POLICY:
		g_value_set_enum(value, gtk_scrollable_get_vscroll_policy(scroll));
		break;
	}
}
开发者ID:happytcj,项目名称:cainteoir-gtk,代码行数:25,代码来源:cainteoir_document_view.cpp


示例10: item_list_view_clear

/* cleans up the item list, sets up the iter hash when called for the first time */
void
item_list_view_clear (ItemListView *ilv)
{
	GtkAdjustment		*adj;
	GtkTreeStore		*itemstore;

	itemstore = GTK_TREE_STORE (gtk_tree_view_get_model (ilv->priv->treeview));
	
	/* unselecting all items is important to remove items
	   whose removal is deferred until unselecting */
	gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (ilv->priv->treeview));
	
	adj = gtk_tree_view_get_vadjustment (ilv->priv->treeview);
	gtk_adjustment_set_value (adj, 0.0);
#if GTK_API_VERSION >= 3
	gtk_scrollable_set_vadjustment (GTK_SCROLLABLE (ilv->priv->treeview), adj);
#else
	gtk_tree_view_set_vadjustment (ilv->priv->treeview, adj);
#endif
	if (itemstore)
		gtk_tree_store_clear (itemstore);
	if (ilv->priv->item_id_to_iter)
		g_hash_table_destroy (ilv->priv->item_id_to_iter);
	
	ilv->priv->item_id_to_iter = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
	
	/* enable batch mode for following item adds */
	ilv->priv->batch_mode = TRUE;
	ilv->priv->batch_itemstore = item_list_view_create_tree_store ();
}
开发者ID:dmitryvk,项目名称:liferea,代码行数:31,代码来源:item_list_view.c


示例11: chat_text_view_scroll_cb

/* Code stolen from pidgin/gtkimhtml.c */
static gboolean
chat_text_view_scroll_cb (EmpathyChatTextView *view)
{
	EmpathyChatTextViewPriv *priv;
	GtkAdjustment      *adj;
	gdouble             max_val;

	priv = GET_PRIV (view);

	adj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (view));
	max_val = gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj);

	g_return_val_if_fail (priv->scroll_time != NULL, FALSE);

	if (g_timer_elapsed (priv->scroll_time, NULL) > MAX_SCROLL_TIME) {
		/* time's up. jump to the end and kill the timer */
		gtk_adjustment_set_value (adj, max_val);
		chat_text_view_scroll_stop (view);
		return FALSE;
	}

	/* scroll by 1/3rd the remaining distance */
	gtk_adjustment_set_value (adj, gtk_adjustment_get_value (adj) + ((max_val - gtk_adjustment_get_value (adj)) / 3));
	return TRUE;
}
开发者ID:JGulic,项目名称:empathy,代码行数:26,代码来源:empathy-chat-text-view.c


示例12: _gtk_text_handle_parent_hierarchy_changed

static void
_gtk_text_handle_parent_hierarchy_changed (GtkWidget     *widget,
                                           GtkWindow     *previous_toplevel,
                                           GtkTextHandle *handle)
{
  GtkWidget *toplevel, *scrollable;
  GtkTextHandlePrivate *priv;

  priv = handle->priv;
  toplevel = gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW);

  if (previous_toplevel && !toplevel)
    {
      if (priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].widget)
        {
          _gtk_window_remove_popover (GTK_WINDOW (previous_toplevel),
                                      priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].widget);
          g_object_unref (priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].widget);
          priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].widget = NULL;
        }

      if (priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END].widget)
        {
          _gtk_window_remove_popover (GTK_WINDOW (previous_toplevel),
                                      priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END].widget);
          g_object_unref (priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END].widget);
          priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END].widget = NULL;
        }
    }

  scrollable = gtk_text_handle_lookup_scrollable (handle);
  _gtk_text_handle_update_scrollable (handle, GTK_SCROLLABLE (scrollable));
}
开发者ID:GYGit,项目名称:gtk,代码行数:33,代码来源:gtktexthandle.c


示例13: gnc_header_set_property

static void
gnc_header_set_property (GObject *object,
                         guint param_id,
                         const GValue *value,
                         GParamSpec *pspec)
{
    GncHeader *header = GNC_HEADER (object);
    GtkLayout *layout = GTK_LAYOUT (header);
    gboolean needs_update = FALSE;
    gchar *old_name;

    switch (param_id)
    {
    case PROP_SHEET:
        header->sheet = GNUCASH_SHEET (g_value_get_object (value));
        gtk_scrollable_set_hadjustment (GTK_SCROLLABLE(layout), header->sheet->hadj);
        needs_update = TRUE;
        break;
    case PROP_CURSOR_NAME:
        old_name = header->cursor_name;

        header->cursor_name = g_value_dup_string (value);
        needs_update = !old_name || !header->cursor_name ||
                       strcmp (old_name, header->cursor_name) != 0;
        g_free (old_name);
        break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
        break;
    }

    if ((header->sheet != NULL) && needs_update)
        gnc_header_reconfigure (header);
}
开发者ID:limitedAtonement,项目名称:gnucash,代码行数:34,代码来源:gnucash-header.c


示例14: _gtk_text_handle_set_parent

static void
_gtk_text_handle_set_parent (GtkTextHandle *handle,
                             GtkWidget     *parent)
{
  GtkTextHandlePrivate *priv;
  GtkWidget *scrollable = NULL;

  priv = handle->priv;

  if (priv->parent == parent)
    return;

  if (priv->parent && priv->hierarchy_changed_id &&
      g_signal_handler_is_connected (priv->parent, priv->hierarchy_changed_id))
    g_signal_handler_disconnect (priv->parent, priv->hierarchy_changed_id);

  priv->parent = parent;

  if (parent)
    {
      priv->hierarchy_changed_id =
        g_signal_connect (parent, "hierarchy-changed",
                          G_CALLBACK (_gtk_text_handle_parent_hierarchy_changed),
                          handle);

      scrollable = gtk_text_handle_lookup_scrollable (handle);
    }

  _gtk_text_handle_update_scrollable (handle, GTK_SCROLLABLE (scrollable));
}
开发者ID:GYGit,项目名称:gtk,代码行数:30,代码来源:gtktexthandle.c


示例15: nsgtk_layout_set_vadjustment

void nsgtk_layout_set_vadjustment(GtkLayout *layout, GtkAdjustment *adj) 
{
#if GTK_CHECK_VERSION(3,0,0)
	gtk_scrollable_set_vadjustment(GTK_SCROLLABLE(layout), adj);
#else
	gtk_layout_set_vadjustment(layout, adj);
#endif
}
开发者ID:pcwalton,项目名称:NetSurf,代码行数:8,代码来源:compat.c


示例16: GTK_CHECK_VERSION

GtkAdjustment *nsgtk_layout_get_hadjustment(GtkLayout *layout)
{
#if GTK_CHECK_VERSION(3,0,0)
	return gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(layout));
#else
	return gtk_layout_get_hadjustment(layout);
#endif
}
开发者ID:pcwalton,项目名称:NetSurf,代码行数:8,代码来源:compat.c


示例17: horizontal_policy_changed

static void
horizontal_policy_changed (GtkComboBox *combo_box,
			   GtkViewport *viewport)
{
  GtkScrollablePolicy policy = gtk_combo_box_get_active (combo_box);

  gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (viewport), policy);
}
开发者ID:GYGit,项目名称:gtk,代码行数:8,代码来源:testscrolledwindow.c


示例18: _gtk_text_handle_scrollable_notify

static void
_gtk_text_handle_scrollable_notify (GObject       *object,
                                    GParamSpec    *pspec,
                                    GtkTextHandle *handle)
{
  if (pspec->value_type == GTK_TYPE_ADJUSTMENT)
    _gtk_text_handle_set_scrollable (handle, GTK_SCROLLABLE (object));
}
开发者ID:GYGit,项目名称:gtk,代码行数:8,代码来源:gtktexthandle.c


示例19: disconnect_view

static void
disconnect_view (GtkSourceMap *map)
{
	GtkSourceMapPrivate *priv;
	GtkAdjustment *vadj;

	priv = gtk_source_map_get_instance_private (map);

	if (priv->view == NULL)
	{
		return;
	}

	disconnect_buffer (map);

	if (priv->buffer_binding != NULL)
	{
		g_object_remove_weak_pointer (G_OBJECT (priv->buffer_binding),
		                              (gpointer *)&priv->buffer_binding);
		g_binding_unbind (priv->buffer_binding);
		priv->buffer_binding = NULL;
	}

	if (priv->indent_width_binding != NULL)
	{
		g_object_remove_weak_pointer (G_OBJECT (priv->indent_width_binding),
		                              (gpointer *)&priv->indent_width_binding);
		g_binding_unbind (priv->indent_width_binding);
		priv->indent_width_binding = NULL;
	}

	if (priv->tab_width_binding != NULL)
	{
		g_object_remove_weak_pointer (G_OBJECT (priv->tab_width_binding),
		                              (gpointer *)&priv->tab_width_binding);
		g_binding_unbind (priv->tab_width_binding);
		priv->tab_width_binding = NULL;
	}

	if (priv->view_notify_buffer_handler != 0)
	{
		g_signal_handler_disconnect (priv->view, priv->view_notify_buffer_handler);
		priv->view_notify_buffer_handler = 0;
	}

	vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (priv->view));
	if (vadj != NULL)
	{
		g_signal_handler_disconnect (vadj, priv->view_vadj_value_changed_handler);
		priv->view_vadj_value_changed_handler = 0;

		g_signal_handler_disconnect (vadj, priv->view_vadj_notify_upper_handler);
		priv->view_vadj_notify_upper_handler = 0;
	}

	g_object_remove_weak_pointer (G_OBJECT (priv->view), (gpointer *)&priv->view);
	priv->view = NULL;
}
开发者ID:mgedmin,项目名称:gtksourceview,代码行数:58,代码来源:gtksourcemap.c


示例20: scroll_layout

static gboolean
scroll_layout (gpointer data)
{
  GtkWidget *layout = data;
  GtkAdjustment *adj;

  adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (layout));
  gtk_adjustment_set_value (adj, gtk_adjustment_get_value (adj) + 5.0);
  return G_SOURCE_CONTINUE;
}
开发者ID:BoozzyAmdJin,项目名称:gtk-,代码行数:10,代码来源:testoffscreen.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GTK_SCROLLED_WINDOW函数代码示例发布时间:2022-05-30
下一篇:
C++ GTK_SCALE_BUTTON函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap