Commit Graph

41 Commits

Author SHA1 Message Date
Emmanuele Bassi
64c7973c74 bin-layout: Fix text direction checks
When using the new ActorAlign flags we must get the real alignment for
the horizontal axis, as clutter_actor_allocate() will compute the
effective alignment by itself; if we use the effective alignment then
ClutterActor.allocate() will swap it, and undo our work.

When using the old BinAlignment flags we should reverse the alignment
depending on whether the text direction of the child is RTL or LTR.

See bug: https://bugzilla.gnome.org/show_bug.cgi?id=684214
2012-09-19 11:40:33 +01:00
Emmanuele Bassi
8536314dbf bin-layout: Ensure that fixed position get a 0.0 alignment
If the actor has a fixed position set, but it's not using the BinLayout
alignment enumeration to set its alignment, then we force the alignment
factor to 0.0; this is consistent with what happens with an explicit
alignment of CLUTTER_BIN_ALIGNMENT_FIXED.

https://bugzilla.gnome.org/show_bug.cgi?id=682265
2012-08-20 14:50:39 +01:00
Emmanuele Bassi
97755882c1 bin-layout: Use ClutterActor:fixed-position-set
Instead of only relying on the (now) deprecated BinAlignment.FIXED
enumeration value, we just ask the actor if a fixed position has been
explicitly set, under the assumption that if a developer decided to call
set_x(), set_y(), or set_position() on an actor inside a BinLayout then
she wanted the fixed position to be honoured.

This removes the last (proper) use of the BinAlignment enumeration.
2012-08-10 15:05:28 +01:00
Emmanuele Bassi
d381ab1207 Revert "bin-layout: Implement layout animations"
This reverts commit 03ec016faa.

ClutterLayoutManager implementations should just defer the easing state
set up to the child, and not try to impose a global one.
2012-07-11 13:22:21 +01:00
Alexander Larsson
c0b3e2e83a Don't allocate size to invisible BinLayout children
This is similar to what other layouts do, and avoids problems with
Gtk+ actor children which warn about being allocated not enough
space.
2012-06-08 11:34:40 +02:00
Alexander Larsson
76f1a42ef8 BinLayout: Always use fixed_x/y for FIXED if set
We want to use the actually set value for x/y, not the current allocation,
as that might be a transition from an earlier allocation animation.
2012-06-07 16:44:08 +02:00
Alexander Larsson
8ef55e4e98 Don't allocate size for invisible BinLayout children 2012-06-05 10:55:17 +02:00
Bastian Winkler
03ec016faa bin-layout: Implement layout animations
Allow to animate the child allocation using the ClutterLayoutManager
animation API

https://bugzilla.gnome.org/show_bug.cgi?id=676827
2012-05-28 19:37:10 +02:00
Emmanuele Bassi
07c95ebf0c Move examples from tests/interactive to a new top-level
The example code that is meant to be XIncluded into the API reference
should not be part of the interactive test suite: it's code that it is
meant to be used as a reference implementation - whereas the interactive
test suite should be allowed to be lean and test behaviour even in nasty
ways. In short: the test suite should not be the place where we show off
idiomatic code for educational purposes.
2012-05-01 19:00:35 +01:00
Emmanuele Bassi
78aae84d43 actor: Coalesce needs_[xy]_expand() into one method
Use the orientation enumeration instead of a per-axis method.
2012-04-27 12:30:49 +01:00
Emmanuele Bassi
5d8b177679 bin-layout: Deprecate BinLayout alignments
We should use the ClutterActor's API for this.
2012-04-27 12:30:49 +01:00
Emmanuele Bassi
26d366a3a5 docs: XInclude the bin layout example 2012-04-27 12:30:49 +01:00
Emmanuele Bassi
6ddc694e68 bin-layout: Use the actor align/expand flags
If an actor is set to expand, we use the actor's horizontal and vertical
alignment values instead of the BinLayout's.
2012-04-27 12:30:49 +01:00
Emmanuele Bassi
2567049ce3 Fix missing/redundant declarations 2012-03-07 12:36:43 +00:00
Emmanuele Bassi
986307f5e4 Use ClutterActorIter inside layout managers
Whenever it is possible, or convenient.
2012-01-30 11:09:59 +00:00
Emmanuele Bassi
5959099473 Deprecate Container add() and remove() methods
This will make things interesting.

