Gtk2::Ex::LayoutBits - misc Gtk2::Layout helpers


Gtk2-Ex-WidgetBits documentation Contained in the Gtk2-Ex-WidgetBits distribution.

Index


Code Index:

NAME

Top

Gtk2::Ex::LayoutBits -- misc Gtk2::Layout helpers

SYNOPSIS

Top

 use Gtk2::Ex::LayoutBits;

FUNCTIONS

Top

Gtk2::Ex::LayoutBits::move_maybe ($layout, $child, $x, $y)

Move $child to $x,$y in $layout as per $layout->move(), if it's not already at $x,$y.

As of Gtk 2.22 $layout->move() or a child_set_property() always does a queue_resize(). This function avoids that if the child is already in the right place.

SEE ALSO

Top

Gtk2::Layout, Gtk2::Ex::WidgetBits

HOME PAGE

Top

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

LICENSE

Top

Copyright 2010, 2011 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/.


Gtk2-Ex-WidgetBits documentation Contained in the Gtk2-Ex-WidgetBits distribution.

# Copyright 2010, 2011 Kevin Ryde

# This file is part of Gtk2-Ex-WidgetBits.
#
# 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/>.

package Gtk2::Ex::LayoutBits;
use 5.008;
use strict;
use warnings;

use Exporter;
our @ISA = ('Exporter');
our @EXPORT_OK = qw(move_maybe);

our $VERSION = 43;

# uncomment this to run the ### lines
#use Smart::Comments;

sub move_maybe {
  my ($layout, $child, $x, $y) = @_;
  ### LayoutBits move_maybe()...
  if ($layout->child_get_property($child,'x') != $x
      || $layout->child_get_property($child,'y') != $y) {
    ### move to: "$x,$y"
    $layout->move ($child, $x, $y)
  }
}

1;
__END__