The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

FLTK::Rectangle - Base class for Widgets, Windows, Monitors, and just about everything else you can see

Description

TODO

Functions

b

my $b = $rectangle->b( );

Returns y( ) + h( ), the bottom edge of the rectangle.

baseline_y

my $baseline = $rectangle->baseline_y( );

Where to put baseline to center current font nicely.

center_x

my $x = $rectangle->center_x( );

Integer center position. Rounded to the left if w( ) is odd.

center_y

my $y = $rectangle->center_y( );

Integer center position. Rounded to lower y if h( ) is odd.

contains

my $can_has = $rectangle->contains( $x, $y );

True if rectangle contains the pixel who's upper-left corner is at $x, $y.

empty

my $empty = $rectangle->empty( );

True if w( ) or h( ) are less or equal to zero.

h

my $h = $rectangle->h( );

Distance between top and bottom edges.

$rectangle->h( $value );

Change h( ) by moving the bottom edge. y( ) does not change.

inset

$rectangle->inset( $d );

Move all edges in by $d. See also Symbol::inset( ).

intersect

$rectangle->intersect( $r );

merge

$rectangle->merge( $r );

move

$rectangle->move( $x, $y );

Move entire rectangle by given distance in $x and $y.

move_b

$rectangle->move_b( $d );

Add $d to b( ) and h( ).

move_r

$rectangle->move_r( $d );

Add $d to r( ) and w( ).

move_x

$rectangle->move_x( $d );

Add $d to x( ) without changing r( ) (it reduces w( ) by $d).

move_y

$rectangle->move_y( $d );

Add $d to y( ) without changing b( ) (it reduces h( ) by $d).

new

my $self = $rectangle->new( );

This constructor does not put anything into the fields! You can either call set( ) or just modify the x, y, w, and h variables directly.

my $self = $rectangle->new( $x, $y, $w, $h );

Constructor that sets x( ), y( ), w( ), and h( ).

my $self = $rectangle->new( $w, $h );

Constructor that sets x( ) and y( ) to zero, and sets w( ) and h( ).

my $clone = $rectangle->new( $original );

Copy constructor.

my $clone = $rectangle->new( $original, $w, $h, $flags );

Constructor that calls set( ).

not_empty

my $not_empty = $rectangle->not_empty( );

Not exactly the same as !empty(). Returns true if w( ) and h( ) are both greater than zero.

r

my $r = $rectangle->r( );

Returns x( ) + w( ), the right edge of the rectangle.

set

$rectangle->set( $x, $y, $w, $h );

Set x( ), y( ), w( ), h( ) all at once.

$rectangle->set( $rect, $w, $h, $flags );

Sets x, y, w, h so that's it's centered or aligned (if $flags != 0) inside the source $rect.

set_b

$rectangle->set_b( $v );

Change b( ) without changing y( ), by changing the height.

set_r

$rectangle->set_r( $v );

Change r( ) without changing x( ), by changing the width.

set_x

$rectangle->set_x( $v );

Change x( ) without changing r( ), by changing the width.

set_y

$rectangle->set_y( $v );

Change y( ) without changing b( ), by changing the height.

w

my $w = $rectangle->w( );

Distance between left and right edges.

$rectangle->w( $value );

Change w( ) by moving the right edge. x( ) does not change.

x

my $x = $rectangle->x( );

Left edge.

$rectangle->x( $value );

Move the rectangle so that the left edge is at $value.

y

my $y = $rectangle->y( );

Top edge.

$rectangle->y( $value );

Move the rectangle so that the top edge is at $value.

Author

Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/

License and Legal

Copyright (C) 2008-2010 by Sanko Robinson <sanko@cpan.org>

This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or notes on the Artistic License 2.0 for clarification.

When separated from the distribution, all original POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See the clarification of the CCA-SA3.0.