Kevin Ryde > Glib-Ex-ConnectProperties-19 > Glib::Ex::ConnectProperties::Element::textbuffer

Download:
Glib-Ex-ConnectProperties-19.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 19   Source  

NAME ^

Glib::Ex::ConnectProperties::Element::textbuffer -- TextBuffer character count

SYNOPSIS ^

 Glib::Ex::ConnectProperties->new([$textbuf, 'textbuffer#empty'],
                                  [$another, 'something']);

DESCRIPTION ^

This element class implements ConnectProperties access to the following attributes of a Gtk2::TextBuffer.

    textbuffer#empty           boolean, read-only
    textbuffer#not-empty       boolean, read-only
    textbuffer#char-count      integer, read-only

For example textbuffer#not-empty might be connected up to make a "clear" button sensitive only when there is in fact something to clear

    Glib::Ex::ConnectProperties->new
      ([$textbuf, 'textbuffer#not-empty'],
       [$button,  'sensitive', write_only => 1]);

These attributes use $textbuf->get_char_count(). Gtk2::TextBuffer doesn't offer this count from a property as such, only a method.

The full text string is available from the text property on the TextBuffer in the usual way. But Gtk circa 2.24.8 doesn't seem to emit a notify for changes to it, only the changed signal. If accessing text with ConnectProperties it may be necessary to use read_signal => "changed" instead of the usual notify.

SEE ALSO ^

Glib::Ex::ConnectProperties, Glib::Ex::ConnectProperties::Element::model_rows, Gtk2::TextBuffer

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/.

syntax highlighting: