| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
############################################################################# |
|
2
|
|
|
|
|
|
|
## Name: lib/Wx/DemoModules/wxMDI.pm |
|
3
|
|
|
|
|
|
|
## Purpose: MDI (Multiple Document Interface) demo |
|
4
|
|
|
|
|
|
|
## Author: Mattia Barbon |
|
5
|
|
|
|
|
|
|
## Modified by: |
|
6
|
|
|
|
|
|
|
## Created: 17/09/2001 |
|
7
|
|
|
|
|
|
|
## RCS-ID: $Id: wxMDI.pm 2189 2007-08-21 18:15:31Z mbarbon $ |
|
8
|
|
|
|
|
|
|
## Copyright: (c) 2001, 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
|
1
|
|
|
1
|
|
1336
|
use Wx::MDI; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package Wx::DemoModules::wxMDI; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use strict; |
|
18
|
|
|
|
|
|
|
use base qw(Wx::MDIParentFrame); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Wx qw(:misc :textctrl :window :frame wxID_CLOSE); |
|
21
|
|
|
|
|
|
|
use Wx::Event qw(EVT_MENU EVT_CLOSE EVT_SIZE); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my( $ID_CREATE_CHILD, ) = |
|
24
|
|
|
|
|
|
|
( 2000 .. 3000 ); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new { |
|
27
|
|
|
|
|
|
|
my( $class, $parent ) = @_; |
|
28
|
|
|
|
|
|
|
my $self = $class->SUPER::new |
|
29
|
|
|
|
|
|
|
( $parent, -1, 'wxPerl MDI demo', wxDefaultPosition, wxDefaultSize, |
|
30
|
|
|
|
|
|
|
wxDEFAULT_FRAME_STYLE|wxHSCROLL|wxVSCROLL|wxNO_FULL_REPAINT_ON_RESIZE); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $file = Wx::Menu->new; |
|
33
|
|
|
|
|
|
|
$file->Append( $ID_CREATE_CHILD, "Create a new child" ); |
|
34
|
|
|
|
|
|
|
$file->AppendSeparator; |
|
35
|
|
|
|
|
|
|
$file->Append( wxID_CLOSE, "Close frame" ); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$self->{help} = new Wx::TextCtrl($self, -1, "A help Window", |
|
38
|
|
|
|
|
|
|
wxDefaultPosition, wxDefaultSize, |
|
39
|
|
|
|
|
|
|
wxTE_MULTILINE | wxSUNKEN_BORDER); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $bar = Wx::MenuBar->new; |
|
42
|
|
|
|
|
|
|
$bar->Append( $file, "File" ); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$self->SetMenuBar( $bar ); |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
EVT_MENU( $self, $ID_CREATE_CHILD, \&OnCreateChild ); |
|
47
|
|
|
|
|
|
|
EVT_MENU( $self, wxID_CLOSE, sub { $_[0]->Close } ); |
|
48
|
|
|
|
|
|
|
EVT_SIZE( $self, \&OnSize ); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$self->SetSize( 500, 400 ); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
return $self; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub OnCreateChild { |
|
56
|
|
|
|
|
|
|
my( $self, $event ) = @_; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $child = Wx::MDIChildFrame->new( $self, -1, "I'm a child" ); |
|
59
|
|
|
|
|
|
|
$child->SetIcon( Wx::GetWxPerlIcon ); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $file = Wx::Menu->new; |
|
62
|
|
|
|
|
|
|
$file->Append( $ID_CREATE_CHILD, "Create a new child" ); |
|
63
|
|
|
|
|
|
|
$file->AppendSeparator; |
|
64
|
|
|
|
|
|
|
$file->Append( wxID_CLOSE, "Close child" ); |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $bar = Wx::MenuBar->new; |
|
67
|
|
|
|
|
|
|
$bar->Append( $file, "File" ); |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
$child->SetMenuBar( $bar ); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
EVT_MENU( $child, wxID_CLOSE, sub { $_[0]->Close } ); |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
$child->Show; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub OnSize { |
|
77
|
|
|
|
|
|
|
my( $self, $event ) = @_; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my( $x, $y ) = $self->GetClientSizeXY(); |
|
80
|
|
|
|
|
|
|
my $client_window = $self->GetClientWindow(); |
|
81
|
|
|
|
|
|
|
$client_window->SetSize( 200, 0, $x - 200, $y); |
|
82
|
|
|
|
|
|
|
$self->{help}->SetSize( 0, 0, 200, $y); |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
$event->Skip; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub add_to_tags { qw(managed) } |
|
88
|
|
|
|
|
|
|
sub title { 'MDI' } |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
|
91
|
|
|
|
|
|
|
|