Documentation | InterfaceKit | PictureButton
SYNOPSIS
Perl
use HaikuR1::PictureButton []; HaikuR1::PictureButton->new( frame => $frame, name => $name, off => $off, on => $on, message => $message, behavior => $behavior, resizingMode => $resizingMode, flags => $flags, ); $window->AddChild($button);
Python
import HaikuR1.PictureButton [] button = Button( frame = frame, name = name, off = off, on = on, message = message, behavior = behavior, resizingMode = resizingMode, flags = flags, ) window.AddChild(button)
DESCRIPTION
Exposes the BPictureButton
object.
For more information on PictureButton, see the Be Book class description, the Be Book overview, and the Haiku Book class description.
METHODS
Constructor
Creates a PictureButton.
Perl
HaikuR1::PictureButton->new( frame => $frame, name => $name, off => $off, on => $on, message => $message, behavior => $behavior, resizingMode => $resizingMode, flags => $flags, ); HaikuR1::PictureButton->new($archive);
Python
PictureButton( frame = frame, name = name, off = off, on = on, message = message, behavior = behavior, resizingMode = resizingMode, flags = flags, ) PictureButton(archive)
frame
A Rect that indicates where on the parent Window the View should be. You should not specify a frame on a View that will be added to a parent which uses a Layout.
name
A string, the Button's internal name.
on
,off
Pictures, to be displayed when the button is pressed (on) or not pressed (off).
message
A Message that will be sent when the Button is Invoked.
behavior
An integer behavior constant.
resizingMode
An integer, the resizing mode. (See the resizing mode constants.) Should only be specified when there is a frame. Defaults to
B_FOLLOW_NONE
.flags
An integer, view flags. (See the view flag constants.)
archive
A Message, contains an archived version of the Button.
Behavior
SetBehavior
Gets or sets the button behavior.
Perl
$picturebutton->Behavior(); $picturebutton->SetBehavior($behavior);
Python
picturebutton.Behavior() picturebutton.SetBehavior(behavior)
behavior
An integer behavior constant.
Pictures
EnabledOn
SetEnabledOn
EnabledOff
SetEnabledOff
DisabledOn
SetDisabledOn
DisabledOff
SetDisabledOff
Gets or sets the picture for the given state. The Set...
methods can also be
called as hooks.
The Disabled
images cannot be set by the constructor, so if you are going to
disable your button for any reason, you must set them via this function.
(However, DisabledOff
is not a valid state when the behavior is
B_ONE_STATE_BUTTON
, so you won't need that image in that case.)
Note: There is no way to unset a Picture once set; passing the empty value to this method will cause your application to crash.
Perl
$picturebutton->EnabledOn(); $picturebutton->SetEnabledOn($on); $picturebutton->EnabledOff(); $picturebutton->SetEnabledOff($off); $picturebutton->DisabledOn(); $picturebutton->SetDisabledOn($on); $picturebutton->DisabledOff(); $picturebutton->SetDisabledOff($off);
Python
picturebutton.EnabledOn() picturebutton.SetEnabledOn(on) picturebutton.EnabledOff() picturebutton.SetEnabledOff(off) picturebutton.DisabledOn() picturebutton.SetDisabledOn(on) picturebutton.DisabledOff() picturebutton.SetDisabledOff(off)
on
,off
Pictures, the new picture for the given state.
ARCHIVABLE INTERFACE
PictureButton
inherits the methods and hooks of Archivable.
HANDLER INTERFACE
PictureButton
inherits the methods and hooks of Handler.
VIEW INTERFACE
PictureButton
inherits the methods and hooks of View.
CONTROL INTERFACE
PictureButton
inherits the methods and hooks of Control.
CONSTANTS
Button behavior
Perl
use HaikuR1::PictureButton qw(:behavior)
Python
Python does not support export tags.
B_ONE_STATE_BUTTON
The button is on when clicked, and automatically reverts to off when released.
B_TWO_STATE_BUTTON
The button switches between off and on at each click.
SCRIPTING SUITE
PictureButton inherits the following suites: