本文整理汇总了C++中GTK_SCROLLABLE函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_SCROLLABLE函数的具体用法?C++ GTK_SCROLLABLE怎么用?C++ GTK_SCROLLABLE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_SCROLLABLE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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));
}
示例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;
}
示例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);
}
示例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;
}
示例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));
}
示例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);
}
示例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);
}
}
示例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;
}
}
示例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 ();
}
示例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;
}
示例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));
}
示例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);
}
示例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));
}
示例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
}