MildenhallWidgetContainer

MildenhallWidgetContainer — A container that can be used to lay out other widgets. It supports animating widgets when moving them inside its view port.

Functions

Properties

guint animation-mode Read / Write
guint animation-timeline Read / Write
gfloat maximize Read / Write
gfloat minimize Read / Write
GObject * model Read / Write
gfloat move-left Read / Write
gfloat move-right Read / Write

Signals

void maximize-completed No Recursion
void minimize-completed No Recursion
void move-left-completed No Recursion
void move-right-completed No Recursion

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── ClutterActor
            ╰── MildenhallWidgetContainer

Implemented Interfaces

MildenhallWidgetContainer implements ClutterContainer, ClutterScriptable, ClutterAnimatable and AtkImplementorIface.

Includes

#include <include/mildenhall_roller_container.h>

Description

Freeing the widget

Call g_object_unref() to free the widget.

Sample C Code

A private enum to set column of ThornburyModel

1
2
3
4
5
6
7
enum
{
  COLUMN_WIDGET_ACTOR,
  COLUMN_WIDGET_X,
  COLUMN_WIDGET_Y,
  COLUMN_WIDGET_LAST
};

How to create MildenhallWidgetContainer

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
ThornburyItemFactory *factory_container;
ThornburyItemFactory *item_factory;
ThornburyItemFactory *item_factory1;
GObject *object = NULL, *object1 = NULL, *object_container = NULL;
ClutterActor *widget_container = NULL;

ThornburyModel *model = NULL, *model1 = NULL;
ClutterActor *cont1 = NULL, *cont = NULL;
ThornburyModel *container_model = NULL;

g_autofree gchar *launcher_video_file = NULL;
g_autofree gchar *content_video_file = NULL;

launcher_video_file = g_build_filename ("/usr/share/mildenhall",
                                       "mildenhallroller",
                                       "01_appl_launcher_2009.03.09.avi",
                                       NULL);
content_video_file = g_build_filename ("/usr/share/mildenhall",
                                      "mildenhallroller",
                                      "03_content_roll_2009.03.09.avi",
                                      NULL);

factory_container = thornbury_item_factory_generate_widget_with_props (
      	MILDENHALL_TYPE_WIDGET_CONTAINER, "/usr/share/mildenhall/mildenhall_widget_container_prop.json");

g_object_get (factory_container, "object", &object_container, NULL);
widget_container = CLUTTER_ACTOR (object_container);

container_model = (ThornburyModel*) thornbury_list_model_new (
	COLUMN_WIDGET_LAST, G_TYPE_OBJECT, NULL, G_TYPE_FLOAT, NULL, G_TYPE_FLOAT,
     NULL, -1);

model = (ThornburyModel *)thornbury_list_model_new (COLUMN_LAST,
                                                   G_TYPE_STRING, NULL,
                                                   G_TYPE_STRING, NULL,
                                                   G_TYPE_STRING, NULL,
                                                   G_TYPE_BOOLEAN, NULL,
                                                   G_TYPE_STRING, NULL,
                                                   G_TYPE_FLOAT, NULL,
                                                   G_TYPE_STRING, NULL,
                                                   G_TYPE_STRING, NULL,
                                                   G_TYPE_STRING, NULL,
                                                   -1);
for (i = 0; i < 3; i++)
{
  g_autofree gchar *number = g_strdup_printf ("item number %i", i);
  g_autofree gchar *text = g_strdup_printf ("text for item %i", i);

  thornbury_model_append (model,
                         COLUMN_NAME, number,
                         COLUMN_ICON, i % 2 == 0 ? icon1 : icon2,
                         COLUMN_LABEL, number,
                         COLUMN_TOGGLE, i % 2,
                         COLUMN_VIDEO, i % 2 == 0 ? launcher_video_file : content_video_file,
                         COLUMN_EXTRA_HEIGHT, (float) (i % 100),
                         COLUMN_COVER, covers[i % 3],
                         COLUMN_THUMB, NULL,
                         COLUMN_LONG_TEXT, text,
                         -1);
}

