| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Gtk2::Ex::FormFactory::Container; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
22
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
61
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
7
|
use base qw( Gtk2::Ex::FormFactory::Widget ); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
1482
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
0
|
|
|
0
|
0
|
|
sub get_content { shift->{content} } |
|
8
|
0
|
|
|
0
|
0
|
|
sub get_title { shift->{title} } |
|
9
|
|
|
|
|
|
|
|
|
10
|
0
|
|
|
0
|
0
|
|
sub set_content { shift->{content} = $_[1] } |
|
11
|
0
|
|
|
0
|
0
|
|
sub set_title { shift->{title} = $_[1] } |
|
12
|
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
0
|
|
sub isa_container { 1 } |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
|
16
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
|
17
|
0
|
|
|
|
|
|
my %par = @_; |
|
18
|
0
|
|
|
|
|
|
my ($content, $title) = @par{'content','title'}; |
|
19
|
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new(@_); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#-- Handle some defaults for 'content' parameter |
|
23
|
0
|
0
|
|
|
|
|
if ( not defined $content ) { |
|
|
|
0
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
$content = []; |
|
25
|
|
|
|
|
|
|
} elsif ( ref $content ne 'ARRAY' ) { |
|
26
|
0
|
|
|
|
|
|
$content = [ $content ]; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#-- For convenience the developer may write pairs of |
|
30
|
|
|
|
|
|
|
#-- the Widget's short name and a hash ref with its |
|
31
|
|
|
|
|
|
|
#-- attributes instead of adding real objects. This |
|
32
|
|
|
|
|
|
|
#-- loop search for such non-objects and creates |
|
33
|
|
|
|
|
|
|
#-- objects accordingly. |
|
34
|
0
|
|
|
|
|
|
my @content_with_objects; |
|
35
|
0
|
|
|
|
|
|
for ( my $i=0; $i < @{$content}; ++$i ) { |
|
|
0
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if ( not defined $content->[$i] ) { |
|
37
|
0
|
|
|
|
|
|
die "Child #$i of ".$self->get_type."/".$self->get_name. |
|
38
|
|
|
|
|
|
|
" is not defined"; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
0
|
0
|
|
|
|
|
if ( not ref $content->[$i] ) { |
|
41
|
|
|
|
|
|
|
#-- No object, so derive the class name |
|
42
|
|
|
|
|
|
|
#-- from the short name |
|
43
|
0
|
|
|
|
|
|
my $class = $content->[$i]; |
|
44
|
0
|
|
|
|
|
|
$class =~ s/^(.)/uc($1)/e; |
|
|
0
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
$class =~ s/_(.)/uc($1)/eg; |
|
|
0
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
$class =~ s/_//g; |
|
47
|
0
|
|
|
|
|
|
$class = "Gtk2::Ex::FormFactory::$class"; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
#-- And create the object |
|
50
|
0
|
|
|
|
|
|
my $object = $class->new(%{$content->[$i+1]}); |
|
|
0
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
push @content_with_objects, $object; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
#-- Skip next entry in @content |
|
54
|
0
|
|
|
|
|
|
++$i; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} else { |
|
57
|
|
|
|
|
|
|
#-- Regular objects are taken as is |
|
58
|
0
|
|
|
|
|
|
push @content_with_objects, $content->[$i]; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
$self->set_content(\@content_with_objects); |
|
63
|
0
|
|
|
|
|
|
$self->set_title($title); |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
return $self; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub debug_dump { |
|
69
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
70
|
0
|
|
|
|
|
|
my ($level) = @_; |
|
71
|
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$self->SUPER::debug_dump($level); |
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
foreach my $c ( @{$self->get_content} ) { |
|
|
0
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
if ( $c ) { |
|
76
|
0
|
|
|
|
|
|
$c->debug_dump($level+1); |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
else { |
|
79
|
0
|
|
|
|
|
|
print " "x($level+1),"UNDEF\n"; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
1; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub build { |
|
87
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
#-- First build the widget itself |
|
90
|
0
|
|
|
|
|
|
$self->SUPER::build(@_); |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
#-- Now build the children |
|
93
|
0
|
|
|
|
|
|
$self->build_children; |
|
94
|
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
1; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub build_children { |
|
99
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
100
|
|
|
|
|
|
|
|
|
101
|
0
|
0
|
|
|
|
|
$Gtk2::Ex::FormFactory::DEBUG && |
|
102
|
|
|
|
|
|
|
print "$self->build_children\n"; |
|
103
|
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
my $layouter = $self->get_form_factory->get_layouter; |
|
105
|
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
foreach my $child ( @{$self->get_content} ) { |
|
|
0
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
$child->set_parent($self); |
|
108
|
0
|
|
|
|
|
|
$child->set_form_factory($self->get_form_factory); |
|
109
|
0
|
|
|
|
|
|
$child->build; |
|
110
|
0
|
|
|
|
|
|
$layouter->add_widget_to_container ($child, $self); |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
1; |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub add_child_widget { |
|
117
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
118
|
0
|
|
|
|
|
|
my ($child) = @_; |
|
119
|
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
push @{$self->get_content}, $child; |
|
|
0
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
|
122
|
0
|
0
|
|
|
|
|
return unless $self->get_built; |
|
123
|
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
my $form_factory = $self->get_form_factory; |
|
125
|
0
|
|
|
|
|
|
my $layouter = $form_factory->get_layouter; |
|
126
|
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
$form_factory->register_all_widgets($child); |
|
128
|
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
$child->set_parent($self); |
|
130
|
0
|
|
|
|
|
|
$child->set_form_factory($form_factory); |
|
131
|
0
|
|
|
|
|
|
$child->build; |
|
132
|
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
$layouter->add_widget_to_container($child, $self); |
|
134
|
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
$child->connect_signals; |
|
136
|
0
|
|
|
|
|
|
$child->update_all; |
|
137
|
0
|
|
|
|
|
|
$child->get_gtk_parent_widget->show_all; |
|
138
|
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
1; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub remove_child_widget { |
|
143
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
144
|
0
|
|
|
|
|
|
my ($child) = @_; |
|
145
|
|
|
|
|
|
|
|
|
146
|
0
|
|
|
|
|
|
my $found; |
|
147
|
0
|
|
|
|
|
|
my $i = 0; |
|
148
|
0
|
|
|
|
|
|
foreach my $c ( @{$self->get_content} ) { |
|
|
0
|
|
|
|
|
|
|
|
149
|
0
|
0
|
|
|
|
|
$found = 1, last if $c eq $child; |
|
150
|
0
|
|
|
|
|
|
++$i; |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
|
|
153
|
0
|
0
|
|
|
|
|
die "Widget '".$child->get_name. |
|
154
|
|
|
|
|
|
|
"' no child of container '". |
|
155
|
|
|
|
|
|
|
$self->get_name."'" unless $found; |
|
156
|
|
|
|
|
|
|
|
|
157
|
0
|
|
|
|
|
|
splice @{$self->get_content}, $i, 1; |
|
|
0
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
|
159
|
0
|
0
|
|
|
|
|
return unless $self->get_built; |
|
160
|
|
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
my $child_gtk_widget = $child->get_gtk_parent_widget; |
|
162
|
0
|
|
|
|
|
|
my $gtk_widget = $self->get_gtk_widget; |
|
163
|
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
|
$gtk_widget->remove($child_gtk_widget); |
|
165
|
|
|
|
|
|
|
|
|
166
|
0
|
|
|
|
|
|
$child->cleanup; |
|
167
|
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
|
1; |
|
169
|
|
|
|
|
|
|
} |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub update_all { |
|
172
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
173
|
|
|
|
|
|
|
|
|
174
|
0
|
|
|
|
|
|
$self->SUPER::update(@_); |
|
175
|
0
|
|
|
|
|
|
foreach my $c ( @{$self->get_content} ) { |
|
|
0
|
|
|
|
|
|
|
|
176
|
0
|
|
|
|
|
|
$c->update_all; |
|
177
|
|
|
|
|
|
|
} |
|
178
|
|
|
|
|
|
|
|
|
179
|
0
|
|
|
|
|
|
1; |
|
180
|
|
|
|
|
|
|
} |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub apply_changes_all { |
|
183
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
184
|
|
|
|
|
|
|
|
|
185
|
0
|
|
|
|
|
|
$self->SUPER::apply_changes(@_); |
|
186
|
|
|
|
|
|
|
|
|
187
|
0
|
|
|
|
|
|
foreach my $c ( @{$self->get_content} ) { |
|
|
0
|
|
|
|
|
|
|
|
188
|
0
|
|
|
|
|
|
$c->apply_changes_all; |
|
189
|
|
|
|
|
|
|
} |
|
190
|
|
|
|
|
|
|
|
|
191
|
0
|
|
|
|
|
|
1; |
|
192
|
|
|
|
|
|
|
} |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
sub commit_proxy_buffers_all { |
|
195
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
196
|
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
|
$self->SUPER::commit_proxy_buffers(@_); |
|
198
|
|
|
|
|
|
|
|
|
199
|
0
|
|
|
|
|
|
foreach my $c ( @{$self->get_content} ) { |
|
|
0
|
|
|
|
|
|
|
|
200
|
0
|
|
|
|
|
|
$c->commit_proxy_buffers_all; |
|
201
|
|
|
|
|
|
|
} |
|
202
|
|
|
|
|
|
|
|
|
203
|
0
|
|
|
|
|
|
1; |
|
204
|
|
|
|
|
|
|
} |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
sub discard_proxy_buffers_all { |
|
207
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
208
|
|
|
|
|
|
|
|
|
209
|
0
|
|
|
|
|
|
$self->SUPER::discard_proxy_buffers(@_); |
|
210
|
|
|
|
|
|
|
|
|
211
|
0
|
|
|
|
|
|
foreach my $c ( @{$self->get_content} ) { |
|
|
0
|
|
|
|
|
|
|
|
212
|
0
|
|
|
|
|
|
$c->discard_proxy_buffers_all; |
|
213
|
|
|
|
|
|
|
} |
|
214
|
|
|
|
|
|
|
|
|
215
|
0
|
|
|
|
|
|
1; |
|
216
|
|
|
|
|
|
|
} |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub connect_signals { |
|
219
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
220
|
|
|
|
|
|
|
|
|
221
|
0
|
|
|
|
|
|
$self->SUPER::connect_signals(@_); |
|
222
|
|
|
|
|
|
|
|
|
223
|
0
|
|
|
|
|
|
foreach my $c ( @{$self->get_content} ) { |
|
|
0
|
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
|
$c->connect_signals; |
|
225
|
|
|
|
|
|
|
} |
|
226
|
|
|
|
|
|
|
|
|
227
|
0
|
|
|
|
|
|
1; |
|
228
|
|
|
|
|
|
|
} |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
sub cleanup { |
|
231
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
232
|
|
|
|
|
|
|
|
|
233
|
0
|
|
|
|
|
|
foreach my $c ( @{$self->get_content} ) { |
|
|
0
|
|
|
|
|
|
|
|
234
|
0
|
|
|
|
|
|
$c->cleanup; |
|
235
|
|
|
|
|
|
|
} |
|
236
|
|
|
|
|
|
|
|
|
237
|
0
|
|
|
|
|
|
$self->SUPER::cleanup(@_); |
|
238
|
|
|
|
|
|
|
|
|
239
|
0
|
|
|
|
|
|
$self->set_content([]); |
|
240
|
|
|
|
|
|
|
|
|
241
|
0
|
|
|
|
|
|
1; |
|
242
|
|
|
|
|
|
|
} |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
1; |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
__END__ |