On Mon, 2008-07-28 at 10:09 +0300, Nati B wrote:
> Hi,
> I have a ClutterLabel that I display above an actor that represents
> some sort of frame.
> Since I wanted the label to be centered directly above the frame I set
> the position of the label at the beginning of the line (the frame and
> the label are wrapped inside the same container so I just set x = 0),
> and set its width to be the underneath actor's width and then used
> 'clutter_label_set_alignment' with 'PANGO_ALIGN_CENTER' and it just
> worked out fine (and I was happy :-)).

it was a bug, actually, due to the size negotiation issues that the
Label actor had. the :alignment property doesn't do what you think it
does: it's for Pango to use when you have multiple lines, and you want
them all to be aligned.

if you want to align a label, you just need to set its position relative
to its container; you can see the TidyFrame container[0] inside Tidy for
a container that supports alignment of children. the code is really
trivial, and can be done both in fixed point or in floating point math.

ciao,
 Emmanuele.

+++

[1] see the "tidy_frame_allocate" function for the code; it's 47 lines
long, but it also handles padding around the child and it does
everything in fixed point; a floating point, alignment-only
implementation should take less than 30 lines.

-- 
Emmanuele Bassi, OpenedHand Ltd.
Unit R, Homesdale Business Centre
216-218 Homesdale Rd., Bromley - BR12QZ
http://www.o-hand.com

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to