We have better replacements in ClutterActor, that do The Right Thing™
instead of deferring control and requiring reimplementation in every
single container actor.
2012-01-16 23:37:11 +00:00
Emmanuele Bassi
9c9ab42060 Begin porting layout managers to the new child iteration API
Instead of getting the list of children to iterate over it, let's use
the newly added child iteration API; this should save us a bunch of
allocations, as well as indirections.

Ported: ClutterBinLayout and ClutterBoxLayout.
2012-01-16 23:37:09 +00:00
Emmanuele Bassi
368c916c7f layout-managers: Take into account the allocations's origin
If an actor using a LayoutManager has attributes like margin or padding
then it'll have to shave them from the available allocation before
passing it to the LayoutManager::allocate() implementation. Layout
managers should, thus, not assume that the origin of the allocation is
in (0, 0), but take into account that the passed ActorBox might have a
different origin.

https://bugzilla.gnome.org/show_bug.cgi?id=649631
2011-08-29 22:43:42 +01:00
Emmanuele Bassi
0f8e3ab4aa bin-layout: Fix a leak
https://bugzilla.gnome.org/show_bug.cgi?id=655342
2011-07-26 13:55:24 +01:00
Jasper St. Pierre
0c576c0c33 Remove private helper #define's
Finish off the second half of 09a830d294.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2596
2011-03-03 11:47:49 +00:00
Emmanuele Bassi
050e775da2 Move more classes to install_properties() 2010-10-18 11:26:45 +01:00
Damien Lespiau
24577a0538 bin-layer: Fix the property blurbs
The descriptions for the 'y-align' and 'x-align' properties talk about a
layer and a layer manager. It seems that these properties are the
alignement factors relative to the BinLayout, so document them
accordingly.
2010-10-05 07:50:52 +01:00
Emmanuele Bassi
5e1d40c07b Merge branch 'wip/table-layout'
* wip/table-layout:
  Add ClutterTableLayout, a layout showing children in rows and columns
  box-layout: Use allocate_align_fill()
  bin-layout: Migrate to allocate_align_fill()
  actor: Add allocate_align_fill()
  test-flow-layout: Use BindConstraints
2010-08-11 11:32:44 +01:00
Emmanuele Bassi
6ad4126e17 bin-layout: Migrate to allocate_align_fill()
Now that we have the code in ClutterActor itself.
2010-08-10 22:25:11 +01:00
Neil Roberts
8d51617979 Conditionally use g_object_notify_by_pspec
This adds a wrapper macro to clutter-private that will use
g_object_notify_by_pspec if it's compiled against a version of GLib
that is sufficiently new. Otherwise it will notify by the property
name as before by extracting the name from the pspec. The objects can
then store a static array of GParamSpecs and notify using those as
suggested in the documentation for g_object_notify_by_pspec.

Note that the name of the variable used for storing the array of
GParamSpecs is obj_props instead of properties as used in the
documentation because some places in Clutter uses 'properties' as the
name of a local variable.

Mose of the classes in Clutter have been converted using the script in
the bug report. Some classes have not been modified even though the
script picked them up as described here:

json-generator:

 We probably don't want to modify the internal copy of JSON

behaviour-depth:
rectangle:
score:
stage-manager:

 These aren't using the separate GParamSpec* variable style.

blur-effect:
win32/device-manager:

 Don't actually define any properties even though it has the enum.

box-layout:
flow-layout:

  Have some per-child properties that don't work automatically with
  the script.

clutter-model:

  The script gets confused with ClutterModelIter

stage:

  Script gets confused because PROP_USER_RESIZE doesn't match
  "user-resizable"

test-layout:

  Don't really want to modify the tests

