widgets

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventItemSelected

type EventItemSelected struct {
	// The name of the item
	Name string

	// The index of the item
	Index int

	tcell.EventTime
	// contains filtered or unexported fields
}

EventItemSelected represents an event on the item selected

func (*EventItemSelected) Widget

func (e *EventItemSelected) Widget() views.Widget

Widget returns a target widget of the event

type HighlightText

type HighlightText struct {
	views.WidgetWatchers
	// contains filtered or unexported fields
}

HighlightText is a text widget with highlighted keyword

func (*HighlightText) ActivateHighlight

func (t *HighlightText) ActivateHighlight(index int)

ActivateHighlight makes the highlighted keyword active (focused)

func (*HighlightText) AppendLine

func (t *HighlightText) AppendLine(line string)

AppendLine appends the line into the content

func (*HighlightText) ClearText

func (t *HighlightText) ClearText()

ClearText clears current content and highlights

func (*HighlightText) CurrentHighlight

func (t *HighlightText) CurrentHighlight() int

CurrentHighlight returns the index of the current highlight. It returns -1 if no highlights are active.

func (*HighlightText) Draw

func (t *HighlightText) Draw()

Draw draws the HighlightText.

func (*HighlightText) HandleEvent

func (t *HighlightText) HandleEvent(ev tcell.Event) bool

HandleEvent implements a tcell.EventHandler

func (*HighlightText) HighlightCount

func (t *HighlightText) HighlightCount() int

HighlightCount returns the count of the highlighted keywords

func (*HighlightText) HighlightPos

func (t *HighlightText) HighlightPos(index int) (int, int)

HighlightPos returns the position (x, y) of highlighted text in the content

func (*HighlightText) Keyword

func (t *HighlightText) Keyword() string

Keyword returns the current keyword in the content

func (*HighlightText) Resize

func (t *HighlightText) Resize()

Resize is called when the View changes sizes.

func (*HighlightText) SetKeyword

func (t *HighlightText) SetKeyword(keyword string)

SetKeyword sets the keyword to be highlighted in the content

func (*HighlightText) SetView

func (t *HighlightText) SetView(view views.View)

SetView sets the view for the HighlightText

func (*HighlightText) Size

func (t *HighlightText) Size() (int, int)

Size returns the width and height of the HighlightText

type InputLine

type InputLine struct {
	views.WidgetWatchers
	// contains filtered or unexported fields
}

InputLine is a single-line input widget

func NewInputLine

func NewInputLine() *InputLine

NewInputLine returns new InputLine

func (*InputLine) Draw

func (w *InputLine) Draw()

Draw draws the input with the cursor

func (*InputLine) HandleEvent

func (w *InputLine) HandleEvent(ev tcell.Event) bool

HandleEvent handles events on tcell

func (*InputLine) Resize

func (w *InputLine) Resize()

Resize is called when our View changes sizes.

func (*InputLine) SetCursorAt

func (w *InputLine) SetCursorAt(pos int)

SetCursorAt sets the pos of the cursor

func (*InputLine) SetPrompt

func (w *InputLine) SetPrompt(prompt string)

SetPrompt sets the prompt of the input

func (*InputLine) SetStyle

func (w *InputLine) SetStyle(style tcell.Style)

SetStyle sets the style of the input

func (*InputLine) SetValue

func (w *InputLine) SetValue(value string)

SetValue sets the value of the input

func (*InputLine) SetView

func (w *InputLine) SetView(view views.View)

SetView sets the view

func (*InputLine) Size

func (w *InputLine) Size() (int, int)

Size returns the width and height in vertical line.

func (*InputLine) Value

func (w *InputLine) Value() string

Value gets current value of the input

type ListView

type ListView struct {
	views.WidgetWatchers
	// contains filtered or unexported fields
}

ListView is a Widget with containing multiple items as a list

func NewListView

func NewListView() *ListView

NewListView returns a new ListView

func (*ListView) AddItem

func (w *ListView) AddItem(text string, style tcell.Style)

AddItem adds a new item with the text and its style. The text must be unique in the list view. It panics when the text is already exists in the list

func (*ListView) DeleteItem

func (w *ListView) DeleteItem(text string)

DeleteItem deletes a item with the text. It panics when the text does not exist in the list

func (*ListView) Draw

func (w *ListView) Draw()

Draw draws the ListView

func (*ListView) HandleEvent

func (w *ListView) HandleEvent(ev tcell.Event) bool

HandleEvent handles events on tcell

func (*ListView) ItemCount

func (w *ListView) ItemCount() int

ItemCount returns the count of the items.

func (*ListView) Resize

func (w *ListView) Resize()

Resize is called when our View changes sizes.

func (*ListView) SelectAt

func (w *ListView) SelectAt(index int)

SelectAt selects nth items by the index.

func (*ListView) SelectNext

func (w *ListView) SelectNext()

SelectNext selects next item of the current

func (*ListView) SelectPrev

func (w *ListView) SelectPrev()

SelectPrev selects previous item of the current

func (*ListView) SetStyle

func (w *ListView) SetStyle(text string, style tcell.Style)

SetStyle updates the style of the text. It panics when the text does not exist in the list.

func (*ListView) SetView

func (w *ListView) SetView(view views.View)

SetView sets the View object used for the list view

