line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::GUI::Notepad::MenuBar; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1787
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
474
|
use Wx::Menu (); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use vars qw{$VERSION}; |
7
|
|
|
|
|
|
|
BEGIN { |
8
|
|
|
|
|
|
|
$VERSION = '0.01'; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
|
|
|
|
|
|
my $class = ref $_[0] ? ref shift : shift; |
13
|
|
|
|
|
|
|
my %args = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Create the object |
16
|
|
|
|
|
|
|
my $this = bless { |
17
|
|
|
|
|
|
|
ID_NEW => 99, |
18
|
|
|
|
|
|
|
ID_OPEN => 100, |
19
|
|
|
|
|
|
|
ID_SAVE => 105, |
20
|
|
|
|
|
|
|
ID_SAVEAS => 110, |
21
|
|
|
|
|
|
|
ID_CLOSE => 115, |
22
|
|
|
|
|
|
|
ID_EXIT => 120, |
23
|
|
|
|
|
|
|
ID_UNDO => 123, |
24
|
|
|
|
|
|
|
ID_REDO => 124, |
25
|
|
|
|
|
|
|
ID_CUT => 125, |
26
|
|
|
|
|
|
|
ID_COPY => 130, |
27
|
|
|
|
|
|
|
ID_PASTE => 135, |
28
|
|
|
|
|
|
|
ID_ABOUT => 140, |
29
|
|
|
|
|
|
|
}, $class; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Create the File menu |
32
|
|
|
|
|
|
|
$this->{filemenu} = Wx::Menu->new() or die(); |
33
|
|
|
|
|
|
|
$this->{filemenu}->Append( $this->{ID_NEW}, "&New", "Create a file" ); |
34
|
|
|
|
|
|
|
$this->{filemenu}->Append( $this->{ID_OPEN}, "&Open", "Open a file" ); |
35
|
|
|
|
|
|
|
$this->{filemenu}->Append( $this->{ID_SAVE}, "&Save", "Save current file" ); |
36
|
|
|
|
|
|
|
$this->{filemenu}->Append( $this->{ID_SAVEAS}, "Save &As", "Save under different filename" ); |
37
|
|
|
|
|
|
|
$this->{filemenu}->Append( $this->{ID_CLOSE}, "&Close", "Close current file" ); |
38
|
|
|
|
|
|
|
$this->{filemenu}->AppendSeparator(); |
39
|
|
|
|
|
|
|
$this->{filemenu}->Append( $this->{ID_EXIT}, "E&xit", "Quit this Program" ); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Create the Edit menu |
42
|
|
|
|
|
|
|
$this->{editmenu} = Wx::Menu->new() or die(); |
43
|
|
|
|
|
|
|
$this->{editmenu}->Append( $this->{ID_UNDO}, "&Undo", "Undo" ); |
44
|
|
|
|
|
|
|
$this->{editmenu}->Append( $this->{ID_REDO}, "&Redo", "Redo" ); |
45
|
|
|
|
|
|
|
$this->{editmenu}->AppendSeparator(); |
46
|
|
|
|
|
|
|
$this->{editmenu}->Append( $this->{ID_CUT}, "&Cut", "Cut selected text" ); |
47
|
|
|
|
|
|
|
$this->{editmenu}->Append( $this->{ID_COPY}, "&Copy", "Copy selected text" ); |
48
|
|
|
|
|
|
|
$this->{editmenu}->Append( $this->{ID_PASTE}, "&Paste", "Paste text" ); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Create the Help menu |
51
|
|
|
|
|
|
|
$this->{helpmenu} = Wx::Menu->new(); |
52
|
|
|
|
|
|
|
$this->{helpmenu}->Append( $this->{ID_ABOUT}, "&About", "About this program" ); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Assemble the menubar |
55
|
|
|
|
|
|
|
$this->{menubar} = Wx::MenuBar->new() or die(); |
56
|
|
|
|
|
|
|
$this->{menubar}->Append( $this->{filemenu}, "&File" ); |
57
|
|
|
|
|
|
|
$this->{menubar}->Append( $this->{editmenu}, "&Edit" ); |
58
|
|
|
|
|
|
|
$this->{menubar}->Append( $this->{helpmenu}, "&Help" ); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
return $this; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub menubar { |
64
|
|
|
|
|
|
|
$_[0]->{menubar}; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |