2010-04-26 18:07:22 +00:00
|
|
|
/* CALLY - The Clutter Accessibility Implementation Library
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Igalia, S.L.
|
|
|
|
*
|
|
|
|
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <clutter/clutter.h>
|
|
|
|
|
|
|
|
#include "cally-examples-util.h"
|
|
|
|
|
|
|
|
#define WIDTH 300
|
|
|
|
#define HEIGHT 300
|
|
|
|
#define SIZE 50
|
|
|
|
#define DEPTH -100
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
ClutterActor *stage = NULL;
|
|
|
|
ClutterActor *button1 = NULL;
|
|
|
|
ClutterActor *button2 = NULL;
|
|
|
|
ClutterActor *button3 = NULL;
|
|
|
|
ClutterActor *button4 = NULL;
|
|
|
|
ClutterActor *group[4];
|
2011-11-08 14:46:16 +00:00
|
|
|
int i = 0;
|
2010-04-26 18:07:22 +00:00
|
|
|
|
2011-02-22 00:19:35 +00:00
|
|
|
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
|
|
|
return 1;
|
2010-04-26 18:07:22 +00:00
|
|
|
|
|
|
|
cally_util_a11y_init (&argc, &argv);
|
|
|
|
|
2011-11-08 17:11:34 +00:00
|
|
|
stage = clutter_stage_new ();
|
2010-04-26 18:07:22 +00:00
|
|
|
|
2011-11-08 17:11:34 +00:00
|
|
|
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cally - AtkComponent Test");
|
2012-10-07 18:18:33 +00:00
|
|
|
clutter_actor_set_background_color (stage, CLUTTER_COLOR_White);
|
2010-04-26 18:07:22 +00:00
|
|
|
clutter_actor_set_size (stage, WIDTH, HEIGHT);
|
|
|
|
|
2011-11-09 10:55:49 +00:00
|
|
|
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
|
|
|
|
2012-10-07 18:18:33 +00:00
|
|
|
button1 = clutter_actor_new ();
|
|
|
|
clutter_actor_set_background_color (button1, CLUTTER_COLOR_Yellow);
|
2011-11-08 14:46:16 +00:00
|
|
|
clutter_actor_set_size (button1, SIZE, SIZE);
|
2010-04-26 18:07:22 +00:00
|
|
|
|
2012-10-07 18:18:33 +00:00
|
|
|
button2 = clutter_actor_new ();
|
|
|
|
clutter_actor_set_background_color (button2, CLUTTER_COLOR_Green);
|
2011-11-08 14:46:16 +00:00
|
|
|
clutter_actor_set_position (button2, 2 * SIZE, 0);
|
|
|
|
clutter_actor_set_size (button2, SIZE, SIZE);
|
2010-04-26 18:07:22 +00:00
|
|
|
|
2012-10-07 18:18:33 +00:00
|
|
|
button3 = clutter_actor_new ();
|
|
|
|
clutter_actor_set_background_color (button3, CLUTTER_COLOR_Blue);
|
2011-11-08 14:46:16 +00:00
|
|
|
clutter_actor_set_position (button3, 0, 2 * SIZE);
|
|
|
|
clutter_actor_set_size (button3, SIZE, SIZE);
|
2012-10-07 18:18:33 +00:00
|
|
|
clutter_actor_set_z_position (button3, DEPTH);
|
2010-04-26 18:07:22 +00:00
|
|
|
|
|
|
|
/* a nested hierarchy, to check that the relative positions are
|
|
|
|
computed properly */
|
2012-10-07 18:18:33 +00:00
|
|
|
button4 = clutter_actor_new ();
|
|
|
|
clutter_actor_set_background_color (button4, CLUTTER_COLOR_Magenta);
|
2011-11-08 14:46:16 +00:00
|
|
|
clutter_actor_set_position (button4, SIZE / 2, SIZE / 2);
|
|
|
|
clutter_actor_set_size (button4, SIZE, SIZE);
|
2010-04-26 18:07:22 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
2012-10-07 18:18:33 +00:00
|
|
|
group[i] = clutter_actor_new ();
|
2011-11-08 14:46:16 +00:00
|
|
|
clutter_actor_set_position (group[i], SIZE / 2, SIZE / 2);
|
|
|
|
clutter_actor_set_size (group[i], SIZE, SIZE);
|
2010-04-26 18:07:22 +00:00
|
|
|
|
|
|
|
if (i > 0)
|
2012-10-07 18:18:33 +00:00
|
|
|
clutter_actor_add_child (group[i], group[i - 1]);
|
2010-04-26 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
2012-10-07 18:18:33 +00:00
|
|
|
clutter_actor_add_child (stage, button1);
|
|
|
|
clutter_actor_add_child (stage, button2);
|
|
|
|
clutter_actor_add_child (stage, button3);
|
|
|
|
clutter_actor_add_child (stage, group[3]);
|
|
|
|
clutter_actor_add_child (group[0], button4);
|
2010-04-26 18:07:22 +00:00
|
|
|
|
2011-11-08 14:46:16 +00:00
|
|
|
clutter_actor_show (stage);
|
2010-04-26 18:07:22 +00:00
|
|
|
|
|
|
|
clutter_main ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|