Documentation | InterfaceKit | Size
SYNOPSIS
Perl
use HaikuR1::Size qw(B_SIZE_UNSET B_SIZE_UNLIMITED); my $size = HaikuR1::Size->new($width, $height);
Python
from HaikuR1.InterfaceKit import Size, B_SIZE_UNSET, B_SIZE_UNLIMITED size = Size(width, height)
DESCRIPTION
Exposes the BSize
object.
As a convenience, wherever a method expects a Size as input, you may pass a two-item native list or native map instead. In addition, you may treat a Size object like a native list.
For more information on Size, see the Haiku Book class description.
Perl
# input converter $message->AddSize("size", [$width,$height]); $message->AddSize("size", { $width, $height }); # list accessors $size->[0] = $width2; $size->[1] = $height2;
Python
# input converter message.AddSize("size", [width,height]) message.AddSize("size", { width, height }) # list accessors size[0] = width2 size[1] = height2
PROPERTIES
width
A floating point number.
height
A floating point number.
METHODS
Constructor
Creates a Size object.
Perl
HaikuR1::Size->new($width, $height); HaikuR1::Size->new($copy_from); HaikuR1::Size->new();
Python
Size(width, height) Size(copy_from) Size()
width, height
Optional floating point numbers, the width and height.
copy_from
Optional, a Size to copy. (Substitution of a native list is not implemented here.)
copy
Copies the contents of another object into this object.
Perl
$size->copy($copy_from);
Python
size.copy(copy_from)
copy_from
A Size to copy.
Width and Height
Set
Width
IntegerWidth
SetWidth
IsWidthSet
Height
SetHeight
IntegerHeight
IsHeightSet
These methods do what you expect.
Perl
$size->Set($width, $height); $size->Width(); $size->IntegerWidth(); $size->SetWidth($width); $size->IsWidthSet(); $size->Height(); $size->IntegerHeight(); $size->SetHeight($height); $size->IsHeightSet();
Python
size.Set(width, height) size.Width() size.IntegerWidth() size.SetWidth(width) size.IsWidthSet() size.Height() size.IntegerHeight() size.SetHeight(height) size.IsHeightSet()
width
A floating point number, the new width.
height
A floating point number, the new height.
OPERATORS
==
Returns true if the Size objects have the same dimensions.
!=
Returns true if the Size objects do not have the same dimensions.
CONSTANTS
B_SIZE_UNSET
An empty Size starts out with its width and height set to this value; you can also unset a dimensions by setting it to this value.
B_SIZE_UNLIMITED
An absurdly large size, specifically
1 073 741 824
. Used as an indicator that there is no maximum size in a particular dimension.