http://bugzilla.clutter-project.org/show_bug.cgi?id=2150
2010-08-10 17:12:06 +01:00
Emmanuele Bassi
fd27ca7398 Mark property strings for translation
Both the nick and the blurb fields should be translatable, for UI
builders and other introspection-based tools.
2010-07-15 14:07:07 +01:00
Emmanuele Bassi
ab76584965 layout-manager: Implement set_container()
Store a back pointer of the layout manager inside the container using
the GObject instance data. This introduces a change in the implementation
of ClutterLayoutManager, though it's still binary compatible.
2010-06-07 22:40:34 +01:00
Emmanuele Bassi
d2bdd3cb62 Fix some compiler warnings
GCC complains that some variable might be used uninitialized.
2010-02-09 16:58:03 +00:00
Emmanuele Bassi
eea00d2805 bin-layout: Add get_child_meta_type() override
Return the GType of ClutterBinLayer.
2009-11-05 12:26:10 +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
87f0b94df7 layout, docs: Fix description of Bin properties
The BinLayer and BinLayout properties name and blurb for introspection
should be slightly more descriptive.
2009-10-15 14:20:44 +01:00
Emmanuele Bassi
852abbb138 layout, bin: Use ceilf() instead of casting to int
Casting a float to int to truncate it before assigning the value
to a float again is wrong. We should use ceilf() instead which
does what we want to achieve (rounding up the size to avoid
sub-pixel positioning of children).
2009-10-15 14:12:37 +01:00
Emmanuele Bassi
0876575a95 layout: Use the get_request_mode() getter in BinLayout
Instead of using g_object_get(child, "request-mode", ...).
2009-10-14 11:31:31 +01:00
Emmanuele Bassi
df6ca3d171 [layout, docs] Clean up BinLayout documentation
Documentation and code style fixes for BinLayout.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
431a63d04a [layout] Store and use the container inside BinLayout
The BinLayout should store a pointer to the Container that it is
using it as the layout manager.

This allows us to fix the API and drop the additional Container
arguments from set_alignment() and get_alignment().

This also allows us to add a ClutterBinLayout::add() method which
adds an actor and sets the alignment policies without dealing with
variadic arguments functions and GValue (de)marshalling.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
a2086f1178 [layout] Add LayoutMeta
Instead of overloading ClutterChildMeta with both container and layout
metadata and delegate to every LayoutManager implementation to keep a
backpointer to the layout manager instance, we can simply subclass
ChildMeta into LayoutMeta and presto! everything works out pretty well
for everyone.
2009-10-14 11:31:26 +01:00
Emmanuele Bassi
899db6f226 [layout, docs] Add layout managers sections
Add LayoutManager and its subclasses, and the Box actor to the
gtk-doc machinery needed to generate the API reference.
2009-10-14 11:30:43 +01:00
Emmanuele Bassi
9cccff504a [layout] Add layers to BinLayout
Each actor managed by a BinLayout policy should reside inside its
own "layer", with horizontal and vertical alignment. The :x-align
and :y-align properties of the BinLayout are the default alignment
policies, which are copied to each new "layer" when it is created.

The set_alignment() and get_alignment() methods of BinLayout can
be changed to operate on a specific "layer".

The whole machinery uses the new ChildMeta support inside the
LayoutManager base abstract class.
2009-10-14 11:27:29 +01:00
Emmanuele Bassi
83a4e96267 [layout] Document BinLayout 2009-10-14 11:27:29 +01:00
Emmanuele Bassi
b06a3293fe [layout] Notify of alignment changes in BinLayout
Emit the ::layout-changed when the BinLayout alignment policies change.

This will result in a queue_relayout() on the containers using the
BinLayout layout manager.
2009-10-14 11:27:29 +01:00
Emmanuele Bassi
1061ebeac9 [layout] Add BinLayout
A BinLayout is a simple layout manager that allocates a single cell,
providing alignment on both the horizontal and vertical axis.

If the container associated to the BinLayout has more than one child,
the preferred size returned by the layout manager will be as big as
the maximum of the children preferred sizes; the allocation will be
applied to all children - but it will still depend on each child
preferred size and the BinLayout horizontal and vertical alignment
properties.

The supported alignment properties are:

  * center: align the child by centering it
  * start: align the child at the top or left border of the layout
  * end: align the child at the bottom or right border of the layout
  * fill: expand the child to fill the size of the layout
  * fixed: let the child position itself
2009-10-14 11:27:19 +01:00