From 6dacec484b0a793a2cb6fcfd1833da5c8d73a31b Mon Sep 17 00:00:00 2001 From: Lee Mallabone Date: Sat, 22 Mar 2003 16:37:03 +0000 Subject: [PATCH] Add a sample showing a Calendar and build it on linux by default. svn path=/trunk/gtk-sharp/; revision=12749 --- ChangeLog | 5 ++++ sample/CalendarApp.cs | 54 +++++++++++++++++++++++++++++++++++++++++++ sample/Makefile.in | 5 +++- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100755 sample/CalendarApp.cs diff --git a/ChangeLog b/ChangeLog index f7bbe74ed..d2124bd96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-03-22 Lee Mallabone + + * sample/makefile.in: + * sample/CalendarApp.cs: Add a sample showing a Gtk.Calendar. + 2003-03-15 Duncan Mak * gtk/TextBuffer.custom: Fix the Text property. Patch from Mathias diff --git a/sample/CalendarApp.cs b/sample/CalendarApp.cs new file mode 100755 index 000000000..5015756ff --- /dev/null +++ b/sample/CalendarApp.cs @@ -0,0 +1,54 @@ +// CalendarApp.cs - Gtk.Calendar class Test implementation +// +// Author: Lee Mallabone +// +// (c) 2003 Lee Mallabone + +namespace GtkSamples { + + using Gtk; + using GtkSharp; + using System; + using System.Drawing; + + public class CalendarApp { + + public static Calendar CreateCalendar () + { + Calendar cal = new Calendar(); + cal.DisplayOptions (CalendarDisplayOptions.ShowHeading | CalendarDisplayOptions.ShowDayNames | CalendarDisplayOptions.ShowWeekNumbers); + 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; + uint year, month, day; + activatedCalendar.GetDate(out year, out month, out day); + // The month is zero-based, so tweak it before output + Console.WriteLine ("Selected date: {0}/{1}/{2}", + year, month+1, day); + } + + static void Window_Delete (object obj, DeleteEventArgs args) + { + Application.Quit (); + args.RetVal = true; + } + + } +} diff --git a/sample/Makefile.in b/sample/Makefile.in index e54ad796b..af9feb635 100755 --- a/sample/Makefile.in +++ b/sample/Makefile.in @@ -18,7 +18,7 @@ windows: $(CSC) /unsafe /out:gtk-hello-world.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll /r:../gdk/gdk-sharp.dll HelloWorld.cs $(CSC) /unsafe /out:button.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll ButtonApp.cs -linux: gtk-hello-world.exe button.exe subclass.exe menu.exe size.exe scribble.exe treeviewdemo.exe $(GNOME_TARGETS) $(GLADE_TARGETS) +linux: gtk-hello-world.exe button.exe calendar.exe subclass.exe menu.exe size.exe scribble.exe treeviewdemo.exe $(GNOME_TARGETS) $(GLADE_TARGETS) @ENABLE_GNOME_TRUE@ $(MAKE) -C gconf @ENABLE_GNOME_TRUE@ $(MAKE) -C rsvg @@ -37,6 +37,9 @@ fifteen.exe: Fifteen.cs button.exe: ButtonApp.cs $(MCS) --unsafe -o button.exe $(local_paths) $(all_assemblies) ButtonApp.cs +calendar.exe: CalendarApp.cs + $(MCS) --unsafe -o calendar.exe $(local_paths) $(all_assemblies) CalendarApp.cs + subclass.exe: Subclass.cs $(MCS) --unsafe -o subclass.exe $(local_paths) $(all_assemblies) Subclass.cs