File: bday

package info (click to toggle)
libcdk-perl 4.9.10-3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 884 kB
  • ctags: 414
  • sloc: perl: 6,419; makefile: 45; sh: 27
file content (120 lines) | stat: -rwxr-xr-x 2,328 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/perl -w
# $Id: bday,v 1.3 2002/07/24 10:04:30 tom Exp $

#
# Purpose:
#	To demonstrate the Perl5 Cdk Calendar Widget

# Set some global variables.
my %birthdays = ();
my %appointments = ();
my %anniversay = ();

# Initialize Cdk.
use Cdk;
Cdk::init();

# Create the calendar object.
my $calendar = new Cdk::Calendar ('Dattrib' => "</32/B>",
					'Mattrib' => "</5/B>",
					'Yattrib' => "</24/B>",
					'Highlight' => "</R>");

# Create the scrolling window.
my $swindow = new Cdk::Swindow ('Title' => "<C></B/5>Date Information",
					'Lines' => 300,
					'Height' => 4,
					'Width' => 50,
					'Ypos' => "BOTTOM");

# Set the key binding for the calendar widget.
$calendar->bind ('Key' => "m", 'Function' => sub { setMarkerCB ($calendar);});

# Set the post-process function for the calendar widget.
$calendar->postProcess ('Function' => sub { checkDatePP ($calendar);});

# Draw the scrolling window.
$swindow->draw();

# Let the user play.
for (;;)
{
   # Activate the object.
   my $ret = $calendar->activate();
}

# Exit Cdk.
Cdk::end();

#
# This checks if the current date has a marker set on it.
#
sub checkDatePP
{
   my $calendar = shift;
}

#
# This allows the user to create a marker.
#
sub setMarkerCB
{
   my $calendar = shift;
   my @mesg = ("<C></B/5>What type of a marker is it?");
   my @buttons = ("</B/3>Birthday", "</B/5>Anniversary", "</B/30>Appointment");

   # Get the current date the marker is at.
   my ($day, $month, $year) = $calendar->getDate();

   # Ask the user what type of marker to add.
   my $dialog = new Cdk::Dialog ('Message' => \@mesg, 'Buttons' => \@buttons);
   my $choice = $dialog->activate();
   undef $dialog;

   # If they hit escape, tell them...
   if (!defined $choice)
   {
      popupLabel (["Escape Hit. No marker set."]);
      $calendar->draw();
      return 1;
   }

   # Check the choice.
   if ($choice == 0)
   {
      addBirthdayMarker ($day, $month, $year);
   }
   elsif ($choice == 1)
   {
      addAnniversaryMarker ($day, $month, $year);
   }
   elsif ($choice == 2)
   {
      addAppointmentMarker ($day, $month, $year);
   }
   return 1;
}

#
#
#
sub addBirthdayMarker
{
   my ($day, $month, $year) = @_;
}

#
#
#
sub addAnniversaryMarker
{
   my ($day, $month, $year) = @_;
}

#
#
#
sub addAppointmentMarker
{
   my ($day, $month, $year) = @_;
}