| 1 | package Graphics::Primitive::Aligned; | ||
| 2 | 1 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | 1 | ▶ | use Moose::Util::TypeConstraints; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | enum 'Graphics::Primitive::Alignment::Horizontals' => [qw(center left right)]; | |
| 7 | 1 | enum 'Graphics::Primitive::Alignment::Verticals' => [qw(bottom center top)]; | |
| 8 | |||
| 9 | 1 | has 'horizontal_alignment' => ( | |
| 10 | is => 'rw', | ||
| 11 | isa => 'Graphics::Primitive::Alignment::Horizontals', | ||
| 12 | ); | ||
| 13 | 1 | has 'vertical_alignment' => ( | |
| 14 | is => 'rw', | ||
| 15 | isa => 'Graphics::Primitive::Alignment::Verticals', | ||
| 16 | ); | ||
| 17 | |||
| 18 | 1 | ▶ | no Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 19 | 1 | 1; | |
| 20 | __END__ | ||
| 21 | =head1 NAME | ||
| 22 | |||
| 23 | Graphics::Primitive::Aligned - Role for components that care about alignment. | ||
| 24 | |||
| 25 | =head1 SYNOPSIS | ||
| 26 | |||
| 27 | Some components (or things that use components) require a bit more information | ||
| 28 | than origin and width/height. The alignment role allows a component to | ||
| 29 | specify it's horizontal and vertical alignment. | ||
| 30 | |||
| 31 | package My::Component; | ||
| 32 | |||
| 33 | extends 'Graphics::Primitive::Component'; | ||
| 34 | |||
| 35 | with 'Graphics::Primitive::Aligned'; | ||
| 36 | |||
| 37 | 1; | ||
| 38 | |||
| 39 | =head1 METHODS | ||
| 40 | |||
| 41 | =head2 horizontal_alignment | ||
| 42 | |||
| 43 | Horizontal alignment value. Valid values are 'center', 'left' and 'right'. | ||
| 44 | |||
| 45 | =head2 vertical_alignment | ||
| 46 | |||
| 47 | Vertical alignment value. Valid values are 'bottom', 'center' and 'top'. | ||
| 48 | |||
| 49 | =head1 AUTHOR | ||
| 50 | |||
| 51 | Cory Watson, C<< <gphat@cpan.org> >> | ||
| 52 | |||
| 53 | =head1 SEE ALSO | ||
| 54 | |||
| 55 | perl(1) | ||
| 56 | |||
| 57 | =head1 COPYRIGHT & LICENSE | ||
| 58 | |||
| 59 | Copyright 2008-2010 by Cory G Watson. | ||
| 60 | |||
| 61 | This program is free software; you can redistribute it and/or modify it | ||
| 62 | under the same terms as Perl itself. | ||