Reaction::UI::FocusStack - A linked list of ViewPort-based objects
my $stack = Reaction::UI::FocusStack->new(); # Or more commonly, in a Reaction::UI::RootController based # Catalyst Controller: my $stack = $ctx->focus_stack; # Add a new basic viewport inside the last viewport on the stack: my $vp = $stack->push_viewport('Reaction::UI::ViewPort' => layout => 'xhtml' ); # Fetch the innermost viewport from the stack: my $vp = $stack->pop_viewport(); # Remove all viewports inside a given viewport: $stack->pop_viewports_to($vp); # Create a named stack as a tangent to an existing viewport: my $newstack = $vp->create_tangent('somename'); # Resolve current events using your stack: # This is called by Reaction::UI::RootController in the end action. $stack->apply_events($ctx, $param_hash);
A FocusStack represents a list of related ViewPort objects. The Reaction::UI::RootController creates an empty stack for you in it's begin action, which represents the main thread/container of the page. Typically you add new ViewPorts to this stack as the main parts of your page. To add multiple parallel page subparts, create a tangent from the outer viewport, and add more viewports as normal.
Create a new empty FocusStack. This is done for you in Reaction::UI::RootController.
Creates a new Reaction::UI::ViewPort based object and adds it to the stack.
The following attributes of the new ViewPort are set:
Is set to the preceding ViewPort in the stack.
Is set to the FocusStack object that created the ViewPort.
Is set to the location of the ViewPort in the stack.
Removes the last/innermost ViewPort from the stack and returns it.
Pops all ViewPorts off the stack until the given ViewPort object remains as the last item. If passed a $viewport not on the stack, this will empty the stack completely (and then die complainingly).
TODO: Should pop_viewports_to check $vp->focus_stack eq $self first?
Retrieve the first ViewPort in this stack. Useful for calling "render_viewport" in Reaction::UI::Window on a "focus_tangent" in Reaction::UI::ViewPort.
Retrieve the last ViewPort in this stack. Useful for calling "render_viewport" in Reaction::UI::Window on a "focus_tangent" in Reaction::UI::ViewPort.
Instruct each of the ViewPorts in the stack to apply the given events to each of it's tangent stacks, and then to itself. These are applied starting with the last/innermost ViewPort first.
See Reaction::Class for authors.
See Reaction::Class for the license.
To install Reaction, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Reaction
CPAN shell
perl -MCPAN -e shell install Reaction
For more information on module installation, please visit the detailed CPAN module installation guide.