mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-08 14:45:43 +01:00
Allow to destroy Widgets when removing them from a container
This is useful when the container uses manage()d Widgets, which are otherwise not destroyed.
This commit is contained in:
parent
defc902571
commit
f9d80c32d6
2 changed files with 5 additions and 2 deletions
|
|
@ -139,7 +139,7 @@ namespace Gtkmm2ext {
|
|||
LIBGTKMM2EXT_API int physical_screen_height (Glib::RefPtr<Gdk::Window>);
|
||||
LIBGTKMM2EXT_API int physical_screen_width (Glib::RefPtr<Gdk::Window>);
|
||||
|
||||
LIBGTKMM2EXT_API void container_clear (Gtk::Container&);
|
||||
LIBGTKMM2EXT_API void container_clear (Gtk::Container&, bool and_delete = false);
|
||||
|
||||
/* C++ API for rounded rectangles */
|
||||
|
||||
|
|
|
|||
|
|
@ -667,12 +667,15 @@ Gtkmm2ext::physical_screen_width (Glib::RefPtr<Gdk::Window> win)
|
|||
}
|
||||
|
||||
void
|
||||
Gtkmm2ext::container_clear (Gtk::Container& c)
|
||||
Gtkmm2ext::container_clear (Gtk::Container& c, bool and_delete)
|
||||
{
|
||||
list<Gtk::Widget*> children = c.get_children();
|
||||
for (list<Gtk::Widget*>::iterator child = children.begin(); child != children.end(); ++child) {
|
||||
(*child)->hide ();
|
||||
c.remove (**child);
|
||||
if (and_delete) {
|
||||
delete *child;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue