views

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeybindsWidth  = 48
	KeybindsHeight = 23

	LabelWidth = 12
	FieldWidth = 20

	PopupWidth  = LabelWidth + FieldWidth
	PopupHeight = 16

	TimeFormat = "2006-01-02 15:04"

	TimeViewWidth = 10

	TitleViewHeight = 3

	Padding = 1
)

Variables

View Source
var (
	MainViewWidthRatio = 0.8
	SideViewWidthRatio = 0.2
)
View Source
var WeekdayNames = []string{
	"Sunday",
	"Monday",
	"Tuesday",
	"Wednesday",
	"Thursday",
	"Friday",
	"Saturday",
}

Functions

This section is empty.

Types

type AppView

type AppView struct {
	*BaseView

	Database *database.Database
	Calendar *calendar.Calendar
}

func NewAppView

func NewAppView(g *gocui.Gui, db *database.Database) *AppView

func (*AppView) ChangeToNotepadView

func (av *AppView) ChangeToNotepadView(g *gocui.Gui) error

func (*AppView) ClearNotepadContent

func (av *AppView) ClearNotepadContent(g *gocui.Gui) error

func (*AppView) DeleteEvent

func (av *AppView) DeleteEvent(g *gocui.Gui)

func (*AppView) DeleteEvents

func (av *AppView) DeleteEvents(g *gocui.Gui)

func (*AppView) GetCursorY

func (av *AppView) GetCursorY() int

func (*AppView) GetHoveredOnView

func (av *AppView) GetHoveredOnView(g *gocui.Gui) View

func (*AppView) JumpToToday

func (av *AppView) JumpToToday()

func (*AppView) Layout

func (av *AppView) Layout(g *gocui.Gui) error

func (*AppView) ReturnToMainView

func (av *AppView) ReturnToMainView(g *gocui.Gui) error

func (*AppView) SaveNotepadContent

func (av *AppView) SaveNotepadContent(g *gocui.Gui) error

func (*AppView) ShowEditEventPopup

func (av *AppView) ShowEditEventPopup(g *gocui.Gui) error

func (*AppView) ShowKeybinds

func (av *AppView) ShowKeybinds(g *gocui.Gui) error

func (*AppView) ShowNewEventPopup

func (av *AppView) ShowNewEventPopup(g *gocui.Gui) error

func (*AppView) ShowOrHideSideView

func (av *AppView) ShowOrHideSideView(g *gocui.Gui) error

func (*AppView) Update

func (av *AppView) Update(g *gocui.Gui) error

func (*AppView) UpdateToNextDay

func (av *AppView) UpdateToNextDay(g *gocui.Gui)

func (*AppView) UpdateToNextTime

func (av *AppView) UpdateToNextTime(g *gocui.Gui)

func (*AppView) UpdateToNextWeek

func (av *AppView) UpdateToNextWeek()

func (*AppView) UpdateToPrevDay

func (av *AppView) UpdateToPrevDay(g *gocui.Gui)

func (*AppView) UpdateToPrevTime

func (av *AppView) UpdateToPrevTime(g *gocui.Gui)

func (*AppView) UpdateToPrevWeek

func (av *AppView) UpdateToPrevWeek()

type BaseView

type BaseView struct {
	Name       string
	X, Y, W, H int
	// contains filtered or unexported fields
}

func NewBaseView

func NewBaseView(name string) *BaseView

func (*BaseView) AddChild

func (bv *BaseView) AddChild(name string, child View) (View, bool)

func (*BaseView) Children

func (bv *BaseView) Children() *orderedmap.OrderedMap[string, View]

func (*BaseView) ClearChildren

func (bv *BaseView) ClearChildren(g *gocui.Gui) error

func (*BaseView) FindChildView

func (bv *BaseView) FindChildView(name string) (View, bool)

func (*BaseView) GetChild

func (bv *BaseView) GetChild(name string) (View, bool)

func (*BaseView) GetName

func (bv *BaseView) GetName() string

func (*BaseView) GetProperties

func (bv *BaseView) GetProperties() (int, int, int, int)

func (*BaseView) SetProperties

func (bv *BaseView) SetProperties(x, y, w, h int)

func (*BaseView) Update

func (bv *BaseView) Update(g *gocui.Gui) error

func (*BaseView) UpdateChildren

func (bv *BaseView) UpdateChildren(g *gocui.Gui) error

type DayView

type DayView struct {
	*BaseView

	Day      *calendar.Day
	TimeView *TimeView
}

func NewDayView

func NewDayView(name string, d *calendar.Day, tv *TimeView) *DayView

func (*DayView) IsOnEvent

func (dv *DayView) IsOnEvent(y int) (*EventView, bool)

func (*DayView) Update

func (dv *DayView) Update(g *gocui.Gui) error

type EventPopupView

