mirror of https://github.com/buggins/dlangui.git
Adds flag whether to destroy objects when removing all children from a widget
This commit is contained in:
parent
bcf76405cb
commit
1355b26e84
|
@ -324,9 +324,11 @@ struct ObjectList(T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** remove and destroy all items */
|
/** remove and destroy all items */
|
||||||
void clear() {
|
void clear(bool destroyObj = true) {
|
||||||
for (int i = 0; i < _count; i++) {
|
for (int i = 0; i < _count; i++) {
|
||||||
destroy(_list[i]);
|
if(destroyObj) {
|
||||||
|
destroy(_list[i]);
|
||||||
|
}
|
||||||
_list[i] = null;
|
_list[i] = null;
|
||||||
}
|
}
|
||||||
_count = 0;
|
_count = 0;
|
||||||
|
|
|
@ -1513,7 +1513,7 @@ public:
|
||||||
_window = window;
|
_window = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeAllChildren() {
|
void removeAllChildren(bool destroyObj = true) {
|
||||||
// override
|
// override
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1648,8 +1648,8 @@ class WidgetGroup : Widget {
|
||||||
/// returns index of widget in child list, -1 if passed widget is not a child of this widget
|
/// returns index of widget in child list, -1 if passed widget is not a child of this widget
|
||||||
override int childIndex(Widget item) { return _children.indexOf(item); }
|
override int childIndex(Widget item) { return _children.indexOf(item); }
|
||||||
|
|
||||||
override void removeAllChildren() {
|
override void removeAllChildren(bool destroyObj = true) {
|
||||||
_children.clear();
|
_children.clear(destroyObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue