gi-gtk4-4.0.12: Gtk 4.x bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.Calendar

Description

Displays a Gregorian calendar, one month at a time.

<picture> <source srcset="calendar-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkCalendar" src="calendar.png"> </picture>

A GtkCalendar can be created with calendarNew.

The selected date can be retrieved from a GtkCalendar using calendarGetDate. It can be altered with calendarSetDate.

To place a visual marker on a particular day, use calendarMarkDay and to remove the marker, calendarUnmarkDay. Alternative, all marks can be cleared with calendarClearMarks.

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.

Shortcuts and Gestures

GtkCalendar supports the following gestures:

  • Scrolling up or down will switch to the previous or next month.
  • Date strings can be dropped for setting the current day.

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.

Synopsis

Exported types

newtype Calendar Source #

Memory-managed wrapper type.

Constructors

Calendar (ManagedPtr Calendar) 

class (GObject o, IsDescendantOf Calendar o) => IsCalendar o Source #

Type class for types which can be safely cast to Calendar, for instance with toCalendar.

Instances

Instances details
(GObject o, IsDescendantOf Calendar o) => IsCalendar o Source # 
Instance details

Defined in GI.Gtk.Objects.Calendar

toCalendar :: (MonadIO m, IsCalendar o) => o -> m Calendar Source #

Cast to Calendar, for types for which this is known to be safe. For general casts, use castTo.

Methods

Click to display all available methods, including inherited ones

Expand

Methods

actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, announce, bindProperty, bindPropertyFull, childFocus, clearMarks, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, markDay, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, selectDay, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unmarkDay, unparent, unrealize, unref, unsetStateFlags, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateState, watchClosure.

Getters

getAccessibleId, getAccessibleParent, getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBounds, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDate, getDay, getDayIsMarked, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getMonth, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getShowDayNames, getShowHeading, getShowWeekNumbers, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, getYear.

Setters

setAccessibleParent, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDate, setDay, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setMonth, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setSensitive, setShowDayNames, setShowHeading, setShowWeekNumbers, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, setYear.

clearMarks

calendarClearMarks Source #

Arguments

:: (HasCallStack, MonadIO m, IsCalendar a) 
=> a

calendar: a GtkCalendar

-> m () 

Remove all visual markers.

getDate

calendarGetDate Source #

Arguments

:: (HasCallStack, MonadIO m, IsCalendar a) 
=> a

self: a GtkCalendar

-> m DateTime

Returns: the GDateTime representing the selected date

Returns a GDateTime representing the shown year, month and the selected day.

The returned date is in the local time zone.

getDay

calendarGetDay Source #

Arguments

:: (HasCallStack, MonadIO m, IsCalendar a) 
=> a

self: a GtkCalendar

-> m