blib/lib/Gapp/Layout/Default.pm

filter: Statementstmt 20.1% 83 / 413 Branchbran 0.0% 0 / 240 Conditioncond 0.0% 0 / 101 MC/DCmcdc 0.0% 0 / 57 Subroutinesub 13.2% 9 / 68 Podpod n/a totaltotal 10.4% 92 / 879 CC 159 SCAR 40.7
CC
159
Cov
11%
__ANON__
132.0
__ANON__
132.0
__ANON__
132.0
CRAP 58.5
« blib/lib/Gapp/Gtk2/DateEntry.pm ↑ Summary blib/lib/Gapp/TableMap.pm »
1 package Gapp::Layout::Default;
2 {
3 1 $Gapp::Layout::Default::VERSION = '0.60';
4 }
5 1 ▶use Gapp::Layout;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use Gapp::Util qw( replace_entities );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Gapp::Actions::Util qw( actioncb parse_action);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Gapp::Types qw( GappAction GappActionOrArrayRef );
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use MooseX::Types::Moose qw( ArrayRef CodeRef Object Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Carp qw( confess );
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 # Assistant
17  
18 0 ▶build 'Gapp::Assistant', sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
19 0 my ( $l, $w ) = @_;
20 0 ▶ $w->gobject->set_icon( $w->gobject->render_icon( $w->icon, 'dnd' ) ) if $w->icon;
Branch: 1 branch
BranchTrueFalseTotal
if $w->icon 0 0 0
21
22 0 ▶ if ( $w->forward_page_func ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w->forward_page_func) 0 0 0
23
24 0 my ( $cb, @args ) = parse_action $w->forward_page_func;
25
26 0 ▶ $w->gobject->set_forward_page_func( sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
27 0 my ( $pagenum, $w ) = @_;
28 0 $cb->( $w, \@args, $w->gobject, [$pagenum] );
29 0 }, $w);
30 }
31 1 };
32  
33  
34 # Assistnat Page
35  
36 0 ▶add 'Gapp::Widget', to 'Gapp::Assistant', sub {
Subroutine __ANON__: not called CC=4 SCAR=26.4
37 0 my ( $l, $w, $c) = @_;
38
39 0 ▶ if ( ! $w->does('Gapp::Meta::Widget::Native::Trait::AssistantPage') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($w->does("Gapp::Meta::Widget::Native::Trait::AssistantPage")) 0 0 0
40 1 ▶ use Carp qw(cluck);
Subroutine BEGIN: called CC=1 SCAR=0.0
41 0 cluck qq[$w does not have the AssistantPage trait applied. Any widget added to ].
42 qq[an assistant must have the AssistntPage trait.];
43 }
44  
45 0 my $gtk_w = $w->gwrapper;
46
47 0 my $assistant = $c->gobject;
48
49 0 my $page_num = $assistant->append_page( $w->gwrapper );
50 0 $w->set_page_num( $page_num );
51
52 0 $assistant->set_page_title ($w->gwrapper , $w->page_title );
53 0 ▶ $assistant->set_page_side_image($w->gwrapper , $assistant->render_icon( $w->page_icon , 'dnd' ) ) if $w->page_icon;
Branch: 1 branch
BranchTrueFalseTotal
if $w->page_icon 0 0 0
54 0 $assistant->set_page_type ($w->gwrapper , $w->page_type );
55 0 $assistant->set_page_complete ($w->gwrapper , 1);
56 0 ▶ $assistant->{pages}{$w->name} = $w if $w->name;
Branch: 1 branch
BranchTrueFalseTotal
if $w->name 0 0 0
57 1 };
58  
59  
60  
61 # Button
62  
63 #style 'Gapp::Button', sub {
64 # my ( $l, $w ) = @_;
65 #
66 # my ( $action, @args ) = parse_action ( $w->action );
67 #
68 # if ( is_GappAction ( $action ) && $action->mnemonic ) {
69 # if ( ! $w->label && ! $w->mnemonic ) {
70 # $w->set_mnemonic( $action->mnemonic );
71 # $w->set_constructor( 'new_with_mnemonic' );
72 # $w->set_args( [ $action->mnemonic ] );
73 # }
74 # }
75 #};
76  
77 0 ▶build 'Gapp::Button', sub {
Subroutine __ANON__: not called CC=8 SCAR=42.8
78 0 my ( $l, $w ) = @_;
79 0 my $gtkw = $w->gobject;
80
81 0 my ( $image );
82 0 ▶ if ( $w->image ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($w->image) { } 0 0 0
elsif ($w->icon) { } 0 0 0
83 0 $image = $w->image->gobject;
84 }
85 elsif ( $w->icon ) {
86 0 ▶ $image = Gtk2::Image->new_from_stock( $w->icon, $w->icon_size || 'button' );
Condition0%0/2
$w->icon_size || 'button'
l!l
00
MC/DC0%0/1
$w->icon_size || 'button'
$w->icon_size
Truth table0%0/2
A
A= $w->icon_size
Aresult
11
00
87 }
88
89  
90
91 0 ▶ $gtkw->set_label( $w->label ) if defined $w->label && ! defined $w->mnemonic;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->label and not defined $w->mnemonic 0 0 0
Condition0%0/3
defined $w->label and not defined $w->mnemonic
!ll&&!rl&&r
000
MC/DC0%0/2
defined $w->label and not defined $w->mnemonic
defined $w->label not defined $w->mnemonic
Truth table0%0/3
A and not(B)
A= defined $w->labelB= not defined $w->mnemonic
ABresult
0X0
100
111
92 0 ▶ $gtkw->set_image( $image ) if defined $image;
Branch: 1 branch
BranchTrueFalseTotal
if defined $image 0 0 0
93 0 ▶ $gtkw->set_tooltip_text( $w->tooltip ) if defined $w->tooltip;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->tooltip 0 0 0
94 1 };
95  
96  
97 0 ▶paint 'Gapp::Button', sub {
Subroutine __ANON__: not called CC=11 SCAR=48.8
98 0 my ( $l, $w ) = @_;
99 0 ▶ return if ! $w->action;
Branch: 1 branch
BranchTrueFalseTotal
unless $w->action 0 0 0
100
101 0 my ( $action, @args ) = parse_action ( $w->action );
102
103
104 0 ▶ if ( is_CodeRef $action ) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_CodeRef($action)) { } 0 0 0
105 0 $w->signal_connect( 'clicked', $action, @args );
106 }
107 else {
108 0 my $gtkw = $w->gobject;
109 0 ▶ $gtkw->set_label( $action->label ) if ! defined $w->mnemonic && ! defined $w->label && defined $action->label;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $w->mnemonic || defined $w->label and defined $action->label 0 0 0
Condition0%0/6
not defined $w->mnemonic || defined $w->label and defined $action->label
!ll&&!rl&&r
000
defined $w->mnemonic || defined $w->label
l!l&&r!l&&!r
000
MC/DC0%0/3
not defined $w->mnemonic || defined $w->label and defined $action->label
defined $w->mnemonic defined $w->label defined $action->label
Truth table0%0/4
not(A || B) and C
A= defined $w->mnemonicB= defined $w->labelC= defined $action->label
ABCresult
1XX0
01X0
0000
0011
110 0 ▶ $gtkw->set_image( $action->create_gtk_image( 'button' ) ) if ! defined $w->icon && ! defined $w->image && defined $action->icon;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $w->icon || defined $w->image and defined $action->icon 0 0 0
Condition0%0/6
not defined $w->icon || defined $w->image and defined $action->icon
!ll&&!rl&&r
000
defined $w->icon || defined $w->image
l!l&&r!l&&!r
000
MC/DC0%0/3
not defined $w->icon || defined $w->image and defined $action->icon
defined $w->icon defined $w->image defined $action->icon
Truth table0%0/4
not(A || B) and C
A= defined $w->iconB= defined $w->imageC= defined $action->icon
ABCresult
1XX0
01X0
0000
0011
111 0 ▶ $gtkw->set_tooltip_text( $action->tooltip ) if ! defined $w->tooltip && defined $action->tooltip;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $w->tooltip and defined $action->tooltip 0 0 0
Condition0%0/3
not defined $w->tooltip and defined $action->tooltip
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $w->tooltip and defined $action->tooltip
not defined $w->tooltip defined $action->tooltip
Truth table0%0/3
not(A) and B
A= not defined $w->tooltipB= defined $action->tooltip
ABresult
0X0
100
111
112 0 $gtkw->signal_connect( clicked => actioncb( $action, $w, \@args ) );
113 }
114 1 };
115  
116 # ComboBox
117  
118 0 ▶build 'Gapp::ComboBox', sub {
Subroutine __ANON__: not called CC=11 SCAR=48.8
119 0 my ( $l, $w ) = @_;
120 0 my $gtkw = $w->gobject;
121
122
123 0 ▶ if ( ! $w->model ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($w->model) 0 0 0
124 0 my $model = Gapp::Model::SimpleList->new;
125 0 $w->set_model( $model )
126 }
127
128 0 ▶ my $model = $w->model->isa('Gapp::Object') ? $w->model->gobject : $w->model;
Branch: 1 branch
BranchTrueFalseTotal
$w->model->isa('Gapp::Object') ? : 0 0 0
129
130 # populate the module with values
131 0 ▶ if ( $w->values ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w->values) 0 0 0
132
133 0 ▶ my $model = $w->model->isa('Gapp::Object') ? $w->model->gobject : $w->model;
Branch: 1 branch
BranchTrueFalseTotal
$w->model->isa('Gapp::Object') ? : 0 0 0
134
135 0 ▶ my @values = is_CodeRef($w->values) ? &{$w->values}($w) : @{$w->values};
Branch: 1 branch
BranchTrueFalseTotal
is_CodeRef($w->values) ? : 0 0 0
136 0 $model->append( $_ ) for ( @values );
137
138 }
139
140 0 $gtkw->set_model( $model );
141
142 # create the renderer to display the values
143 0 my $gtkr = $w->renderer->gobject;
144 0 $gtkw->{renderer} = $gtkr;
145
146 # add the renderer to the column
147 0 ▶ $gtkw->pack_start( $gtkr, $w->renderer->expand ? 1 : 0 );
Branch: 1 branch
BranchTrueFalseTotal
$w->renderer->expand ? : 0 0 0
148
149
150 # define how to display the renderer
151 0 ▶ if ( defined $w->data_column && ! $w->data_func ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $w->data_column and not $w->data_func) { } 0 0 0
elsif ($w->data_func) { } 0 0 0
Condition0%0/3
defined $w->data_column and not $w->data_func
!ll&&!rl&&r
000
MC/DC0%0/2
defined $w->data_column and not $w->data_func
defined $w->data_column not $w->data_func
Truth table0%0/3
A and not(B)
A= defined $w->data_columnB= not $w->data_func
ABresult
0X0
100
111
152 0 ▶ $gtkw->set_cell_data_func($gtkr, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
153
154 0 my ( $col, $gtkrenderer, $model, $iter, @args ) = @_;
155
156 0 ▶ my $value = $model->get( $iter ) if defined $w->data_column;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->data_column 0 0 0
157
158 0 ▶ $gtkrenderer->set_property( 'markup' => defined $value ? replace_entities( $value ) : '' );
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 0 0 0
159 0 });
160 }
161 elsif ( $w->data_func ) {
162
163 0 ▶ $gtkw->set_cell_data_func($gtkr, sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
164
165 0 my ( $col, $gtkrenderer, $model, $iter, @args ) = @_;
166  
167 0 ▶ my $value = $model->get( $iter ) if defined $w->data_column;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->data_column 0 0 0
168 0 local $_ = $value;
169
170 0 ▶ if ( is_CodeRef( $w->data_func ) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (is_CodeRef($w->data_func)) { } 0 0 0
elsif (is_Str($w->data_func)) { } 0 0 0
171 0 $value = &{ $w->data_func }( $_ );
172 }
173 elsif ( is_Str( $w->data_func ) ) {
174 0 my $method = $w->data_func;
175 0 ▶ $value = defined $_ ? $_->$method : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
176 }
177  
178 0 ▶ $gtkrenderer->set_property( 'markup' => defined $value ? replace_entities( $value ) : '' );
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 0 0 0
179
180 0 });
181 }
182  
183 1 };
184  
185 # Dialog
186  
187 0 ▶build 'Gapp::Dialog', sub {
Subroutine __ANON__: not called CC=8 SCAR=42.8
188 0 my ( $l, $w ) = @_;
189 0 my $gtk_w = $w->gobject;
190 0 ▶ $w->gobject->set_icon( $w->gobject->render_icon( $w->icon, 'dnd' ) ) if $w->icon;
Branch: 1 branch
BranchTrueFalseTotal
if $w->icon 0 0 0
191 0 ▶ $w->gobject->set_transient_for( $w->transient_for->gobject ) if $w->transient_for;
Branch: 1 branch
BranchTrueFalseTotal
if $w->transient_for 0 0 0
192
193 0 ▶ if ( $w->action_widgets ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w->action_widgets) 0 0 0
194
195 0 ▶ while ( @{$w->action_widgets} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$w->action_widgets;}) 0 0 0
196 0 my $b = shift @{$w->action_widgets};
197 0 my $r = shift @{$w->action_widgets};
198 0 $gtk_w->add_action_widget( $b->gobject, $r );
199 }
200 }
201 0 ▶ if ( $w->buttons ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w->buttons) 0 0 0
202 0 ▶ while ( @{$w->buttons} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$w->buttons;}) 0 0 0
203 0 my $b = shift @{$w->buttons};
204 0 my $r = shift @{$w->buttons};
205
206 0 ▶ if ( is_Object( $b ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_Object($b)) { } 0 0 0
207 0 $gtk_w->add_action_widget( $b->gobject, $r );
208 }
209 else {
210 0 $gtk_w->add_button( $b, $r );
211 }
212
213 }
214 }
215  
216 1 };
217  
218  
219 0 ▶style 'Gapp::Entry', sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
220 0 my ( $l, $w ) = @_;
221 0 ▶ $w->properties->{activates_default} ||= 1;
Condition0%0/2
$w->properties->{"activates_default"} ||= 1
l!l
00
MC/DC0%0/1
$w->properties->{"activates_default"} ||= 1
$w->properties->{"activates_default"}
Truth table0%0/2
A
A= $w->properties->{"activates_default"}
Aresult
11
00
222 1 };
223  
224  
225  
226  
227  
228  
229 # EventBox
230 0 ▶style 'Gapp::EventBox', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
231 0 my ( $l, $w ) = @_;
232 1 };
233  
234 0 ▶build 'Gapp::EventBox', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
235 0 my ( $l, $w ) = @_;
236 1 };
237  
238  
239  
240  
241  
242 # FileChooserDialog
243  
244 0 ▶build 'Gapp::FileChooserDialog', sub {
Subroutine __ANON__: not called CC=9 SCAR=45.0
245 0 my ( $l, $w ) = @_;
246 0 my $gtk_w = $w->gobject;
247 0 ▶ $w->gobject->set_icon( $w->gobject->render_icon( $w->icon, 'dnd' ) ) if $w->icon;
Branch: 1 branch
BranchTrueFalseTotal
if $w->icon 0 0 0
248 0 ▶ $w->gobject->set_transient_for( $w->transient_for->gobject ) if $w->transient_for;
Branch: 1 branch
BranchTrueFalseTotal
if $w->transient_for 0 0 0
249
250 0 ▶ if ( $w->action_widgets ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w->action_widgets) 0 0 0
251
252 0 ▶ while ( @{$w->action_widgets} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$w->action_widgets;}) 0 0 0
253 0 my $b = shift @{$w->action_widgets};
254 0 my $r = shift @{$w->action_widgets};
255 0 ▶ $gtk_w->add_action_widget( is_Object($b) ? $b->gobject : $b, $r );
Branch: 1 branch
BranchTrueFalseTotal
is_Object($b) ? : 0 0 0
256 }
257 }
258 0 ▶ if ( $w->buttons ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w->buttons) 0 0 0
259 0 ▶ while ( @{$w->buttons} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$w->buttons;}) 0 0 0
260 0 my $b = shift @{$w->buttons};
261 0 my $r = shift @{$w->buttons};
262 0 ▶ $gtk_w->add_button( is_Object($b) ? $b->gobject : $b, $r );
Branch: 1 branch
BranchTrueFalseTotal
is_Object($b) ? : 0 0 0
263 }
264 }
265  
266
267 0 map { $w->gobject->add_filter( $_->gobject ) } $w->filters;
268 1 };
269  
270 # FileFilter
271  
272 0 ▶build 'Gapp::FileFilter', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
273 0 my ( $l, $w ) = @_;
274
275 0 my $gtkw = $w->gobject;
276 0 $gtkw->set_name( $w->name );
277 0 map { $gtkw->add_pattern( $_ ) } $w->patterns;
278 0 map { $gtkw->add_mime_type( $_ ) } $w->mime_types;
279 1 };
280  
281  
282 # Label
283  
284 0 ▶build 'Gapp::Label', sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
285 0 my ( $l, $w ) = @_;
286  
287 0 my $gtkw = $w->gobject;
288 0 ▶ $gtkw->set_text( $w->text ) if defined $w->text;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->text 0 0 0
289 0 ▶ $gtkw->set_markup( $w->markup ) if defined $w->markup;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->markup 0 0 0
290 1 };
291  
292 # List
293  
294 0 ▶build 'Gapp::Model::List', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
295 0 my ( $l, $w ) = @_;
296 0 map { $w->gobject->append_record( @$_ ) } @{ $w->content };
297 1 };
298  
299  
300  
301 # Image
302  
303 0 ▶build 'Gapp::Image', sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
304 0 my ( $l, $w ) = @_;
305
306 0 my $gtkw = $w->gobject;
307 0 ▶ if ( $w->file ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($w->file) { } 0 0 0
elsif ($w->stock) { } 0 0 0
308 0 $gtkw->set_from_file( $w->file );
309 }
310 elsif ( $w->stock ) {
311 0 $gtkw->set_from_stock( $w->stock->[0], $w->stock->[1] );
312 }
313 1 };
314  
315 # ImageMenuItem
316  
317 #style 'Gapp::ImageMenuItem', sub {
318 # my ( $l, $w ) = @_;
319 #
320 # my ( $action, @args ) = parse_action ( $w->action );
321 #
322 #
323 #
324 # if ( is_GappAction ( $action ) && $action->mnemonic ) {
325 #
326 # if ( ! $w->label && ! $w->mnemonic ) {
327 #
328 # $w->set_mnemonic( $action->mnemonic );
329 # $w->set_constructor( 'new_with_mnemonic' );
330 # $w->set_args( [ $action->mnemonic ] );
331 #
332 # $w->_construct_gobject;
333 # }
334 # }
335 #};
336  
337  
338  
339 0 ▶build 'Gapp::ImageMenuItem', sub {
Subroutine __ANON__: not called CC=8 SCAR=42.8
340 0 my ( $l, $w ) = @_;
341 0 my $gtkw = $w->gobject;
342
343 0 my ( $image );
344
345 0 ▶ if ( $w->icon ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w->icon) 0 0 0
346 0 $image = Gtk2::Image->new_from_stock( $w->icon, 'menu' );
347 }
348 0 ▶ if ( $w->image ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w->image) 0 0 0
349 0 $image = $w->image->gobject;
350 }
351
352 0 ▶ $gtkw->set_label( $w->label ) if defined $w->label && ! defined $w->mnemonic;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->label and not defined $w->mnemonic 0 0 0
Condition0%0/3
defined $w->label and not defined $w->mnemonic
!ll&&!rl&&r
000
MC/DC0%0/2
defined $w->label and not defined $w->mnemonic
defined $w->label not defined $w->mnemonic
Truth table0%0/3
A and not(B)
A= defined $w->labelB= not defined $w->mnemonic
ABresult
0X0
100
111
353 0 ▶ $gtkw->set_image( $image ) if defined $image;
Branch: 1 branch
BranchTrueFalseTotal
if defined $image 0 0 0
354 0 ▶ $gtkw->set_tooltip_text( $w->tooltip ) if defined $w->tooltip;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->tooltip 0 0 0
355
356 0 ▶ if ( $w->menu ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w->menu) 0 0 0
357 0 $gtkw->set_submenu( $w->menu->gobject );
358 }
359 1 };
360  
361 0 ▶paint 'Gapp::ImageMenuItem', sub {
Subroutine __ANON__: not called CC=11 SCAR=48.8
362 0 my ( $l, $w ) = @_;
363 0 ▶ return if ! $w->action;
Branch: 1 branch
BranchTrueFalseTotal
unless $w->action 0 0 0
364
365 #print $w, $w->mnemonic, "\n";
366
367 0 my ( $action, @args ) = parse_action ( $w->action );
368
369 0 ▶ if ( is_CodeRef $action ) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_CodeRef($action)) { } 0 0 0
370 0 $w->signal_connect( 'activate', $action, \@args );
371 }
372 else {
373 0 my $gtkw = $w->gobject;
374
375 0 ▶ $gtkw->set_label( $action->label ) if ! defined $w->label && ! defined $w->mnemonic && defined $action->label;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $w->label || defined $w->mnemonic and defined $action->label 0 0 0
Condition0%0/6
not defined $w->label || defined $w->mnemonic and defined $action->label
!ll&&!rl&&r
000
defined $w->label || defined $w->mnemonic
l!l&&r!l&&!r
000
MC/DC0%0/3
not defined $w->label || defined $w->mnemonic and defined $action->label
defined $w->label defined $w->mnemonic defined $action->label
Truth table0%0/4
not(A || B) and C
A= defined $w->labelB= defined $w->mnemonicC= defined $action->label
ABCresult
1XX0
01X0
0000
0011
376 0 ▶ $gtkw->set_image( $action->create_gtk_image( 'menu' ) ) if ! $w->icon && ! defined $w->image && defined $action->icon;
Branch: 1 branch
BranchTrueFalseTotal
if not $w->icon || defined $w->image and defined $action->icon 0 0 0
Condition0%0/6
not $w->icon || defined $w->image and defined $action->icon
!ll&&!rl&&r
000
$w->icon || defined $w->image
l!l&&r!l&&!r
000
MC/DC0%0/3
not $w->icon || defined $w->image and defined $action->icon
$w->icon defined $w->image defined $action->icon
Truth table0%0/4
not(A || B) and C
A= $w->iconB= defined $w->imageC= defined $action->icon
ABCresult
1XX0
01X0
0000
0011
377 0 ▶ $gtkw->set_tooltip_text( $action->tooltip ) if ! defined $w->tooltip && defined $action->tooltip;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $w->tooltip and defined $action->tooltip 0 0 0
Condition0%0/3
not defined $w->tooltip and defined $action->tooltip
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $w->tooltip and defined $action->tooltip
not defined $w->tooltip defined $action->tooltip
Truth table0%0/3
not(A) and B
A= not defined $w->tooltipB= defined $action->tooltip
ABresult
0X0
100
111
378 0 $gtkw->signal_connect( activate => actioncb( $action, $w, \@args ) );
379 }
380 1 };
381  
382  
383  
384  
385 # MenuItem
386 #style 'Gapp::MenuItem', sub {
387 # my ( $l, $w ) = @_;
388 #
389 # my ( $action, @args ) = parse_action ( $w->action );
390 #
391 # if ( is_GappAction ( $action ) && $action->mnemonic ) {
392 # if ( ! $w->label && ! $w->mnemonic ) {
393 # $w->set_constructor( 'new_with_mnemonic' );
394 # $w->set_args( [ $action->mnemonic ] );
395 # }
396 # }
397 #};
398  
399  
400 0 ▶build 'Gapp::MenuItem', sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
401 0 my ( $l, $w ) = @_;
402 0 my $gtkw = $w->gobject;
403
404 0 ▶ $gtkw->set_label( $w->label ) if defined $w->label && ! defined $w->mnemonic;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->label and not defined $w->mnemonic 0 0 0
Condition0%0/3
defined $w->label and not defined $w->mnemonic
!ll&&!rl&&r
000
MC/DC0%0/2
defined $w->label and not defined $w->mnemonic
defined $w->label not defined $w->mnemonic
Truth table0%0/3
A and not(B)
A= defined $w->labelB= not defined $w->mnemonic
ABresult
0X0
100
111
405 0 ▶ $gtkw->set_tooltip_text( $w->tooltip ) if defined $w->tooltip;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->tooltip 0 0 0
406
407 0 ▶ if ( $w->menu ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w->menu) 0 0 0
408 0 $gtkw->set_submenu( $w->menu->gobject );
409 }
410 1 };
411  
412 0 ▶paint 'Gapp::MenuItem', sub {
Subroutine __ANON__: not called CC=8 SCAR=42.8
413 0 my ( $l, $w ) = @_;
414 0 ▶ return if ! $w->action;
Branch: 1 branch
BranchTrueFalseTotal
unless $w->action 0 0 0
415
416 0 my ( $action, @args ) = parse_action ( $w->action );
417
418 0 ▶ if ( is_CodeRef $action ) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_CodeRef($action)) { } 0 0 0
419 0 $w->signal_connect( 'activate', $action, \@args );
420 }
421 else {
422 0 my $gtkw = $w->gobject;
423 0 ▶ $gtkw->set_label( $action->label ) if ! defined $w->label && ! defined $w->mnemonic && defined $action->label;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $w->label || defined $w->mnemonic and defined $action->label 0 0 0
Condition0%0/6
not defined $w->label || defined $w->mnemonic and defined $action->label
!ll&&!rl&&r
000
defined $w->label || defined $w->mnemonic
l!l&&r!l&&!r
000
MC/DC0%0/3
not defined $w->label || defined $w->mnemonic and defined $action->label
defined $w->label defined $w->mnemonic defined $action->label
Truth table0%0/4
not(A || B) and C
A= defined $w->labelB= defined $w->mnemonicC= defined $action->label
ABCresult
1XX0
01X0
0000
0011
424 0 ▶ $gtkw->set_tooltip_text( $action->tooltip ) if ! defined $w->tooltip && defined $action->tooltip;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $w->tooltip and defined $action->tooltip 0 0 0
Condition0%0/3
not defined $w->tooltip and defined $action->tooltip
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $w->tooltip and defined $action->tooltip
not defined $w->tooltip defined $action->tooltip
Truth table0%0/3
not(A) and B
A= not defined $w->tooltipB= defined $action->tooltip
ABresult
0X0
100
111
425 0 $gtkw->signal_connect( activate => actioncb( $action, $w, \@args ) );
426 }
427 1 };
428  
429  
430 0 ▶add 'Gapp::MenuItem', to 'Gapp::MenuShell', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
431 0 my ( $l, $w, $c ) = @_;
432 0 $c->gobject->append( $w->gwrapper );
433 0 $c->gobject->show;
434 1 };
435  
436  
437 # ToolButton
438  
439 0 ▶style 'Gapp::MenuToolButton', sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
440 0 my ( $l, $w ) = @_;
441
442 0 ▶ my $image = $w->image ?
Branch: 1 branch
BranchTrueFalseTotal
$w->image ? : 0 0 0
Condition0%0/4
$w->icon || 'gtk-dialog-error'
l!l
00
$w->icon_size || 'large-toolbar'
l!l
00
MC/DC0%0/1
$w->icon || 'gtk-dialog-error'
$w->icon
MC/DC0%0/1
$w->icon_size || 'large-toolbar'
$w->icon_size
Truth table0%0/2
A
A= $w->icon
Aresult
11
00
Truth table0%0/2
A
A= $w->icon_size
Aresult
11
00
443 $w->image->gobject :
444 Gtk2::Image->new_from_stock( $w->icon || 'gtk-dialog-error' , $w->icon_size || 'large-toolbar' );
445
446 0 ▶ $w->set_args( [ $image, defined $w->label ? $w->label : '' ] );
Branch: 1 branch
BranchTrueFalseTotal
defined $w->label ? : 0 0 0
447 1 };
448  
449  
450 0 ▶build 'Gapp::MenuToolButton', sub {
Subroutine __ANON__: not called CC=7 SCAR=40.3
451 0 my ( $l, $w ) = @_;
452 0 my $gtkw = $w->gobject;
453
454 0 ▶ $w->gobject->set_menu( $w->menu->gobject ) if $w->menu;
Branch: 1 branch
BranchTrueFalseTotal
if $w->menu 0 0 0
455
456 0 ▶ $gtkw->set_stock_id( $w->stock_id ) if $w->stock_id;
Branch: 1 branch
BranchTrueFalseTotal
if $w->stock_id 0 0 0
457 0 ▶ $gtkw->set_label( $w->label ) if defined $w->label;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->label 0 0 0
458 0 ▶ $gtkw->set_tooltip_text( $w->tooltip ) if defined $w->tooltip;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->tooltip 0 0 0
459 0 ▶ $gtkw->set_homogeneous( 1 ) if $w->homogeneous;
Branch: 1 branch
BranchTrueFalseTotal
if $w->homogeneous 0 0 0
460 0 ▶ $w->menu->gwrapper->show_all if $w->menu;
Branch: 1 branch
BranchTrueFalseTotal
if $w->menu 0 0 0
461 1 };
462  
463 0 ▶paint 'Gapp::MenuToolButton', sub {
Subroutine __ANON__: not called CC=11 SCAR=48.8
464 0 my ( $l, $w ) = @_;
465 0 ▶ return if ! $w->action;
Branch: 1 branch
BranchTrueFalseTotal
unless $w->action 0 0 0
466
467 0 my ( $action, @args ) = parse_action ( $w->action );
468
469 0 ▶ if ( is_CodeRef $action ) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_CodeRef($action)) { } 0 0 0
470 0 $w->signal_connect( 'clicked', $action, \@args );
471 }
472 else {
473 0 my $gtkw = $w->gobject;
474 0 ▶ $gtkw->set_label( $action->label ) if ! defined $w->label && defined $action->label;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $w->label and defined $action->label 0 0 0
Condition0%0/3
not defined $w->label and defined $action->label
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $w->label and defined $action->label
not defined $w->label defined $action->label
Truth table0%0/3
not(A) and B
A= not defined $w->labelB= defined $action->label
ABresult
0X0
100
111
475 0 ▶ $gtkw->set_icon_widget( $action->create_gtk_image( $w->icon_size || 'large-toolbar' ) ) if ! $w->icon && ! $w->image && defined $action->icon;
Branch: 1 branch
BranchTrueFalseTotal
if not $w->icon || $w->image and defined $action->icon 0 0 0
Condition0%0/8
not $w->icon || $w->image and defined $action->icon
!ll&&!rl&&r
000
$w->icon || $w->image
l!l&&r!l&&!r
000
$w->icon_size || 'large-toolbar'
l!l
00
MC/DC0%0/3
not $w->icon || $w->image and defined $action->icon
$w->icon $w->image defined $action->icon
MC/DC0%0/1
$w->icon_size || 'large-toolbar'
$w->icon_size
Truth table0%0/4
not(A || B) and C
A= $w->iconB= $w->imageC= defined $action->icon
ABCresult
1XX0
01X0
0000
0011
Truth table0%0/2
A
A= $w->icon_size
Aresult
11
00
476 0 ▶ $gtkw->set_tooltip_text( $action->tooltip ) if ! defined $w->tooltip && defined $action->tooltip;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $w->tooltip and defined $action->tooltip 0 0 0
Condition0%0/3
not defined $w->tooltip and defined $action->tooltip
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $w->tooltip and defined $action->tooltip
not defined $w->tooltip defined $action->tooltip
Truth table0%0/3
not(A) and B
A= not defined $w->tooltipB= defined $action->tooltip
ABresult
0X0
100
111
477 0 $gtkw->signal_connect( clicked => actioncb( $action, $w, \@args ) );
478 }
479 1 };
480  
481  
482 # Notice
483 0 ▶build 'Gapp::Notebook', sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
484 0 my ( $l, $w ) = @_;
485  
486 0 my $gtkw = $w->gobject;
487
488 # handle action widget
489 0 ▶ if ( $w->action_widget ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w->action_widget) 0 0 0
490 0 ▶ $w->action_widget->show_all if $w->action_widget;
Branch: 1 branch
BranchTrueFalseTotal
if $w->action_widget 0 0 0
491 0 $gtkw->set_action_widget( $w->action_widget->gobject, 'end' );
492 }
493  
494 1 };
495  
496  
497 0 ▶add 'Gapp::Widget', to 'Gapp::Notebook', sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
498 0 my ( $l, $w, $c) = @_;
499
500 0 my $gtkw = $w->gwrapper;
501
502 # check that widget is a NotebookPage
503 0 ▶ if ( ! $w->does('Gapp::Meta::Widget::Native::Trait::NotebookPage') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($w->does("Gapp::Meta::Widget::Native::Trait::NotebookPage")) 0 0 0
504 0 die qq[ Could not add $w to $c, $w must have the NotebookPage trait applied.];
505 }
506
507
508
509 # append the page
510 0 $c->gobject->append_page( $gtkw, $w->page_name );
511
512 # create the label
513 0 ▶ $w->tab_label ?
Branch: 1 branch
BranchTrueFalseTotal
$w->tab_label ? : 0 0 0
514 $c->gobject->set_tab_label( $gtkw, $w->tab_label->gobject ) :
515 $c->gobject->set_tab_label_text( $gtkw, $w->page_name );
516
517 0 ▶ $w->tab_label->show_all if $w->tab_label;
Branch: 1 branch
BranchTrueFalseTotal
if $w->tab_label 0 0 0
518  
519 # call show all on the widget
520 0 $w->show_all;
521
522 0 $c->{pages}{$w->page_name} = $w;
523 1 };
524  
525  
526  
527  
528  
529  
530 # SimpleList
531 0 ▶build 'Gapp::Model::SimpleList', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
532 0 my ( $l, $w ) = @_;
533 0 map { $w->gobject->append( $_ ) } @{ $w->content };
534 1 };
535  
536  
537 # SpinButton
538  
539 0 ▶style 'Gapp::SpinButton', sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
540 0 my ( $l, $w ) = @_;
541 0 ▶ $w->properties->{activates_default} ||= 1;
Condition0%0/2
$w->properties->{"activates_default"} ||= 1
l!l
00
MC/DC0%0/1
$w->properties->{"activates_default"} ||= 1
$w->properties->{"activates_default"}
Truth table0%0/2
A
A= $w->properties->{"activates_default"}
Aresult
11
00
542 1 };
543  
544  
545 0 ▶build 'Gapp::SpinButton', sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
546 0 my ( $l, $w ) = @_;
547 0 ▶ $w->gobject->set_increments( $w->step, $w->page ) if $w->page;
Branch: 1 branch
BranchTrueFalseTotal
if $w->page 0 0 0
548 1 };
549  
550  
551  
552  
553 # ScrolledWindow
554 0 ▶build 'Gapp::ScrolledWindow', sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
555 0 my ( $l, $w ) = @_;
556 0 ▶ $w->gobject->set_policy( @{ $w->policy }) if $w->policy;
Branch: 1 branch
BranchTrueFalseTotal
if $w->policy 0 0 0
557 1 };
558  
559 0 ▶add 'Gapp::Widget', to 'Gapp::ScrolledWindow', sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
560 0 my ($l, $w, $c) = @_;
561
562 0 ▶ if ( $c->use_viewport ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->use_viewport) { } 0 0 0
563 0 $c->gobject->add_with_viewport( $w->gwrapper );
564 }
565 else {
566 0 $c->gobject->add( $w->gwrapper );
567 }
568
569 1 };
570  
571  
572 # TextBuffer
573 0 ▶build 'Gapp::TextView', sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
574 0 my ( $l, $w ) = @_;
575 0 ▶ $w->gobject->set_buffer( $w->buffer->gobject ) if $w->buffer;
Branch: 1 branch
BranchTrueFalseTotal
if $w->buffer 0 0 0
576 1 };
577  
578  
579  
580 # TextView
581 0 ▶build 'Gapp::TextView', sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
582 0 my ( $l, $w ) = @_;
583 0 ▶ $w->gobject->set_buffer( $w->buffer->gobject ) if $w->buffer;
Branch: 1 branch
BranchTrueFalseTotal
if $w->buffer 0 0 0
584 1 };
585  
586 # ToggleButton
587 0 ▶build 'Gapp::ToggleButton', sub {
Subroutine __ANON__: not called CC=8 SCAR=42.8
588 0 my ( $l, $w ) = @_;
589 0 my $gtkw = $w->gobject;
590
591 0 my ( $image );
592 0 ▶ if ( $w->image ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($w->image) { } 0 0 0
elsif ($w->icon) { } 0 0 0
593 0 $image = $w->image->gobject;
594 }
595 elsif ( $w->icon ) {
596 0 ▶ $image = Gtk2::Image->new_from_stock( $w->icon, $w->icon_size || 'button' );
Condition0%0/2
$w->icon_size || 'button'
l!l
00
MC/DC0%0/1
$w->icon_size || 'button'
$w->icon_size
Truth table0%0/2
A
A= $w->icon_size
Aresult
11
00
597 }
598
599  
600
601 0 ▶ $gtkw->set_label( $w->label ) if defined $w->label && ! defined $w->mnemonic;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->label and not defined $w->mnemonic 0 0 0
Condition0%0/3
defined $w->label and not defined $w->mnemonic
!ll&&!rl&&r
000
MC/DC0%0/2
defined $w->label and not defined $w->mnemonic
defined $w->label not defined $w->mnemonic
Truth table0%0/3
A and not(B)
A= defined $w->labelB= not defined $w->mnemonic
ABresult
0X0
100
111
602 0 ▶ $gtkw->set_image( $image ) if defined $image;
Branch: 1 branch
BranchTrueFalseTotal
if defined $image 0 0 0
603 0 ▶ $gtkw->set_tooltip_text( $w->tooltip ) if defined $w->tooltip;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->tooltip 0 0 0
604 1 };
605  
606  
607 # Toolbar
608 0 ▶build 'Gapp::Toolbar', sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
609 0 my ( $l, $w ) = @_;
610 0 ▶ $w->gobject->set_icon_size( $w->icon_size ) if $w->icon_size;
Branch: 1 branch
BranchTrueFalseTotal
if $w->icon_size 0 0 0
611 1 };
612  
613 # ToolItem
614  
615 0 ▶add 'Gapp::ToolItem', to 'Gapp::Toolbar', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
616 0 my ($l, $w, $c) = @_;
617 0 $c->gobject->insert( $w->gwrapper, -1 );
618 0 $c->gobject->child_set_property( $w->gwrapper, 'homogeneous', 1 );
619 1 };
620  
621  
622 # ToolButton
623  
624 0 ▶style 'Gapp::ToolButton', sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
625 0 my ( $l, $w ) = @_;
626
627 0 ▶ my $image = $w->image ?
Branch: 1 branch
BranchTrueFalseTotal
$w->image ? : 0 0 0
Condition0%0/4
$w->icon || 'gtk-dialog-error'
l!l
00
$w->icon_size || 'large-toolbar'
l!l
00
MC/DC0%0/1
$w->icon || 'gtk-dialog-error'
$w->icon
MC/DC0%0/1
$w->icon_size || 'large-toolbar'
$w->icon_size
Truth table0%0/2
A
A= $w->icon
Aresult
11
00
Truth table0%0/2
A
A= $w->icon_size
Aresult
11
00
628 $w->image->gobject :
629 Gtk2::Image->new_from_stock( $w->icon || 'gtk-dialog-error' , $w->icon_size || 'large-toolbar' );
630
631 0 ▶ $w->set_args( [ $image, defined $w->label ? $w->label : '' ] );
Branch: 1 branch
BranchTrueFalseTotal
defined $w->label ? : 0 0 0
632 1 };
633  
634  
635 0 ▶build 'Gapp::ToolButton', sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
636 0 my ( $l, $w ) = @_;
637 0 my $gtkw = $w->gobject;
638
639 0 ▶ $gtkw->set_stock_id( $w->stock_id ) if $w->stock_id;
Branch: 1 branch
BranchTrueFalseTotal
if $w->stock_id 0 0 0
640 0 ▶ $gtkw->set_label( $w->label ) if defined $w->label;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->label 0 0 0
641 0 ▶ $gtkw->set_tooltip_text( $w->tooltip ) if defined $w->tooltip;
Branch: 1 branch
BranchTrueFalseTotal
if defined $w->tooltip 0 0 0
642 0 ▶ $gtkw->set_homogeneous( 1 ) if $w->homogeneous;
Branch: 1 branch
BranchTrueFalseTotal
if $w->homogeneous 0 0 0
643 1 };
644  
645 0 ▶paint 'Gapp::ToolButton', sub {
Subroutine __ANON__: not called CC=11 SCAR=48.8
646 0 my ( $l, $w ) = @_;
647 0 ▶ return if ! $w->action;
Branch: 1 branch
BranchTrueFalseTotal
unless $w->action 0 0 0
648
649 0 my ( $action, @args ) = parse_action ( $w->action );
650
651 0 ▶ if ( is_CodeRef $action ) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_CodeRef($action)) { } 0 0 0
652 0 $w->signal_connect( 'clicked', $action, \@args );
653 }
654 else {
655 0 my $gtkw = $w->gobject;
656 0 ▶ $gtkw->set_label( $action->label ) if ! defined $w->label && defined $action->label;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $w->label and defined $action->label 0 0 0
Condition0%0/3
not defined $w->label and defined $action->label
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $w->label and defined $action->label
not defined $w->label defined $action->label
Truth table0%0/3
not(A) and B
A= not defined $w->labelB= defined $action->label
ABresult
0X0
100
111
657 0 ▶ $gtkw->set_icon_widget( $action->create_gtk_image( $w->icon_size || 'large-toolbar' ) ) if ! $w->icon && ! $w->image && defined $action->icon;
Branch: 1 branch
BranchTrueFalseTotal
if not $w->icon || $w->image and defined $action->icon 0 0 0
Condition0%0/8
not $w->icon || $w->image and defined $action->icon
!ll&&!rl&&r
000
$w->icon || $w->image
l!l&&r!l&&!r
000
$w->icon_size || 'large-toolbar'
l!l
00
MC/DC0%0/3
not $w->icon || $w->image and defined $action->icon
$w->icon $w->image defined $action->icon
MC/DC0%0/1
$w->icon_size || 'large-toolbar'
$w->icon_size
Truth table0%0/4
not(A || B) and C
A= $w->iconB= $w->imageC= defined $action->icon
ABCresult
1XX0
01X0
0000
0011
Truth table0%0/2
A
A= $w->icon_size
Aresult
11
00
658 0 ▶ $gtkw->set_tooltip_text( $action->tooltip ) if ! defined $w->tooltip && defined $action->tooltip;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $w->tooltip and defined $action->tooltip 0 0 0
Condition0%0/3
not defined $w->tooltip and defined $action->tooltip
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $w->tooltip and defined $action->tooltip
not defined $w->tooltip defined $action->tooltip
Truth table0%0/3
not(A) and B
A= not defined $w->tooltipB= defined $action->tooltip
ABresult
0X0
100
111
659 0 $gtkw->signal_connect( clicked => actioncb( $action, $w, \@args ) );
660 }
661 1 };
662  
663 0 ▶style 'Gapp::ToggleToolButton', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
664 0 my ( $l, $w ) = @_;
665 1 };
666  
667  
668  
669 # TreeView
670  
671 0 ▶build 'Gapp::TreeView', sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
672 0 my ( $l, $w ) = @_;
673 0 my $gtkw = $w->gobject;
674
675 0 my $model = $w->model;
676
677 0 ▶ $gtkw->set_model( $model->isa('Gapp::Object') ? $model->gobject : $model ) if $model;
Branch: 2 branches
BranchTrueFalseTotal
if $model 0 0 0
$model->isa('Gapp::Object') ? : 0 0 0
678 1 };
679  
680 # TreeViewColumn
681  
682 0 ▶build 'Gapp::TreeViewColumn', sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
683 0 my ( $l, $w ) = @_;
684
685 0 my $gtkw = $w->gobject;
686
687 0 ▶ if ( $w->renderer ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w->renderer) 0 0 0
688
689 0 my $gtkr = $w->renderer->gobject;
690 0 $gtkw->{renderer} = $gtkr;
691
692 # add the renderer to the column
693 0 ▶ $gtkw->pack_start( $gtkr, $w->renderer->expand ? 1 : 0 );
Branch: 1 branch
BranchTrueFalseTotal
$w->renderer->expand ? : 0 0 0
694
695 # set the data function
696 0 ▶ $gtkw->set_cell_data_func($gtkr, sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
697 0 my ( $col, $gtkrenderer, $model, $iter, @args ) = @_;
698 0 my $value = $w->get_cell_value( $model->get( $iter, $w->data_column ) );
699 0 $gtkrenderer->set_property( $w->renderer->property => $value );
700 0 });
701 }
702
703 # if sorting enabled
704 0 ▶ if ( $w->sort_enabled ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w->sort_enabled) 0 0 0
705 0 $w->gobject->set_clickable( 1 );
706 0 ▶ $w->gobject->signal_connect( 'clicked', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
707 0 ▶ $w->gobject->get_tree_view->get_model->set_default_sort_func( sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
708 0 my ( $model, $itera, $iterb, $w ) = @_;
709 0 my $a = $model->get( $itera, $w->data_column );
710 0 my $b = $model->get( $iterb, $w->data_column );
711 0 $w->sort_func->( $w, $a, $b );
712 0 }, $w)
713 0 } );
714 }
715 1 };
716  
717 # Widget
718  
719 0 ▶add 'Gapp::Widget', to 'Gapp::AssistantPage', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
720 0 my ($l, $w, $c ) = @_;
721 0 $c->gobject->pack_start( $w->gwrapper, $w->expand, $w->fill, $w->padding );
722 1 };
723  
724 0 ▶add 'Gapp::Widget', to 'Gapp::Bin', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
725 0 my ($l, $w, $c ) = @_;
726 0 $c->gobject->add( $w->gwrapper );
727 1 };
728  
729 0 ▶add 'Gapp::Widget', to 'Gapp::Container', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
730 0 my ($l, $w, $c) = @_;
731 0 $c->gobject->pack_start( $w->gwrapper, $w->expand, $w->fill, $w->padding );
732 1 };
733  
734 0 ▶add 'Gapp::Widget', to 'Gapp::Expander', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
735 0 my ($l, $w, $c ) = @_;
736 0 $c->gobject->add( $w->gwrapper );
737 1 };
738  
739  
740 0 ▶add 'Gapp::Widget', to 'Gapp::HBox', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
741 0 my ($l, $w, $c ) = @_;
742 0 $c->gobject->pack_start( $w->gwrapper, $w->expand, $w->fill, $w->padding );
743 1 };
744  
745 0 ▶add 'Gapp::Widget', to 'Gapp::VBox', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
746 0 my ($l, $w, $c ) = @_;
747 0 $c->gobject->pack_start( $w->gwrapper, $w->expand, $w->fill, $w->padding );
748 1 };
749  
750 0 ▶add 'Gapp::Widget', to 'Gapp::Paned', sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
751 0 my ($l, $w, $c ) = @_;
752
753 0 ▶ if ( ! $c->gobject->get_child1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $c->gobject->get_child1) { } 0 0 0
754 0 $c->gobject->pack1( $w->gwrapper, $c->resize1, $c->shrink1 );
755 }
756 else {
757 0 $c->gobject->pack2( $w->gwrapper, $c->resize2, $c->shrink2 );
758 }
759 1 };
760  
761 0 ▶add 'Gapp::Widget', to 'Gapp::Dialog', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
762 0 my ($l, $w, $c ) = @_;
763 0 $c->gobject->vbox->pack_start( $w->gwrapper, $w->expand, $w->fill, $w->padding );
764 0 $w->gobject->show;
765 1 };
766  
767 0 ▶add 'Gapp::Widget', to 'Gapp::Table', sub {
Subroutine __ANON__: not called CC=7 SCAR=40.3
768 0 my ( $l, $w, $c ) = @_;
769
770 0 my $cell = $c->next_cell;
771
772 0 my $gtkw;
773 0 ▶ if ( defined $cell->xalign || defined $cell->yalign ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $cell->xalign or defined $cell->yalign) { } 0 0 0
Condition0%0/3
defined $cell->xalign or defined $cell->yalign
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $cell->xalign or defined $cell->yalign
defined $cell->xalign defined $cell->yalign
Truth table0%0/3
A or B
A= defined $cell->xalignB= defined $cell->yalign
ABresult
1X1
011
000
774 0 my ( $xa, $ya ) = ( $cell->xalign, $cell->yalign );
775 0 ▶ my $xs = $xa == -1 ? 1 : 0; # x-scale
Branch: 1 branch
BranchTrueFalseTotal
$xa == -1 ? : 0 0 0
776 0 ▶ my $ys = $ya == -1 ? 1 : 0; # y-scale
Branch: 1 branch
BranchTrueFalseTotal
$ya == -1 ? : 0 0 0
777 0 ▶ $xa = 0 if $xa == -1; # x-align
Branch: 1 branch
BranchTrueFalseTotal
if $xa == -1 0 0 0
778 0 ▶ $ya = 0 if $ya == -1; # y-align
Branch: 1 branch
BranchTrueFalseTotal
if $ya == -1 0 0 0
779
780 0 my $gtk_align = Gtk2::Alignment->new( $xa, $ya, $xs, $ys );
781 0 $gtk_align->add( $w->gwrapper );
782 0 $gtkw = $gtk_align;
783 }
784 else {
785 0 $gtkw = $w->gwrapper;
786 }
787
788
789 0 $c->gobject->attach(
790 $gtkw, $cell->table_attach,
791 0, 0
792 );
793
794
795 0 1;
796 1 };
797  
798 0 ▶add 'Gapp::Widget', to 'Gapp::ToolItemGroup', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
799 0 my ($l, $w, $c ) = @_;
800 0 $c->gobject->add( $w->gwrapper );
801 1 };
802  
803 0 ▶add 'Gapp::Widget', to 'Gapp::ToolPalette', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
804 0 my ($l, $w, $c ) = @_;
805 0 $c->gobject->add( $w->gwrapper );
806 1 };
807  
808 0 ▶add 'Gapp::Widget', to 'Gapp::Window', sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
809 0 my ($l, $w, $c ) = @_;
810 0 $c->gobject->add( $w->gwrapper );
811 1 };
812  
813 # Window
814  
815 0 ▶build 'Gapp::Window', sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
816 0 my ( $l, $w ) = @_;
817 0 ▶ $w->gobject->set_icon( $w->gobject->render_icon( $w->icon, 'dnd' ) ) if $w->icon;
Branch: 1 branch
BranchTrueFalseTotal
if $w->icon 0 0 0
818 0 ▶ $w->gobject->set_transient_for( $w->transient_for->gobject ) if $w->transient_for;
Branch: 1 branch
BranchTrueFalseTotal
if $w->transient_for 0 0 0
819 1 };
820  
821  
822  
823  
824 1 1;
« blib/lib/Gapp/Gtk2/DateEntry.pm ↑ Summary blib/lib/Gapp/TableMap.pm »