line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
################################################### |
2
|
|
|
|
|
|
|
## mySplashScreen.pm |
3
|
|
|
|
|
|
|
## Andrew N. Hicox |
4
|
|
|
|
|
|
|
## WorldCom Customer Security Development Group |
5
|
|
|
|
|
|
|
## |
6
|
|
|
|
|
|
|
## Based on Tk::MainWindow |
7
|
|
|
|
|
|
|
################################################### |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
## Global Stuff ################################### |
11
|
|
|
|
|
|
|
#Tk Version String |
12
|
|
|
|
|
|
|
$Tk::mySplashScreen::VERSION = '1.0.3'; |
13
|
|
|
|
|
|
|
#package declaration |
14
|
|
|
|
|
|
|
package Tk::mySplashScreen; |
15
|
|
|
|
|
|
|
#export so that we don't need to call Tk::mySplashScreen, just mySplashScreen |
16
|
|
|
|
|
|
|
@mySplashScreen::ISA = 'Tk::mySplashScreen'; |
17
|
|
|
|
|
|
|
#widgets to be used |
18
|
1
|
|
|
1
|
|
10601
|
use Tk::widgets ("Photo","Label","MainWindow"); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#this is derived |
20
|
|
|
|
|
|
|
use base ("Tk::Derived", "Tk::MainWindow"); |
21
|
|
|
|
|
|
|
#cast magic missile (make this a bona-fide Tk widget) |
22
|
|
|
|
|
|
|
Construct Tk::MainWindow 'SplashScreen'; |
23
|
|
|
|
|
|
|
#default configSpecs |
24
|
|
|
|
|
|
|
our %defaultSpecs = ( |
25
|
|
|
|
|
|
|
#'-image' => "./default.gif", |
26
|
|
|
|
|
|
|
'-image' => Tk->findINC('mySplashScreen/default.gif'), |
27
|
|
|
|
|
|
|
'-text' => "Tk::mySplashScreen version: $Tk::mySplashScreen::VERSION", |
28
|
|
|
|
|
|
|
'-anchor' => "w" |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
## Populate ####################################### |
33
|
|
|
|
|
|
|
sub Populate { |
34
|
|
|
|
|
|
|
my ($self, $args) = @_; |
35
|
|
|
|
|
|
|
#make gui |
36
|
|
|
|
|
|
|
$self->makeGUI(); |
37
|
|
|
|
|
|
|
#configspecs! |
38
|
|
|
|
|
|
|
$self->ConfigSpecs( |
39
|
|
|
|
|
|
|
#native stuff (don't monk wit) |
40
|
|
|
|
|
|
|
'-width' => [PASSIVE => undef, undef, 0], |
41
|
|
|
|
|
|
|
'-length' => [PASSIVE => undef, undef, 0], |
42
|
|
|
|
|
|
|
#local stuff |
43
|
|
|
|
|
|
|
'-image' => [METHOD, undef, undef, $defaultSpecs{'-image'}], |
44
|
|
|
|
|
|
|
'-text' => [$self->{Mesg}, undef, undef, $defaultSpecs{'-text'}], |
45
|
|
|
|
|
|
|
'-anchor' => [$self->{Mesg}, undef, undef, $defaultSpecs{'-anchor'}], |
46
|
|
|
|
|
|
|
'-hide' => [METHOD, undef, undef, 0] |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
#draw the main frame |
49
|
|
|
|
|
|
|
$self->SUPER::Populate($args); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
## makeGUI ######################################## |
55
|
|
|
|
|
|
|
sub makeGUI { |
56
|
|
|
|
|
|
|
#local vars |
57
|
|
|
|
|
|
|
my $self = shift(); |
58
|
|
|
|
|
|
|
#auto-placement stuffs |
59
|
|
|
|
|
|
|
$self->{desk_width} = Tk::winfo($self, 'screenwidth'); |
60
|
|
|
|
|
|
|
$self->{desk_height} = Tk::winfo($self, 'screenheight'); |
61
|
|
|
|
|
|
|
Tk::wm( |
62
|
|
|
|
|
|
|
$self, |
63
|
|
|
|
|
|
|
"geometry", |
64
|
|
|
|
|
|
|
"+" . int($self->{desk_width}/4 - $self->{'-width'}/2) . |
65
|
|
|
|
|
|
|
"+" . int($self->{desk_height}/5 -$self->{'height'}/2) |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
#the image label |
68
|
|
|
|
|
|
|
$self->{Image} = $self->Label()->pack(-fill => 'both', -expand=> 1, -padx => '2'); |
69
|
|
|
|
|
|
|
#the 'AltContent' frame |
70
|
|
|
|
|
|
|
$self->{AltContentFrame} = $self->Frame( |
71
|
|
|
|
|
|
|
-borderwidth => 0, |
72
|
|
|
|
|
|
|
-relief => 'groove' |
73
|
|
|
|
|
|
|
)->pack(-fill =>'both'); |
74
|
|
|
|
|
|
|
#the status message |
75
|
|
|
|
|
|
|
$self->{Mesg} = $self->Label()->pack(-fill => 'x'); |
76
|
|
|
|
|
|
|
#highlight in TkPreferences |
77
|
|
|
|
|
|
|
$self->{Status_Disp}->{Highlight} = 1; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
## image ########################################## |
82
|
|
|
|
|
|
|
##can't just pass to image label because we need to intercept possible filenames |
83
|
|
|
|
|
|
|
##and convert to Tk::Photo object here |
84
|
|
|
|
|
|
|
sub image { |
85
|
|
|
|
|
|
|
my ($self, $image) = @_; |
86
|
|
|
|
|
|
|
if (ref($image) eq "Tk::Photo"){ |
87
|
|
|
|
|
|
|
##do the object thang |
88
|
|
|
|
|
|
|
$self->{splash_image} = $image; |
89
|
|
|
|
|
|
|
$self->{Image}->configure(-image => $self->{splash_image}); |
90
|
|
|
|
|
|
|
}else{ |
91
|
|
|
|
|
|
|
#load the image file |
92
|
|
|
|
|
|
|
$self->{splash_image} = $self->Photo(-file => $image); |
93
|
|
|
|
|
|
|
$self->{Image}->configure(-image => $self->{splash_image}); |
94
|
|
|
|
|
|
|
$self->{Image}->update(); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
## hide ########################################### |
99
|
|
|
|
|
|
|
##hides the splash screen |
100
|
|
|
|
|
|
|
sub hide { |
101
|
|
|
|
|
|
|
my ($self, $state) = @_; |
102
|
|
|
|
|
|
|
if ($state == 1){ |
103
|
|
|
|
|
|
|
unless ($self->{show_flag}){ |
104
|
|
|
|
|
|
|
$self->{show_flag} = 1; |
105
|
|
|
|
|
|
|
$self->withdraw(); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
}elsif ($self->{show_flag}){ |
108
|
|
|
|
|
|
|
$self->{show_flag} = 0; |
109
|
|
|
|
|
|
|
$self->deiconify(); |
110
|
|
|
|
|
|
|
$self->raise(); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
## AltContent ###################################### |
116
|
|
|
|
|
|
|
sub AltContent { |
117
|
|
|
|
|
|
|
($self, %p) = @_; |
118
|
|
|
|
|
|
|
my $temp = $self->{AltContentFrame}->Frame(%p)->pack(); |
119
|
|
|
|
|
|
|
return ($temp); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
## True For Perl Include ########################## |
124
|
|
|
|
|
|
|
1; |