Documentation ¶
Index ¶
- Constants
- type Component
- type DummyComponent
- type GridComponent
- type InteractiveComponent
- type TaskList
- type TaskListComponent
- func (l *TaskListComponent) GetSelectedTask() (*model.Task, bool)
- func (l *TaskListComponent) HandleEvent(e ui.Event) error
- func (l *TaskListComponent) IsActivated() bool
- func (l *TaskListComponent) ParentID() int64
- func (l *TaskListComponent) SetActivate(yes bool)
- func (l *TaskListComponent) SetEventHandler(handle func(TaskListEvent))
- func (l *TaskListComponent) SetParentID(parentID int64)
- func (l *TaskListComponent) Update() error
- func (l *TaskListComponent) UpdateTasks(tasks []*model.Task)
- type TaskListEvent
- type TaskListEventType
- type Text
- type TextComponent
Constants ¶
const DefaultActivated = "DEFAULT_ACTIVATED"
DefaultActivated is a special key used in the keymap while creating GridComponent to make a Component activated by default.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component interface {
// contains filtered or unexported methods
}
Component contains interfaces every Component should implement.
type DummyComponent ¶
type DummyComponent struct{}
DummyComponent is a Component that does nothing.
func (DummyComponent) HandleEvent ¶
func (DummyComponent) HandleEvent(ui.Event) error
func (DummyComponent) IsActivated ¶
func (DummyComponent) IsActivated() bool
func (DummyComponent) SetActivate ¶
func (DummyComponent) SetActivate(bool)
func (DummyComponent) Update ¶
func (DummyComponent) Update() error
type GridComponent ¶
func NewGridComponent ¶
func NewGridComponent(keyMap map[string]InteractiveComponent, items ...ui.GridItem) *GridComponent
NewGridComponent creates a GridComponent.
func (*GridComponent) HandleEvent ¶
func (g *GridComponent) HandleEvent(e ui.Event) error
HandleEvent handles Component activation.
type InteractiveComponent ¶
type InteractiveComponent interface { Component // contains filtered or unexported methods }
InteractiveComponent is a component that interacts to user input.
type TaskList ¶
type TaskList interface { InteractiveComponent ParentID() int64 SetParentID(parentID int64) UpdateTasks(tasks []*model.Task) GetSelectedTask() (*model.Task, bool) SetEventHandler(func(TaskListEvent)) }
TaskList represents a list of tasks.
type TaskListComponent ¶
type TaskListComponent struct { *widgets.List use.CasesTask // contains filtered or unexported fields }
TaskListComponent displays a list of tasks.
func NewListComponent ¶
func NewListComponent(title string) *TaskListComponent
NewListComponent creates a TaskListComponent with given title.
func (*TaskListComponent) GetSelectedTask ¶
func (l *TaskListComponent) GetSelectedTask() (*model.Task, bool)
func (*TaskListComponent) HandleEvent ¶
func (l *TaskListComponent) HandleEvent(e ui.Event) error
HandleEvent handles keyboard events.
func (*TaskListComponent) IsActivated ¶
func (l *TaskListComponent) IsActivated() bool
func (*TaskListComponent) ParentID ¶
func (l *TaskListComponent) ParentID() int64
ParentID returns the ParentID of all tasks within the List.
func (*TaskListComponent) SetActivate ¶
func (l *TaskListComponent) SetActivate(yes bool)
SetActivate highlights selected row.
func (*TaskListComponent) SetEventHandler ¶
func (l *TaskListComponent) SetEventHandler(handle func(TaskListEvent))
func (*TaskListComponent) SetParentID ¶
func (l *TaskListComponent) SetParentID(parentID int64)
SetParentID sets the parentID of this list.
func (*TaskListComponent) Update ¶
func (l *TaskListComponent) Update() error
func (*TaskListComponent) UpdateTasks ¶
func (l *TaskListComponent) UpdateTasks(tasks []*model.Task)
UpdateTasks replaces tasks displayed with given slice.
type TaskListEvent ¶
type TaskListEvent struct { Type TaskListEventType Order uint64 }
type TaskListEventType ¶
type TaskListEventType int
const ( TaskListEventAfterUpdate TaskListEventType = iota EventChangeTaskState EventInsertTaskWithOrder )
type TextComponent ¶
func NewTextComponent ¶
func NewTextComponent(title string) *TextComponent
func (*TextComponent) Info ¶
func (t *TextComponent) Info(s string)
func (*TextComponent) Plain ¶
func (t *TextComponent) Plain(s string)
func (*TextComponent) Warn ¶
func (t *TextComponent) Warn(e error)