| 1 | # not really working ??? | ||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | # Copyright 2008, 2009, 2010 Kevin Ryde | ||
| 6 | |||
| 7 | # This file is part of Chart. | ||
| 8 | # | ||
| 9 | # Chart is free software; you can redistribute it and/or | ||
| 10 | # modify it under the terms of the GNU General Public License as published | ||
| 11 | # by the Free Software Foundation; either version 3, or (at your option) any | ||
| 12 | # later version. | ||
| 13 | # | ||
| 14 | # Chart is distributed in the hope that it will be useful, but | ||
| 15 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 16 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 17 | # for more details. | ||
| 18 | # | ||
| 19 | # You should have received a copy of the GNU General Public License along | ||
| 20 | # with Chart. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | package App::Chart::Gtk2::Ex::CellRendererButton; | ||
| 23 | use 5.006; | ||
| 24 | use strict; | ||
| 25 | use warnings; | ||
| 26 | use Gtk2; | ||
| 27 | |||
| 28 | # uncomment this to run the ### lines | ||
| 29 | #use Smart::Comments; | ||
| 30 | |||
| 31 | use Glib::Object::Subclass | ||
| 32 | 'Gtk2::CellRendererText', | ||
| 33 | signals => { editing_started => \&_do_editing_started, | ||
| 34 | clicked => { param_types => ['Glib::String'], | ||
| 35 | return_type => undef }, | ||
| 36 | }; | ||
| 37 | |||
| 38 | |||
| 39 | sub INIT_INSTANCE { | ||
| 40 | my ($self) = @_; | ||
| 41 | $self->set (editable => 1); | ||
| 42 | } | ||
| 43 | |||
| 44 | # gtk_cell_renderer_start_editing() | ||
| 45 | # | ||
| 46 | sub START_EDITING { | ||
| 47 | my ($self, $event, $view, $pathstr, $back_rect, $cell_rect, $flags) = @_; | ||
| 48 | ### CellRendererButton START_EDITING: $pathstr | ||
| 49 | $self->{'pathstr'} = $pathstr; | ||
| 50 | return undef; | ||
| 51 | } | ||
| 52 | |||
| 53 | sub _do_editing_started { | ||
| 54 | my ($self, $editable, $pathstr) = @_; | ||
| 55 | ### CellRendererButton editing_started | ||
| 56 | $self->signal_chain_from_overridden ($editable, $pathstr); | ||
| 57 | $self->stop_editing (1); | ||
| 58 | $self->signal_emit ('clicked', $self->{'pathstr'}); | ||
| 59 | } | ||
| 60 | |||
| 61 | 1; | ||
| 62 | __END__ |