App::MathImage::Gtk2::Ex::Statusbar::PointerPosition -- widget pointer position message in a statusbar
use App::MathImage::Gtk2::Ex::Statusbar::PointerPosition; my $ppos = App::MathImage::Gtk2::Ex::Statusbar::PointerPosition->new (widget => $my_widget, statusbar => $my_statusbar);
App::MathImage::Gtk2::Ex::Statusbar::PointerPosition is a Glib::Object subclass,
App::MathImage::Gtk2::Ex::Statusbar::PointerPosition
Glib::Object
Glib::Object Gtk2::Ex::Statusbar::Message App::MathImage::Gtk2::Ex::Statusbar::PointerPosition
Experimental!
A PointerPosition object displays a message in a Gtk2::Statusbar following the mouse pointer position in a given widget.
Gtk2::Statusbar
+--------------------------------------------+ | | | * | | \__mouse pointer | | | | | +--------------------------------------------+ | statusbar message about pointer position | +--------------------------------------------+
The basic operation is a motion-notify-event handler on the widget and a message-string callback to get a string to show. But the advantage of PointerPosition is that it also blanks on leave and it defers updates with the Gtk2::Ex::SyncCall mechanism so as not to do more statusbar updates than can be actually displayed.
motion-notify-event
message-string
Gtk2::Ex::SyncCall
$ppos = App::MathImage::Gtk2::Ex::Statusbar::PointerPosition->new (key=>value,...)
Create and return a new PointerPosition object. Optional key/value pairs set initial properties per Glib::Object->new.
Glib::Object->new
$ppos = App::MathImage::Gtk2::Ex::Statusbar::PointerPosition->new (widget => $my_widget, statusbar => $my_statusbar);
widget
Gtk2::Widget
undef
The widget to watch for mouse motion.
In the current code this must be a windowed widget. It doesn't have to be realized or visible yet -- a statusbar message will be shown if or when that happens (and the mouse is in it).
statusbar
The statusbar to display a message in.
Emitted as a callback to the application asking it for a message string to display for the mouse at x,y within widget.
The widget is always the PointerPosition widget parameter value, but is included as a parameter since making a message will very often want to get or check something from the widget.
$ppos->signal_connect (message_string => \&my_message_string); sub my_message_string { my ($ppos, $widget, $x, $y, $userdata) = @_; return "mouse at X=$x Y=$y, in widget coordinates"; }
If no message should be shown then return undef from the handler.
App::MathImage::Gtk2::Ex::Statusbar::PointerPosition can be built in a Gtk2::Builder spec the same as any other Glib::Object. The class name is "App__MathImage__Gtk2__Ex__Statusbar__PointerPosition" as usual for Perl-Gtk package name to class name conversion.
Gtk2::Builder
The target widget and statusbar properties can be set to objects created in the builder spec. For example
<object class="App__MathImage__Gtk2__Ex__Statusbar__PointerPosition" id="pointerposition"> <property name="widget">my_drawing</property> <property name="statusbar">my_statusbar</property> </object>
Glib::Object, Gtk2::Statusbar, Gtk2::Widget
http://user42.tuxfamily.org/math-image/index.html
Copyright 2010, 2011, 2012, 2013, 2014, 2019, 2020 Kevin Ryde
Math-Image 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.
Math-Image 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 Math-Image. If not, see http://www.gnu.org/licenses/.
To install App::MathImage, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::MathImage
CPAN shell
perl -MCPAN -e shell install App::MathImage
For more information on module installation, please visit the detailed CPAN module installation guide.