Prima::ScrollBar(3) standard scroll bars class

DESCRIPTION

The class "Prima::ScrollBar" implements both vertical and horizontal scrollbars in Prima. This is a purely Perl class without any C-implemented parts except those inherited from "Prima::Widget".

SYNOPSIS


use Prima::ScrollBar;
my $sb = Prima::ScrollBar-> create( owner => $group, %rest_of_profile);
my $sb = $group-> insert( 'ScrollBar', %rest_of_profile);
my $isAutoTrack = $sb-> autoTrack;
$sb-> autoTrack( $yesNo);
my $val = $sb-> value;
$sb-> value( $value);
my $min = $sb-> min;
my $max = $sb-> max;
$sb-> min( $min);
$sb-> max( $max);
$sb-> set_bounds( $min, $max);
my $step = $sb-> step;
my $pageStep = $sb-> pageStep;
$sb-> step( $step);
$sb-> pageStep( $pageStep);
my $partial = $sb-> partial;
my $whole = $sb-> whole;
$sb-> partial( $partial);
$sb-> whole( $whole);
$sb-> set_proportion( $partial, $whole);
my $size = $sb-> minThumbSize;
$sb-> minThumbSize( $size);
my $isVertical = $sb-> vertical;
$sb-> vertical( $yesNo);
my ($width,$height) = $sb-> get_default_size;

API

Properties

autoTrack BOOLEAN
Tells the widget if it should send "Change" notification during mouse tracking events. Generally it should only be set to 0 on very slow computers.

Default value is 1 (logical true).

growMode INTEGER
Default value is gm::GrowHiX, i.e. the scrollbar will try to maintain the constant distance from its right edge to its owner's right edge as the owner changes its size. This is useful for horizontal scrollbars.
height INTEGER
Default value is $Prima::ScrollBar::stdMetrics[1], which is an operating system dependent value determined with a call to "Prima::Application-> get_default_scrollbar_metrics". The height is affected because by default the horizontal "ScrollBar" will be created.
max INTEGER
Sets the upper limit for "value".

Default value: 100.

min INTEGER
Sets the lower limit for "value".

Default value: 0

minThumbSize INTEGER
A minimal thumb breadth in pixels. The thumb cannot have main dimension lesser than this.

Default value: 21

pageStep INTEGER
This determines the increment/decrement to "value" during ``page''-related operations, for example clicking the mouse on the strip outside the thumb, or pressing "PgDn" or "PgUp".

Default value: 10

partial INTEGER
This tells the scrollbar how many of imaginary units the thumb should occupy. See "whole" below.

Default value: 10

selectable BOOLEAN
Default value is 0 (logical false). If set to 1 the widget receives keyboard focus; when in focus, the thumb is blinking.
step INTEGER
This determines the minimal increment/decrement to "value" during mouse/keyboard interaction.

Default value is 1.

value INTEGER
A basic scrollbar property; reflects the imaginary position between "min" and "max", which corresponds directly to the position of the thumb.

Default value is 0.

vertical BOOLEAN
Determines the main scrollbar style. Set this to 1 when the scrollbar style is vertical, 0 - horizontal. The property can be changed at run-time, so the scrollbars can morph from horizontal to vertical and vice versa.

Default value is 0 (logical false).

whole INTEGER
This tells the scrollbar how many of imaginary units correspond to the whole length of the scrollbar. This value has nothing in common with "min" and "max". You may think of the combination of "partial" and "whole" as of the proportion between the visible size of something (document, for example) and the whole size of that ``something''. Useful to struggle against infamous ``bird'' size of Windows scrollbar thumbs.

Default value is 100.

Methods

get_default_size
Returns two integers, the default platform dependant width of a vertical scrollbar and height of a horizontal scrollbar.

Events

Change
The "Change" notification is sent whenever the thumb position of scrollbar is changed, subject to a certain limitations when "autoTrack" is 0. The notification conforms the general Prima rule: it is sent when appropriate, regardless to whether this was a result of user interaction, or a side effect of some method programmer has called.
Track
If "autoTrack" is 0, called when the user changes the thumb position by the mouse instead of "Change".

EXAMPLE

        use Prima;
        use Prima::Application name => 'ScrollBar test';
        use Prima::ScrollBar;
        my $w = Prima::Window-> create(
                text => 'ScrollBar test',
                size => [300,200]);
        my $sb = $w-> insert( ScrollBar =>
                width => 280,
                left => 10,
                bottom => 50,
                onChange => sub {
                        $w-> text( $_[0]-> value);
                });
        run Prima;

AUTHORS

Dmitry Karasik <[email protected]>, Anton Berezin <[email protected]> - documentation