item_factory = thornbury_item_factory_generate_widget_with_props (
      MILDENHALL_TYPE_ROLLER_CONTAINER,
      "/usr/share/mildenhall/mildenhall_roller_container_prop.json");

g_object_get (item_factory, "object", &object, NULL);
cont = CLUTTER_ACTOR (object);

g_object_set (object, "item-type", MILDENHALL_TYPE_SAMPLE_ITEM, "model",
             model, NULL);
mildenhall_roller_container_add_attribute (MILDENHALL_ROLLER_CONTAINER(cont),
                                          "name", COLUMN_NAME);
mildenhall_roller_container_add_attribute (MILDENHALL_ROLLER_CONTAINER(cont),
                                          "label", COLUMN_LABEL);
g_signal_connect (G_OBJECT (cont), "roller-item-activated",
                 G_CALLBACK (roller_item_activated_cb), widget_container);

model1 = (ThornburyModel *)thornbury_list_model_new (COLUMN_LAST,
                                                    G_TYPE_STRING, NULL,
                                                    G_TYPE_STRING, NULL,
                                                    G_TYPE_STRING, NULL,
                                                    G_TYPE_BOOLEAN, NULL,
                                                    G_TYPE_STRING, NULL,
                                                    G_TYPE_FLOAT, NULL,
                                                    G_TYPE_STRING, NULL,
                                                    G_TYPE_STRING, NULL,
                                                    G_TYPE_STRING, NULL,
                                                    -1);
for (i = 0; i < 3; i++)
{
  g_autofree gchar *number = g_strdup_printf ("item number %i", i);
  g_autofree gchar *text = g_strdup_printf ("text for item %i", i);

  thornbury_model_append (model1,
                         COLUMN_NAME, number,
                         COLUMN_ICON, i % 2 == 0 ? icon1 : icon2,
                         COLUMN_LABEL, number,
                         COLUMN_TOGGLE, i % 2,
                         COLUMN_VIDEO, i % 2 == 0 ? launcher_video_file : content_video_file,
                         COLUMN_EXTRA_HEIGHT, (float) (i % 100),
                         COLUMN_COVER, covers[i % 3],
                         COLUMN_THUMB, NULL,
                         COLUMN_LONG_TEXT, text,
                         -1);
}
item_factory1 = thornbury_item_factory_generate_widget_with_props (
	MILDENHALL_TYPE_ROLLER_CONTAINER, roller_container_prop_file);

g_object_get (item_factory1, "object", &object1, NULL);
g_object_set (object1, "background", TRUE, "item-type",
             MILDENHALL_TYPE_SAMPLE_ITEM, "model", model1, NULL);

cont1 = CLUTTER_ACTOR (object1);
mildenhall_roller_container_add_attribute (MILDENHALL_ROLLER_CONTAINER(cont1),
                                          "name", COLUMN_NAME);
mildenhall_roller_container_add_attribute (MILDENHALL_ROLLER_CONTAINER(cont1),
                                          "label", COLUMN_LABEL);
g_signal_connect (G_OBJECT (cont1), "roller-item-activated",
                 G_CALLBACK (roller2_item_activated_cb), widget_container);

thornbury_model_append (container_model, COLUMN_WIDGET_ACTOR, cont,
                       COLUMN_WIDGET_X, 5.0, COLUMN_WIDGET_Y, 0.0, -1);
thornbury_model_append (container_model, COLUMN_WIDGET_ACTOR, cont1,
                       COLUMN_WIDGET_X, 345.0, COLUMN_WIDGET_Y, 0.0, -1);

g_signal_connect (G_OBJECT (widget_container), "move-left-completed",
                 G_CALLBACK (left_animation_completed_cb), NULL);
