File Coverage

blib/lib/Wx/DemoModules/wxFlexGridSizer.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/wxFlexGridSizer.pm
3             ## Purpose: wxPerl demo helper for Wx::FlexGridSizer
4             ## Author: Mattia Barbon
5             ## Modified by:
6             ## Created: 03/07/2002
7             ## RCS-ID: $Id: wxFlexGridSizer.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::wxFlexGridSizer;
14              
15 1     1   1387 use strict;
  1         1  
  1         40  
16 1     1   6 use base qw(Wx::Frame);
  1         1  
  1         690  
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::FlexGridSizer",
23             wxDefaultPosition, wxDefaultSize,
24             wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
25              
26             # top level sizer
27             my $tsz = Wx::FlexGridSizer->new( 5, 5, 1, 1, );
28              
29             for my $i ( 1 .. 25 ) {
30             $tsz->Add( Wx::Button->new( $self, -1, "Button $i" ),
31             0, wxGROW|wxALL, 2 );
32             }
33              
34             # add growable rows/columns
35             $tsz->AddGrowableCol( 1 );
36             $tsz->AddGrowableCol( 3 );
37             $tsz->AddGrowableRow( 2 );
38              
39             # tell we want automatic layout
40             $self->SetAutoLayout( 1 );
41             $self->SetSizer( $tsz );
42             # size the window optimally and set its minimal size
43             $tsz->Fit( $self );
44             $tsz->SetSizeHints( $self );
45              
46             return $self;
47             }
48              
49             sub add_to_tags { qw(sizers) }
50             sub title { 'wxFlexGridSizer' }
51              
52             1;