diff options
author | Alexander Larsson <alexl@redhat.com> | 2009-01-21 13:11:54 +0100 |
---|---|---|
committer | Alexander Larsson <alex@localhost.localdomain> | 2009-04-02 10:15:21 +0200 |
commit | c2ee81ea86eb5c32b144fa96ab147edde5d73b30 (patch) | |
tree | 0ebaab2256c0f216f56c8430e721c0cef5e7377a /tests | |
parent | 50d9a9018ae5f4d9f6fe9b15bdc5555cd1b50dc8 (diff) | |
download | gtk+-c2ee81ea86eb5c32b144fa96ab147edde5d73b30.tar.gz |
Add support for scrolling to testwindows
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testwindows.c | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/tests/testwindows.c b/tests/testwindows.c index 480fab5d6d..8382d5b8d2 100644 --- a/tests/testwindows.c +++ b/tests/testwindows.c @@ -424,6 +424,48 @@ move_window_clicked (GtkWidget *button, } static void +scroll_window_clicked (GtkWidget *button, + gpointer data) +{ + GdkWindow *window; + GtkDirectionType direction; + GList *selected, *l; + gint dx, dy; + + direction = GPOINTER_TO_INT (data); + + selected = get_selected_windows (); + + dx = 0; dy = 0; + switch (direction) { + case GTK_DIR_UP: + dy = 10; + break; + case GTK_DIR_DOWN: + dy = -10; + break; + case GTK_DIR_LEFT: + dx = 10; + break; + case GTK_DIR_RIGHT: + dx = -10; + break; + default: + break; + } + + for (l = selected; l != NULL; l = l->next) + { + window = l->data; + + gdk_window_scroll (window, dx, dy); + } + + g_list_free (selected); +} + + +static void raise_window_clicked (GtkWidget *button, gpointer data) { @@ -699,7 +741,7 @@ main (int argc, char **argv) gtk_widget_show (scrolled); gtk_widget_show (treeview); - table = gtk_table_new (3, 3, TRUE); + table = gtk_table_new (4, 4, TRUE); gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, @@ -811,6 +853,34 @@ main (int argc, char **argv) gtk_widget_show (button); + button = gtk_button_new_with_label ("scroll"); + gtk_button_set_image (GTK_BUTTON (button), + gtk_image_new_from_stock (GTK_STOCK_GO_UP, + GTK_ICON_SIZE_BUTTON)); + g_signal_connect (button, "clicked", + G_CALLBACK (scroll_window_clicked), + GINT_TO_POINTER (GTK_DIR_UP)); + gtk_table_attach_defaults (GTK_TABLE (table), + button, + 3, 4, + 0, 1); + gtk_widget_show (button); + + button = gtk_button_new_with_label ("scroll"); + gtk_button_set_image (GTK_BUTTON (button), + gtk_image_new_from_stock (GTK_STOCK_GO_DOWN, + GTK_ICON_SIZE_BUTTON)); + g_signal_connect (button, "clicked", + G_CALLBACK (scroll_window_clicked), + GINT_TO_POINTER (GTK_DIR_DOWN)); + gtk_table_attach_defaults (GTK_TABLE (table), + button, + 3, 4, + 1, 2); + gtk_widget_show (button); + + + button = gtk_button_new_with_label ("Add window"); gtk_box_pack_start (GTK_BOX (vbox), button, |