g_signal_connect (G_OBJECT (widget_container), "move-right-completed",
                 G_CALLBACK (right_animation_completed_cb), NULL);
g_signal_connect (G_OBJECT (widget_container), "minimize-completed",
                 G_CALLBACK (minimize_completed_cb), NULL);
g_signal_connect (G_OBJECT (widget_container), "maximize-completed",
                 G_CALLBACK (maximize_completed_cb), NULL);

g_object_set (widget_container, "model", container_model, "minimize", 120.0,
             NULL);
clutter_actor_add_child (stage, CLUTTER_ACTOR (widget_container));

Example callback functions for MildenhallRollerContainer::roller-item-activated, MildenhallRollerContainer::move-left-completed, MildenhallRollerContainer::move-right-completed and MildenhallRollerContainer::minimize-completed, maximize-completed.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
static void
roller_item_activated_cb (MildenhallRollerContainer *roller, guint row,
                         gpointer data)
{
  g_debug ("%s:row = %d", __FILE__, row);
  g_object_set (G_OBJECT (data), "move-left", 30.0, "maximize", 700.0, NULL);
}
static void
roller2_item_activated_cb (MildenhallRollerContainer *roller, guint row,
                          gpointer data)
{
  g_debug ("%s:row = %d", __FILE__, row);
  g_object_set (G_OBJECT (data), "move-right", 400.0,
		  NULL);
}
static void
left_animation_completed_cb (MildenhallWidgetContainer *widget_container,
                            gpointer userData)
{
  g_debug ("%s", __FUNCTION__);
}
static void
right_animation_completed_cb (MildenhallWidgetContainer *widget_container,
                             gpointer userData)
{
  g_debug ("%s", __FUNCTION__);
}
static void
maximize_completed_cb (MildenhallWidgetContainer *widget_container,
                      gpointer userData)
{
  g_debug ("%s", __FUNCTION__);
}
static void
minimize_completed_cb (MildenhallWidgetContainer *widget_container,
                      gpointer userData)
{
  g_debug ("%s", __FUNCTION__);
}

Functions

mildenhall_widget_container_new ()

MildenhallWidgetContainer *
mildenhall_widget_container_new (void);

Creates a mildenhall widget container object

Returns

widget container object.

[transfer full]


mildenhall_widget_container_get_model ()

ThornburyModel *
mildenhall_widget_container_get_model (MildenhallWidgetContainer *pWidgetContainer);

gets the container model

Parameters

pWidgetContainer

Object reference

 

Returns

model pointer


mildenhall_widget_container_get_height ()

gfloat
mildenhall_widget_container_get_height
                               (MildenhallWidgetContainer *pWidgetContainer);

gets the height of widget container.

Parameters

pWidgetContainer

Object reference

 

Returns

height of the widget container


mildenhall_widget_container_get_width ()

gfloat
mildenhall_widget_container_get_width (MildenhallWidgetContainer *pWidgetContainer);

gets the width of widget container.

Parameters

pWidgetContainer

Object reference

 

Returns

width of the widget container


mildenhall_widget_container_set_model ()

void
mildenhall_widget_container_set_model (MildenhallWidgetContainer *pWidgetContainer,
                                       ThornburyModel *pModel);

Set the model used by the widget container model format: "widget-pointer" - ClutterActor* "widget-x" - x position for widget "widget-y" - y position for widget

Parameters

pWidgetContainer

Object reference

 

pModel

model for widget container

 

mildenhall_widget_container_set_move_right ()

void
mildenhall_widget_container_set_move_right
                               (MildenhallWidgetContainer *pWidgetContainer,
                                gfloat inMoveRight);

mildenhall_widget_container_set_move_left ()

void
mildenhall_widget_container_set_move_left
                               (MildenhallWidgetContainer *pWidgetContainer,
                                gfloat inMoveLeft);

mildenhall_widget_container_set_maximize ()

