File Coverage

blib/lib/Wx/DemoModules/wxGridSizer.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             #############################################################################
2             ## Name: lib/Wx/DemoModules/wxGridSizer.pm
3             ## Purpose: wxPerl demo helper for Wx::GridSizer
4             ## Author: Mattia Barbon
5             ## Modified by:
6             ## Created: 03/07/2002
7             ## RCS-ID: $Id: wxGridSizer.pm 2189 2007-08-21 18:15:31Z mbarbon $
8             ## Copyright: (c) 2002, 2006 Mattia Barbon
9             ## Licence: This program is free software; you can redistribute it and/or
10             ## modify it under the same terms as Perl itself
11             #############################################################################
12              
13             package Wx::DemoModules::wxGridSizer;
14              
15 1     1   1536 use strict;
  1         3  
  1         37  
16 1     1   5 use base qw(Wx::Frame);
  1         2  
  1         556  
17             use Wx qw(:sizer wxDefaultPosition wxDefaultSize
18             wxDEFAULT_DIALOG_STYLE wxRESIZE_BORDER);
19              
20             sub new {
21             my( $class, $parent ) = @_;
22             my $self = $class->SUPER::new( undef, -1, "Wx::GridSizer",
23             wxDefaultPosition, wxDefaultSize,
24             wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
25              
26             # top level sizer
27             my $tsz = Wx::GridSizer->new( 5, 5, 1, 1, );
28              
29             for my $i ( 1 .. 25 ) {
30             my $grow = ( $i % 2 ) * wxGROW;
31              
32             $tsz->Add( Wx::Button->new( $self, -1, "Button $i" ),
33             0, $grow|wxALL, 2 );
34             }
35              
36             # tell we want automatic layout
37             $self->SetAutoLayout( 1 );
38             $self->SetSizer( $tsz );
39             # size the window optimally and set its minimal size
40             $tsz->Fit( $self );
41             $tsz->SetSizeHints( $self );
42              
43             return $self;
44             }
45              
46             sub add_to_tags { qw(sizers) }
47             sub title { 'wxGridSizer' }
48              
49             1;