NAME

Glib::Ex::ConnectProperties::Element::widget_allocation -- widget size and position

SYNOPSIS

Glib::Ex::ConnectProperties->new([$widget, 'widget-allocation#width'],
                                 [$another, 'something']);

DESCRIPTION

This element class implements ConnectProperties access to the fields of $widget->allocation() on a Gtk2::Widget (see Gtk2::Widget).

widget-allocation#width       integer, read-only
widget-allocation#height      integer, read-only
widget-allocation#x           integer, read-only
widget-allocation#y           integer, read-only
widget-allocation#rectangle   Gtk2::Gdk::Rectangle, read-only

widget-allocation#width and widget-allocation#height are the widget's current size as set by its container parent (or set by the window manager for a top level). The values are read-only, but for example might be connected up to display the size somewhere,

Glib::Ex::ConnectProperties->new
  ([$toplevel, 'widget-allocation#width'],
   [$label,    'label']);

One use could be to connect the allocated size of one widget to the width-request or height-request of another so as to make it follow that size, though how closely depends on what the target's container parent does for a given requested size. (See Gtk2::SizeGroup for making a common width or height request among a set of widgets.)

Glib::Ex::ConnectProperties->new
  ([$image,  'widget-allocation#height'],
   [$vscale, 'height-request']);

widget-allocation#x and widget-allocation#y are the position of the widget area within its windowed ancestor. These may be of limited use but are included for completeness.

widget-allocation#rectangle is the whole $widget->allocation() object.

SEE ALSO

Glib::Ex::ConnectProperties, Glib::Ex::ConnectProperties::Element::widget, Gtk2::Widget, Gtk2::Gdk::Rectangle

HOME PAGE

http://user42.tuxfamily.org/glib-ex-connectproperties/index.html

LICENSE

Copyright 2010, 2011, 2012 Kevin Ryde

Glib-Ex-ConnectProperties 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.

Glib-Ex-ConnectProperties 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 Glib-Ex-ConnectProperties. If not, see http://www.gnu.org/licenses/.