The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Gtk2::Ex::Spinner::EntryWithCancel -- Gtk2::Entry with a cancelled property

SYNOPSIS

 use Gtk2::Ex::Spinner::EntryWithCancel;
 my $entry = Gtk2::Ex::Spinner::EntryWithCancel->new;

 $entry->signal_connect ('editing-done',
                         sub {
                           if ($entry->get('editing-cancelled'))
                             ...
                         });

WIDGET HIERARCHY

Gtk2::Ex::Spinner::EntryWithCancel is a subclass of Gtk2::Entry.

    Gtk2::Widget
      Gtk2::Entry
        Gtk2::Ex::Spinner::EntryWithCancel

And implements the interface

    Gtk2::CellEditable

DESCRIPTION

Gtk2::Ex::Spinner::EntryWithCancel is based on a great Gtk2::Ex::DateSpinner::EntryWithCancel, so in most cases documentation is the same. License is (of course) the same too :-).

Caution: This is internals of Gtk2::Ex::Spinner::CellRenderer. If it ends up with a use beyond that then it'll be split out and renamed.

EntryWithCancel extends Gtk2::Entry to have an "editing-cancelled" flag set when editing through the Gtk2::CellEditable interface. An an Escape key press or cancel action sets the flag.

Gtk2::Entry already has such a flag (mis-spelt editing_canceled) but doesn't make it publicly available. Is that right? At any rate this subclass gets the desired effect.

FUNCTIONS

$entry = Gtk2::Ex::Spinner::EntryWithCancel->new (key=>value,...)

Create and return a new EntryWithCancel object. Optional key/value pairs set initial properties as per Glib::Object->new. Eg.

    my $entry = Gtk2::Ex::Spinner::EntryWithCancel->new
                  (xalign => 0.5);
$entry->cancel ()

Emit the cancel action signal, thus performing that action (see "SIGNALS" below).

PROPERTIES

editing-cancelled (boolean, default false)

Cleared by start_editing (the Gtk2::CellEditable func) and then set to true or false under an Escape (keypress), cancel (below), or activate (Gtk2::Widget signal). editing-done handlers (the Gtk2::CellEditable signal) can then consult the value.

SIGNALS

cancel (action, no parameters)

Perform the cancel action, which is to set the editing-cancelled property, and if editing is active (from a start_editing) then emit editing-done and remove-widget.

The Escape key binding runs this signal.

SEE ALSO

Gtk2::Entry, Glib::Object

LICENSE

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