gi-gtk-4.0.4: Gtk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gtk.Objects.Calendar

Description

Calendar is a widget that displays a Gregorian calendar, one month at a time. It can be created with calendarNew.

The date that is currently displayed can be altered with calendarSelectDay.

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.

The selected date can be retrieved from a Calendar using calendarGetDate.

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

plain code

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) 

Instances

Instances details
Eq Calendar Source # 
Instance details

Defined in GI.Gtk.Objects.Calendar

GObject Calendar Source # 
Instance details

Defined in GI.Gtk.Objects.Calendar

ManagedPtrNewtype Calendar Source # 
Instance details

Defined in GI.Gtk.Objects.Calendar

Methods

toManagedPtr :: Calendar -> ManagedPtr Calendar

TypedObject Calendar Source # 
Instance details

Defined in GI.Gtk.Objects.Calendar

Methods

glibType :: IO GType

HasParentTypes Calendar Source # 
Instance details

Defined in GI.Gtk.Objects.Calendar

IsGValue (Maybe Calendar) Source #

Convert Calendar to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.Calendar

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe Calendar -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe Calendar)

type ParentTypes Calendar Source # 
Instance details

Defined in GI.Gtk.Objects.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, bindProperty, bindPropertyFull, childFocus, clearMarks, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, 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, updateProperty, updateRelation, updateState, watchClosure.

Getters

getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getData, getDate, getDayIsMarked, getDirection, getDisplay, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, 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.

Setters

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

clearMarks

calendarClearMarks Source #

Arguments

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

calendar: a Calendar

-> m () 

Remove all visual markers.

getDate

calendarGetDate Source #

Arguments

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

self: a Calendar

-> m DateTime

Returns: the Date representing the shown date.

Returns a DateTime representing the shown year, month and the selected day, in the local time zone.

getDayIsMarked

calendarGetDayIsMarked Source #

Arguments

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

calendar: a Calendar

-> Word32

day: the day number between 1 and 31.

-> m Bool

Returns: whether the day is marked.

Returns if the day of the calendar is already marked.

getShowDayNames

calendarGetShowDayNames Source #

Arguments

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

self: a Calendar

-> m Bool

Returns: Whether the calendar shows day names.

Returns whether self is currently showing the names of the week days above the day numbers, i.e. the value of the Calendar:show-day-names property.

getShowHeading

calendarGetShowHeading Source #

Arguments

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

self: a Calendar

-> m Bool

Returns: Whether the calendar is showing a heading.

Returns whether self is currently showing the heading, i.e. the value of the Calendar:show-heading property.

getShowWeekNumbers

calendarGetShowWeekNumbers Source #

Arguments

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

self: a Calendar

-> m Bool

Returns: Whether the calendar is showing week numbers.

Returns whether self is showing week numbers right now, i.e. the value of the Calendar:show-week-numbers property.

markDay

calendarMarkDay Source #

Arguments

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

calendar: a Calendar

-> Word32

day: the day number to mark between 1 and 31.

-> m () 

Places a visual marker on a particular day.

new

calendarNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Calendar

Returns: a newly Calendar widget

Creates a new calendar, with the current date being selected.

selectDay

calendarSelectDay Source #

Arguments

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

self: a Calendar.

-> DateTime

date: a DateTime representing the day to select

-> m () 

Will switch to date's year and month and select its day.

setShowDayNames

calendarSetShowDayNames Source #

Arguments

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

self: a Calendar

-> Bool

value: Whether to show day names above the day numbers

-> m () 

Sets whether the calendar shows day names.

setShowHeading

calendarSetShowHeading Source #

Arguments

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

self: a Calendar

-> Bool

value: Whether to show the heading in the calendar

-> m () 

Sets whether the calendar should show a heading containing the current year and month as well as buttons for changing both.

setShowWeekNumbers

calendarSetShowWeekNumbers Source #

Arguments

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

self: a Calendar

-> Bool

