Author image Kevin Ryde
and 1 contributors


Glib::Ex::ConnectProperties::Element::widget -- various widget attributes


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


This element class implements ConnectProperties access to the following attributes of a Gtk2::Widget,

    widget#direction      Gtk2::TextDirection enum, ltr or rtl
    widget#screen         Gtk2::Gdk::Screen
    widget#has-screen     boolean, read-only
    widget#state          Gtk2::StateType enum
    widget#toplevel       Gtk2::Window or undef, read-only

These things are not available as widget properties as such (though perhaps they could have been) but instead have get/set methods and report changes with specific signals.

  • widget#direction is the "ltr" or "rtl" text direction, per get_direction() and set_direction() methods.

    If "none" is set then get_direction() gives back "ltr" or "rtl" following the global default. Storing "none" with ConnectProperties probably won't work very well, except to a forced write_only target so that it's not read back.

  • widget#screen uses the get_screen() method. This means it will give the default screen until the widget is added to a toplevel Gtk2::Window or similar to determine the screen.

    widget#screen is read-only for most widgets, but is writable for anything with a set_screen() such as Gtk2::Menu. There's a plain screen property on Gtk2::Window so it doesn't need this special widget#screen, but other widgets benefit.

    Gtk2::Gdk::Screen is new in Gtk 2.2 and widget#screen and widget#has-screen are not available in Gtk 2.0.x.

  • widget#state is the state() / set_state() condition, such as "normal" or "prelight".

    Note that storing "insensitive" doesn't work very well, since a subsequent setting back to "normal" doesn't turn the sensitive flag back on. Perhaps this will change in the future, so as to actually enforce the desired new state.

  • widget#toplevel is the widget ancestor with toplevel flag set, or undef if none. This is get_toplevel() plus its recommended $parent->toplevel() flag check. The hierarchy-changed signal indicates a change to the toplevel.

          ([$toolitem, 'widget#toplevel'],
           [$dialog,   'transient-for']);

    The toplevel is normally a Gtk2::Window or subclass, but in principle could be another class.


Glib::Ex::ConnectProperties, Glib::Ex::ConnectProperties::Element::widget_allocation, Gtk2::Widget



Copyright 2010, 2011, 2012, 2017 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