Gtk2::Ex::AdjustmentBits -- helpers for Gtk2::Adjustment objects
use Gtk2::Ex::AdjustmentBits;
Gtk2::Ex::AdjustmentBits::scroll_value ($adj, $amount)
Add $amount to the value in $adj, restricting the result to between lower and upper - page, as suitable for a scrollbar range etc.
$amount
$adj
lower
upper - page
Gtk2::Ex::AdjustmentBits::scroll_increment ($adj, $inctype)
Gtk2::Ex::AdjustmentBits::scroll_increment ($adj, $inctype, $inverted)
Increment the value in $adj. $inctype (a string) can be either
$inctype
"step" increment by step_increment() "page" increment by page_increment()
If optional parameter $inverted is true then decrement instead of increment. The scroll is applied per scroll_value() above.
$inverted
scroll_value()
$propagate = Gtk2::Ex::AdjustmentBits::scroll_event ($adj, $event)
$propagate = Gtk2::Ex::AdjustmentBits::scroll_event ($adj, $event, $inverted)
Scroll $adj according to $event, a Gtk2::Gdk::Event::Scroll.
$event
Gtk2::Gdk::Event::Scroll
$event->direction() gives the direction
$event->direction()
"up" decrement "left" decrement "down" increment "right" increment
If the control key is held down (control-mask in $event->state()) then the scroll amount is page_increment rather than step_increment.
control-mask
$event->state()
page_increment
step_increment
If optional parameter $inverted is true then increment/decrement are swapped, so up+left are increment and down+right are decrement.
The return value is Gtk2::EVENT_PROPAGATE which may be convenient if called from a widget scroll-event signal handler.
Gtk2::EVENT_PROPAGATE
scroll-event
The increment direction corresponds to an adjustment used in a Gtk2::ScrollBar (and its inverted property), and similar such widgets.
Gtk2::ScrollBar
inverted
Gtk2::Ex::AdjustmentBits::set_maybe ($adjustment, field => $value, ...)
Set fields in $adjustment, with changed and notify signals emitted if the values are different from what's already there. The fields are
$adjustment
value upper lower page_size page_increment step_increment
For example
Gtk2::Ex::AdjustmentBits::set_maybe ($adjustment, upper => 100.0, lower => 0.0, value => 50.0);
The plain field getter/setters like $adjustment->upper() don't emit any signals, and the object $adjustment->set only emits notify (or changed too in Gtk 2.18 or thereabouts). set_maybe takes care of all necessary signals and does them only after storing all the values and only if actually changed.
$adjustment->upper()
$adjustment->set
notify
changed
set_maybe
Not emitting signals when values are unchanged may save some work in widgets controlled by $adjustment, though a good widget might notice unchanged values itself.
Gtk2::Ex::AdjustmentBits::set_empty ($adj)
Make $adj empty by setting its upper, lower, and all values to 0. This is done with set_maybe() above, so if it's already empty no changed etc signals are emitted.
set_maybe()
Gtk2::Adjustment, Gtk2::Ex::WidgetBits
http://user42.tuxfamily.org/gtk2-ex-widgetbits/index.html
Copyright 2010, 2011, 2012 Kevin Ryde
Gtk2-Ex-WidgetBits 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-WidgetBits 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-WidgetBits. If not, see http://www.gnu.org/licenses/.
To install Gtk2::Ex::WidgetBits, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gtk2::Ex::WidgetBits
CPAN shell
perl -MCPAN -e shell install Gtk2::Ex::WidgetBits
For more information on module installation, please visit the detailed CPAN module installation guide.