Haiku API Bindings
ScrollBar
Not logged in

Documentation | InterfaceKit | ScrollBar

SYNOPSIS

Perl

use HaikuR1::Application;
use HaikuR1::Window;
use HaikuR1::View;
use HaikuR1::ScrollBar;

# define MyApplication, MyWindow, MyView, and MyScrollBar subclass here

my $app = MyApplication->new($signature);
my $window = MyWindow->new(
    frame      => Rect->new($left, $top, $right, $bottom),
    title      => $title,
    type       => B_TITLED_WINDOW,
    flags      => B_QUIT_ON_WINDOW_CLOSE,
    workspaces => B_CURRENT_WORKSPACE,
);
my $view = MyView->new(
    frame        => Rect->new($vleft, $vtop, $vright, $vbottom),
    name         => $name,
    resizingMode => $resizing_mode,
    flags        = >$vflags,
);
my $scrollbar = MyScrollBar->new(
    frame     => Rect->new($vleft, $vtop, $vright, $vbottom),
    name      => $name2,
    target    => $view,
    min       => $min,
    max       => $max,
    direction => $direction,
);
$window->AddChild($scrollview);

$window->Show();
$app->Run();

# wait for an event to Quit the app or window

Python

from HaikuR1.ApplicationKit import Application
from HaikuR1.InterfaceKit import Window
from HaikuR1.InterfaceKit import View
from HaikuR1.InterfaceKit import ScrollBar

# define MyApplication, MyWindow, MyView, and MyScrollBar subclass here

app = MyApplication(signature)
window = MyWindow(
    frame      = Rect(left, top, right, bottom),
    title      = title,
    type       = B_TITLED_WINDOW,
    flags      = B_QUIT_ON_WINDOW_CLOSE,
    workspaces = B_CURRENT_WORKSPACE,
)
view = MyView(
    frame        = Rect(vleft, vtop, vright, vbottom),
    name         = name,
    resizingMode = resizing_mode,
    flags        = >vflags,
)
scrollbar = MyScrollBar(
    frame     = Rect(vleft, vtop, vright, vbottom),
    name      = name2,
    target    = view,
    min       = min,
    max       = max,
    direction = direction,
)
window.AddChild(scrollview)

window.Show()
app.Run()

# wait for an event to Quit the app or window

DESCRIPTION

Exposes the BScrollBar object.

For more information on ScrollBar, see the Be Book class description, the Be Book overview, and the Haiku Book class description.

METHODS

Constructor

Creates a ScrollBar.

Perl

HaikuR1::ScrollBar->new(
    frame => $frame,
    name => $name,
    target => $target,
    min => $min,
    max => $max,
    direction => $direction,
);
HaikuR1::ScrollBar->newWithoutFrame(
    name => $name,
    target => $target,
    min => $min,
    max => $max,
    direction => $direction,
);
HaikuR1::ScrollBar->newFromArchive($archive);

Python

ScrollBar(
    frame = frame,
    name = name,
    target = target,
    min = min,
    max = max,
    direction = direction,
)
ScrollBar.WithoutFrame(
    name = name,
    target = target,
    min = min,
    max = max,
    direction = direction,
)
ScrollBar.FromArchive(archive)

Border

SetBorderHighlighted

Sets the ScrollBar's highlighted state.

This method is used internally when the target View's focus rectangle should extend around the ScrollBar. You probably won't need to use it unless you are creating a custom View.

Perl

$scrollbar->SetBorderHighlighted($state);

Python

scrollbar.SetBorderHighlighted(state)

Orientation

SetOrientation

Gets or sets the ScrollBar's direction (horizontal or vertical).

Perl

$scrollbar->Orientation();
$scrollbar->SetOrientation($direction);

Python

scrollbar.Orientation()
scrollbar.SetOrientation(direction)

Proportion

SetProportion

Gets or sets the ScrollBar's proportion; the proportion is a value between 1 and 0 that indicates the proportion of the target View's contents that is visible inside the View.

For example, if half of the View's contents are visible at a time within the View's frame, set the proportion to 0.5.

Perl

$scrollbar->Proportion();
$scrollbar->SetProportion($proportion);

Python

scrollbar.Proportion()
scrollbar.SetProportion(proportion)

Range

GetRange

SetRange

Get or sets the ScrollBar's range; that is, the minimum and maximum allowable values.

Perl

Two values are returned (not an array reference).

Perl

$scrollbar->GetRange();
$scrollbar->SetRange($min, $max);

Python

scrollbar.GetRange()
scrollbar.SetRange(min, max)

Steps

GetSteps

SetSteps

Gets or sets the ScrollBar's steps; that is, the amounts by which user action changes the scrollbar.

Perl

Two values are returned (not an array reference).

Perl

$scrollbar->GetSteps();
$scrollbar->SetSteps($smallStep, $largeStep);

Python

scrollbar.GetSteps()
scrollbar.SetSteps(smallStep, largeStep)

Target

SetTarget

Gets or sets the ScrollBar's target.

Perl

$scrollbar->Target();
$scrollbar->SetTarget($target);
$scrollbar->SetTarget($targetName);

Python

scrollbar.Target()
scrollbar.SetTarget(target)
scrollbar.SetTarget(targetName)

Value

SetValue

Gets or sets the ScrollBar's value; the value should be within the range; if it is not, it will be accordingly adjusted.

Perl

$scrollbar->Value();
$scrollbar->SetValue($value);

Python

scrollbar.Value()
scrollbar.SetValue(value)

HOOKS

ValueChanged

Called when the value changes. This method is called whenever the value changes.

The default version does the range checking, so be sure to call the base class version if you override this.

Perl

$scrollbar->ValueChanged($newValue);

Python

scrollbar.ValueChanged(newValue)

ARCHIVABLE INTERFACE

ScrollView inherits the methods and hooks of Archivable.

HANDLER INTERFACE

ScrollView inherits the methods and hooks of Handler.

VIEW INTERFACE

ScrollView inherits the methods and hooks of View.

The following differ from the View versions:

AttachedToWindow

Sends the ScrollBar's value to the App Server. If you override this hook in a custom ScrollBar, be sure to call the base class version to make sure this happens.

WindowActivated

Under some circumstances (see below), ScrollBars are disabled when the Window becomes inactive. If you override this hook in a custom ScrollBar, you should call the base class version to ensure this occurs.

CONSTANTS

The ScrollBar constants represent values used when compiling the C++ code. It is possible, for example, to use set_scroll_bar_info to set a different width and height than those indicated by the constants.

(Please note, however, that set_scroll_bar_info affects the entire system. At this time, the public Haiku R1 API does not support setting widths for individual scrollbars.)

Size

Perl

use HaikuR1::ScrollBar qw(:size)

Python

Python does not support export tags.

Other constants

These constants do not have an export tag.

SCRIPTING SUITE

ScrollBar inherits the following suites: