| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
GI.Gtk.Objects.Calendar
Description
GtkCalendar is a widget that displays a Gregorian calendar, one month
at a time.

A GtkCalendar 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 GtkCalendar 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
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
- newtype Calendar = Calendar (ManagedPtr Calendar)
- class (GObject o, IsDescendantOf Calendar o) => IsCalendar o
- toCalendar :: (MonadIO m, IsCalendar o) => o -> m Calendar
- calendarClearMarks :: (HasCallStack, MonadIO m, IsCalendar a) => a -> m ()
- calendarGetDate :: (HasCallStack, MonadIO m, IsCalendar a) => a -> m DateTime
- calendarGetDayIsMarked :: (HasCallStack, MonadIO m, IsCalendar a) => a -> Word32 -> m Bool
- calendarGetShowDayNames :: (HasCallStack, MonadIO m, IsCalendar a) => a -> m Bool
- calendarGetShowHeading :: (HasCallStack, MonadIO m, IsCalendar a) => a -> m Bool
- calendarGetShowWeekNumbers :: (HasCallStack, MonadIO m, IsCalendar a) => a -> m Bool
- calendarMarkDay :: (HasCallStack, MonadIO m, IsCalendar a) => a -> Word32 -> m ()
- calendarNew :: (HasCallStack, MonadIO m) => m Calendar
- calendarSelectDay :: (HasCallStack, MonadIO m, IsCalendar a) => a -> DateTime -> m ()
- calendarSetShowDayNames :: (HasCallStack, MonadIO m, IsCalendar a) => a -> Bool -> m ()
- calendarSetShowHeading :: (HasCallStack, MonadIO m, IsCalendar a) => a -> Bool -> m ()
- calendarSetShowWeekNumbers :: (HasCallStack, MonadIO m, IsCalendar a) => a -> Bool -> m ()
- calendarUnmarkDay :: (HasCallStack, MonadIO m, IsCalendar a) => a -> Word32 -> m ()
- constructCalendarDay :: (IsCalendar o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getCalendarDay :: (MonadIO m, IsCalendar o) => o -> m Int32
- setCalendarDay :: (MonadIO m, IsCalendar o) => o -> Int32 -> m ()
- constructCalendarMonth :: (IsCalendar o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getCalendarMonth :: (MonadIO m, IsCalendar o) => o -> m Int32
- setCalendarMonth :: (MonadIO m, IsCalendar o) => o -> Int32 -> m ()
- constructCalendarShowDayNames :: (IsCalendar o, MonadIO m) => Bool -> m (GValueConstruct o)
- getCalendarShowDayNames :: (MonadIO m, IsCalendar o) => o -> m Bool
- setCalendarShowDayNames :: (MonadIO m, IsCalendar o) => o -> Bool -> m ()
- constructCalendarShowHeading :: (IsCalendar o, MonadIO m) => Bool -> m (GValueConstruct o)
- getCalendarShowHeading :: (MonadIO m, IsCalendar o) => o -> m Bool
- setCalendarShowHeading :: (MonadIO m, IsCalendar o) => o -> Bool -> m ()
- constructCalendarShowWeekNumbers :: (IsCalendar o, MonadIO m) => Bool -> m (GValueConstruct o)
- getCalendarShowWeekNumbers :: (MonadIO m, IsCalendar o) => o -> m Bool
- setCalendarShowWeekNumbers :: (MonadIO m, IsCalendar o) => o -> Bool -> m ()
- constructCalendarYear :: (IsCalendar o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getCalendarYear :: (MonadIO m, IsCalendar o) => o -> m Int32
- setCalendarYear :: (MonadIO m, IsCalendar o) => o -> Int32 -> m ()
- type CalendarDaySelectedCallback = IO ()
- afterCalendarDaySelected :: (IsCalendar a, MonadIO m) => a -> ((?self :: a) => CalendarDaySelectedCallback) -> m SignalHandlerId
- onCalendarDaySelected :: (IsCalendar a, MonadIO m) => a -> ((?self :: a) => CalendarDaySelectedCallback) -> m SignalHandlerId
- type CalendarNextMonthCallback = IO ()
- afterCalendarNextMonth :: (IsCalendar a, MonadIO m) => a -> ((?self :: a) => CalendarNextMonthCallback) -> m SignalHandlerId
- onCalendarNextMonth :: (IsCalendar a, MonadIO m) => a -> ((?self :: a) => CalendarNextMonthCallback) -> m SignalHandlerId
- type CalendarNextYearCallback = IO ()
- afterCalendarNextYear :: (IsCalendar a, MonadIO m) => a -> ((?self :: a) => CalendarNextYearCallback) -> m SignalHandlerId
- onCalendarNextYear :: (IsCalendar a, MonadIO m) => a -> ((?self :: a) => CalendarNextYearCallback) -> m SignalHandlerId
- type CalendarPrevMonthCallback = IO ()
- afterCalendarPrevMonth :: (IsCalendar a, MonadIO m) => a -> ((?self :: a) => CalendarPrevMonthCallback) -> m SignalHandlerId
- onCalendarPrevMonth :: (IsCalendar a, MonadIO m) => a -> ((?self :: a) => CalendarPrevMonthCallback) -> m SignalHandlerId
- type CalendarPrevYearCallback = IO ()
- afterCalendarPrevYear :: (IsCalendar a, MonadIO m) => a -> ((?self :: a) => CalendarPrevYearCallback) -> m SignalHandlerId
- onCalendarPrevYear :: (IsCalendar a, MonadIO m) => a -> ((?self :: a) => CalendarPrevYearCallback) -> m SignalHandlerId
Exported types
Memory-managed wrapper type.
Instances
| Eq Calendar Source # | |
| GObject Calendar Source # | |
Defined in GI.Gtk.Objects.Calendar | |
| ManagedPtrNewtype Calendar Source # | |
Defined in GI.Gtk.Objects.Calendar Methods toManagedPtr :: Calendar -> ManagedPtr Calendar | |
| TypedObject Calendar Source # | |
Defined in GI.Gtk.Objects.Calendar | |
| HasParentTypes Calendar Source # | |
Defined in GI.Gtk.Objects.Calendar | |
| IsGValue (Maybe Calendar) Source # | Convert |
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 # | |
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
| (GObject o, IsDescendantOf Calendar o) => IsCalendar o Source # | |
Defined in GI.Gtk.Objects.Calendar | |
toCalendar :: (MonadIO m, IsCalendar o) => o -> m Calendar Source #
Methods
Click to display all available methods, including inherited ones
Methods
actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, 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, updateProperty, updateRelation, updateState, watchClosure.
Getters
getAccessibleParent, getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBounds, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDate, getDayIsMarked, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, 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.
Setters
setAccessibleParent, 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
Arguments
| :: (HasCallStack, MonadIO m, IsCalendar a) | |
| => a |
|
| -> m () |
Remove all visual markers.
getDate
Arguments
| :: (HasCallStack, MonadIO m, IsCalendar a) | |
| => a |
|
| -> m DateTime | Returns: the |
Returns a GDateTime representing the shown
year, month and the selected day.
The returned date is in the local time zone.
getDayIsMarked
calendarGetDayIsMarked Source #
Arguments
| :: (HasCallStack, MonadIO m, IsCalendar a) | |
| => a |
|
| -> Word32 |
|
| -> 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 |
|
| -> m Bool | Returns: Whether the calendar shows day names. |
Returns whether self is currently showing the names
of the week days.
This is the value of the Calendar:showDayNames property.
getShowHeading
calendarGetShowHeading Source #
Arguments
| :: (HasCallStack, MonadIO m, IsCalendar a) | |
| => a |
|
| -> m Bool | Returns: Whether the calendar is showing a heading. |
Returns whether self is currently showing the heading.
This is the value of the Calendar:showHeading property.
getShowWeekNumbers
calendarGetShowWeekNumbers Source #
Arguments
| :: (HasCallStack, MonadIO m, IsCalendar a) | |
| => a |
|
| -> m Bool | Returns: Whether the calendar is showing week numbers. |
Returns whether self is showing week numbers right
now.
This is the value of the Calendar:showWeekNumbers property.
markDay
Arguments
| :: (HasCallStack, MonadIO m, IsCalendar a) | |
| => a |
|
| -> Word32 |
|
| -> m () |
Places a visual marker on a particular day of the current month.
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m Calendar | Returns: a newly |
Creates a new calendar, with the current date being selected.
selectDay
Arguments
| :: (HasCallStack, MonadIO m, IsCalendar a) | |
| => a |
|
| -> DateTime |
|
| -> m () |
Switches to date's year and month and select its day.
setShowDayNames
calendarSetShowDayNames Source #
Arguments
| :: (HasCallStack, MonadIO m, IsCalendar a) | |
| => a |
|
| -> Bool |
|
| -> m () |
Sets whether the calendar shows day names.
setShowHeading
calendarSetShowHeading Source #
Arguments
| :: (HasCallStack, MonadIO m, IsCalendar a) | |
| => a |
|
| -> Bool |
|
| -> m () |
Sets whether the calendar should show a heading.
The heading contains the current year and month as well as buttons for changing both.
setShowWeekNumbers
calendarSetShowWeekNumbers Source #
Arguments
| :: (HasCallStack, MonadIO m, IsCalendar a) | |
| => a |
|
| -> Bool |
|
| -> m () |
Sets whether week numbers are shown in the calendar.
unmarkDay
Arguments
| :: (HasCallStack, MonadIO m, IsCalendar a) | |
| => a |
|
| -> Word32 |
|
| -> m () |
Removes the visual marker from a particular day.
Properties
day
The selected day (as a number between 1 and 31).
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
setcalendar [ #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
setcalendar [ #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
setcalendar [ #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
setcalendar [ #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
setcalendar [ #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
setcalendar [ #year:=value ]
Signals
daySelected
type CalendarDaySelectedCallback = IO () Source #
Emitted when the user selects a day.
afterCalendarDaySelected :: (IsCalendar a, MonadIO m) => a -> ((?self :: 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
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onCalendarDaySelected :: (IsCalendar a, MonadIO m) => a -> ((?self :: 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 CalendarNextMonthCallback = IO () Source #
Emitted when the user switched to the next month.
afterCalendarNextMonth :: (IsCalendar a, MonadIO m) => a -> ((?self :: 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
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onCalendarNextMonth :: (IsCalendar a, MonadIO m) => a -> ((?self :: 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 CalendarNextYearCallback = IO () Source #
Emitted when user switched to the next year.
afterCalendarNextYear :: (IsCalendar a, MonadIO m) => a -> ((?self :: 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
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onCalendarNextYear :: (IsCalendar a, MonadIO m) => a -> ((?self :: 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 CalendarPrevMonthCallback = IO () Source #
Emitted when the user switched to the previous month.
afterCalendarPrevMonth :: (IsCalendar a, MonadIO m) => a -> ((?self :: 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
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onCalendarPrevMonth :: (IsCalendar a, MonadIO m) => a -> ((?self :: 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 CalendarPrevYearCallback = IO () Source #
Emitted when user switched to the previous year.
afterCalendarPrevYear :: (IsCalendar a, MonadIO m) => a -> ((?self :: 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
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onCalendarPrevYear :: (IsCalendar a, MonadIO m) => a -> ((?self :: 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