From 8b70260528c02db27c3e4546bf7b28b2a4286b24 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 9 Jun 2011 14:42:31 +0100 Subject: [PATCH] test-bin-layout: Use the long-press signal on ClickAction --- tests/interactive/test-bin-layout.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/tests/interactive/test-bin-layout.c b/tests/interactive/test-bin-layout.c index bc461ba81..7414b7a38 100644 --- a/tests/interactive/test-bin-layout.c +++ b/tests/interactive/test-bin-layout.c @@ -5,6 +5,8 @@ static const ClutterColor bg_color = { 0xcc, 0xcc, 0xcc, 0x99 }; +static gboolean is_expanded = FALSE; + static void update_background (ClutterActor *tex, const ClutterColor *color, @@ -95,8 +97,6 @@ on_rect_clicked (ClutterClickAction *action, ClutterActor *rect, ClutterActor *box) { - static gboolean is_expanded = FALSE; - if (!is_expanded) clutter_actor_animate (box, CLUTTER_EASE_OUT_BOUNCE, 250, "width", 400.0, @@ -111,6 +111,30 @@ on_rect_clicked (ClutterClickAction *action, is_expanded = !is_expanded; } +static gboolean +on_rect_long_press (ClutterClickAction *action, + ClutterActor *rect, + ClutterLongPressState state, + ClutterActor *box) +{ + switch (state) + { + case CLUTTER_LONG_PRESS_QUERY: + g_print ("*** long press: query ***\n"); + return is_expanded; + + case CLUTTER_LONG_PRESS_CANCEL: + g_print ("*** long press: cancel ***\n"); + break; + + case CLUTTER_LONG_PRESS_ACTIVATE: + g_print ("*** long press: activate ***\n"); + break; + } + + return TRUE; +} + static void on_box_allocation_changed (ClutterActor *box, const ClutterActorBox *allocation, @@ -219,6 +243,7 @@ test_bin_layout_main (int argc, char *argv[]) action = clutter_click_action_new (); clutter_actor_add_action (rect, action); g_signal_connect (action, "clicked", G_CALLBACK (on_rect_clicked), box); + g_signal_connect (action, "long-press", G_CALLBACK (on_rect_long_press), box); g_signal_connect (box, "enter-event", G_CALLBACK (on_box_enter), rect);