line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# $Id: Sizer.pm,v 1.11 2008/01/22 03:56:31 Daddy Exp $
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Tk::Wizard::Installer::Win32::Sizer;
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
2851
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
7
|
1
|
|
|
1
|
|
5
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
84
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our
|
10
|
|
|
|
|
|
|
$VERSION = do { my @r = ( q$Revision: 1.11 $ =~ /\d+/g ); sprintf "%d." . "%03d" x $#r, @r };
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Tk::Wizard::Installer::Win32::Sizer - Interactively determine the best size for your Wizard::Installer::Win32
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use Tk::Wizard::Installer::Win32::Sizer;
|
17
|
|
|
|
|
|
|
my $wizard = new Tk::Wizard::Installer::Win32::Sizer(
|
18
|
|
|
|
|
|
|
# Same arguments as Tk::Wizard::Installer::Win32
|
19
|
|
|
|
|
|
|
);
|
20
|
|
|
|
|
|
|
$wizard->Show;
|
21
|
|
|
|
|
|
|
MainLoop;
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut
|
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
5
|
use Carp;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
71
|
|
26
|
1
|
|
|
1
|
|
512
|
use Tk::Wizard::Installer::Win32;
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use Tk::Wizard::Sizer;
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our @ISA = qw( Tk::Wizard::Installer::Win32 Tk::Wizard::Sizer );
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
A typical Wizard application utilizes a fixed-size window;
|
34
|
|
|
|
|
|
|
Tk::Wizard follows this philosophy by creating a window
|
35
|
|
|
|
|
|
|
without resize handles.
|
36
|
|
|
|
|
|
|
In addition, Tk::Wizard allows you to specify the size of the content area.
|
37
|
|
|
|
|
|
|
But there's a problem with this mechanism --
|
38
|
|
|
|
|
|
|
how do you know how large to make your window?
|
39
|
|
|
|
|
|
|
You know what you want to appear in the window,
|
40
|
|
|
|
|
|
|
and you know how you want it to be arranged,
|
41
|
|
|
|
|
|
|
but you do not know the dimensions of that combination of elements.
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Fret no more, dear programmer! Simply replace your call to
|
44
|
|
|
|
|
|
|
Tk::Wizard::Installer->new with a call to
|
45
|
|
|
|
|
|
|
Tk::Wizard::Installer::Win32::Sizer->new, and run your Wizard
|
46
|
|
|
|
|
|
|
application. On each page, adjust the size of the window for best
|
47
|
|
|
|
|
|
|
aesthetics. After you click the Next button on each page, on STDOUT
|
48
|
|
|
|
|
|
|
will be printed the ideal height and width arguments. After you click
|
49
|
|
|
|
|
|
|
the Finish button on the last page, on STDOUT will be printed the
|
50
|
|
|
|
|
|
|
ideal dimensions that will contain all your pages (i.e. the width of
|
51
|
|
|
|
|
|
|
the widest page and the height of the tallest page).
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 METHODS
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 new
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Create a new Sizer wizard.
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub new
|
62
|
|
|
|
|
|
|
{
|
63
|
|
|
|
|
|
|
my $class = shift;
|
64
|
|
|
|
|
|
|
# This is NOT a clone mechanism:
|
65
|
|
|
|
|
|
|
return if ref($class);
|
66
|
|
|
|
|
|
|
# Our arguments are exactly the same as Tk::Wizard::Installer::Win32::new:
|
67
|
|
|
|
|
|
|
my $oWiz = $class->SUPER::new(@_);
|
68
|
|
|
|
|
|
|
# Make sure the window is resizable!
|
69
|
|
|
|
|
|
|
$oWiz->{Configure}{-resizable} = 1;
|
70
|
|
|
|
|
|
|
# Make sure the window does not auto-forward:
|
71
|
|
|
|
|
|
|
$oWiz->{Configure}{-wait} = 0;
|
72
|
|
|
|
|
|
|
# Add our size adder-upper:
|
73
|
|
|
|
|
|
|
$oWiz->configure(
|
74
|
|
|
|
|
|
|
-preNextButtonAction => sub { $oWiz->_prenext() },
|
75
|
|
|
|
|
|
|
-finishButtonAction => sub { $oWiz->_finish() },
|
76
|
|
|
|
|
|
|
);
|
77
|
|
|
|
|
|
|
$oWiz->{_max_width_} = -999;
|
78
|
|
|
|
|
|
|
$oWiz->{_max_height_} = -999;
|
79
|
|
|
|
|
|
|
return bless $oWiz, __PACKAGE__;
|
80
|
|
|
|
|
|
|
} # new
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1;
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__
|