gtk-sharpGtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details.Gtk.WidgetDisplay a Calendar and/or allow the user to select a date.With a Calendar widget, dates are presented to the user one month at a time. Additional information and decorations can be added to the Calendar by using the enumeration with the property.Days can be highlighted on the Calendar with or .The following example shows a method that creates a simple Calendar displaying day names, headings and week numbers.
// Create a calendar with some simple display options
public Calendar CreateCalendar ()
{
Calendar cal = new Calendar ();
cal.DisplayOptions = CalendarDisplayOptions.ShowHeading |
CalendarDisplayOptions.ShowDayNames |
CalendarDisplayOptions.ShowWeekNumbers;
cal.DaySelected += new EventHandler(HandleDaySelected);
return cal;
}
The following example shows a typical event handler that outputs the date when one is selected.
// Typical event handler for capturing the selected date
void HandleDaySelected (object obj, EventArgs args)
{
Calendar activatedCalendar = (Calendar) obj;
Console.WriteLine (activatedCalendar.GetDate ().ToString ("yyyy/MM/dd"));
}
ConstructorCreates a new Calendar displaying the current month and having the current day selectedConstructor
Pointer to the C object.
Internal constructorThis is an internal constructor, and should not be used by user code.MethodSystem.VoidRemoves all visual marks that have been added to dates.PropertySystem.DateTimea DateTime that contains the current day for the Calendar widgeta Setting the date fires Calendar changes events (Day, Month/Year)PropertyGLib.Property("day")System.Int32The selected day as a number between 1 and 31, or 0 to unselect the currently selected day.a EventGLib.Signal("day-selected")System.EventHandlerRaised when a day is selected on the Calendar.EventGLib.Signal("day-selected-double-click")System.EventHandlerRaised when the user "double clicks" on a day.PropertyGtk.CalendarDetailFuncTo be added.To be added.To be added.PropertyGLib.Property("detail-height-rows")System.Int32To be added.To be added.To be added.PropertyGLib.Property("detail-width-chars")System.Int32To be added.To be added.To be added.PropertyGtk.CalendarDisplayOptionsSet the display options for this Calendar.One or more values from , combined using a bit-wise OR.This method allows fine control over which parts of the Calendar, such as day names, are displayed. The describe the choices in more detail.MethodSystem.DateTimeGet the selected date.A DateTime object containing the selected day, month and year.Selected date information can also be retrieved with the method.MethodSystem.Void
A variable to place the chosen year in.
A variable to place the chosen month in.
A variable to place the chosen day in.
Get the selected date.NOTE: That month number is ZERO based, (0-11), whereas the day is one based, (1-31).An alternative way to get the date is with the method.MethodSystem.Boolean
To be added.
To be added.To be added.To be added.PropertyGLib.GTypeGType Property.a Returns the native value for .MethodSystem.Void
To be added.
To be added.To be added.PropertyGLib.Property("month")System.Int32The selected month as a number between 0 and 11.a EventGLib.Signal("month-changed")System.EventHandlerRaised when the current month changes.EventGLib.Signal("next-month")System.EventHandlerRaised when the month of the Calendar moves to the next one.EventGLib.Signal("next-year")System.EventHandlerRaised when the current year of the Calendar is increased.This may happen when the user explicitly advances the year, or when advancing from December to January.PropertyGLib.Property("no-month-change")System.BooleanIf , the selected month can not be changed.a MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideDaySelected", Type=typeof(Gtk.Calendar))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideDaySelectedDoubleClick", Type=typeof(Gtk.Calendar))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideMonthChanged", Type=typeof(Gtk.Calendar))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideNextMonth", Type=typeof(Gtk.Calendar))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideNextYear", Type=typeof(Gtk.Calendar))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverridePrevMonth", Type=typeof(Gtk.Calendar))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverridePrevYear", Type=typeof(Gtk.Calendar))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.EventGLib.Signal("prev-month")System.EventHandlerRaised when the Calendar moves to the previous month.EventGLib.Signal("prev-year")System.EventHandlerRaised when the current year of the Calendar is decreased.This may happen when the user explicitly advances the year, or when clicking 'back' from January to December.MethodSystem.Void
A day number from 1 to 31.
Select a specified day on the displayed month.A value of 0 for the will unselect the currently selected day.MethodSystem.Void
To be added.
To be added.
To be added.To be added.PropertyGLib.Property("show-day-names")System.BooleanIf , day names are displayed.a PropertyGLib.Property("show-details")System.BooleanTo be added.To be added.To be added.PropertyGLib.Property("show-heading")System.BooleanIf , a heading is displayeda PropertyGLib.Property("show-week-numbers")System.BooleanIf , week numbers are displayeda MethodSystem.Void
To be added.
To be added.To be added.PropertyGLib.Property("year")System.Int32The selected year.a