Minimum size of an actor



Hi clutter-list

   I 'm trying to set minimum size of a parent actor, which has one child (a text) managed by ClutterBinLayout. I want the functionality of ClutterBinLayout which would resize the parent when child is expanding, but at  the same time, I want the parent to maintain some minimum size which can be bigger than size of the child. Consider following code (below). There are an actor named "parent", which lays on the stage. In the "parent" actor I've got a label, which is editable, thus it can grow horizontally upon edit. And then I have a ClutterBinLayout which cares that the label would always be at the center of the "parent", and also will resize the parent to the "label" size accordingly. The code works as expected when "clutter_actor_set_size" in line 3 is commented. But when I uncomment it, the parent would stay 100x100 pixels whatever the size of the "label". How can I change this so the parent would grow and shrink upon "label" size changes, but won't shrink to be less than 100x100? PS. I tried the "min-width" and "min-height" properties but no luck. The code:

ClutterActor *parent = clutter_actor_new ();
clutter_actor_set_position (parent, 500, 500);
// clutter_actor_set_size (parent, 100, 100);

clutter_actor_add_child (stage->getActor (), parent);

static ClutterColor c = { 0xff, 0x00, 0x00, 0x88 };
clutter_actor_set_background_color (CLUTTER_ACTOR (parent), &c);

ClutterLayoutManager *layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_BIN_ALIGNMENT_CENTER);
clutter_actor_set_layout_manager (parent, layout);

ClutterActor *label = clutter_text_new ();
clutter_actor_set_name (label, "text");
clutter_text_set_text (CLUTTER_TEXT (label), "A");
clutter_text_set_font_name (CLUTTER_TEXT (label), "20px");
clutter_text_set_editable (CLUTTER_TEXT (label), TRUE);
clutter_text_set_selectable (CLUTTER_TEXT (label), TRUE);
clutter_text_set_single_line_mode (CLUTTER_TEXT (label), TRUE);
clutter_actor_set_reactive (label, TRUE);
clutter_actor_set_x_expand (label, TRUE);
clutter_actor_set_x_align (label, CLUTTER_ACTOR_ALIGN_CENTER);
clutter_actor_set_y_expand (label, TRUE);
clutter_actor_set_y_align (label, CLUTTER_ACTOR_ALIGN_CENTER);
clutter_actor_add_child (parent, label);

Best regards. Iwasz.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]