void
mildenhall_widget_container_set_maximize
                               (MildenhallWidgetContainer *pWidgetContainer,
                                gfloat inMaximize);

mildenhall_widget_container_set_minimize ()

void
mildenhall_widget_container_set_minimize
                               (MildenhallWidgetContainer *pWidgetContainer,
                                gfloat inMinimize);

mildenhall_widget_container_set_animation_timeline ()

void
mildenhall_widget_container_set_animation_timeline
                               (MildenhallWidgetContainer *pWidgetContainer,
                                gint uinTimeline);

mildenhall_widget_container_set_animation_mode ()

void
mildenhall_widget_container_set_animation_mode
                               (MildenhallWidgetContainer *pWidgetContainer,
                                gint uinAnimationMode);

Types and Values

struct MildenhallWidgetContainer

struct MildenhallWidgetContainer;

The MildenhallWidgetContainer struct contains only private data.


struct MildenhallWidgetContainerClass

struct MildenhallWidgetContainerClass {
	ClutterActorClass parent_class;
	void (*move_left_completed) ( GObject *pWidgetContainer);
	void (*move_right_completed)( GObject *pWidgetContainer);
	void (*maximize_completed)  ( GObject *pWidgetContainer);
	void (*minimize_completed)  ( GObject *pWidgetContainer);
};

The MildenhallWidgetContainerClass struct contains only private data.

Members

move_left_completed ()

class handler for the “move_left_completed” signal

 

move_right_completed ()

class handler for the “move_right_completed” signal

 

maximize_completed ()

class handler for the “maximize_completed” signal

 

minimize_completed ()

class handler for the “minimize_completed” signal

 

Property Details

The “animation-mode” property

  “animation-mode”           guint

mode of animation to animate widget container

Default: CLUTTER_LINEAR

Flags: Read / Write

Default value: 250


The “animation-timeline” property

  “animation-timeline”       guint

timeline of animation to animate widget container

Default: 2000

Flags: Read / Write

Default value: 2000


The “maximize” property

  “maximize”                 gfloat

Maximize the widget container

Default: -1

Flags: Read / Write

Allowed values: >= -1

Default value: -1


The “minimize” property

  “minimize”                 gfloat

Minimize the widget container

Default: -1

Flags: Read / Write

Allowed values: >= -1

Default value: -1


The “model” property

  “model”                    GObject *

model for the mildenhall widget container

Default: NULL

Flags: Read / Write


The “move-left” property

  “move-left”                gfloat

Move left the widget container

Default: -1

Flags: Read / Write

Allowed values: >= -1

Default value: -1


The “move-right” property

  “move-right”               gfloat

Move right the widget container

Default: -1

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Signal Details

The “maximize-completed” signal

void
user_function (MildenhallWidgetContainer *mildenhallWidgetContainer,
               gpointer                   user_data)

::maximize-completed is emitted when animation for maximize the widget containerfinished

Parameters

mildenhallWidgetContainer

The object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: No Recursion


The “minimize-completed” signal

void
user_function (MildenhallWidgetContainer *mildenhallWidgetContainer,
               gpointer                   user_data)

::minimize-completed is emitted when animation for minimize the widget container finished

Parameters

mildenhallWidgetContainer

The object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: No Recursion


The “move-left-completed” signal

void
user_function (MildenhallWidgetContainer *mildenhallWidgetContainer,
               gpointer                   user_data)

::move-left-completed is emitted when animation for left movement of the widget container finished

Parameters

mildenhallWidgetContainer

The object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: No Recursion


The “move-right-completed” signal

void
user_function (MildenhallWidgetContainer *mildenhallWidgetContainer,
               gpointer                   user_data)

::move-right-completed is emitted when animation for right movement of the widget container finished

Parameters

mildenhallWidgetContainer

The object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: No Recursion

See Also

ClutterActor, ThornburyItemFactory, ThornburyModel