Add a sample showing a Calendar and build it on linux by default.
svn path=/trunk/gtk-sharp/; revision=12749
This commit is contained in:
parent
f8c625b0f9
commit
6dacec484b
3 changed files with 63 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
2003-03-22 Lee Mallabone <gnome@fonicmonkey.net>
|
||||
|
||||
* sample/makefile.in:
|
||||
* sample/CalendarApp.cs: Add a sample showing a Gtk.Calendar.
|
||||
|
||||
2003-03-15 Duncan Mak <duncan@ximian.com>
|
||||
|
||||
* gtk/TextBuffer.custom: Fix the Text property. Patch from Mathias
|
||||
|
|
54
sample/CalendarApp.cs
Executable file
54
sample/CalendarApp.cs
Executable file
|
@ -0,0 +1,54 @@
|
|||
// CalendarApp.cs - Gtk.Calendar class Test implementation
|
||||
//
|
||||
// Author: Lee Mallabone <gnome@fonicmonkey.net>
|
||||
//
|
||||
// (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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue