line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
############################################################################# |
2
|
|
|
|
|
|
|
## Name: lib/Wx/DemoModules/wxCalendarCtrl.pm |
3
|
|
|
|
|
|
|
## Purpose: wxPerl demo helper for Wx::CalendarCtrl |
4
|
|
|
|
|
|
|
## Author: Mattia Barbon |
5
|
|
|
|
|
|
|
## Modified by: |
6
|
|
|
|
|
|
|
## Created: 11/10/2002 |
7
|
|
|
|
|
|
|
## RCS-ID: $Id: wxCalendarCtrl.pm 3118 2011-11-18 09:58:12Z mdootson $ |
8
|
|
|
|
|
|
|
## Copyright: (c) 2002-2003, 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
|
|
1702
|
use Wx::Calendar; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package Wx::DemoModules::wxCalendarCtrl; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use strict; |
18
|
|
|
|
|
|
|
use base qw(Wx::Panel); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Wx qw(:sizer :calendar wxDefaultPosition wxDefaultSize wxRED wxBLUE); |
21
|
|
|
|
|
|
|
use Wx::Event qw(EVT_CALENDAR_SEL_CHANGED); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
|
|
|
|
|
|
my $class = shift; |
25
|
|
|
|
|
|
|
my $this = $class->SUPER::new( $_[0], -1 ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $sizer = Wx::BoxSizer->new( wxVERTICAL ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# 8 Jan 1979 |
30
|
|
|
|
|
|
|
my $date = Wx::DateTime->newFromDMY( 8, 0, 1979 ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $calendar = Wx::CalendarCtrl->new( $this, -1, $date ); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $textctrl = Wx::TextCtrl->new( $this, -1, $date->FormatDate ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$sizer->Add( $calendar, 0, wxALL, 10 ); |
37
|
|
|
|
|
|
|
$sizer->Add( $textctrl, 0, wxGROW|wxALL, 10 ); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# EnableYearChange not available on native controls |
40
|
|
|
|
|
|
|
$calendar->EnableYearChange if $calendar->can('EnableYearChange'); |
41
|
|
|
|
|
|
|
$calendar->EnableMonthChange; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# test attributes |
44
|
|
|
|
|
|
|
my $attr = Wx::CalendarDateAttr->new; |
45
|
|
|
|
|
|
|
$attr->SetTextColour( wxRED ); |
46
|
|
|
|
|
|
|
$attr->SetBorderColour( wxBLUE ); |
47
|
|
|
|
|
|
|
$attr->SetBorder( wxCAL_BORDER_ROUND ); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$calendar->SetAttr( 2, $attr ); |
50
|
|
|
|
|
|
|
$calendar->SetAttr( 3, $attr ); |
51
|
|
|
|
|
|
|
$calendar->SetAttr( 4, $attr ); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
EVT_CALENDAR_SEL_CHANGED( $this, $calendar, |
54
|
|
|
|
|
|
|
sub { |
55
|
|
|
|
|
|
|
my( $self, $event ) = @_; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
$textctrl->SetValue |
58
|
|
|
|
|
|
|
( $event->GetDate->FormatDate ); |
59
|
|
|
|
|
|
|
} ); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
$this->SetSizer( $sizer ); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
return $this; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub add_to_tags { qw(controls) } |
67
|
|
|
|
|
|
|
sub title { 'wxCalendarCtrl' } |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |