App::Chart::Gtk2::Ex::BindingBits -- helpers for Gtk2::BindingSet etc
$bool = App::Chart::Gtk2::Ex::BindingBits::activate_button_event ($bindings, $event, $object)
Activate bindings for a button press
$event. The return is true if a binding was found and activated or false if not.
$event should be a
Gtk2::Gdk::Event::Button. The button number is turned into keyval
Pointer_Button1 etc, modifiers get
release-mask added if it's a
button-release event, then simply
$bindings->activate ($keyval, $modifiers, $object)
$bindings can be either a
Gtk2::BindingSet object or a string name of a binding set for
Gtk2::BindingSet->find. As of Gtk 2.18 there's keyvals for buttons 1 through 5. If
$event->button is somehow another value then
activate_button_event returns 0 as there cannot be any bindings for it.
See examples/binding-button-event.pl in the sources for a sample program.
For reference, as of Gtk 2.18 the
$object->bindings_activate is no good for
Pointer_Button1 etc as that
bindings_activate trys to go from keyval to hardware keycode then back to keyvals, but there's normally no keycode for the pointer buttons, so it doesn't lookup anything in the BindingSet.
Copyright 2009, 2010 Kevin Ryde
Chart 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.
Chart 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 Chart. If not, see http://www.gnu.org/licenses/.