<Type Name="Calendar" FullName="Gtk.Calendar"> <TypeSignature Language="C#" Maintainer="Lee Mallabone" Value="public class Calendar : Gtk.Widget" /> <AssemblyInfo> <AssemblyName>gtk-sharp</AssemblyName> <AssemblyPublicKey> </AssemblyPublicKey> <AssemblyVersion>2.6.0.0</AssemblyVersion> </AssemblyInfo> <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement> <Docs> <summary>Display a Calendar and/or allow the user to select a date.</summary> <remarks> <para>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 <see cref="T:Gtk.CalendarDisplayOptions" /> enumeration with the <see cref="P:Gtk.DisplayOptions" /> property.</para> <para>Days can be highlighted on the Calendar with <see cref="M:Gtk.Calendar.MarkDay" /> or <see cref="M:Gtk.Calendar.SelectDay" />.</para> <para>The following example shows a method that creates a simple Calendar displaying day names, headings and week numbers. <example> <code lang="C#"> // 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; } </code> </example></para> <para>The following example shows a typical event handler that outputs the date when one is selected. <example> <code lang="C#"> // 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")); } </code> </example></para> </remarks> </Docs> <Base> <BaseTypeName>Gtk.Widget</BaseTypeName> </Base> <Interfaces> </Interfaces> <Members> <Member MemberName="UnmarkDay"> <MemberSignature Language="C#" Value="public bool UnmarkDay (uint day);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Boolean</ReturnType> </ReturnValue> <Parameters> <Parameter Name="day" Type="System.UInt32" /> </Parameters> <Docs> <summary>Removes a visual marker from the specified <paramref name="day" />.</summary> <param name="day">A day number from 1 to 31.</param> <returns> <see langword="true" /> </returns> <remarks> <para>Visual markers are added to the Calendar with <see cref="M:Gtk.Calendar.MarkDay" />.</para> </remarks> </Docs> </Member> <Member MemberName="MarkDay"> <MemberSignature Language="C#" Value="public bool MarkDay (uint day);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Boolean</ReturnType> </ReturnValue> <Parameters> <Parameter Name="day" Type="System.UInt32" /> </Parameters> <Docs> <summary>Adds a visual marker to the specified <paramref name="day" />.</summary> <param name="day">A day number from 1 to 31.</param> <returns> <see langword="true" /> </returns> <remarks /> </Docs> </Member> <Member MemberName="SelectDay"> <MemberSignature Language="C#" Value="public void SelectDay (uint day);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="day" Type="System.UInt32" /> </Parameters> <Docs> <summary>Select a specified day on the displayed month.</summary> <param name="day">A day number from 1 to 31.</param> <remarks> <para>A value of 0 for the <paramref name="day" /> will unselect the currently selected day.</para> </remarks> </Docs> </Member> <Member MemberName="Freeze"> <MemberSignature Language="C#" Value="public void Freeze ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Stops the Calendar from visually updating.</summary> <remarks> <para>If used before a large number of graphical updates, (such as calls to <see cref="M:Gtk.Calendar.MarkDay" />), this method may prevent flicker. Once a batch of updates has taken place, call <see cref="M:Gtk.Calendar.Thaw" /> to render them.</para> </remarks> </Docs> </Member> <Member MemberName="GetDate"> <MemberSignature Language="C#" Value="public void GetDate (out uint year, out uint month, out uint day);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="year" Type="System.UInt32&" RefType="out" /> <Parameter Name="month" Type="System.UInt32&" RefType="out" /> <Parameter Name="day" Type="System.UInt32&" RefType="out" /> </Parameters> <Docs> <summary>Get the selected date.</summary> <param name="year">A variable to place the chosen year in.</param> <param name="month">A variable to place the chosen month in.</param> <param name="day">A variable to place the chosen day in.</param> <remarks> <para>NOTE: That month number is ZERO based, (0-11), whereas the day is one based, (1-31).</para> <para>An alternative way to get the date is with the <see cref="M:Gtk.Calendar.GetDate(uint,uint,uint)" /> method.</para> </remarks> </Docs> </Member> <Member MemberName="Thaw"> <MemberSignature Language="C#" Value="public void Thaw ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Removes the effects of calling <see cref="M:Gtk.Calendar.Freeze" />.</summary> <remarks> <para>This draws all graphical updates to the Calendar that have happened since a <see cref="M:Gtk.Calendar.Freeze" />.</para> </remarks> </Docs> </Member> <Member MemberName="ClearMarks"> <MemberSignature Language="C#" Value="public void ClearMarks ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Removes all visual marks that have been added to dates.</summary> <remarks /> </Docs> </Member> <Member MemberName="SelectMonth"> <MemberSignature Language="C#" Value="public bool SelectMonth (uint month, uint year);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Boolean</ReturnType> </ReturnValue> <Parameters> <Parameter Name="month" Type="System.UInt32" /> <Parameter Name="year" Type="System.UInt32" /> </Parameters> <Docs> <summary>Shifts the Calendar to display the specified month.</summary> <param name="month">A zero-based month number.</param> <param name="year">The year the month is in.</param> <returns> <see langword="true" /> </returns> <remarks /> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public Calendar (IntPtr raw);" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters> <Parameter Name="raw" Type="System.IntPtr" /> </Parameters> <Docs> <summary>Internal constructor</summary> <param name="raw">Pointer to the C object.</param> <remarks> <para>This is an internal constructor, and should not be used by user code.</para> </remarks> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public Calendar ();" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters /> <Docs> <summary>Creates a new Calendar displaying the current month and having the current day selected</summary> <remarks /> </Docs> </Member> <Member MemberName="NextYear"> <MemberSignature Language="C#" Value="public event EventHandler NextYear;" /> <MemberType>Event</MemberType> <ReturnValue> <ReturnType>System.EventHandler</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Fired when the current year of the Calendar is increased.</summary> <remarks> <para>This may happen when the user explicitly advances the year, or when advancing from December to January.</para> </remarks> </Docs> <Attributes> <Attribute> <AttributeName>GLib.Signal(CName="next_year")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="DaySelectedDoubleClick"> <MemberSignature Language="C#" Value="public event EventHandler DaySelectedDoubleClick;" /> <MemberType>Event</MemberType> <ReturnValue> <ReturnType>System.EventHandler</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Fired when the user "double clicks" on a day.</summary> <remarks /> </Docs> <Attributes> <Attribute> <AttributeName>GLib.Signal(CName="day_selected_double_click")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="PrevYear"> <MemberSignature Language="C#" Value="public event EventHandler PrevYear;" /> <MemberType>Event</MemberType> <ReturnValue> <ReturnType>System.EventHandler</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Fired when the current year of the Calendar is decreased.</summary> <remarks> <para>This may happen when the user explicitly advances the year, or when clicking 'back' from January to December.</para> </remarks> </Docs> <Attributes> <Attribute> <AttributeName>GLib.Signal(CName="prev_year")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="MonthChanged"> <MemberSignature Language="C#" Value="public event EventHandler MonthChanged;" /> <MemberType>Event</MemberType> <ReturnValue> <ReturnType>System.EventHandler</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Fired when the current month changes.</summary> <remarks /> </Docs> <Attributes> <Attribute> <AttributeName>GLib.Signal(CName="month_changed")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="NextMonth"> <MemberSignature Language="C#" Value="public event EventHandler NextMonth;" /> <MemberType>Event</MemberType> <ReturnValue> <ReturnType>System.EventHandler</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Fired when the month of the Calendar moves to the next one.</summary> <remarks /> </Docs> <Attributes> <Attribute> <AttributeName>GLib.Signal(CName="next_month")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="DaySelected"> <MemberSignature Language="C#" Value="public event EventHandler DaySelected;" /> <MemberType>Event</MemberType> <ReturnValue> <ReturnType>System.EventHandler</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Fired when a day is selected on the Calendar.</summary> <remarks /> </Docs> <Attributes> <Attribute> <AttributeName>GLib.Signal(CName="day_selected")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="PrevMonth"> <MemberSignature Language="C#" Value="public event EventHandler PrevMonth;" /> <MemberType>Event</MemberType> <ReturnValue> <ReturnType>System.EventHandler</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Fired when the Calendar moves to the previous month.</summary> <remarks /> </Docs> <Attributes> <Attribute> <AttributeName>GLib.Signal(CName="prev_month")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="GetDate"> <MemberSignature Language="C#" Value="public DateTime GetDate ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.DateTime</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Get the selected date.</summary> <returns>A DateTime object containing the selected day, month and year.</returns> <remarks> <para>Selected date information can also be retrieved with the <see cref="M:Gtk.Calendar.GetDate(uint,uint,uint)" /> method.</para> </remarks> </Docs> </Member> <Member MemberName="GType"> <MemberSignature Language="C#" Value="public static GLib.GType GType { get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>GLib.GType</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>GType Property.</summary> <value>a <see cref="T:GLib.GType" /></value> <remarks>Returns the native <see cref="T:GLib.GType" /> value for <see cref="T:Gtk.Calendar" />.</remarks> </Docs> </Member> <Member MemberName="OnPrevMonth"> <MemberSignature Language="C#" Value="protected virtual void OnPrevMonth ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Default handler for the <see cref="M:Gtk.Calendar.PrevMonth" /> event.</summary> <remarks>Override this method in a subclass to provide a default handler for the <see cref="M:Gtk.Calendar.PrevMonth" /> event.</remarks> </Docs> </Member> <Member MemberName="OnDaySelected"> <MemberSignature Language="C#" Value="protected virtual void OnDaySelected ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Default handler for the <see cref="M:Gtk.Calendar.DaySelected" /> event.</summary> <remarks>Override this method in a subclass to provide a default handler for the <see cref="M:Gtk.Calendar.DaySelected" /> event.</remarks> </Docs> </Member> <Member MemberName="OnNextMonth"> <MemberSignature Language="C#" Value="protected virtual void OnNextMonth ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Default handler for the <see cref="M:Gtk.Calendar.NextMonth" /> event.</summary> <remarks>Override this method in a subclass to provide a default handler for the <see cref="M:Gtk.Calendar.NextMonth" /> event.</remarks> </Docs> </Member> <Member MemberName="OnMonthChanged"> <MemberSignature Language="C#" Value="protected virtual void OnMonthChanged ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Default handler for the <see cref="M:Gtk.Calendar.MonthChanged" /> event.</summary> <remarks>Override this method in a subclass to provide a default handler for the <see cref="M:Gtk.Calendar.MonthChanged" /> event.</remarks> </Docs> </Member> <Member MemberName="OnPrevYear"> <MemberSignature Language="C#" Value="protected virtual void OnPrevYear ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Default handler for the <see cref="M:Gtk.Calendar.PrevYear" /> event.</summary> <remarks>Override this method in a subclass to provide a default handler for the <see cref="M:Gtk.Calendar.PrevYear" /> event.</remarks> </Docs> </Member> <Member MemberName="OnDaySelectedDoubleClick"> <MemberSignature Language="C#" Value="protected virtual void OnDaySelectedDoubleClick ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Default handler for the <see cref="M:Gtk.Calendar.DaySelectedDoubleClick" /> event.</summary> <remarks>Override this method in a subclass to provide a default handler for the <see cref="M:Gtk.Calendar.DaySelectedDoubleClick" /> event.</remarks> </Docs> </Member> <Member MemberName="OnNextYear"> <MemberSignature Language="C#" Value="protected virtual void OnNextYear ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Default handler for the <see cref="M:Gtk.Calendar.NextYear" /> event.</summary> <remarks>Override this method in a subclass to provide a default handler for the <see cref="M:Gtk.Calendar.NextYear" /> event.</remarks> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="protected Calendar (GLib.GType gtype);" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters> <Parameter Name="gtype" Type="GLib.GType" /> </Parameters> <Docs> <summary>Protected Constructor.</summary> <param name="gtype">a <see cref="T:GLib.GType" /></param> <remarks>Chain to this constructor if you have manually registered a native <see cref="T:GLib.GType" /> value for your subclass.</remarks> </Docs> <Attributes> <Attribute> <AttributeName>System.Obsolete(Message=null, IsError=False)</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="Date"> <MemberSignature Language="C#" Value="public DateTime Date { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.DateTime</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>a DateTime that contains the current day for the Calendar widget</summary> <value>a <see cref="T:System.DateTime" /></value> <remarks>Setting the date fires Calendar changes events (Day, Month/Year)</remarks> </Docs> </Member> <Member MemberName="Day"> <MemberSignature Language="C#" Value="public int Day { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.Int32</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>The selected day as a number between 1 and 31, or 0 to unselect the currently selected day.</summary> <value>a <see cref="T:System.Int32" /></value> <remarks> </remarks> <since version="Gtk# 2.4" /> </Docs> <Attributes> <Attribute> <AttributeName>GLib.Property(Name="day")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="ShowWeekNumbers"> <MemberSignature Language="C#" Value="public bool ShowWeekNumbers { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.Boolean</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>If <see langword="true" />, week numbers are displayed</summary> <value>a <see cref="T:System.Boolean" /></value> <remarks> </remarks> <since version="Gtk# 2.4" /> </Docs> <Attributes> <Attribute> <AttributeName>GLib.Property(Name="show_week_numbers")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="ShowDayNames"> <MemberSignature Language="C#" Value="public bool ShowDayNames { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.Boolean</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>If <see langword="true" />, day names are displayed.</summary> <value>a <see cref="T:System.Boolean" /></value> <remarks> </remarks> <since version="Gtk# 2.4" /> </Docs> <Attributes> <Attribute> <AttributeName>GLib.Property(Name="show_day_names")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="ShowHeading"> <MemberSignature Language="C#" Value="public bool ShowHeading { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.Boolean</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>If <see langword="true" />, a heading is displayed</summary> <value>a <see cref="T:System.Boolean" /></value> <remarks> </remarks> <since version="Gtk# 2.4" /> </Docs> <Attributes> <Attribute> <AttributeName>GLib.Property(Name="show_heading")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="Month"> <MemberSignature Language="C#" Value="public int Month { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.Int32</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>The selected month as a number between 0 and 11.</summary> <value>a <see cref="T:System.Int32" /></value> <remarks> </remarks> <since version="Gtk# 2.4" /> </Docs> <Attributes> <Attribute> <AttributeName>GLib.Property(Name="month")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="Year"> <MemberSignature Language="C#" Value="public int Year { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.Int32</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>The selected year.</summary> <value>a <see cref="T:System.Int32" /></value> <remarks> </remarks> <since version="Gtk# 2.4" /> </Docs> <Attributes> <Attribute> <AttributeName>GLib.Property(Name="year")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="NoMonthChange"> <MemberSignature Language="C#" Value="public bool NoMonthChange { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.Boolean</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>If <see langword="true" />, the selected month can not be changed.</summary> <value>a <see cref="T:System.Boolean" /></value> <remarks> </remarks> <since version="Gtk# 2.4" /> </Docs> <Attributes> <Attribute> <AttributeName>GLib.Property(Name="no_month_change")</AttributeName> </Attribute> </Attributes> </Member> <Member MemberName="DisplayOptions"> <MemberSignature Language="C#" Value="public Gtk.CalendarDisplayOptions DisplayOptions { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>Gtk.CalendarDisplayOptions</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Set the display options for this Calendar.</summary> <value>One or more values from <see cref="T:Gtk.CalendarDisplayOptions" />, combined using a bit-wise OR.</value> <remarks> <para>This method allows fine control over which parts of the Calendar, such as day names, are displayed. The <see cref="T:Gtk.CalendarDisplayOptions" /> describe the choices in more detail.</para> </remarks> <since version="Gtk# 2.4" /> </Docs> </Member> </Members> </Type>