View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Kevin Ryde > Glib-Ex-ConnectProperties-19 > Glib::Ex::ConnectProperties::Element::widget_allocation



Annotate this POD


View/Report Bugs
Module Version: 19   Source  


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


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


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,

      ([$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.)

      ([$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.


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



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

syntax highlighting: