View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Kevin Ryde > Gtk2-Ex-WidgetBits-48 > Gtk2::Ex::ContainerBits



Annotate this POD



Open  0
View/Report Bugs
Module Version: 48   Source  


Gtk2::Ex::ContainerBits -- helpers for Gtk2::Container widgets


 use Gtk2::Ex::ContainerBits;


Gtk2::Ex::ContainerBits::remove_widgets ($container, $widget,...)

Remove each given $widget from $container if it is in fact a child of $container.

Checking widgets are children avoids Glib::Log error messages from $container->remove, including unusual cases of a remove signal handler removing multiple widgets in response to removing one.

Gtk2::Ex::ContainerBits::remove_all ($container)

Remove all child widgets from $container.

This is simply the above remove_widgets on all current children and so copes with removal of one child causing removal of others. If a removal causes new children to be added then they're not removed, only those present at the start.


Nothing is exported by default, but the functions can be requested in usual Exporter style,

    use Gtk2::Ex::ContainerBits 'remove_widgets';
    remove_widgets ($container, $widget1, $widget2);

There's no :all tag since this module is meant as a grab-bag of functions and to import as-yet unknown things would be asking for name clashes.

When making a container subclass the functions could be imported to have them available as methods on the new class if the names and purpose suit.

    package MyBucket;                         # new class
    use Glib::Object::Subclass 'Gtk2::HBox';
    use Gtk2::Ex::ContainerBits 'remove_all'; # import

    $bucket->remove_all;  # available as a method


Gtk2::Container, Gtk2::Ex::WidgetBits



Copyright 2010, 2011, 2012 Kevin Ryde

Gtk2-Ex-WidgetBits is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Gtk2-Ex-WidgetBits is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Gtk2-Ex-WidgetBits. If not, see

syntax highlighting: