layout-manager: Create LayoutMeta on demand

The ClutterLayoutMeta instances should be created on demand, whenever
the layout manager needs them - if the layout manager supports layout
properties.

This removes the requirement to call add_child_meta() and
remove_child_meta() on add and remove respectively; it also simplifies
the implementation of LayoutManager sub-classes since we can add
fallback code in the base abstract class.

Eventually, this will also lead to an easier to implement ClutterScript
parser for layout properties.

With the new scheme, the ClutterLayoutMeta instance is created whenever
the layout manager tries to access it; if there isn't an instance
already attached to the container's child, one is created -- assuming
that the LayoutManager sub-class has overridden the
get_child_meta_type() virtual function and it's returning a valid GType.

We can also provide a default implementation for create_child_meta(),
by getting the GType and instantiating a ClutterLayoutMeta with all the
fields already set. If the layout manager requires more work then it can
obviously override the default implementation (and even chain up to it).

The ClutterBox actor has been updated, as well as the ClutterBoxLayout
layout manager, to take advantage of the changes of LayoutManager.
This commit is contained in:
Emmanuele Bassi
2009-11-30 19:03:11 +00:00
parent 7d842079ca
commit 15a04a1dd3
5 changed files with 70 additions and 184 deletions

View File

@ -1749,8 +1749,6 @@ clutter_layout_manager_layout_changed
clutter_layout_manager_set_container
<SUBSECTION>
clutter_layout_manager_add_child_meta
clutter_layout_manager_remove_child_meta
clutter_layout_manager_get_child_meta
clutter_layout_manager_child_set
clutter_layout_manager_child_set_property