component

package
v0.0.0-...-2873b17 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
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

type GridComponent struct {
	*ui.Grid
	// contains filtered or unexported fields
}

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 Text

type Text interface {
	Plain(string)
	Info(string)
	Warn(error)
}

Text represents a readonly text element.

type TextComponent

type TextComponent struct {
	*widgets.Paragraph
}

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)

Jump to

Keyboard shortcuts

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