From 5b5813fcdcfce7de6492019e426b60c116a74902 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Tue, 18 Mar 2014 20:42:59 -0700 Subject: [PATCH] stack: Add counterparts of OVER_UP_DOWN transition The GtkStackTransitionType enum now has OVER_DOWN_UP, OVER_LEFT_RIGHT, and OVER_RIGHT_LEFT values to complement OVER_UP_DOWN. https://bugzilla.gnome.org/show_bug.cgi?id=726676 --- gtk/gtkstack.c | 16 ++++++++++++++-- gtk/gtkstack.h | 5 ++++- tests/teststack.c | 3 +++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c index b248161632..2534da6250 100644 --- a/gtk/gtkstack.c +++ b/gtk/gtkstack.c @@ -66,7 +66,10 @@ * @GTK_STACK_TRANSITION_TYPE_UNDER_DOWN: Uncover the new page by sliding down. Since: 3.12 * @GTK_STACK_TRANSITION_TYPE_UNDER_LEFT: Uncover the new page by sliding to the left. Since: 3.12 * @GTK_STACK_TRANSITION_TYPE_UNDER_RIGHT: Uncover the new page by sliding to the right. Since: 3.12 - * @GTK_STACK_TRANSITION_TYPE_OVER_UP_DOWN: Cover the old page or uncover the new page, according to order. Since: 3.12 + * @GTK_STACK_TRANSITION_TYPE_OVER_UP_DOWN: Cover the old page sliding up or uncover the new page sliding down, according to order. Since: 3.12 + * @GTK_STACK_TRANSITION_TYPE_OVER_DOWN_UP: Cover the old page sliding down or uncover the new page sliding up, according to order. Since: 3.14 + * @GTK_STACK_TRANSITION_TYPE_OVER_LEFT_RIGHT: Cover the old page sliding left or uncover the new page sliding right, according to order. Since: 3.14 + * @GTK_STACK_TRANSITION_TYPE_OVER_RIGHT_LEFT: Cover the old page sliding right or uncover the new page sliding left, according to order. Since: 3.14 * * These enumeration values describe the possible transitions * between pages in a #GtkStack widget. @@ -724,7 +727,10 @@ is_direction_dependent_transition (GtkStackTransitionType transition_type) { return (transition_type == GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT || transition_type == GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN || - transition_type == GTK_STACK_TRANSITION_TYPE_OVER_UP_DOWN); + transition_type == GTK_STACK_TRANSITION_TYPE_OVER_UP_DOWN || + transition_type == GTK_STACK_TRANSITION_TYPE_OVER_DOWN_UP || + transition_type == GTK_STACK_TRANSITION_TYPE_OVER_LEFT_RIGHT || + transition_type == GTK_STACK_TRANSITION_TYPE_OVER_RIGHT_LEFT); } /* Returns simple transition type for a direction dependent transition, given @@ -742,6 +748,12 @@ get_simple_transition_type (gboolean new_child_first, return new_child_first ? GTK_STACK_TRANSITION_TYPE_SLIDE_DOWN : GTK_STACK_TRANSITION_TYPE_SLIDE_UP; case GTK_STACK_TRANSITION_TYPE_OVER_UP_DOWN: return new_child_first ? GTK_STACK_TRANSITION_TYPE_UNDER_DOWN : GTK_STACK_TRANSITION_TYPE_OVER_UP; + case GTK_STACK_TRANSITION_TYPE_OVER_DOWN_UP: + return new_child_first ? GTK_STACK_TRANSITION_TYPE_UNDER_UP : GTK_STACK_TRANSITION_TYPE_OVER_DOWN; + case GTK_STACK_TRANSITION_TYPE_OVER_LEFT_RIGHT: + return new_child_first ? GTK_STACK_TRANSITION_TYPE_UNDER_RIGHT : GTK_STACK_TRANSITION_TYPE_OVER_LEFT; + case GTK_STACK_TRANSITION_TYPE_OVER_RIGHT_LEFT: + return new_child_first ? GTK_STACK_TRANSITION_TYPE_UNDER_LEFT : GTK_STACK_TRANSITION_TYPE_OVER_RIGHT; } return transition_type; } diff --git a/gtk/gtkstack.h b/gtk/gtkstack.h index edecf7f5a3..3240ada482 100644 --- a/gtk/gtkstack.h +++ b/gtk/gtkstack.h @@ -54,7 +54,10 @@ typedef enum { GTK_STACK_TRANSITION_TYPE_UNDER_DOWN, GTK_STACK_TRANSITION_TYPE_UNDER_LEFT, GTK_STACK_TRANSITION_TYPE_UNDER_RIGHT, - GTK_STACK_TRANSITION_TYPE_OVER_UP_DOWN + GTK_STACK_TRANSITION_TYPE_OVER_UP_DOWN, + GTK_STACK_TRANSITION_TYPE_OVER_DOWN_UP, + GTK_STACK_TRANSITION_TYPE_OVER_LEFT_RIGHT, + GTK_STACK_TRANSITION_TYPE_OVER_RIGHT_LEFT } GtkStackTransitionType; struct _GtkStack { diff --git a/tests/teststack.c b/tests/teststack.c index 76933ee1ac..bca6265a82 100644 --- a/tests/teststack.c +++ b/tests/teststack.c @@ -227,6 +227,9 @@ main (gint argc, gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "UNDER_LEFT"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "UNDER_RIGHT"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "OVER_UP_DOWN"); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "OVER_DOWN_UP"); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "OVER_LEFT_RIGHT"); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "OVER_RIGHT_LEFT"); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); gtk_container_add (GTK_CONTAINER (hbox), combo);