Haiku API Bindings
Alignment
Not logged in

Documentation | InterfaceKit | Alignment

SYNOPSIS

Perl

Python

use HaikuR1::Alignment;
use HaikuR1::InterfaceKit qw(B_ALIGN_LEFT B_ALIGN_RIGHT B_ALIGN_CENTER B_ALIGN_HORIZONTAL_CENTER B_ALIGN_HORIZONTAL_UNSET B_ALIGN_USE_FULL_WIDTH B_ALIGN_TOP B_ALIGN_MIDDLE B_ALIGN_BOTTOM B_ALIGN_VERTICAL_CENTER B_ALIGN_VERTICAL_UNSET B_ALIGN_NO_VERTICAL B_ALIGN_USE_FULL_HEIGHT)

DESCRIPTION

Exposes the BAlignment object.

As a convenience, wherever a method expects a Alignment as input, you may pass a two-item native list or native map instead. In addition, you may treat an Alignment object like a native list.

For more information on Alignment, see the Haiku Book class description.

Perl

Python

# input converters
$message->AddAlignment("alignment", [$horizontal,$vertical]);
$message->AddAlignment("alignment", {
    horizontal => $horizontal,
    vertical   => $vertical
});

# list accessors
$alignment->[0] = $horizontal2;
$alignment->[1] = $vertical2;

PROPERTIES

horizontal

The horizontal alignment.

vertical

The vertical alignment.

METHODS

Constructor

Creates a Size object.

Perl

Python

HaikuR1::Alignment->new($horizontal, $vertical);
HaikuR1::Alignment->new($copy_from);
HaikuR1::Alignment->new();

copy

Copies the contents of another object into this object.

Perl

Python

$alignment->copy($copy_from);

Alignments

Horizontal

RelativeHorizontal

SetHorizontal

IsHorizontalSet

Vertical

RelativeVertical

SetVertical

IsVerticalSet

RelativeHorizontal returns the horizontal alignment as a floating point number: 0 for B_ALIGN_LEFT, 1 for B_ALIGN_RIGHT, 0.5 for B_ALIGN_HORIZONTAL_CENTER.

RelativeVertical returns the vertical alignment as a floating point number: 0 for B_ALIGN_TOP, 1 for B_ALIGN_BOTTOM, 0.5 for B_ALIGN_VERTICAL_CENTER.

The other methods do what you expect.

Perl

Python

$alignment->Horizontal();
$alignment->RelativeHorizontal();
$alignment->SetHorizontal($horizontal);
$alignment->IsHorizontalSet();

$alignment->Vertical();
$alignment->RelativeVertical();
$alignment->SetVertical($vertical);
$alignment->IsVerticalSet();

OPERATORS

==

Returns true if the Alignment objects have the same alignments.

!=

Returns true if the Alignment objects do not have the same alignments.