2003-03-22 16:37:03 +00:00
|
|
|
// CalendarApp.cs - Gtk.Calendar class Test implementation
|
|
|
|
//
|
|
|
|
// Author: Lee Mallabone <gnome@fonicmonkey.net>
|
|
|
|
//
|
|
|
|
// (c) 2003 Lee Mallabone
|
|
|
|
|
|
|
|
namespace GtkSamples {
|
|
|
|
|
|
|
|
using Gtk;
|
|
|
|
using System;
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
|
|
public class CalendarApp {
|
|
|
|
|
|
|
|
public static Calendar CreateCalendar ()
|
|
|
|
{
|
|
|
|
Calendar cal = new Calendar();
|
2003-03-25 00:47:13 +00:00
|
|
|
cal.DisplayOptions = CalendarDisplayOptions.ShowHeading |
|
|
|
|
CalendarDisplayOptions.ShowDayNames |
|
|
|
|
CalendarDisplayOptions.ShowWeekNumbers;
|
2003-03-22 16:37:03 +00:00
|
|
|
return cal;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static int Main (string[] args)
|
|
|
|
{
|
|
|
|
Application.Init ();
|
|
|
|
Window win = new Window ("Calendar Tester");
|
|
|
|
win.DefaultSize = new Size (200, 150);
|
|
|
|
win.DeleteEvent += new DeleteEventHandler (Window_Delete);
|
|
|
|
Calendar cal = CreateCalendar();
|
|
|
|
cal.DaySelected += new EventHandler (DaySelected);
|
|
|
|
win.Add (cal);
|
|
|
|
win.ShowAll ();
|
|
|
|
Application.Run ();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void DaySelected (object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Calendar activatedCalendar = (Calendar) obj;
|
2003-03-25 00:47:13 +00:00
|
|
|
Console.WriteLine (activatedCalendar.GetDate ().ToString ("yyyy/MM/dd"));
|
2003-03-22 16:37:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void Window_Delete (object obj, DeleteEventArgs args)
|
|
|
|
{
|
|
|
|
Application.Quit ();
|
|
|
|
args.RetVal = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|