forked from AuroraMiddleware/gtk
scrolledwindow: Port bindings to use shortcuts
This commit is contained in:
parent
45ec453b76
commit
fb7d1095d1
@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include "gtkadjustment.h"
|
#include "gtkadjustment.h"
|
||||||
#include "gtkadjustmentprivate.h"
|
#include "gtkadjustmentprivate.h"
|
||||||
#include "gtkbindings.h"
|
|
||||||
#include "gtkeventcontrollermotion.h"
|
#include "gtkeventcontrollermotion.h"
|
||||||
#include "gtkeventcontrollerscroll.h"
|
#include "gtkeventcontrollerscroll.h"
|
||||||
#include "gtkgesturedrag.h"
|
#include "gtkgesturedrag.h"
|
||||||
@ -413,7 +412,7 @@ static GParamSpec *properties[NUM_PROPERTIES];
|
|||||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkScrolledWindow, gtk_scrolled_window, GTK_TYPE_BIN)
|
G_DEFINE_TYPE_WITH_PRIVATE (GtkScrolledWindow, gtk_scrolled_window, GTK_TYPE_BIN)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_scroll_binding (GtkBindingSet *binding_set,
|
add_scroll_binding (GtkWidgetClass *widget_class,
|
||||||
guint keyval,
|
guint keyval,
|
||||||
GdkModifierType mask,
|
GdkModifierType mask,
|
||||||
GtkScrollType scroll,
|
GtkScrollType scroll,
|
||||||
@ -421,27 +420,29 @@ add_scroll_binding (GtkBindingSet *binding_set,
|
|||||||
{
|
{
|
||||||
guint keypad_keyval = keyval - GDK_KEY_Left + GDK_KEY_KP_Left;
|
guint keypad_keyval = keyval - GDK_KEY_Left + GDK_KEY_KP_Left;
|
||||||
|
|
||||||
gtk_binding_entry_add_signal (binding_set, keyval, mask,
|
gtk_widget_class_add_binding_signal (widget_class,
|
||||||
"scroll-child", 2,
|
keyval, mask,
|
||||||
GTK_TYPE_SCROLL_TYPE, scroll,
|
"scroll-child",
|
||||||
G_TYPE_BOOLEAN, horizontal);
|
"(ib)", scroll, horizontal);
|
||||||
gtk_binding_entry_add_signal (binding_set, keypad_keyval, mask,
|
gtk_widget_class_add_binding_signal (widget_class,
|
||||||
"scroll-child", 2,
|
keypad_keyval, mask,
|
||||||
GTK_TYPE_SCROLL_TYPE, scroll,
|
"scroll-child",
|
||||||
G_TYPE_BOOLEAN, horizontal);
|
"(ib)", scroll, horizontal);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_tab_bindings (GtkBindingSet *binding_set,
|
add_tab_bindings (GtkWidgetClass *widget_class,
|
||||||
GdkModifierType modifiers,
|
GdkModifierType modifiers,
|
||||||
GtkDirectionType direction)
|
GtkDirectionType direction)
|
||||||
{
|
{
|
||||||
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Tab, modifiers,
|
gtk_widget_class_add_binding_signal (widget_class,
|
||||||
"move-focus-out", 1,
|
GDK_KEY_Tab, modifiers,
|
||||||
GTK_TYPE_DIRECTION_TYPE, direction);
|
"move-focus-out",
|
||||||
gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Tab, modifiers,
|
"(i)", direction);
|
||||||
"move-focus-out", 1,
|
gtk_widget_class_add_binding_signal (widget_class,
|
||||||
GTK_TYPE_DIRECTION_TYPE, direction);
|
GDK_KEY_KP_Tab, modifiers,
|
||||||
|
"move-focus-out",
|
||||||
|
"(i)", direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -517,7 +518,6 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
|
|||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
||||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||||
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
|
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
|
||||||
GtkBindingSet *binding_set;
|
|
||||||
|
|
||||||
gobject_class->set_property = gtk_scrolled_window_set_property;
|
gobject_class->set_property = gtk_scrolled_window_set_property;
|
||||||
gobject_class->get_property = gtk_scrolled_window_get_property;
|
gobject_class->get_property = gtk_scrolled_window_get_property;
|
||||||
@ -789,25 +789,23 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
|
|||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
G_TYPE_NONE, 1, GTK_TYPE_POSITION_TYPE);
|
G_TYPE_NONE, 1, GTK_TYPE_POSITION_TYPE);
|
||||||
|
|
||||||
binding_set = gtk_binding_set_by_class (class);
|
add_scroll_binding (widget_class, GDK_KEY_Left, GDK_CONTROL_MASK, GTK_SCROLL_STEP_BACKWARD, TRUE);
|
||||||
|
add_scroll_binding (widget_class, GDK_KEY_Right, GDK_CONTROL_MASK, GTK_SCROLL_STEP_FORWARD, TRUE);
|
||||||
|
add_scroll_binding (widget_class, GDK_KEY_Up, GDK_CONTROL_MASK, GTK_SCROLL_STEP_BACKWARD, FALSE);
|
||||||
|
add_scroll_binding (widget_class, GDK_KEY_Down, GDK_CONTROL_MASK, GTK_SCROLL_STEP_FORWARD, FALSE);
|
||||||
|
|
||||||
add_scroll_binding (binding_set, GDK_KEY_Left, GDK_CONTROL_MASK, GTK_SCROLL_STEP_BACKWARD, TRUE);
|
add_scroll_binding (widget_class, GDK_KEY_Page_Up, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_BACKWARD, TRUE);
|
||||||
add_scroll_binding (binding_set, GDK_KEY_Right, GDK_CONTROL_MASK, GTK_SCROLL_STEP_FORWARD, TRUE);
|
add_scroll_binding (widget_class, GDK_KEY_Page_Down, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_FORWARD, TRUE);
|
||||||
add_scroll_binding (binding_set, GDK_KEY_Up, GDK_CONTROL_MASK, GTK_SCROLL_STEP_BACKWARD, FALSE);
|
add_scroll_binding (widget_class, GDK_KEY_Page_Up, 0, GTK_SCROLL_PAGE_BACKWARD, FALSE);
|
||||||
add_scroll_binding (binding_set, GDK_KEY_Down, GDK_CONTROL_MASK, GTK_SCROLL_STEP_FORWARD, FALSE);
|
add_scroll_binding (widget_class, GDK_KEY_Page_Down, 0, GTK_SCROLL_PAGE_FORWARD, FALSE);
|
||||||
|
|
||||||
add_scroll_binding (binding_set, GDK_KEY_Page_Up, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_BACKWARD, TRUE);
|
add_scroll_binding (widget_class, GDK_KEY_Home, GDK_CONTROL_MASK, GTK_SCROLL_START, TRUE);
|
||||||
add_scroll_binding (binding_set, GDK_KEY_Page_Down, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_FORWARD, TRUE);
|
add_scroll_binding (widget_class, GDK_KEY_End, GDK_CONTROL_MASK, GTK_SCROLL_END, TRUE);
|
||||||
add_scroll_binding (binding_set, GDK_KEY_Page_Up, 0, GTK_SCROLL_PAGE_BACKWARD, FALSE);
|
add_scroll_binding (widget_class, GDK_KEY_Home, 0, GTK_SCROLL_START, FALSE);
|
||||||
add_scroll_binding (binding_set, GDK_KEY_Page_Down, 0, GTK_SCROLL_PAGE_FORWARD, FALSE);
|
add_scroll_binding (widget_class, GDK_KEY_End, 0, GTK_SCROLL_END, FALSE);
|
||||||
|
|
||||||
add_scroll_binding (binding_set, GDK_KEY_Home, GDK_CONTROL_MASK, GTK_SCROLL_START, TRUE);
|
add_tab_bindings (widget_class, GDK_CONTROL_MASK, GTK_DIR_TAB_FORWARD);
|
||||||
add_scroll_binding (binding_set, GDK_KEY_End, GDK_CONTROL_MASK, GTK_SCROLL_END, TRUE);
|
add_tab_bindings (widget_class, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
|
||||||
add_scroll_binding (binding_set, GDK_KEY_Home, 0, GTK_SCROLL_START, FALSE);
|
|
||||||
add_scroll_binding (binding_set, GDK_KEY_End, 0, GTK_SCROLL_END, FALSE);
|
|
||||||
|
|
||||||
add_tab_bindings (binding_set, GDK_CONTROL_MASK, GTK_DIR_TAB_FORWARD);
|
|
||||||
add_tab_bindings (binding_set, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
|
|
||||||
|
|
||||||
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SCROLLED_WINDOW_ACCESSIBLE);
|
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SCROLLED_WINDOW_ACCESSIBLE);
|
||||||
gtk_widget_class_set_css_name (widget_class, I_("scrolledwindow"));
|
gtk_widget_class_set_css_name (widget_class, I_("scrolledwindow"));
|
||||||
|
Loading…
Reference in New Issue
Block a user