| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | #_{ Encoding and name | 
| 2 |  |  |  |  |  |  | =encoding utf8 | 
| 3 |  |  |  |  |  |  | =head1 NAME | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | Grid::Layout::Area | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =cut | 
| 8 |  |  |  |  |  |  | #_} | 
| 9 |  |  |  |  |  |  | package Grid::Layout::Render; | 
| 10 |  |  |  |  |  |  | #_{ use … | 
| 11 | 1 |  |  | 1 |  | 299 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 26 |  | 
| 12 | 1 |  |  | 1 |  | 5 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 19 |  | 
| 13 | 1 |  |  | 1 |  | 4 | use utf8; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 4 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 1 |  |  | 1 |  | 32 | use Carp; | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 65 |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 1 |  |  | 1 |  | 8 | use Grid::Layout; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 185 |  | 
| 18 |  |  |  |  |  |  | #_} | 
| 19 |  |  |  |  |  |  | our $VERSION = $Grid::Layout::VERSION; | 
| 20 |  |  |  |  |  |  | #_{ Synopsis | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | C iterate over an L<< Grid::Layout >> and call appropriate call backs so as to render the grid on a device. | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | =cut | 
| 27 |  |  |  |  |  |  | #_} | 
| 28 |  |  |  |  |  |  | #_{ Description | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | =cut | 
| 34 |  |  |  |  |  |  | #_} | 
| 35 |  |  |  |  |  |  | #_{ Methods | 
| 36 |  |  |  |  |  |  | #_{ POD | 
| 37 |  |  |  |  |  |  | =head1 METHODS | 
| 38 |  |  |  |  |  |  | =cut | 
| 39 |  |  |  |  |  |  | #_} | 
| 40 |  |  |  |  |  |  | sub top_to_bottom_left_to_right { #_{ | 
| 41 |  |  |  |  |  |  | #_{ POD | 
| 42 |  |  |  |  |  |  | =head2 new | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | use Grid::Layout; | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | my $gl = Grid::Layout->new(…); | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | Grid::Layout::Render::top_to_bottom_left_to_right( | 
| 49 |  |  |  |  |  |  | $gl, | 
| 50 |  |  |  |  |  |  | sub { # call back for next horizontal L<< track|Grid::Layout::Track >>. | 
| 51 |  |  |  |  |  |  | my vertical_track = shift; | 
| 52 |  |  |  |  |  |  | }, | 
| 53 |  |  |  |  |  |  | sub { # call back for each L<< cell|Grid::Layout::Cell> in the horizontal track | 
| 54 |  |  |  |  |  |  | my $cell = shift; | 
| 55 |  |  |  |  |  |  | }, | 
| 56 |  |  |  |  |  |  | sub { # call back when a horizontal track is finished | 
| 57 |  |  |  |  |  |  | my vertical_track = shift; | 
| 58 |  |  |  |  |  |  | } | 
| 59 |  |  |  |  |  |  | ); | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | =cut | 
| 62 |  |  |  |  |  |  | #_} | 
| 63 |  |  |  |  |  |  |  | 
| 64 | 1 |  |  | 1 | 0 | 3 | my $gl              = shift; | 
| 65 | 1 |  |  |  |  | 2 | my $sub_next_track  = shift; | 
| 66 | 1 |  |  |  |  | 2 | my $sub_next_cell   = shift; | 
| 67 | 1 |  |  |  |  | 2 | my $sub_track_done  = shift; | 
| 68 |  |  |  |  |  |  |  | 
| 69 | 1 | 50 |  |  |  | 6 | croak "Need a Grid::Layout"            unless $gl->isa('Grid::Layout'); | 
| 70 | 1 | 50 |  |  |  | 6 | croak "Need a code ref for next track" unless ref($sub_next_track) eq 'CODE'; | 
| 71 | 1 | 50 |  |  |  | 4 | croak "Need a code ref for next cell"  unless ref($sub_next_cell ) eq 'CODE'; | 
| 72 | 1 | 50 |  |  |  | 4 | croak "Need a code ref for track done" unless ref($sub_track_done) eq 'CODE'; | 
| 73 |  |  |  |  |  |  |  | 
| 74 | 1 |  |  |  |  | 2 | for my $track_h (@{$gl->{H}->{tracks}}) { | 
|  | 1 |  |  |  |  | 5 |  | 
| 75 | 10 |  |  |  |  | 41 | &$sub_next_track($track_h); | 
| 76 |  |  |  |  |  |  |  | 
| 77 | 10 |  |  |  |  | 7993 | for my $cell ($track_h->cells) { | 
| 78 | 80 |  |  |  |  | 283 | &$sub_next_cell($cell); | 
| 79 |  |  |  |  |  |  | } | 
| 80 |  |  |  |  |  |  |  | 
| 81 | 10 |  |  |  |  | 42 | &$sub_track_done($track_h); | 
| 82 |  |  |  |  |  |  | } | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | } #_} | 
| 85 |  |  |  |  |  |  | #_} | 
| 86 |  |  |  |  |  |  | #_{ POD: Copyright | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | =head1 Copyright | 
| 89 |  |  |  |  |  |  | Copyright © 2017 René Nyffenegger, Switzerland. All rights reserved. | 
| 90 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify it | 
| 91 |  |  |  |  |  |  | under the terms of the the Artistic License (2.0). You may obtain a | 
| 92 |  |  |  |  |  |  | copy of the full license at: L | 
| 93 |  |  |  |  |  |  | =cut | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | #_} | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | 'tq84'; | 
| 98 |  |  |  |  |  |  |  |