line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# You may distribute under the terms of the GNU General Public License |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# (C) Paul Evans, 2010-2013 -- leonerd@leonerd.org.uk |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Circle::FE::Term::Widget::Box; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1117
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
32
|
|
8
|
1
|
|
|
1
|
|
5
|
use constant type => "Box"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
84
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
385
|
use Tickit::Widget::HBox; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Tickit::Widget::VBox; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub build |
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
my $class = shift; |
16
|
|
|
|
|
|
|
my ( $obj, $tab ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $orientation = $obj->prop("orientation"); |
19
|
|
|
|
|
|
|
my $widget; |
20
|
|
|
|
|
|
|
if( $orientation eq "vertical" ) { |
21
|
|
|
|
|
|
|
$widget = Tickit::Widget::VBox->new( |
22
|
|
|
|
|
|
|
classes => $obj->prop( "classes" ), |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
elsif( $orientation eq "horizontal" ) { |
26
|
|
|
|
|
|
|
$widget = Tickit::Widget::HBox->new( |
27
|
|
|
|
|
|
|
classes => $obj->prop( "classes" ), |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else { |
31
|
|
|
|
|
|
|
die "Unrecognised orientation '$orientation'"; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
foreach my $c ( @{ $obj->prop("children") } ) { |
35
|
|
|
|
|
|
|
if( $c->{child} ) { |
36
|
|
|
|
|
|
|
my $childwidget = $tab->build_widget( $c->{child} ); |
37
|
|
|
|
|
|
|
$widget->add( $childwidget, expand => $c->{expand} ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
|
|
|
|
|
|
# Just add spacing |
41
|
|
|
|
|
|
|
$widget->add( Tickit::Widget::Static->new( text => " " ), expand => 1 ); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
return $widget; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Tickit::Style->load_style( <<'EOF' ); |
49
|
|
|
|
|
|
|
HBox.status { |
50
|
|
|
|
|
|
|
spacing: 1; |
51
|
|
|
|
|
|
|
bg: "blue"; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
EOF |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
0x55AA; |