1
0
Fork 0
Commit graph

12 commits

Author SHA1 Message Date
José Dapena Paz
7b63da69cf Add "homogeneous" mode to ClutterBoxLayout.
Added new "homogeneous" mode to ClutterBoxLayout, that makes layout children
get all the same size.

This is heavily inspired in the "homogeneous" attribute available in GtkBox,
but simplified as we don't have padding nor borders in box layout, only
spacing.

Also added to test-box-layout a key to set/unset homogeneous mode.

* Coding style fixes.
* Added proper test for homogeneous mode in box layout.
* Fix in homogeneous mode.

http://bugzilla.openedhand.com/show_bug.cgi?id=2034

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-25 09:41:54 +00:00
Emmanuele Bassi
853f9941da analysis: ClutterBoxLayout
Remove an useless assignment. The n_expand_children is not used outside
the extra_space check, and if n_expand_children is 0 then the extra
space we allocate is 0.
2010-02-12 14:50:10 +00:00
Emmanuele Bassi
b9c1de0ec7 box-layout: Remove the allocations hash table
The BoxLayout uses a HashTable to map the latest stable allocation of
each child, in order to use that as the initial value during an
animation; this in spite of already having a perfectly valid per-child
storage as part of the layout manager: ClutterBoxChild.

The last stable allocation should be stored inside the ClutterBoxChild
instead of having it in the private data for ClutterBoxLayout. The
access remains O(1), since there is a 1:1 mapping between child and
BoxChild instances, but we save a little bit of memory and we avoid
keeping aroud allocations for old children.
2009-12-23 10:36:46 +00:00
Emmanuele Bassi
4a21425f48 layout: Let begin_animation() return the Alpha
When beginning a new animation for a LayoutManager, the implementation
should return the ClutterAlpha used. This allows controlling the
timeline and/or modifying the animation parameters on the fly.
2009-12-13 01:23:54 +00:00
Emmanuele Bassi
2e6397c391 box-layout: Add knobs for controlling animations
ClutterLayoutManager does not have any state associated with it, and
defers all the state to its sub-classes.

The BoxLayout is thus in charge of controlling:

  • whether or not animations should be used
  • the duration of the animation
  • the easing mode of the animation

By adding three new properties:

  • ClutterBoxLayout:use-animations
  • ClutterBoxLayout:easing-duration
  • ClutterBoxLayout:easing-mode

And their relative accessors pairs we can make BoxLayout decide whether
or not, and with which parameters, call the begin_animation() method of
ClutterLayoutManager.

The test-box-layout has been modified to reflect this new functionality,
by checking the key-press event for the 'a' key symbol to toggle the use
of animations.
2009-12-13 01:15:02 +00:00
Emmanuele Bassi
3c2e91aef5 box-layout: Animate layout properties
Use the newly added animation support inside LayoutManager to animate
between state changes of the BoxLayout properties.

The implementation is based on equivalent code from Mx, written by:

  Thomas Wood <thomas.wood@intel.com>
2009-12-13 01:14:16 +00:00
Emmanuele Bassi
586750751a Merge branch 'text-direction'
* text-direction:
  docs: Add text-direction accessors
  Set the default language on the Pango context
  actor: Set text direction on parenting
  tests: Display the index inside text-box-layout
  box-layout: Honour :text-direction
  text: Dirty layout cache on text direction changes
  actor: Add :text-direction property
  Use the newly added ClutterTextDirection enumeration
  Add ClutterTextDirection enumeration
2009-12-01 14:55:19 +00:00
Emmanuele Bassi
15a04a1dd3 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.
2009-11-30 19:11:00 +00:00
Emmanuele Bassi
4bc3d02ebd box-layout: Honour :text-direction
During size request and allocation a ClutterBoxLayout should honour
the ClutterActor:text-direction property, and change the order of
the children.
2009-11-10 12:20:14 +00:00
Emmanuele Bassi
b0c9de2730 box-layout: Add get_child_meta_type() override
Return the GType of ClutterBoxChild.
2009-11-05 12:26:30 +00:00
Emmanuele Bassi
f0b434918b docs: Add images for layout managers
It's easier to show the layout manager policy with a simple
screen shot coming from our interactive tests.
2009-10-23 17:32:18 +01:00
Emmanuele Bassi
b526b76593 layout: Add BoxLayout, a single line layout manager
The BoxLayout layout manager implements a layout policy for arranging
children on a single line, either alongside the X axis or alongside the
Y axis.
2009-10-14 11:31:48 +01:00