Canvas: change API of Item::child_changed() to include bool indicate bounding_box change

This commit is contained in:
Paul Davis 2020-06-10 15:24:52 -06:00
parent d6fa458f3b
commit fc9840f2a9
4 changed files with 10 additions and 11 deletions

View File

@ -61,7 +61,7 @@ public:
double top_padding, right_padding, bottom_padding, left_padding;
double top_margin, right_margin, bottom_margin, left_margin;
void child_changed ();
void child_changed (bool bbox_changed);
private:
struct ChildInfo {
Item* item;

View File

@ -226,7 +226,7 @@ public:
void raise_child_to_top (Item *);
void raise_child (Item *, int);
void lower_child_to_bottom (Item *);
virtual void child_changed ();
virtual void child_changed (bool bbox_changed);
static int default_items_per_cell;

View File

@ -353,11 +353,11 @@ Grid::place (Item* i, double x, double y, double col_span, double row_span)
}
void
Grid::child_changed ()
Grid::child_changed (bool bbox_changed)
{
/* catch visibility and size changes */
Item::child_changed ();
Item::child_changed (bbox_changed);
reposition_children ();
}

View File

@ -278,9 +278,8 @@ Item::set_position (Duple p)
if (visible()) {
_canvas->item_moved (this, pre_change_parent_bounding_box);
if (_parent) {
_parent->child_changed ();
_parent->child_changed (false);
}
}
}
@ -378,7 +377,7 @@ Item::propagate_show_hide ()
/* bounding box may have changed while we were hidden */
if (_parent) {
_parent->child_changed ();
_parent->child_changed (false);
}
_canvas->item_shown_or_hidden (this);
@ -640,7 +639,7 @@ Item::end_change ()
_canvas->item_changed (this, _pre_change_bounding_box);
if (_parent) {
_parent->child_changed ();
_parent->child_changed (_pre_change_bounding_box != _bounding_box);
}
}
}
@ -1061,13 +1060,13 @@ Item::invalidate_lut () const
}
void
Item::child_changed ()
Item::child_changed (bool bbox_changed)
{
invalidate_lut ();
_bounding_box_dirty = true;
_bounding_box_dirty = bbox_changed;
if (_parent) {
_parent->child_changed ();
_parent->child_changed (bbox_changed);
}
}