layout: + remove_widget
This commit is contained in:
parent
3c5f5c8ea9
commit
231499f24c
2 changed files with 11 additions and 0 deletions
|
@ -43,6 +43,16 @@ namespace bwidgets
|
|||
for (const auto& w : _widgets) f(w.get());
|
||||
}
|
||||
|
||||
void remove_widget(const std::shared_ptr<Widget>& widget) override
|
||||
{
|
||||
for (auto i = _widgets.cbegin(); i != _widgets.cend(); i++) {
|
||||
if (*i == widget) {
|
||||
_widgets.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return smallest usable size.
|
||||
[[nodiscard]] auto size() const noexcept -> Size override
|
||||
{
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace bwidgets
|
|||
// Apply a function to every layout widget.
|
||||
virtual void for_widgets(const std::function<void(Widget*)>&) = 0;
|
||||
virtual void for_widgets(const std::function<void(const Widget*)>&) const = 0;
|
||||
virtual void remove_widget(const std::shared_ptr<Widget>&) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue