line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
############################################################################# |
2
|
|
|
|
|
|
|
## Name: lib/Wx/DemoModules/wxStaticBitmap.pm |
3
|
|
|
|
|
|
|
## Purpose: wxPerl demo helper for Wx::StaticBitmap |
4
|
|
|
|
|
|
|
## Author: Mattia Barbon |
5
|
|
|
|
|
|
|
## Modified by: |
6
|
|
|
|
|
|
|
## Created: 13/08/2006 |
7
|
|
|
|
|
|
|
## RCS-ID: $Id: wxStaticBitmap.pm 3118 2011-11-18 09:58:12Z mdootson $ |
8
|
|
|
|
|
|
|
## Copyright: (c) 2000, 2003, 2005-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::wxStaticBitmap; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
1475
|
use strict; |
|
1
|
|
|
|
|
48
|
|
|
1
|
|
|
|
|
39
|
|
16
|
1
|
|
|
1
|
|
5
|
use base qw(Wx::DemoModules::lib::BaseModule Class::Accessor::Fast); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
126
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use Wx qw(:icon wxTheApp wxNullBitmap); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw(staticbitmap) ); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub commands { |
23
|
|
|
|
|
|
|
my( $self ) = @_; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
return ( { label => 'Clear bitmap', |
26
|
|
|
|
|
|
|
action => \&on_clear_bitmap, |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
{ label => 'Set bitmap', |
29
|
|
|
|
|
|
|
action => \&on_set_bitmap, |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub create_control { |
35
|
|
|
|
|
|
|
my( $self ) = @_; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $icon = wxTheApp->GetStdIcon( wxICON_INFORMATION ); |
38
|
|
|
|
|
|
|
my $staticbitmap = Wx::StaticBitmap->new( $self, -1, $icon ); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
return $self->staticbitmap( $staticbitmap ); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub on_clear_bitmap { |
44
|
|
|
|
|
|
|
my( $self ) = @_; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$self->staticbitmap->SetBitmap( wxNullBitmap ); |
47
|
|
|
|
|
|
|
$self->staticbitmap->Refresh; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub on_set_bitmap { |
51
|
|
|
|
|
|
|
my( $self ) = @_; |
52
|
|
|
|
|
|
|
$self->staticbitmap->SetBitmap(Wx::Bitmap->new( wxTheApp->GetStdIcon( rand > .5 ? wxICON_QUESTION : wxICON_INFORMATION ) ) ); |
53
|
|
|
|
|
|
|
$self->staticbitmap->Refresh; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub add_to_tags { qw(controls) } |
57
|
|
|
|
|
|
|
sub title { 'wxStaticBitmap' } |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |