switch over to sub style from AUTOLOAD style (Widget transition)
[catagits/Reaction.git] / lib / Reaction / UI / Widget.pm
CommitLineData
7adfd53f 1package Reaction::UI::Widget;
2
3use Reaction::Class;
4use aliased 'Reaction::UI::ViewPort';
5use aliased 'Reaction::UI::View';
6
7class Widget which {
8
9 has 'viewport' => (isa => ViewPort, is => 'ro'); # required?
10 has 'view' => (isa => View, is => 'ro', required => 1);
11
12 implements 'render' => as {
13 my ($self, $rctx) = @_;
b8faba69 14 my $args = { self => $self };
15 $args->{viewport} = $self->viewport if $self->has_viewport;
16 $self->render_widget($rctx, $args);
7adfd53f 17 };
18
19 implements 'render_viewport' => as {
20 my ($self, $rctx, $args) = @_;
21 my $vp = $args->{'_'};
22 $self->view->render_viewport($rctx, $vp);
23 };
24
25};
26
271;
28
29=head1 NAME
30
31Reaction::UI::Widget
32
33=head1 DESCRIPTION
34
35=head1 AUTHORS
36
37See L<Reaction::Class> for authors.
38
39=head1 LICENSE
40
41See L<Reaction::Class> for the license.
42
43=cut