The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

SYNOPSIS

use Gtk2::Ex::ContainerBits;

FUNCTIONS

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.

EXPORTS

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

SEE ALSO

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

HOME PAGE

http://user42.tuxfamily.org/gtk2-ex-widgetbits/index.html

LICENSE

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 http://www.gnu.org/licenses/.