FLTK::ScrollGroup - Group that adds scrollbars so you can scroll around the area
This container widget lets you maneuver around a set of widgets much larger than your window. If the child widgets are larger than the size of this object then scrollbars will appear so that you can scroll over to them.
The default type( ) will just scroll a whole arrangement of widgets and never resize them. This is useful if you just want to get a big control panel into a smaller window. The bounding box of the widgets are the area it can scroll, this will remove any borders, if you want the borders preserved put some invisible widgets there as placeholders.
type( )
This can be used to pan around a large drawing by making a single child widget "canvas". This child widget should be of your own class, with a draw( ) method that draws everything. The scrolling is done by changing the x( ) and y( ) of the widget and drawing it with the fltk clip region set to the newly exposed rectangles. You can speed things up by using FLTK::not_clipped( ) or FLTK::intersect_with_clip( ) to detect and skip the clipped portions of the drawing.
draw( )
x( )
y( )
FLTK::not_clipped( )
FLTK::intersect_with_clip( )
By default you can scroll in both directions, and the scrollbars disappear if the data will fit in the area of the scroll. type( ) can change this:
HORIZONTAL resize vertically but scroll horizontally
HORIZONTAL
VERTICAL resize horizontally but scroll vertically
VERTICAL
BOTH this is the default
BOTH
HORIZONTAL_ALWAYS resize vertically but always show horizontal scrollbar
HORIZONTAL_ALWAYS
VERTICAL_ALWAYS resize horizontally but always show vertical scrollbar
VERTICAL_ALWAYS
BOTH_ALWAYS always show both scrollbars
BOTH_ALWAYS
If you use HORIZONTAL or VERTICAL you must initally position and size your child widgets as though the scrollbar is off (ie fill the box( ) width entirely if type( ) is VERTICAL). The first time layout( ) is called it will resize the widgets to fit inside the scrollbars.
box( )
layout( )
It is very useful to put a single PackedGroup child into a VERTICAL ScrollGroup.
Also note that scrollbar_align( ) (a Style parameter) can put the scrollbars on different sides of the widget.
scrollbar_align( )
Currently you cannot use Window or any subclass (including GlWindow) as a child of this. The clipping is not conveyed to the operating system's window and it will draw over the scrollbars and neighboring objects.
bbox
$scrollgroup->bbox( $rect );
Set the rectangle to the scrolling area (in the ScrollGroup's coordinate system). This removes the border of the box( ) and the space needed for any visible scrollbars.
enable_drag_scroll
$scrollgroup->enable_drag_scroll( $enable );
new
my $self = $scrollgroup->new( $x, $y, $w, $h, $label, $begin );
Creates a new FLTK::ScrollGroup widget.
scrollTo
$scrollgroup->scrollTo( $x, $y );
xposition
my $x = $scrollgroup->xposition( );
yposition
my $y = $scrollgroup->yposition( );
Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/
Copyright (C) 2008-2010 by Sanko Robinson <sanko@cpan.org>
This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or notes on the Artistic License 2.0 for clarification.
When separated from the distribution, all original POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See the clarification of the CCA-SA3.0.
To install FLTK, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FLTK
CPAN shell
perl -MCPAN -e shell install FLTK
For more information on module installation, please visit the detailed CPAN module installation guide.