func (*ListView) Size

func (w *ListView) Size() (int, int)

Size returns the width and height in vertical line.

type Pager

type Pager struct {
	views.WidgetWatchers
	// contains filtered or unexported fields
}

Pager is a Widget with the text and its view port. It provides a scrollable view if the content size is larger than the actual view.

func NewPager

func NewPager() *Pager

NewPager returns a new Pager

func (*Pager) AppendLine

func (w *Pager) AppendLine(line string)

AppendLine adds the line into the pager

func (*Pager) ClearText

func (w *Pager) ClearText()

ClearText clears current content on the pager.

func (*Pager) Draw

func (w *Pager) Draw()

Draw draws the Pager

func (*Pager) FindNext

func (w *Pager) FindNext() bool

FindNext finds next keyword in the content. It returns true if the keyword found.

func (*Pager) FindPrev

func (w *Pager) FindPrev() bool

FindPrev finds previous keyword in the content. It returns true if the keyword found.

func (*Pager) GetScrollYPosition

func (w *Pager) GetScrollYPosition() float64

GetScrollYPosition returns vertical position of the scroll on the pager. Its range is 0.0 to 1.0.

func (*Pager) HandleEvent

func (w *Pager) HandleEvent(ev tcell.Event) bool

HandleEvent handles events on tcell.

func (*Pager) Keyword

func (w *Pager) Keyword() string

Keyword returns the current keyword in the content

func (*Pager) Resize

func (w *Pager) Resize()

Resize is called when our View changes sizes.

func (*Pager) ScrollDown

func (w *Pager) ScrollDown()

ScrollDown scrolls down by one line on the pager.

func (*Pager) ScrollHalfPageDown

func (w *Pager) ScrollHalfPageDown()

ScrollHalfPageDown scrolls down by half-height of the screen.

func (*Pager) ScrollHalfPageLeft

func (w *Pager) ScrollHalfPageLeft()

ScrollHalfPageLeft scrolls left by half-width of the screen

func (*Pager) ScrollHalfPageRight

func (w *Pager) ScrollHalfPageRight()

ScrollHalfPageRight scrolls right by half-width of the screen.

func (*Pager) ScrollHalfPageUp

func (w *Pager) ScrollHalfPageUp()

ScrollHalfPageUp scrolls up by half-height of the screen.

func (*Pager) ScrollPageDown

func (w *Pager) ScrollPageDown()

ScrollPageDown scrolls down by the height of the screen.

func (*Pager) ScrollPageUp

func (w *Pager) ScrollPageUp()

ScrollPageUp scrolls up by the height of the screen.

func (*Pager) ScrollToBottom

func (w *Pager) ScrollToBottom()

ScrollToBottom scrolls to the bottom of the content.

func (*Pager) ScrollToTop

func (w *Pager) ScrollToTop()

ScrollToTop scrolls to the top of the content

func (*Pager) ScrollUp

func (w *Pager) ScrollUp()

ScrollUp scrolls up by one line on the pager

func (*Pager) SetKeyword

func (w *Pager) SetKeyword(keyword string)

SetKeyword sets the keyword to be highlighted in the pager

func (*Pager) SetView

func (w *Pager) SetView(view views.View)

SetView sets the View object used for the pager

func (*Pager) Size

func (w *Pager) Size() (int, int)

Size returns the width and height in vertical line.

type Tabs

type Tabs struct {
	views.BoxLayout
	views.WidgetWatchers
	// contains filtered or unexported fields
}

Tabs is a View with multiple items in single line.

func NewTabs

func NewTabs() *Tabs

NewTabs returns a new Tabs.

func (*Tabs) AddTab

func (w *Tabs) AddTab(name string)

AddTab adds a new item with the name.

func (*Tabs) Clear

func (w *Tabs) Clear()

Clear clears current tabs.

func (*Tabs) SelectAt

func (w *Tabs) SelectAt(index int)

SelectAt selects the tab of the index in items.

func (*Tabs) SelectNext

func (w *Tabs) SelectNext()

SelectNext selects next tab of the current

func (*Tabs) SelectPrev

func (w *Tabs) SelectPrev()

SelectPrev selects previous tab of the current

func (*Tabs) TabCount

func (w *Tabs) TabCount() int

TabCount returns the count of the tabs.

type VerticalLine

type VerticalLine struct {
	views.WidgetWatchers
	// contains filtered or unexported fields
}

VerticalLine is a Widget with containing a vertical line.

func NewVerticalLine

func NewVerticalLine(char rune, style tcell.Style) *VerticalLine

NewVerticalLine creates a new VerticalLine

func (*VerticalLine) Draw

func (w *VerticalLine) Draw()

Draw draws the VerticalLine

func (*VerticalLine) HandleEvent

func (w *VerticalLine) HandleEvent(ev tcell.Event) bool

HandleEvent handles events on tcell

func (*VerticalLine) Resize

func (w *VerticalLine) Resize()

Resize is called when our View changes sizes.

func (*VerticalLine) SetView

func (w *VerticalLine) SetView(view views.View)

SetView sets the View object used for the vertical line

func (*VerticalLine) Size

func (w *VerticalLine) Size() (int, int)

Size returns the width and height in vertical line, which always (1, 1).

Jump to

Keyboard shortcuts

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