diff options
author | matthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2007-11-26 20:11:29 +0000 |
---|---|---|
committer | matthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2007-11-26 20:11:29 +0000 |
commit | f2fef590a7283ea919bdaa51bac9d433e8785a09 (patch) | |
tree | 4ccd3b37fb374e1b21883f1d4d3f8e23dd136884 /lib/Reaction/UI/View.pm | |
parent | 097e844260b8b3443cd44d8295c941f1086845bc (diff) | |
download | reaction-f2fef590a7283ea919bdaa51bac9d433e8785a09.tar.gz reaction-f2fef590a7283ea919bdaa51bac9d433e8785a09.zip |
root of componentUI renders
Diffstat (limited to 'lib/Reaction/UI/View.pm')
-rw-r--r-- | lib/Reaction/UI/View.pm | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/Reaction/UI/View.pm b/lib/Reaction/UI/View.pm index 8f0c265..daf1bbc 100644 --- a/lib/Reaction/UI/View.pm +++ b/lib/Reaction/UI/View.pm @@ -48,24 +48,25 @@ class View which { my ($self, $window) = @_; my $root_vp = $window->focus_stack->vp_head; my $rctx = $self->create_rendering_context; - $self->render_viewport($rctx, $root_vp); + my ($widget, $args) = $self->render_viewport_args($root_vp); + $widget->render(widget => $rctx, $args); }; - implements 'render_viewport' => as { - my ($self, $rctx, $vp) = @_; + implements 'render_viewport_args' => as { + my ($self, $vp) = @_; my $layout_set = $self->layout_set_for($vp); my $widget = $self->widget_for($vp, $layout_set); - $widget->render($rctx, { viewport => $vp }); + return ($widget, { viewport => $vp }); }; implements 'widget_for' => as { my ($self, $vp, $layout_set) = @_; return $self->_widget_cache->{$layout_set->name} - ||= $self->widget_class_for($layout_set) - ->new( - view => $self, layout_set => $layout_set - ); + ||= $layout_set->widget_class + ->new( + view => $self, layout_set => $layout_set + ); }; implements 'widget_class_for' => as { @@ -85,6 +86,7 @@ class View which { #only next when !exists eval { Class::MOP::load_class($class) }; #$@ ? next : return $class; + #warn "Loaded ${class}" unless $@; $@ ? next : return $cache->{ $lset_name } = $class; } confess "Couldn't load widget '$tail': tried: @haystack"; @@ -132,7 +134,11 @@ class View which { implements 'layout_set_args_for' => as { my ($self, $name) = @_; - return (name => $name, search_path => $self->layout_search_path); + return ( + name => $name, + search_path => $self->layout_search_path, + view => $self, + ); }; implements 'layout_search_path' => as { |