type EventPopupView struct {
	*BaseView
	Form     *component.Form
	Calendar *calendar.Calendar
	Database *database.Database

	IsVisible bool
}

func NewEvenPopup

func NewEvenPopup(g *gocui.Gui, c *calendar.Calendar, db *database.Database) *EventPopupView

func (*EventPopupView) AddEvent

func (epv *EventPopupView) AddEvent(g *gocui.Gui, v *gocui.View) error

func (*EventPopupView) Close

func (epv *EventPopupView) Close(g *gocui.Gui, v *gocui.View) error

func (*EventPopupView) CreateEventFromInputs

func (epv *EventPopupView) CreateEventFromInputs() *calendar.Event

func (*EventPopupView) EditEvent

func (epv *EventPopupView) EditEvent(g *gocui.Gui, v *gocui.View, event *calendar.Event) error

func (*EventPopupView) EditEventForm

func (epv *EventPopupView) EditEventForm(g *gocui.Gui, title, name, time, location, duration, description string) *component.Form

func (*EventPopupView) NewEventForm

func (epv *EventPopupView) NewEventForm(g *gocui.Gui, title, name, time, location, duration, frequency, occurence, description string) *component.Form

func (*EventPopupView) ShowEditEventPopup

func (epv *EventPopupView) ShowEditEventPopup(g *gocui.Gui, eventView *EventView) error

func (*EventPopupView) ShowNewEventPopup

func (epv *EventPopupView) ShowNewEventPopup(g *gocui.Gui) error

func (*EventPopupView) Update

func (epv *EventPopupView) Update(g *gocui.Gui) error

type EventView

type EventView struct {
	*BaseView

	Event *calendar.Event
}

func NewEvenView

func NewEvenView(name string, e *calendar.Event) *EventView

func (*EventView) Update

func (ev *EventView) Update(g *gocui.Gui) error

type HoverView

type HoverView struct {
	*BaseView

	Calendar    *calendar.Calendar
	CurrentView View
}

func NewHoverView

func NewHoverView(c *calendar.Calendar) *HoverView

func (*HoverView) Update

func (hv *HoverView) Update(g *gocui.Gui) error

type KeybindsView

type KeybindsView struct {
	*BaseView
	IsVisible bool
}

func NewKeybindsView

func NewKeybindsView() *KeybindsView

func (*KeybindsView) Update

func (kbv *KeybindsView) Update(g *gocui.Gui) error

type MainView

type MainView struct {
	*BaseView

	Calendar *calendar.Calendar
}

func NewMainView

func NewMainView(c *calendar.Calendar) *MainView

func (*MainView) Update

func (mv *MainView) Update(g *gocui.Gui) error

type NotepadView

type NotepadView struct {
	*BaseView

	Database *database.Database
	IsActive bool
	// contains filtered or unexported fields
}

func NewNotepadView

func NewNotepadView(c *calendar.Calendar, db *database.Database) *NotepadView

func (*NotepadView) ClearContent

func (npv *NotepadView) ClearContent(g *gocui.Gui) error

func (*NotepadView) SaveContent

func (npv *NotepadView) SaveContent(g *gocui.Gui) error

func (*NotepadView) Update

func (npv *NotepadView) Update(g *gocui.Gui) error

type SideView

type SideView struct {
	*BaseView

	Calendar *calendar.Calendar
}

func NewSideView

func NewSideView(c *calendar.Calendar, db *database.Database) *SideView

func (*SideView) Update

func (sv *SideView) Update(g *gocui.Gui) error

type TimeView

type TimeView struct {
	*BaseView
	Body   string
	Cursor int
}

func NewTimeView

func NewTimeView() *TimeView

func (*TimeView) SetCursor

func (tv *TimeView) SetCursor(y int)

func (*TimeView) Update

func (tv *TimeView) Update(g *gocui.Gui) error

type TitleView

type TitleView struct {
	*BaseView

	Calendar *calendar.Calendar
}

func NewTitleView

func NewTitleView(c *calendar.Calendar) *TitleView

func (*TitleView) Update

func (tv *TitleView) Update(g *gocui.Gui) error

type View

type View interface {
	Update(g *gocui.Gui) error
	SetProperties(x, y, w, h int)
	GetName() string
	GetProperties() (int, int, int, int)
	AddChild(name string, child View) (View, bool)
	GetChild(name string) (View, bool)
	ClearChildren(g *gocui.Gui) error
	Children() *orderedmap.OrderedMap[string, View]
	FindChildView(name string) (View, bool)
}

type WeekView

type WeekView struct {
	*BaseView

	Calendar *calendar.Calendar

	TimeView *TimeView
}

func NewWeekView

func NewWeekView(c *calendar.Calendar, tv *TimeView) *WeekView

func (*WeekView) Update

func (wv *WeekView) Update(g *gocui.Gui) error

Jump to

Keyboard shortcuts

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