CalendarRef

public struct CalendarRef : CalendarProtocol, GWeakCapturing

GtkCalendar is a widget that displays a Gregorian calendar, one month at a time.

An example GtkCalendar

A GtkCalendar can be created with [ctorGtk.Calendar.new].

The date that is currently displayed can be altered with [methodGtk.Calendar.select_day].

To place a visual marker on a particular day, use [methodGtk.Calendar.mark_day] and to remove the marker, [methodGtk.Calendar.unmark_day]. Alternative, all marks can be cleared with [methodGtk.Calendar.clear_marks].

The selected date can be retrieved from a GtkCalendar using [methodGtk.Calendar.get_date].

Users should be aware that, although the Gregorian calendar is the legal calendar in most countries, it was adopted progressively between 1582 and 1929. Display before these dates is likely to be historically incorrect.

CSS nodes

calendar.view
├── header
   ├── button
   ├── stack.month
   ├── button
   ├── button
   ├── label.year
   ╰── button
╰── grid
    ╰── label[.day-name][.week-number][.day-number][.other-month][.today]

GtkCalendar has a main node with name calendar. It contains a subnode called header containing the widgets for switching between years and months.

The grid subnode contains all day labels, including week numbers on the left (marked with the .week-number css class) and day names on top (marked with the .day-name css class).

Day labels that belong to the previous or next month get the .other-month style class. The label of the current day get the .today style class.

Marked day labels get the :selected state assigned.

The CalendarRef type acts as a lightweight Swift reference to an underlying GtkCalendar instance. It exposes methods that can operate on this data type through CalendarProtocol conformance. Use CalendarRef only as an unowned reference to an existing GtkCalendar instance.

  • ptr
    Untyped pointer to the underlying `GtkCalendar` instance.
    

    For type-safe access, use the generated, typed pointer calendar_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

Calendar Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GtkCalendar>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GtkCalendar>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GtkCalendar>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkCalendar>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements CalendarProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : CalendarProtocol
  • This factory is syntactic sugar for setting weak pointers wrapped in GWeak<T>

    Declaration

    Swift

    @inlinable
    static func unowned<T>(_ other: T) -> CalendarRef where T : CalendarProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to CalendarProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(cPointer: UnsafeMutablePointer<T>)
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to CalendarProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(constPointer: UnsafePointer<T>)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to CalendarProtocol.

    Declaration

    Swift

    @inlinable
    init(mutating raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to CalendarProtocol.

    Declaration

    Swift

    @inlinable
    init(raw: UnsafeMutableRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to CalendarProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Creates a new calendar, with the current date being selected.

    Declaration

    Swift

    @inlinable
    init()