Add ClutterTableLayout, a layout showing children in rows and columns
A TableLayout is a layout manager that allocates its children in rows and columns. Each child is assigned to a cell (or more if a cell span is set). The supported child properties are: • x-expand and y-expand: if this cell with try to allocate the available extra space for the table. • x-fill and y-fill: if the child will get all the space available in the cell. • x-align and y-align: if the child does not fill the cell, then where the child will be aligned inside the cell. • row-span and col-span: number of cells the child will allocate for itself. Also, the TableLayout has row-spacing and col-spacing for specifying the space in pixels between rows and between columns. We also include a simple test of the layout manager, and the documentation updates. The TableLayout was implemented starting from MxTable and ClutterBoxLayout. http://bugzilla.clutter-project.org/show_bug.cgi?id=2038 Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
parent
1043e77a00
commit
d14e294d86
@ -133,6 +133,7 @@ source_h = \
|
||||
$(srcdir)/clutter-stage-manager.h \
|
||||
$(srcdir)/clutter-stage-window.h \
|
||||
$(srcdir)/clutter-state.h \
|
||||
$(srcdir)/clutter-table-layout.h \
|
||||
$(srcdir)/clutter-texture.h \
|
||||
$(srcdir)/clutter-text.h \
|
||||
$(srcdir)/clutter-timeline.h \
|
||||
@ -227,6 +228,7 @@ source_c = \
|
||||
$(srcdir)/clutter-stage-manager.c \
|
||||
$(srcdir)/clutter-stage-window.c \
|
||||
$(srcdir)/clutter-state.c \
|
||||
$(srcdir)/clutter-table-layout.c \
|
||||
$(srcdir)/clutter-texture.c \
|
||||
$(srcdir)/clutter-text.c \
|
||||
$(srcdir)/clutter-timeline.c \
|
||||
|
2642
clutter/clutter-table-layout.c
Normal file
2642
clutter/clutter-table-layout.c
Normal file
File diff suppressed because it is too large
Load Diff
163
clutter/clutter-table-layout.h
Normal file
163
clutter/clutter-table-layout.h
Normal file
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2010 Intel Corporation.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author:
|
||||
* Jose Dapena Paz <jdapena@igalia.com>
|
||||
*
|
||||
* Based on the MX MxTable actor by:
|
||||
* Thomas Wood <thomas.wood@intel.com>
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_TABLE_LAYOUT_H__
|
||||
#define __CLUTTER_TABLE_LAYOUT_H__
|
||||
|
||||
#include <clutter/clutter-layout-manager.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_TABLE_LAYOUT (clutter_table_layout_get_type ())
|
||||
#define CLUTTER_TABLE_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TABLE_LAYOUT, ClutterTableLayout))
|
||||
#define CLUTTER_IS_TABLE_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TABLE_LAYOUT))
|
||||
#define CLUTTER_TABLE_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TABLE_LAYOUT, ClutterTableLayoutClass))
|
||||
#define CLUTTER_IS_TABLE_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TABLE_LAYOUT))
|
||||
#define CLUTTER_TABLE_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TABLE_LAYOUT, ClutterTableLayoutClass))
|
||||
|
||||
typedef struct _ClutterTableLayout ClutterTableLayout;
|
||||
typedef struct _ClutterTableLayoutPrivate ClutterTableLayoutPrivate;
|
||||
typedef struct _ClutterTableLayoutClass ClutterTableLayoutClass;
|
||||
|
||||
/**
|
||||
* ClutterTableAlignment:
|
||||
* @CLUTTER_TABLE_ALIGNMENT_START: Align the child to the top or to the
|
||||
* left of a cell in the table, depending on the axis
|
||||
* @CLUTTER_TABLE_ALIGNMENT_CENTER: Align the child to the center of
|
||||
* a cell in the table
|
||||
* @CLUTTER_TABLE_ALIGNMENT_END: Align the child to the bottom or to the
|
||||
* right of a cell in the table, depending on the axis
|
||||
*
|
||||
* The alignment policies available on each axis of the #ClutterTableLayout
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
typedef enum {
|
||||
CLUTTER_TABLE_ALIGNMENT_START,
|
||||
CLUTTER_TABLE_ALIGNMENT_CENTER,
|
||||
CLUTTER_TABLE_ALIGNMENT_END
|
||||
} ClutterTableAlignment;
|
||||
|
||||
/**
|
||||
* ClutterTableLayout:
|
||||
*
|
||||
* The #ClutterTableLayout structure contains only private data
|
||||
* and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterTableLayout
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterLayoutManager parent_instance;
|
||||
|
||||
ClutterTableLayoutPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterTableLayoutClass:
|
||||
*
|
||||
* The #ClutterTableLayoutClass structure contains only private
|
||||
* data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterTableLayoutClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterLayoutManagerClass parent_class;
|
||||
};
|
||||
|
||||
GType clutter_table_layout_get_type (void) G_GNUC_CONST;
|
||||
|
||||
ClutterLayoutManager *clutter_table_layout_new (void);
|
||||
|
||||
void clutter_table_layout_pack (ClutterTableLayout *layout,
|
||||
ClutterActor *actor,
|
||||
gint row,
|
||||
gint column);
|
||||
|
||||
void clutter_table_layout_set_column_spacing (ClutterTableLayout *layout,
|
||||
guint spacing);
|
||||
void clutter_table_layout_set_row_spacing (ClutterTableLayout *layout,
|
||||
guint spacing);
|
||||
guint clutter_table_layout_get_column_spacing (ClutterTableLayout *layout);
|
||||
guint clutter_table_layout_get_row_spacing (ClutterTableLayout *layout);
|
||||
|
||||
void clutter_table_layout_set_span (ClutterTableLayout *layout,
|
||||
ClutterActor *actor,
|
||||
gint column_span,
|
||||
gint row_span);
|
||||
void clutter_table_layout_get_span (ClutterTableLayout *layout,
|
||||
ClutterActor *actor,
|
||||
gint *column_span,
|
||||
gint *row_span);
|
||||
void clutter_table_layout_set_alignment (ClutterTableLayout *layout,
|
||||
ClutterActor *actor,
|
||||
ClutterTableAlignment x_align,
|
||||
ClutterTableAlignment y_align);
|
||||
void clutter_table_layout_get_alignment (ClutterTableLayout *layout,
|
||||
ClutterActor *actor,
|
||||
ClutterTableAlignment *x_align,
|
||||
ClutterTableAlignment *y_align);
|
||||
void clutter_table_layout_set_fill (ClutterTableLayout *layout,
|
||||
ClutterActor *actor,
|
||||
gboolean x_fill,
|
||||
gboolean y_fill);
|
||||
void clutter_table_layout_get_fill (ClutterTableLayout *layout,
|
||||
ClutterActor *actor,
|
||||
gboolean *x_fill,
|
||||
gboolean *y_fill);
|
||||
void clutter_table_layout_set_expand (ClutterTableLayout *layout,
|
||||
ClutterActor *actor,
|
||||
gboolean x_expand,
|
||||
gboolean y_expand);
|
||||
void clutter_table_layout_get_expand (ClutterTableLayout *layout,
|
||||
ClutterActor *actor,
|
||||
gboolean *x_expand,
|
||||
gboolean *y_expand);
|
||||
|
||||
gint clutter_table_layout_get_row_count (ClutterTableLayout *layout);
|
||||
gint clutter_table_layout_get_column_count (ClutterTableLayout *layout);
|
||||
|
||||
void clutter_table_layout_set_use_animations (ClutterTableLayout *layout,
|
||||
gboolean animate);
|
||||
gboolean clutter_table_layout_get_use_animations (ClutterTableLayout *layout);
|
||||
void clutter_table_layout_set_easing_mode (ClutterTableLayout *layout,
|
||||
gulong mode);
|
||||
gulong clutter_table_layout_get_easing_mode (ClutterTableLayout *layout);
|
||||
void clutter_table_layout_set_easing_duration (ClutterTableLayout *layout,
|
||||
guint msecs);
|
||||
guint clutter_table_layout_get_easing_duration (ClutterTableLayout *layout);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_TABLE_LAYOUT_H__ */
|
@ -95,6 +95,7 @@
|
||||
#include "clutter-stage-manager.h"
|
||||
#include "clutter-stage-window.h"
|
||||
#include "clutter-state.h"
|
||||
#include "clutter-table-layout.h"
|
||||
#include "clutter-texture.h"
|
||||
#include "clutter-text.h"
|
||||
#include "clutter-timeline.h"
|
||||
|
@ -90,6 +90,7 @@
|
||||
<xi:include href="xml/clutter-bin-layout.xml"/>
|
||||
<xi:include href="xml/clutter-flow-layout.xml"/>
|
||||
<xi:include href="xml/clutter-box-layout.xml"/>
|
||||
<xi:include href="xml/clutter-table-layout.xml"/>
|
||||
</chapter>
|
||||
|
||||
<chapter>
|
||||
|
@ -2068,6 +2068,53 @@ ClutterBoxLayoutPrivate
|
||||
clutter_box_layout_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>clutter-table-layout</FILE>
|
||||
ClutterTableAlignment
|
||||
ClutterTableLayout
|
||||
ClutterTableLayoutClass
|
||||
clutter_table_layout_new
|
||||
clutter_table_layout_set_row_spacing
|
||||
clutter_table_layout_get_row_spacing
|
||||
clutter_table_layout_set_column_spacing
|
||||
clutter_table_layout_get_column_spacing
|
||||
clutter_table_layout_get_row_count
|
||||
clutter_table_layout_get_column_count
|
||||
|
||||
<SUBSECTION>
|
||||
clutter_table_layout_pack
|
||||
|
||||
<SUBSECTION>
|
||||
clutter_table_layout_set_alignment
|
||||
clutter_table_layout_get_alignment
|
||||
clutter_table_layout_set_expand
|
||||
clutter_table_layout_get_expand
|
||||
clutter_table_layout_set_fill
|
||||
clutter_table_layout_get_fill
|
||||
clutter_table_layout_get_span
|
||||
clutter_table_layout_set_span
|
||||
|
||||
<SUBSECTION>
|
||||
clutter_table_layout_set_use_animations
|
||||
clutter_table_layout_get_use_animations
|
||||
clutter_table_layout_set_easing_duration
|
||||
clutter_table_layout_get_easing_duration
|
||||
clutter_table_layout_set_easing_mode
|
||||
clutter_table_layout_get_easing_mode
|
||||
|
||||
<SUBSECTION Standard>
|
||||
CLUTTER_TYPE_TABLE_LAYOUT
|
||||
CLUTTER_TABLE_LAYOUT
|
||||
CLUTTER_TABLE_LAYOUT_CLASS
|
||||
CLUTTER_IS_TABLE_LAYOUT
|
||||
CLUTTER_IS_TABLE_LAYOUT_CLASS
|
||||
CLUTTER_TABLE_LAYOUT_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
ClutterTableLayoutPrivate
|
||||
clutter_table_layout_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>clutter-animator</FILE>
|
||||
<TITLE>ClutterAnimator</TITLE>
|
||||
|
@ -56,6 +56,7 @@ clutter_shader_effect_get_type
|
||||
clutter_stage_get_type
|
||||
clutter_stage_manager_get_type
|
||||
clutter_state_get_type
|
||||
clutter_table_layout_get_type
|
||||
clutter_text_get_type
|
||||
clutter_texture_get_type
|
||||
clutter_timeline_get_type
|
||||
|
1
tests/interactive/.gitignore
vendored
1
tests/interactive/.gitignore
vendored
@ -71,3 +71,4 @@
|
||||
/test-scrolling
|
||||
/test-bind
|
||||
/test-cogl-point-sprites
|
||||
/test-table-layout
|
||||
|
@ -56,7 +56,8 @@ UNIT_TESTS = \
|
||||
test-constraints.c \
|
||||
test-scrolling.c \
|
||||
test-bind.c \
|
||||
test-cogl-point-sprites.c
|
||||
test-cogl-point-sprites.c \
|
||||
test-table-layout.c
|
||||
|
||||
if X11_TESTS
|
||||
UNIT_TESTS += test-pixmap.c
|
||||
|
275
tests/interactive/test-table-layout.c
Normal file
275
tests/interactive/test-table-layout.c
Normal file
@ -0,0 +1,275 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gmodule.h>
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
#include <cogl/cogl.h>
|
||||
#include "pango/cogl-pango.h"
|
||||
|
||||
#define FONT "Sans 12"
|
||||
|
||||
static void
|
||||
set_text (ClutterActor *actor, const gchar *text)
|
||||
{
|
||||
GList *children, *l;
|
||||
|
||||
children = clutter_container_get_children (CLUTTER_CONTAINER (actor));
|
||||
for (l = children; l; l = g_list_next (l)) {
|
||||
if (CLUTTER_IS_TEXT (l->data)) {
|
||||
clutter_text_set_text (CLUTTER_TEXT (l->data), text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
static void
|
||||
toggle_expand (ClutterActor *actor, ClutterEvent *event, ClutterBox *box)
|
||||
{
|
||||
gboolean x_expand;
|
||||
gchar *label;
|
||||
ClutterLayoutManager *layout = clutter_box_get_layout_manager (box);
|
||||
|
||||
|
||||
clutter_layout_manager_child_get (layout, CLUTTER_CONTAINER (box), actor,
|
||||
"x-expand", &x_expand,
|
||||
NULL);
|
||||
|
||||
x_expand = !x_expand;
|
||||
|
||||
clutter_layout_manager_child_set (layout, CLUTTER_CONTAINER (box), actor,
|
||||
"x-expand", x_expand,
|
||||
"y-expand", x_expand,
|
||||
NULL);
|
||||
|
||||
label = g_strdup_printf ("Expand = %d", x_expand);
|
||||
set_text (actor, label);
|
||||
|
||||
g_free (label);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
get_alignment_name (ClutterTableAlignment alignment)
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
case CLUTTER_TABLE_ALIGNMENT_START:
|
||||
return "start";
|
||||
|
||||
case CLUTTER_TABLE_ALIGNMENT_CENTER:
|
||||
return "center";
|
||||
|
||||
case CLUTTER_TABLE_ALIGNMENT_END:
|
||||
return "end";
|
||||
}
|
||||
|
||||
return "undefined";
|
||||
}
|
||||
|
||||
static void
|
||||
randomise_align (ClutterActor *actor, ClutterEvent *event, ClutterBox *box)
|
||||
{
|
||||
ClutterTableAlignment x_align, y_align;
|
||||
gchar *label;
|
||||
ClutterLayoutManager *layout;
|
||||
|
||||
layout = clutter_box_get_layout_manager (box);
|
||||
|
||||
x_align = (ClutterTableAlignment) g_random_int_range (0, 3);
|
||||
y_align = (ClutterTableAlignment) g_random_int_range (0, 3);
|
||||
|
||||
clutter_layout_manager_child_set (layout, CLUTTER_CONTAINER (box), actor,
|
||||
"x-align", x_align,
|
||||
"y-align", y_align,
|
||||
NULL);
|
||||
|
||||
label = g_strdup_printf ("Align (%s, %s)",
|
||||
get_alignment_name (x_align),
|
||||
get_alignment_name (y_align));
|
||||
set_text (actor, label);
|
||||
g_free (label);
|
||||
}
|
||||
|
||||
static void
|
||||
toggle_visible (ClutterActor *actor, ClutterEvent *event, gpointer userdata)
|
||||
{
|
||||
clutter_actor_hide (actor);
|
||||
}
|
||||
|
||||
gboolean drag = FALSE;
|
||||
|
||||
static ClutterActor *
|
||||
create_cell (ClutterActor *actor, const gchar *color_str)
|
||||
{
|
||||
ClutterActor *result;
|
||||
ClutterActor *rectangle;
|
||||
ClutterColor color;
|
||||
|
||||
result =
|
||||
clutter_box_new (clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FILL,
|
||||
CLUTTER_BIN_ALIGNMENT_FILL));
|
||||
|
||||
rectangle = clutter_rectangle_new ();
|
||||
clutter_color_from_string (&color, color_str);
|
||||
clutter_rectangle_set_color (CLUTTER_RECTANGLE (rectangle), (const ClutterColor *) &color);
|
||||
clutter_color_from_string (&color, "#000f");
|
||||
clutter_rectangle_set_border_color (CLUTTER_RECTANGLE (rectangle), (const ClutterColor *) &color);
|
||||
clutter_rectangle_set_border_width (CLUTTER_RECTANGLE (rectangle), 2);
|
||||
|
||||
clutter_actor_show (rectangle);
|
||||
clutter_actor_set_reactive (result, TRUE);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (result), rectangle);
|
||||
clutter_box_pack (CLUTTER_BOX (result), actor,
|
||||
"x-align", CLUTTER_BIN_ALIGNMENT_CENTER,
|
||||
"y-align", CLUTTER_BIN_ALIGNMENT_CENTER,
|
||||
NULL);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static ClutterActor *
|
||||
create_text (const gchar *label, const gchar *color)
|
||||
{
|
||||
ClutterActor *text;
|
||||
ClutterActor *result;
|
||||
|
||||
text = clutter_text_new_with_text (FONT, label);
|
||||
clutter_actor_show (text);
|
||||
|
||||
result = create_cell (text, color);
|
||||
clutter_actor_show (result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static ClutterActor *
|
||||
create_image (const gchar *file, const gchar *color)
|
||||
{
|
||||
ClutterActor *texture;
|
||||
ClutterActor *result;
|
||||
|
||||
texture = clutter_texture_new_from_file (file, NULL);
|
||||
g_object_set (G_OBJECT (texture), "keep-aspect-ratio", TRUE, NULL);
|
||||
clutter_actor_show (texture);
|
||||
|
||||
result = create_cell (texture, color);
|
||||
clutter_actor_show (result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT int
|
||||
test_table_layout_main (int argc, char *argv[])
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterLayoutManager *layout;
|
||||
ClutterActor *actor1, *actor2, *actor3, *actor4, *actor5, *actor6, *actor7, *actor8, *actor9, *actor10;
|
||||
ClutterActor *box;
|
||||
gchar *file;
|
||||
|
||||
clutter_init (&argc, &argv);
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Table Layout");
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
|
||||
clutter_actor_set_size (stage, 640, 480);
|
||||
|
||||
layout = clutter_table_layout_new ();
|
||||
clutter_table_layout_set_column_spacing (CLUTTER_TABLE_LAYOUT (layout), 10);
|
||||
clutter_table_layout_set_row_spacing (CLUTTER_TABLE_LAYOUT (layout), 10);
|
||||
|
||||
box = clutter_box_new (layout);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);
|
||||
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_WIDTH, -10.0));
|
||||
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_HEIGHT, -10.0));
|
||||
|
||||
actor1 = create_text ("label 1", "#f66f");
|
||||
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||
actor2 = create_image (file, "#bbcf");
|
||||
g_free (file);
|
||||
actor3 = create_text ("label 3", "#6f6f");
|
||||
actor4 = create_text ("Expand = 1", "#66ff");
|
||||
actor5 = create_text ("label 5", "#f6ff");
|
||||
actor6 = create_text ("label 6", "#6fff");
|
||||
actor7 = create_text ("Align (center, center)", "#66ff");
|
||||
actor8 = create_text ("label 8", "#ffff");
|
||||
actor9 = create_text ("label 9", "#666f");
|
||||
actor10 = create_text ("label 10", "#aaaf");
|
||||
|
||||
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor1, 0, 0);
|
||||
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor2, 0, 1);
|
||||
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor3, 1, 1);
|
||||
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor4, 2, 0);
|
||||
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor5, 3, 0);
|
||||
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor6, 3, 1);
|
||||
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor7, 4, 1);
|
||||
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor8, 4, 0);
|
||||
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor9, 5, 0);
|
||||
clutter_table_layout_pack (CLUTTER_TABLE_LAYOUT (layout), actor10, -1, 0);
|
||||
clutter_table_layout_set_span (CLUTTER_TABLE_LAYOUT (layout), actor1, 2, 1);
|
||||
clutter_table_layout_set_span (CLUTTER_TABLE_LAYOUT (layout), actor7, 2, 1);
|
||||
clutter_table_layout_set_span (CLUTTER_TABLE_LAYOUT (layout), actor4, 1, 2);
|
||||
|
||||
clutter_actor_set_size (actor1, 100, 100);
|
||||
clutter_actor_set_width (actor4, 250);
|
||||
|
||||
clutter_layout_manager_child_set (CLUTTER_LAYOUT_MANAGER (layout),
|
||||
CLUTTER_CONTAINER (box),
|
||||
actor1,
|
||||
"x-expand", FALSE, "y-expand", FALSE,
|
||||
NULL);
|
||||
clutter_layout_manager_child_set (CLUTTER_LAYOUT_MANAGER (layout),
|
||||
CLUTTER_CONTAINER (box),
|
||||
actor4,
|
||||
"x-expand", TRUE, "y-expand", TRUE,
|
||||
"x-fill", TRUE, "y-fill", TRUE,
|
||||
NULL);
|
||||
clutter_layout_manager_child_set (CLUTTER_LAYOUT_MANAGER (layout),
|
||||
CLUTTER_CONTAINER (box),
|
||||
actor7,
|
||||
"x-expand", TRUE, "y-expand", TRUE,
|
||||
"x-fill", FALSE, "y-fill", FALSE,
|
||||
NULL);
|
||||
clutter_layout_manager_child_set (CLUTTER_LAYOUT_MANAGER (layout),
|
||||
CLUTTER_CONTAINER (box),
|
||||
actor8,
|
||||
"x-expand", FALSE, "y-expand", FALSE,
|
||||
NULL);
|
||||
clutter_layout_manager_child_set (CLUTTER_LAYOUT_MANAGER (layout),
|
||||
CLUTTER_CONTAINER (box),
|
||||
actor9,
|
||||
"x-expand", FALSE, "y-expand", FALSE,
|
||||
NULL);
|
||||
|
||||
clutter_layout_manager_child_set (CLUTTER_LAYOUT_MANAGER (layout),
|
||||
CLUTTER_CONTAINER (box),
|
||||
actor2,
|
||||
"y-fill", FALSE,
|
||||
"x-fill", FALSE,
|
||||
NULL);
|
||||
|
||||
clutter_actor_set_position (box, 5, 5);
|
||||
|
||||
g_signal_connect (actor4, "button-release-event", G_CALLBACK (toggle_expand), box);
|
||||
g_signal_connect (actor7, "button-release-event", G_CALLBACK (randomise_align), box);
|
||||
g_signal_connect (actor10, "button-release-event", G_CALLBACK (toggle_visible), NULL);
|
||||
|
||||
/* g_signal_connect (stage, "button-press-event", G_CALLBACK (button_press), */
|
||||
/* box); */
|
||||
/* g_signal_connect (stage, "motion-event", G_CALLBACK (motion_event), */
|
||||
/* box); */
|
||||
/* g_signal_connect (stage, "button-release-event", G_CALLBACK (button_release), */
|
||||
/* box); */
|
||||
|
||||
clutter_actor_show (stage);
|
||||
|
||||
g_debug ("table row count = %d",
|
||||
clutter_table_layout_get_row_count (CLUTTER_TABLE_LAYOUT (layout)));
|
||||
g_debug ("table column count = %d",
|
||||
clutter_table_layout_get_column_count (CLUTTER_TABLE_LAYOUT (layout)));
|
||||
|
||||
clutter_main ();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Reference in New Issue
Block a user