value: whether to show week numbers on the left of the days

-> m () 

Sets whether week numbers are shown in the calendar.

unmarkDay

calendarUnmarkDay Source #

Arguments

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

calendar: a Calendar.

-> Word32

day: the day number to unmark between 1 and 31.

-> m () 

Removes the visual marker from a particular day.

Properties

day

The selected day (as a number between 1 and 31, or 0 to unselect the currently selected day). This property gets initially set to the current day.

constructCalendarDay :: (IsCalendar o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “day” property. This is rarely needed directly, but it is used by new.

getCalendarDay :: (MonadIO m, IsCalendar o) => o -> m Int32 Source #

Get the value of the “day” property. When overloading is enabled, this is equivalent to

get calendar #day

setCalendarDay :: (MonadIO m, IsCalendar o) => o -> Int32 -> m () Source #

Set the value of the “day” property. When overloading is enabled, this is equivalent to

set calendar [ #day := value ]

month

The selected month (as a number between 0 and 11). This property gets initially set to the current month.

constructCalendarMonth :: (IsCalendar o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “month” property. This is rarely needed directly, but it is used by new.

getCalendarMonth :: (MonadIO m, IsCalendar o) => o -> m Int32 Source #

Get the value of the “month” property. When overloading is enabled, this is equivalent to

get calendar #month

setCalendarMonth :: (MonadIO m, IsCalendar o) => o -> Int32 -> m () Source #

Set the value of the “month” property. When overloading is enabled, this is equivalent to

set calendar [ #month := value ]

showDayNames

Determines whether day names are displayed.

constructCalendarShowDayNames :: (IsCalendar o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “show-day-names” property. This is rarely needed directly, but it is used by new.

getCalendarShowDayNames :: (MonadIO m, IsCalendar o) => o -> m Bool Source #

Get the value of the “show-day-names” property. When overloading is enabled, this is equivalent to

get calendar #showDayNames

setCalendarShowDayNames :: (MonadIO m, IsCalendar o) => o -> Bool -> m () Source #

Set the value of the “show-day-names” property. When overloading is enabled, this is equivalent to

set calendar [ #showDayNames := value ]

showHeading

Determines whether a heading is displayed.

constructCalendarShowHeading :: (IsCalendar o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “show-heading” property. This is rarely needed directly, but it is used by new.

getCalendarShowHeading :: (MonadIO m, IsCalendar o) => o -> m Bool Source #

Get the value of the “show-heading” property. When overloading is enabled, this is equivalent to

get calendar #showHeading

setCalendarShowHeading :: (MonadIO m, IsCalendar o) => o -> Bool -> m () Source #

Set the value of the “show-heading” property. When overloading is enabled, this is equivalent to

set calendar [ #showHeading := value ]

showWeekNumbers

Determines whether week numbers are displayed.

constructCalendarShowWeekNumbers :: (IsCalendar o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “show-week-numbers” property. This is rarely needed directly, but it is used by new.

getCalendarShowWeekNumbers :: (MonadIO m, IsCalendar o) => o -> m Bool Source #

Get the value of the “show-week-numbers” property. When overloading is enabled, this is equivalent to

get calendar #showWeekNumbers

setCalendarShowWeekNumbers :: (MonadIO m, IsCalendar o) => o -> Bool -> m () Source #

Set the value of the “show-week-numbers” property. When overloading is enabled, this is equivalent to

set calendar [ #showWeekNumbers := value ]

year

The selected year. This property gets initially set to the current year.

constructCalendarYear :: (IsCalendar o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “year” property. This is rarely needed directly, but it is used by new.

getCalendarYear :: (MonadIO m, IsCalendar o) => o -> m Int32 Source #

Get the value of the “year” property. When overloading is enabled, this is equivalent to

get calendar #year

setCalendarYear :: (MonadIO m, IsCalendar o) => o -> Int32 -> m () Source #

Set the value of the “year” property. When overloading is enabled, this is equivalent to

set calendar [ #year := value ]

Signals

daySelected

type C_CalendarDaySelectedCallback = Ptr () -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type CalendarDaySelectedCallback = IO () Source #

Emitted when the user selects a day.

afterCalendarDaySelected :: (IsCalendar a, MonadIO m) => a -> CalendarDaySelectedCallback -> m SignalHandlerId Source #

Connect a signal handler for the daySelected signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after calendar #daySelected callback

onCalendarDaySelected :: (IsCalendar a, MonadIO m) => a -> CalendarDaySelectedCallback -> m SignalHandlerId Source #

Connect a signal handler for the daySelected signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on calendar #daySelected callback

nextMonth

type C_CalendarNextMonthCallback = Ptr () -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type CalendarNextMonthCallback = IO () Source #

Emitted when the user switched to the next month.

afterCalendarNextMonth :: (IsCalendar a, MonadIO m) => a -> CalendarNextMonthCallback -> m SignalHandlerId Source #

Connect a signal handler for the nextMonth signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after calendar #nextMonth callback

genClosure_CalendarNextMonth :: MonadIO m => CalendarNextMonthCallback -> m (GClosure C_CalendarNextMonthCallback) Source #

Wrap the callback into a GClosure.

onCalendarNextMonth :: (IsCalendar a, MonadIO m) => a -> CalendarNextMonthCallback -> m SignalHandlerId Source #

Connect a signal handler for the nextMonth signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on calendar #nextMonth callback

nextYear

type C_CalendarNextYearCallback = Ptr () -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type CalendarNextYearCallback = IO () Source #

Emitted when user switched to the next year.

afterCalendarNextYear :: (IsCalendar a, MonadIO m) => a -> CalendarNextYearCallback -> m SignalHandlerId Source #

Connect a signal handler for the nextYear signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after calendar #nextYear callback

genClosure_CalendarNextYear :: MonadIO m => CalendarNextYearCallback -> m (GClosure C_CalendarNextYearCallback) Source #

Wrap the callback into a GClosure.

onCalendarNextYear :: (IsCalendar a, MonadIO m) => a -> CalendarNextYearCallback -> m SignalHandlerId Source #

Connect a signal handler for the nextYear signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on calendar #nextYear callback

prevMonth

type C_CalendarPrevMonthCallback = Ptr () -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type CalendarPrevMonthCallback = IO () Source #

Emitted when the user switched to the previous month.

afterCalendarPrevMonth :: (IsCalendar a, MonadIO m) => a -> CalendarPrevMonthCallback -> m SignalHandlerId Source #

Connect a signal handler for the prevMonth signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after calendar #prevMonth callback

genClosure_CalendarPrevMonth :: MonadIO m => CalendarPrevMonthCallback -> m (GClosure C_CalendarPrevMonthCallback) Source #

Wrap the callback into a GClosure.

onCalendarPrevMonth :: (IsCalendar a, MonadIO m) => a -> CalendarPrevMonthCallback -> m SignalHandlerId Source #

Connect a signal handler for the prevMonth signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on calendar #prevMonth callback

prevYear

type C_CalendarPrevYearCallback = Ptr () -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type CalendarPrevYearCallback = IO () Source #

Emitted when user switched to the previous year.

afterCalendarPrevYear :: (IsCalendar a, MonadIO m) => a -> CalendarPrevYearCallback -> m SignalHandlerId Source #

Connect a signal handler for the prevYear signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after calendar #prevYear callback

genClosure_CalendarPrevYear :: MonadIO m => CalendarPrevYearCallback -> m (GClosure C_CalendarPrevYearCallback) Source #

Wrap the callback into a GClosure.

onCalendarPrevYear :: (IsCalendar a, MonadIO m) => a -> CalendarPrevYearCallback -> m SignalHandlerId Source #

Connect a signal handler for the prevYear signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on calendar #prevYear callback