Class Component

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.

Public type

None

Constructor and destructor

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 = "");
new_x, new_y provide the initial position for the feuille,
new_width, new_height
provide the initial width and height of a the feuille (160X120 by default),
new_type provide the type of the object being created
new_name provide an optional name.
 

Public methods

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);
set_position set the position of the feuille. If propagate is true it just calls post_reposition, otherwise lock the feuille and sets its position to (x,y). 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 position change (see the MilleFeuille class). The redefine method should call this function before retrieving the current position.
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.

Protected Methods

void post_reposition(Mural32 x,
                     Mural32 y);
post_reposition requests the feuille's parent to move the feuille to (x,y). This function is called by set_position which should be used instead..
void post_resize(MuralU32 width,
                 MuralU32 height);
post_resize requests the feuille's parent to change the feuille's size to (width,height). This function is called by set_size which should be used instead.

Public fields

None

Protected fields

Mural32 x,y;
MuralU32 width, height;
Feuille geometric data.
bool null_translation;
null_translation is used during the evaluation of the absolute bounding box. If it is set to true, the current feuille position is ignored while computing the absolute position of a feuile. For example MilleFeuille set this flag to true, because MilleFeuille is a container that should be ignored while computing the absolute position of feuille.