calendar

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2026 License: LGPL-2.1 Imports: 9 Imported by: 0

Documentation

Overview

Package calendar provides Calendar — a text-mode month grid with keyboard / mouse date selection, and CalendarDialog — a modal "pick a date" wrapper.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShowDialog

func ShowDialog(host *views.Group, initial time.Time, title string) (time.Time, bool)

ShowDialog runs a date picker dialog and returns the chosen date, or zero time if cancelled.

Types

type Calendar

type Calendar struct {
	views.Base

	Selected time.Time
	View     time.Time // first of the visible month

	HeaderColor uint16
	WeekColor   uint16
	DayColor    uint16
	FocusColor  uint16
	OtherMonth  uint16
}

Calendar paints one month with a focused date.

func New

func New(bounds geom.Rect) *Calendar

New constructs a Calendar focused on today.

func (*Calendar) Draw

func (c *Calendar) Draw()

Draw paints title row, weekday header, and the day grid.

func (*Calendar) GetTypeID

func (c *Calendar) GetTypeID() string

GetTypeID for serial registry.

func (*Calendar) HandleEvent

func (c *Calendar) HandleEvent(ev *drivers.Event)

HandleEvent: arrows / pageup-down / Home / End for navigation, plus click-to-pick on any cell of the day grid.

func (*Calendar) Move

func (c *Calendar) Move(deltaDays int)

Move adds delta days to Selected.

func (*Calendar) MoveMonth

func (c *Calendar) MoveMonth(m int)

MoveMonth shifts the calendar by m months without changing the day.

func (*Calendar) SetDate

func (c *Calendar) SetDate(d time.Time)

SetDate moves the selected date and shifts the visible month if needed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL