| 1 | # Copyright 2010, 2011 Kevin Ryde | ||
| 2 | |||
| 3 | # This file is part of Chart. | ||
| 4 | # | ||
| 5 | # Chart is free software; you can redistribute it and/or modify it under the | ||
| 6 | # terms of the GNU General Public License as published by the Free Software | ||
| 7 | # Foundation; either version 3, or (at your option) any later version. | ||
| 8 | # | ||
| 9 | # Chart is distributed in the hope that it will be useful, but WITHOUT ANY | ||
| 10 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 11 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 12 | # details. | ||
| 13 | # | ||
| 14 | # You should have received a copy of the GNU General Public License along | ||
| 15 | # with Chart. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | |||
| 17 | |||
| 18 | package App::Chart::Gtk2::Ex::ContainerBits; | ||
| 19 | use 5.010; | ||
| 20 | use strict; | ||
| 21 | use warnings; | ||
| 22 | |||
| 23 | sub children_propagate_direction { | ||
| 24 | my ($container) = @_; # if signal ($self, $previous_direction, $userdata) | ||
| 25 | my $dir = $container->get_direction; | ||
| 26 | foreach my $child ($container->get_children) { | ||
| 27 | $child->propagate_direction ($dir); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | 1; | ||
| 32 | __END__ | ||
| 33 | |||
| 34 | =for stopwords Ryde Chart | ||
| 35 | |||
| 36 | =head1 NAME | ||
| 37 | |||
| 38 | App::Chart::Gtk2::Ex::ContainerBits -- helpers for Gtk2::Container widgets | ||
| 39 | |||
| 40 | =head1 SYNOPSIS | ||
| 41 | |||
| 42 | use App::Chart::Gtk2::Ex::ContainerBits; | ||
| 43 | |||
| 44 | =head1 FUNCTIONS | ||
| 45 | |||
| 46 | =over 4 | ||
| 47 | |||
| 48 | =item C<< App::Chart::Gtk2::Ex::ContainerBits::children_propagate_direction ($container) >> | ||
| 49 | |||
| 50 | Propagate the C<ltr>/C<rtl> "direction" setting on C<$container> to its | ||
| 51 | child widgets. | ||
| 52 | |||
| 53 | This function can be set as a C<direction-changed> signal handler on the | ||
| 54 | container if you want to propagate future changes too. | ||
| 55 | |||
| 56 | # propagate current setting | ||
| 57 | App::Chart::Gtk2::Ex::ContainerBits::children_propagate_direction($container); | ||
| 58 | |||
| 59 | # propagate any future changes | ||
| 60 | $container->signal_handler | ||
| 61 | (direction_changed => | ||
| 62 | \&App::Chart::Gtk2::Ex::ContainerBits::children_propagate_direction); | ||
| 63 | |||
| 64 | =back | ||
| 65 | |||
| 66 | =head1 SEE ALSO | ||
| 67 | |||
| 68 | L<Gtk2::Container>, L<Gtk2::Ex::WidgetBits> | ||
| 69 | |||
| 70 | =head1 HOME PAGE | ||
| 71 | |||
| 72 | L<http://user42.tuxfamily.org/chart/index.html> | ||
| 73 | |||
| 74 | =head1 LICENSE | ||
| 75 | |||
| 76 | Copyright 2010, 2011 Kevin Ryde | ||
| 77 | |||
| 78 | Chart is free software; you can redistribute it and/or modify | ||
| 79 | it under the terms of the GNU General Public License as published by the | ||
| 80 | Free Software Foundation; either version 3, or (at your option) any later | ||
| 81 | version. | ||
| 82 | |||
| 83 | Chart is distributed in the hope that it will be useful, but | ||
| 84 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 85 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 86 | more details. | ||
| 87 | |||
| 88 | You should have received a copy of the GNU General Public License along with | ||
| 89 | Chart. If not, see L<http://www.gnu.org/licenses/>. | ||
| 90 | |||
| 91 | =cut |