Documentation
¶
Index ¶
- type ActiveView
- type BacklogViewParams
- func (p *BacklogViewParams) ChangeZoomBy(percentage float64) error
- func (p *BacklogViewParams) DurationOfHeight(rows int) time.Duration
- func (p *BacklogViewParams) GetScrollOffset() int
- func (p *BacklogViewParams) GetZoomPercentage() float64
- func (p *BacklogViewParams) HeightOfDuration(dur time.Duration) float64
- func (p *BacklogViewParams) SetScrollOffset(offset int)
- func (p *BacklogViewParams) SetZoom(percentage float64) error
- type BasePane
- type BoxRepresentation
- type CR
- type ConstrainedRenderer
- type CursorLocation
- type CursorLocationRequestHandler
- type CursorWrangler
- type EventBoxPart
- type EventsPanePositionInfo
- type LeafPane
- func (p *LeafPane) ApplyModalOverlay(overlay input.SimpleInputProcessor) (index uint)
- func (p *LeafPane) CapturesInput() bool
- func (p *LeafPane) Dimensions() (x, y, w, h int)
- func (p *LeafPane) Draw()
- func (p *LeafPane) FocusNext()
- func (p *LeafPane) FocusPrev()
- func (p *LeafPane) Focusses() string
- func (p *LeafPane) GetHelp() input.Help
- func (p *LeafPane) HasFocus() bool
- func (p *LeafPane) PopModalOverlay() error
- func (p *LeafPane) PopModalOverlays(index uint)
- func (p *LeafPane) ProcessInput(key input.Key) bool
- func (p *LeafPane) Undraw()
- type MouseCursorPos
- type NoPanePositionInfo
- type Pane
- type PaneQuerier
- type PaneType
- type PositionInfo
- type RenderOrchestratorControl
- type Renderer
- type RendererWithOrchestratorControl
- type SingleDayViewParams
- func (p *SingleDayViewParams) ChangeZoomBy(percentage float64) error
- func (p *SingleDayViewParams) DurationOfHeight(rows int) time.Duration
- func (p *SingleDayViewParams) GetScrollOffset() int
- func (p *SingleDayViewParams) GetZoomPercentage() float64
- func (p *SingleDayViewParams) HeightOfDuration(dur time.Duration) float64
- func (p *SingleDayViewParams) SetZoom(percentage float64) error
- func (p *SingleDayViewParams) TimeAtY(y int) model.Timestamp
- func (p *SingleDayViewParams) YForTime(time model.Timestamp) int
- type StatusPanePositionInfo
- type TasksPanePositionInfo
- type TextCursorController
- type TimeViewParams
- type TimelinePanePositionInfo
- type TimespanViewParams
- type ToolsPanePositionInfo
- type ViewParams
- type WeatherPanePositionInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveView ¶
type ActiveView int
ActiveView is the active view of the UI, which could be a single day, a week or a full month (or in the future any other stretch of time that's to be shown).
const ( // ViewDay represents the view in which a single day is visible. ViewDay ActiveView // ViewWeek represents the view in which a full week (Monday to Sunday) is // visible. ViewWeek // ViewMonth represents the view in which a full month (first to last) is // visible. ViewMonth )
type BacklogViewParams ¶ added in v0.8.0
type BacklogViewParams struct {
// NRowsPerHour is the number of rows in the UI that represent an hour in the
// timeline.
NRowsPerHour *int
// ScrollOffset is the offset in rows by which the UI is scrolled.
// (An unscrolled UI would have 00:00 at the very top.)
ScrollOffset int
// contains filtered or unexported fields
}
BacklogViewParams represents the zoom and scroll of a timeline in the UI.
func (*BacklogViewParams) ChangeZoomBy ¶ added in v0.8.0
func (p *BacklogViewParams) ChangeZoomBy(percentage float64) error
func (*BacklogViewParams) DurationOfHeight ¶ added in v0.8.0
func (p *BacklogViewParams) DurationOfHeight(rows int) time.Duration
MinutesPerRow returns the number of minutes a single row represents.
func (*BacklogViewParams) GetScrollOffset ¶ added in v0.8.0
func (p *BacklogViewParams) GetScrollOffset() int
func (*BacklogViewParams) GetZoomPercentage ¶ added in v0.8.0
func (p *BacklogViewParams) GetZoomPercentage() float64
func (*BacklogViewParams) HeightOfDuration ¶ added in v0.8.0
func (p *BacklogViewParams) HeightOfDuration(dur time.Duration) float64
func (*BacklogViewParams) SetScrollOffset ¶ added in v0.8.0
func (p *BacklogViewParams) SetScrollOffset(offset int)
func (*BacklogViewParams) SetZoom ¶ added in v0.8.0
func (p *BacklogViewParams) SetZoom(percentage float64) error
type BasePane ¶ added in v0.8.0
type BasePane struct {
ID string
Parent PaneQuerier
Children []PaneQuerier
InputProcessor input.ModalInputProcessor
Visible func() bool
}
BasePane is the base data necessary for a UI pane and provides a base implementation using them.
Note that constructing this value that you need to assign the ID.
func (*BasePane) GetChild ¶ added in v0.10.0
func (p *BasePane) GetChild(pathToChild string) PaneQuerier
func (*BasePane) SetParent ¶ added in v0.8.0
func (p *BasePane) SetParent(parent PaneQuerier)
SetParent sets the pane's parent.
type BoxRepresentation ¶ added in v0.9.7
type BoxRepresentation[T any] struct { X int Y int W int H int Represents T Children []BoxRepresentation[T] }
func (*BoxRepresentation[T]) String ¶ added in v0.9.7
func (r *BoxRepresentation[T]) String() string
type CR ¶ added in v0.8.0
type CR struct {
// contains filtered or unexported fields
}
CR is a constrained renderer for a TUI. It only allows rendering using the underlying screen handler within the set dimension constraint.
Non-conforming rendering requests are corrected to be within the bounds.
func NewConstrainedRenderer ¶ added in v0.8.0
func NewConstrainedRenderer( renderer ConstrainedRenderer, constraint func() (x, y, w, h int), ) *CR
func (*CR) Dimensions ¶ added in v0.8.0
type ConstrainedRenderer ¶
type ConstrainedRenderer interface {
Renderer
// Dimensions returns the dimensions of the renderer.
Dimensions() (x, y, w, h int)
}
ConstrainedRenderer is a renderer that is assumed to be constrained to certain dimensions, i.E. it does not draw outside of them.
type CursorLocation ¶ added in v0.9.7
func (CursorLocation) String ¶ added in v0.9.7
func (l CursorLocation) String() string
type CursorLocationRequestHandler ¶ added in v0.9.7
type CursorLocationRequestHandler interface {
Put(l CursorLocation, requesterID string)
Delete(requesterID string)
}
CursorLocationRequestHandler is an interface for a type that can handle requests to place a (text/terminal) cursor on the screen.
type CursorWrangler ¶ added in v0.9.7
type CursorWrangler struct {
// contains filtered or unexported fields
}
CursorWrangler handles requests to place a (text/terminal) cursor on the screen.
func NewCursorWrangler ¶ added in v0.9.7
func NewCursorWrangler(controller TextCursorController) *CursorWrangler
NewCursorWrangler creates a new CursorWrangler.
func (*CursorWrangler) Delete ¶ added in v0.9.7
func (w *CursorWrangler) Delete(requesterID string)
Delete removes the cursor.
func (*CursorWrangler) Enact ¶ added in v0.9.7
func (w *CursorWrangler) Enact()
Enact enacts the current cursor location request via the underlying cursor controller.
func (*CursorWrangler) Put ¶ added in v0.9.7
func (w *CursorWrangler) Put(l CursorLocation, requesterID string)
Put places the cursor at the given location.
type EventBoxPart ¶
type EventBoxPart int
EventBoxPart describes the part of an event box (the visual representation of an event in the user interface). For example this could describe what part of an event the mouse is hovering over.
const ( // Nowhere. It's not part of the box. It's elsewhere. EventBoxNowhere EventBoxPart // In the bottom right corner of the box. EventBoxBottomRight // Along the top edge of the box. EventBoxTopEdge // Inside the box. Anywhere inside the box not described by the above. EventBoxInterior )
NOTE: add values, as they are needed.
func (EventBoxPart) ToString ¶
func (p EventBoxPart) ToString() string
ToString converts an an EventBoxPart to a string.
type EventsPanePositionInfo ¶
type EventsPanePositionInfo struct {
Event *model.Event
EventBoxPart EventBoxPart
Time time.Time
}
EventsPanePositionInfo provides information on a position in an EventsPane.
type LeafPane ¶ added in v0.8.0
type LeafPane struct {
BasePane
Renderer ConstrainedRenderer
Dims func() (x, y, w, h int)
Stylesheet styling.Stylesheet
}
LeafPane is a simple set of data and implementation of a "leaf pane", i.E. a pane that does not have subpanes but instead makes actual draw calls.
func (*LeafPane) ApplyModalOverlay ¶ added in v0.8.0
func (p *LeafPane) ApplyModalOverlay(overlay input.SimpleInputProcessor) (index uint)
ApplyModalOverlay applies an overlay to this processor. It returns the processors index, by which in the future, all overlays down to and including this overlay can be removed
func (*LeafPane) CapturesInput ¶ added in v0.8.0
CapturesInput returns whether this processor "captures" input, i.E. whether it ought to take priority in processing over other processors.
func (*LeafPane) Dimensions ¶ added in v0.8.0
func (*LeafPane) Draw ¶ added in v0.8.0
func (p *LeafPane) Draw()
Draw panics. It MUST be overridden if it is to be called.
func (*LeafPane) FocusNext ¶ added in v0.8.0
func (p *LeafPane) FocusNext()
FocusNext does nothing, as this implements a leaf, which does not focus anything.
func (*LeafPane) FocusPrev ¶ added in v0.8.0
func (p *LeafPane) FocusPrev()
FocusPrev does nothing, as this implements a leaf, which does not focus anything.
func (*LeafPane) Focusses ¶ added in v0.8.0
Focusses returns the empty string, an invalid identifier, as a leaf does not focus another pane.
func (*LeafPane) PopModalOverlay ¶ added in v0.8.0
PopModalOverlay removes the topmost overlay from this processor.
func (*LeafPane) PopModalOverlays ¶ added in v0.8.0
PopModalOverlays pops all overlays down to and including the one at the specified index.
func (*LeafPane) ProcessInput ¶ added in v0.8.0
ProcessInput attempts to process the provided input. Returns whether the provided input "applied", i.E. the processor performed an action based on the input. Defers to the panes' input processor.
type MouseCursorPos ¶
type MouseCursorPos struct {
X, Y int
}
MouseCursorPos represents the position of a mouse cursor on the UI's x-y-plane, which has its origin 0,0 in the top left.
type NoPanePositionInfo ¶ added in v0.8.0
type NoPanePositionInfo struct{}
NoPanePositionInfo is (no) information about no position. Comprende? (example: maybe pane that is none, has to return ~something~)
type Pane ¶
type Pane interface {
Draw()
Undraw()
IsVisible() bool
Dimensions() (x, y, w, h int)
GetPositionInfo(x, y int) PositionInfo
input.ModalInputProcessor
PaneQuerier
SetParent(PaneQuerier)
// NOTE: always an option to add/alter to focus{left,right,up,down} or similar
FocusNext()
FocusPrev()
}
Pane is a UI pane.
...
An InputProcessingPane can focus another InputProcessingPane, in fact one of any number of "child" InputProcessingPanes. Thus they can be structured as a tree and any node in this tree can be asked whether it HasFocus, and what it Focusses; generally, to answer wheter a pane HasFocus, it would probably consult it's parent whether the parent HasFocus and which pane it Focusses.
In this tree of panes, an InputProcessingPane's should generally have a parent, which can be set with SetParent; an exception would be the root pane of the tree.
type PaneQuerier ¶
type PaneQuerier interface {
HasFocus() bool
Focusses() string
IsVisible() bool
Identify() string
GetChild(string) PaneQuerier
}
PaneQuerier are the querying member functions of a pane.
E.g. letting a child access its parent, this allows limiting the childs access.
func PanesToPaneQueries ¶ added in v0.10.0
func PanesToPaneQueries(b []Pane) []PaneQuerier
type PaneType ¶
type PaneType int
PaneType is the type of the bottommost meaningful UI pane.
It's conceivable that panes could have sub-panes for convenience in rendering that aren't meaningfully different from the top pane or their individual purpose isn't relevant outside of the pane structure.
const ( // NoPane describes anything that is not on a meaningful UI Pane, perhaps in // padding space. NoPane PaneType // WeatherPaneType represents a pane displaying weather information. WeatherPaneType // TimelinePaneType represnets a timeline. TimelinePaneType // EventsPaneType represents an events pane. EventsPaneType // ToolsPaneType represents a tools pane. ToolsPaneType // TasksPaneType represents a tasks pane. TasksPaneType // StatusPaneType represents a status pane (or status bar). StatusPaneType // EditorPaneType represents an editor (popup/floating) pane. EditorPaneType // LogPaneType represents a log pane. LogPaneType // SummaryPaneType represents a summary pane. SummaryPaneType )
type PositionInfo ¶
type PositionInfo interface{}
PositionInfo describes a position in the user interface.
Retrievers should initially check for the type of pane they are receiving information on and can then retrieve the relevant additional information from whatever they got.
type RenderOrchestratorControl ¶
type RenderOrchestratorControl interface {
Clear()
Show()
}
RenderOrchestratorControl is the set of functions of a renderer (e.g., tcell.Screen) that the root pane needs to use to have full control over a render cycle. Other panes should not need this access to the renderer.
type Renderer ¶ added in v0.8.0
type Renderer interface {
// Draw a box of the indicated dimensions at the indicated location but
// limited to the constraint (bounding box) of the renderer.
// In the case that the box is not fully contained by the bounding box,
// it is truncated to fit and drawn at the corrected coordinates with the
// corrected dimensions.
DrawBox(x, y, w, h int, style styling.DrawStyling)
// Draw text within the box described by the given coordinates and dimensions,
// but limited to the constraint (bounding box) of the renderer.
// In the case that the box is not fully contained by the bounding box,
// it is truncated to fit and drawn at the corrected coordinates with the
// corrected dimensions.
DrawText(x, y, w, h int, style styling.DrawStyling, text string)
}
type RendererWithOrchestratorControl ¶ added in v0.10.0
type RendererWithOrchestratorControl interface {
ConstrainedRenderer
RenderOrchestratorControl
}
type SingleDayViewParams ¶ added in v0.8.0
type SingleDayViewParams struct {
// NRowsPerHour is the number of rows in the UI that represent an hour in the
// timeline.
NRowsPerHour int
// ScrollOffset is the offset in rows by which the UI is scrolled.
// (An unscrolled UI would have 00:00 at the very top.)
ScrollOffset int
}
SingleDayViewParams represents the zoom and scroll of a timeline in the UI.
func (*SingleDayViewParams) ChangeZoomBy ¶ added in v0.8.0
func (p *SingleDayViewParams) ChangeZoomBy(percentage float64) error
func (*SingleDayViewParams) DurationOfHeight ¶ added in v0.8.0
func (p *SingleDayViewParams) DurationOfHeight(rows int) time.Duration
MinutesPerRow returns the number of minutes a single row represents.
func (*SingleDayViewParams) GetScrollOffset ¶ added in v0.8.0
func (p *SingleDayViewParams) GetScrollOffset() int
func (*SingleDayViewParams) GetZoomPercentage ¶ added in v0.8.0
func (p *SingleDayViewParams) GetZoomPercentage() float64
func (*SingleDayViewParams) HeightOfDuration ¶ added in v0.8.0
func (p *SingleDayViewParams) HeightOfDuration(dur time.Duration) float64
func (*SingleDayViewParams) SetZoom ¶ added in v0.8.0
func (p *SingleDayViewParams) SetZoom(percentage float64) error
type StatusPanePositionInfo ¶
type StatusPanePositionInfo struct{}
StatusPanePositionInfo provides information on a position in a status pane.
type TasksPanePositionInfo ¶ added in v0.8.0
type TasksPanePositionInfo struct{}
TasksPanePositionInfo provides information on a position in a tasks pane.
type TextCursorController ¶
type TextCursorController interface {
HideCursor()
ShowCursor(CursorLocation)
}
TextCursorController offers control of a text cursor, such as for a terminal.
type TimeViewParams ¶ added in v0.8.0
type TimelinePanePositionInfo ¶
type TimelinePanePositionInfo struct{}
TimelinePanePositionInfo provides information on a position in a timeline pane.
type TimespanViewParams ¶ added in v0.8.0
type ToolsPanePositionInfo ¶
type ToolsPanePositionInfo struct {
Category *model.CategoryName
}
ToolsPanePositionInfo conveys information on a position in a tools pane, importantly the possible category displayed at that position.
type ViewParams ¶
type WeatherPanePositionInfo ¶
type WeatherPanePositionInfo struct{}
WeatherPanePositionInfo provides information on a position in a weather pane.