Component are feuille with a position size. Component provide method necessary to set and query the size and position of a Feuille. Setting position and side is more complicated that it seems. When a feuille is resized it first posts a resize request to its parent using post_resize. During this call the parent may resize itself and then will resize the feuille to a size that seem fit. Then using the newly assigned size it can process update its state. A similar mechanism is used during a reposition.
Component(Mural32 new_x = 0, Mural32 new_y = 0, MuralU32 new_width = DEFAULT_WIDTH, MuralU32 new_height = DEFAULT_HEIGHT, ObjectType new_type = TypeComponent, const char *new_name = "");
void get_position(Mural32 &x, Mural32 &y);
- get_position returns the current position of the object. The object is locked during this call.
virtual void set_position(Mural32 x, Mural32 y, bool propagate = true, bool locked = false);
void get_size(MuralU32 &width, MuralU32 &height);
- get_size returns the current size of the object. The object is locked during this call.
virtual void set_size(MuralU32 width, MuralU32 height, bool propagate = true, bool locked = false);
- set_size set the size of the feuille. If propagate is true it just calls post_resize, otherwise it locks the feuille and sets its size to widhtxheight. If the object was locked before calling the method locked should be set to true to prevent deadlocks. Subclasses can redefined this call to track size change (see the Millefeuille class).
bool in_bounding_box(Point<Mural32> point, Mural32 margin = 0);
in_bounding_box checks if point is inside the relative bounding box of the feuille extended by margin in all directions. This method lock the feuille.
void get_absolute_box(Point<Mural32> &origin, MuralU32 &width, MuralU32 &height);
get_absolute_box return the position (in origin)and the size (in width and heigh) of the bounding box of the feuille in the absolute coordinate system of the root Collage. This function will lock recursively all feuilles between this feuille and root.
bool in_absolute_bounding_box(Point<Mural32> point, Mural32 margin = 0);
Using get_absolute_box, in_absolute_bounding_box checks if point is inside the absolute bounding box of the feuille extended by margin. This function will lock recursively all feuilles between this feuille and root.
void post_reposition(Mural32 x, Mural32 y);
void post_resize(MuralU32 width, MuralU32 height);
Mural32 x,y; MuralU32 width, height;