termboxUtil

package module
v0.0.0-...-dc6d695 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

README

termbox-util

Utility Library for Termbox

Documentation

Index

Constants

View Source
const (
	// AlignLeft Aligns text to the left
	AlignLeft = iota
	// AlignCenter Aligns text to the center
	AlignCenter
	// AlignRight Aligns text to the right
	AlignRight
)

Variables

This section is empty.

Functions

func AlignText

func AlignText(txt string, width int, align TextAlignment) string

AlignText Aligns the text txt within width characters using the specified alignment

func AlignTextWithFill

func AlignTextWithFill(txt string, width int, align TextAlignment, fill rune) string

AlignTextWithFill Aligns the text txt within width characters using the specified alignment filling any spaces with the 'fill' character

func DrawBorder

func DrawBorder(x1, y1, x2, y2 int, fg, bg termbox.Attribute)

DrawBorder Draw a border around the area inside x1,y1 -> x2, y2

func DrawBorderWithPct

func DrawBorderWithPct(x1, y1, x2, y2 int, pct float64, fg, bg termbox.Attribute)

func DrawBorderWithTitle

func DrawBorderWithTitle(x1, y1, x2, y2 int, title string, fg, bg termbox.Attribute)

func DrawBorderWithTitleAndPct

func DrawBorderWithTitleAndPct(x1, y1, x2, y2 int, title string, pct float64, fg, bg termbox.Attribute)

func DrawStringAtPoint

func DrawStringAtPoint(str string, x int, y int, fg termbox.Attribute, bg termbox.Attribute) (int, int)

DrawStringAtPoint Draw a string of text at x, y with foreground color fg, background color bg

func FillWithChar

func FillWithChar(r rune, x1, y1, x2, y2 int, fg termbox.Attribute, bg termbox.Attribute)

FillWithChar Fills from x1,y1 through x2,y2 with the rune r, foreground color fg, background bg

func KeyIsAlpha

func KeyIsAlpha(event termbox.Event) bool

KeyIsAlpha Returns whether the termbox event is a alphabetic Key press

func KeyIsAlphaNumeric

func KeyIsAlphaNumeric(event termbox.Event) bool

KeyIsAlphaNumeric Returns whether the termbox event is an Alpha-Numeric Key Press

func KeyIsNumeric

func KeyIsNumeric(event termbox.Event) bool

KeyIsNumeric Returns whether the termbox event is a numeric Key press

func KeyIsSymbol

func KeyIsSymbol(event termbox.Event) bool

KeyIsSymbol Returns whether the termbox event is a symbol Key press

Types

type ASCIIArt

type ASCIIArt struct {
	// contains filtered or unexported fields
}

ASCIIArt is a []string with more functions

func CreateASCIIArt

func CreateASCIIArt(c []string, x, y int, fg, bg termbox.Attribute) *ASCIIArt

CreateASCIIArt Create an ASCII art object from a string slice

func (*ASCIIArt) Align

func (i *ASCIIArt) Align(a TextAlignment, width int)

Align Align the Ascii art over width width with alignment a

func (*ASCIIArt) Draw

func (i *ASCIIArt) Draw()

Draw outputs the input field on the screen

func (*ASCIIArt) GetBgColor

func (i *ASCIIArt) GetBgColor() termbox.Attribute

GetBgColor returns the background color

func (*ASCIIArt) GetContents

func (i *ASCIIArt) GetContents() []string

GetContents returns the ascii art

func (*ASCIIArt) GetFgColor

func (i *ASCIIArt) GetFgColor() termbox.Attribute

GetFgColor returns the foreground color

func (*ASCIIArt) GetHeight

func (i *ASCIIArt) GetHeight() int

GetHeight Returns the number of strings in the contents slice

func (*ASCIIArt) GetID

func (i *ASCIIArt) GetID() string

GetID returns this control's ID

func (*ASCIIArt) GetWidth

func (i *ASCIIArt) GetWidth() int

GetWidth Returns the number of strings in the contents slice

func (*ASCIIArt) GetX

func (i *ASCIIArt) GetX() int

GetX Return the x position of the modal

func (*ASCIIArt) GetY

func (i *ASCIIArt) GetY() int

GetY Return the y position of the modal

func (*ASCIIArt) HandleEvent

func (i *ASCIIArt) HandleEvent(event termbox.Event) bool

HandleEvent accepts the termbox event and returns whether it was consumed

func (*ASCIIArt) IsActive

func (i *ASCIIArt) IsActive() bool

func (*ASCIIArt) IsBordered

func (i *ASCIIArt) IsBordered() bool

IsBordered returns whether this modal is bordered or not

func (*ASCIIArt) IsTabSkipped

func (i *ASCIIArt) IsTabSkipped() bool

IsTabSkipped returns whether this modal has it's tabskip flag set

func (*ASCIIArt) SetActive

func (i *ASCIIArt) SetActive(a bool)

func (*ASCIIArt) SetActiveBgColor

func (i *ASCIIArt) SetActiveBgColor(bg termbox.Attribute)

func (*ASCIIArt) SetActiveFgColor

func (i *ASCIIArt) SetActiveFgColor(fg termbox.Attribute)

func (*ASCIIArt) SetBgColor

func (i *ASCIIArt) SetBgColor(bg termbox.Attribute)

SetBgColor sets the current background color

func (*ASCIIArt) SetBordered

func (i *ASCIIArt) SetBordered(b bool)

SetBordered sets whether we render a border around the frame

func (*ASCIIArt) SetContentLine

func (i *ASCIIArt) SetContentLine(s string, idx int)

SetContentLine Sets a specific line of the contents to s

func (*ASCIIArt) SetContents

func (i *ASCIIArt) SetContents(c []string)

SetContents Sets the contents of i to c

func (*ASCIIArt) SetFgColor

func (i *ASCIIArt) SetFgColor(fg termbox.Attribute)

SetFgColor sets the foreground color

func (*ASCIIArt) SetHeight

func (i *ASCIIArt) SetHeight(h int)

SetHeight truncates lines from the bottom of the ascii art

func (*ASCIIArt) SetID

func (i *ASCIIArt) SetID(newID string)

SetID sets this control's ID

func (*ASCIIArt) SetTabSkip

func (i *ASCIIArt) SetTabSkip(b bool)

SetTabSkip sets the tabskip flag for this control

func (*ASCIIArt) SetWidth

func (i *ASCIIArt) SetWidth(w int)

SetWidth Sets all lines in the contents to width w

func (*ASCIIArt) SetX

func (i *ASCIIArt) SetX(x int)

SetX set the x position of the modal to x

func (*ASCIIArt) SetY

func (i *ASCIIArt) SetY(y int)

SetY Set the y position of the modal to y

type AlertModal

type AlertModal struct {
	// contains filtered or unexported fields
}

AlertModal is a modal with yes/no (or similar) buttons

func CreateAlertModal

func CreateAlertModal(title string, x, y, width, height int, fg, bg termbox.Attribute) *AlertModal

CreateAlertModal Creates a confirmation modal with the specified attributes

func (*AlertModal) Clear

func (i *AlertModal) Clear()

Clear clears all of the non-positional parameters of the modal

func (*AlertModal) Draw

func (i *AlertModal) Draw()

Draw draws the modal

func (*AlertModal) GetBackground

func (i *AlertModal) GetBackground() termbox.Attribute

GetBackground returns the current background color

func (*AlertModal) GetBgColor

func (i *AlertModal) GetBgColor() termbox.Attribute

GetBgColor returns the background color

func (*AlertModal) GetFgColor

func (i *AlertModal) GetFgColor() termbox.Attribute

GetFgColor returns the foreground color

func (*AlertModal) GetForeground

func (i *AlertModal) GetForeground() termbox.Attribute

GetForeground returns the current foreground color

func (*AlertModal) GetHeight

func (i *AlertModal) GetHeight() int

GetHeight returns the current height of the control

func (*AlertModal) GetID

func (i *AlertModal) GetID() string

GetID returns this control's ID

func (*AlertModal) GetText

func (i *AlertModal) GetText() string

GetText returns the current text of the modal

func (*AlertModal) GetTitle

func (i *AlertModal) GetTitle() string

GetTitle returns the current title of the modal

func (*AlertModal) GetWidth

func (i *AlertModal) GetWidth() int

GetWidth returns the current width of the control

func (*AlertModal) GetX

func (i *AlertModal) GetX() int

GetX returns the current x coordinate of the control

func (*AlertModal) GetY

func (i *AlertModal) GetY() int

GetY returns the current y coordinate of the control

func (*AlertModal) HandleEvent

func (i *AlertModal) HandleEvent(event termbox.Event) bool

HandleEvent handles the termbox event and returns whether it was consumed

func (*AlertModal) HelpIsShown

func (i *AlertModal) HelpIsShown() bool

HelpIsShown returns true or false if the help is displayed

func (*AlertModal) Hide

func (i *AlertModal) Hide()

Hide sets the visibility flag of the modal to false

func (*AlertModal) IsAccepted

func (i *AlertModal) IsAccepted() bool

IsAccepted returns whether the user accepted the modal

func (*AlertModal) IsActive

func (i *AlertModal) IsActive() bool

func (*AlertModal) IsBordered

func (i *AlertModal) IsBordered() bool

IsBordered returns whether this control is bordered or not

func (*AlertModal) IsDone

func (i *AlertModal) IsDone() bool

IsDone returns whether the user has answered the modal

func (*AlertModal) IsTabSkipped

func (i *AlertModal) IsTabSkipped() bool

IsTabSkipped returns whether this control has it's tabskip flag set

func (*AlertModal) SetActive

func (i *AlertModal) SetActive(a bool)

func (*AlertModal) SetActiveBgColor

func (i *AlertModal) SetActiveBgColor(bg termbox.Attribute)

func (*AlertModal) SetActiveFgColor

func (i *AlertModal) SetActiveFgColor(fg termbox.Attribute)

func (*AlertModal) SetBackground

func (i *AlertModal) SetBackground(bg termbox.Attribute)

SetBackground sets the background color to bg

func (*AlertModal) SetBgColor

func (i *AlertModal) SetBgColor(bg termbox.Attribute)

SetBgColor sets the current background color

func (*AlertModal) SetBordered

func (i *AlertModal) SetBordered(b bool)

SetBordered sets whether we render a border around the frame

func (*AlertModal) SetDone

func (i *AlertModal) SetDone(b bool)

SetDone sets whether the modal has completed it's purpose

func (*AlertModal) SetFgColor

func (i *AlertModal) SetFgColor(fg termbox.Attribute)

SetFgColor sets the foreground color

func (*AlertModal) SetForeground

func (i *AlertModal) SetForeground(fg termbox.Attribute)

SetForeground sets the current foreground color to fg

func (*AlertModal) SetHeight

func (i *AlertModal) SetHeight(height int)

SetHeight set the height of the control to height

func (*AlertModal) SetID

func (i *AlertModal) SetID(newID string)

SetID sets this control's ID

func (*AlertModal) SetTabSkip

func (i *AlertModal) SetTabSkip(b bool)

SetTabSkip sets the tabskip flag for this control

func (*AlertModal) SetText

func (i *AlertModal) SetText(s string)

SetText sets the text of the modal to s

func (*AlertModal) SetTitle

func (i *AlertModal) SetTitle(s string)

SetTitle sets the current title of the modal to s

func (*AlertModal) SetWidth

func (i *AlertModal) SetWidth(width int)

SetWidth sets the current control width to width

func (*AlertModal) SetX

func (i *AlertModal) SetX(x int)

SetX sets the current x coordinate of the control to x

func (*AlertModal) SetY

func (i *AlertModal) SetY(y int)

SetY sets the current y coordinate of the control to y

func (*AlertModal) Show

func (i *AlertModal) Show()

Show sets the visibility flag of the modal to true

func (*AlertModal) ShowHelp

func (i *AlertModal) ShowHelp(b bool)

ShowHelp sets whether or not to display the help text

type Button

type Button struct {
	// contains filtered or unexported fields
}

func CreateButton

func CreateButton(x, y, w, h int, fg, bg termbox.Attribute) *Button

func (*Button) Draw

func (c *Button) Draw()

func (*Button) GetBgColor

func (c *Button) GetBgColor() termbox.Attribute

func (*Button) GetFgColor

func (c *Button) GetFgColor() termbox.Attribute

func (*Button) GetHeight

func (c *Button) GetHeight() int

func (*Button) GetID

func (c *Button) GetID() string

func (*Button) GetWidth

func (c *Button) GetWidth() int

func (*Button) GetX

func (c *Button) GetX() int

func (*Button) GetY

func (c *Button) GetY() int

func (*Button) HandleEvent

func (c *Button) HandleEvent(e termbox.Event) bool

func (*Button) IsActive

func (c *Button) IsActive() bool

func (*Button) IsBordered

func (c *Button) IsBordered() bool

func (*Button) IsTabSkipped

func (c *Button) IsTabSkipped() bool

func (*Button) SetActive

func (c *Button) SetActive(a bool)

func (*Button) SetActiveBgColor

func (c *Button) SetActiveBgColor(bg termbox.Attribute)

func (*Button) SetActiveFgColor

func (c *Button) SetActiveFgColor(fg termbox.Attribute)

func (*Button) SetBgColor

func (c *Button) SetBgColor(bg termbox.Attribute)

func (*Button) SetBordered

func (c *Button) SetBordered(bordered bool)

func (*Button) SetFgColor

func (c *Button) SetFgColor(fg termbox.Attribute)

func (*Button) SetHeight

func (c *Button) SetHeight(h int)

func (*Button) SetID

func (c *Button) SetID(newID string)

func (*Button) SetTabSkip

func (c *Button) SetTabSkip(skip bool)

func (*Button) SetWidth

func (c *Button) SetWidth(w int)

func (*Button) SetX

func (c *Button) SetX(x int)

func (*Button) SetY

func (c *Button) SetY(y int)

type Checkbox

type Checkbox struct {
	// contains filtered or unexported fields
}

func CreateCheckbox

func CreateCheckbox(lbl string, x, y, w, h int, fg, bg termbox.Attribute) *Checkbox

func (*Checkbox) Draw

func (c *Checkbox) Draw()

func (*Checkbox) GetBgColor

func (c *Checkbox) GetBgColor() termbox.Attribute

GetBgColor returns the background color

func (*Checkbox) GetFgColor

func (c *Checkbox) GetFgColor() termbox.Attribute

GetFgColor returns the foreground color

func (*Checkbox) GetHeight

func (c *Checkbox) GetHeight() int

GetHeight returns the current height of the input field

func (*Checkbox) GetID

func (c *Checkbox) GetID() string

GetID returns this control's ID

func (*Checkbox) GetWidth

func (c *Checkbox) GetWidth() int

GetWidth returns the current width of the input field

func (*Checkbox) GetX

func (c *Checkbox) GetX() int

GetX returns the x position of the input field

func (*Checkbox) GetY

func (c *Checkbox) GetY() int

GetY returns the y position of the input field

func (*Checkbox) HandleEvent

func (c *Checkbox) HandleEvent(event termbox.Event) bool

HandleEvent accepts the termbox event and returns whether it was consumed

func (*Checkbox) IsActive

func (c *Checkbox) IsActive() bool

func (*Checkbox) IsBordered

func (c *Checkbox) IsBordered() bool

IsBordered returns true or false if this input field has a border

func (*Checkbox) IsTabSkipped

func (c *Checkbox) IsTabSkipped() bool

IsTabSkipped returns whether this modal has it's tabskip flag set

func (*Checkbox) SetActive

func (c *Checkbox) SetActive(a bool)

func (*Checkbox) SetActiveBgColor

func (c *Checkbox) SetActiveBgColor(bg termbox.Attribute)

func (*Checkbox) SetActiveFgColor

func (c *Checkbox) SetActiveFgColor(fg termbox.Attribute)

func (*Checkbox) SetBgColor

func (c *Checkbox) SetBgColor(bg termbox.Attribute)

SetBgColor sets the current background color

func (*Checkbox) SetBordered

func (c *Checkbox) SetBordered(b bool)

SetBordered sets whether we render a border around the input field

func (*Checkbox) SetFgColor

func (c *Checkbox) SetFgColor(fg termbox.Attribute)

SetFgColor sets the foreground color

func (*Checkbox) SetHeight

func (c *Checkbox) SetHeight(h int)

SetHeight sets the current height of the input field

func (*Checkbox) SetID

func (c *Checkbox) SetID(newID string)

SetID sets this control's ID

func (*Checkbox) SetTabSkip

func (c *Checkbox) SetTabSkip(b bool)

SetTabSkip sets the tabskip flag for this control

func (*Checkbox) SetTitle

func (c *Checkbox) SetTitle(title string)

func (*Checkbox) SetWidth

func (c *Checkbox) SetWidth(w int)

SetWidth sets the current width of the input field

func (*Checkbox) SetX

func (c *Checkbox) SetX(x int)

SetX sets the x position of the input field

func (*Checkbox) SetY

func (c *Checkbox) SetY(y int)

SetY sets the y position of the input field

type ConfirmModal

type ConfirmModal struct {
	// contains filtered or unexported fields
}

ConfirmModal is a modal with yes/no (or similar) buttons

func CreateConfirmModal

func CreateConfirmModal(title string, x, y, width, height int, fg, bg termbox.Attribute) *ConfirmModal

CreateConfirmModal Creates a confirmation modal with the specified attributes

func (*ConfirmModal) Clear

func (i *ConfirmModal) Clear()

Clear clears all of the non-positional parameters of the modal

func (*ConfirmModal) Draw

func (i *ConfirmModal) Draw()

Draw draws the modal

func (*ConfirmModal) GetBgColor

func (i *ConfirmModal) GetBgColor() termbox.Attribute

GetBgColor returns the background color

func (*ConfirmModal) GetFgColor

func (i *ConfirmModal) GetFgColor() termbox.Attribute

GetFgColor returns the foreground color

func (*ConfirmModal) GetHeight

func (i *ConfirmModal) GetHeight() int

GetHeight returns the current height of the modal

func (*ConfirmModal) GetID

func (i *ConfirmModal) GetID() string

GetID returns this control's ID

func (*ConfirmModal) GetText

func (i *ConfirmModal) GetText() string

GetText returns the current text of the modal

func (*ConfirmModal) GetTitle

func (i *ConfirmModal) GetTitle() string

GetTitle returns the current title of the modal

func (*ConfirmModal) GetWidth

func (i *ConfirmModal) GetWidth() int

GetWidth returns the current width of the modal

func (*ConfirmModal) GetX

func (i *ConfirmModal) GetX() int

GetX returns the current x coordinate of the modal

func (*ConfirmModal) GetY

func (i *ConfirmModal) GetY() int

GetY returns the current y coordinate of the modal

func (*ConfirmModal) HandleEvent

func (i *ConfirmModal) HandleEvent(event termbox.Event) bool

HandleEvent handles the termbox event and returns whether it was consumed

func (*ConfirmModal) HelpIsShown

func (i *ConfirmModal) HelpIsShown() bool

HelpIsShown returns true or false if the help is displayed

func (*ConfirmModal) Hide

func (i *ConfirmModal) Hide()

Hide sets the visibility flag of the modal to false

func (*ConfirmModal) IsAccepted

func (i *ConfirmModal) IsAccepted() bool

IsAccepted returns whether the user accepted the modal

func (*ConfirmModal) IsBordered

func (i *ConfirmModal) IsBordered() bool

IsBordered returns whether this modal is bordered or not

func (*ConfirmModal) IsDone

func (i *ConfirmModal) IsDone() bool

IsDone returns whether the user has answered the modal

func (*ConfirmModal) IsTabSkipped

func (i *ConfirmModal) IsTabSkipped() bool

IsTabSkipped returns whether this modal has it's tabskip flag set

func (*ConfirmModal) SetBgColor

func (i *ConfirmModal) SetBgColor(bg termbox.Attribute)

SetBgColor sets the current background color

func (*ConfirmModal) SetBordered

func (i *ConfirmModal) SetBordered(b bool)

SetBordered sets whether we render a border around the frame

func (*ConfirmModal) SetDone

func (i *ConfirmModal) SetDone(b bool)

SetDone sets whether the modal has completed it's purpose

func (*ConfirmModal) SetFgColor

func (i *ConfirmModal) SetFgColor(fg termbox.Attribute)

SetFgColor sets the foreground color

func (*ConfirmModal) SetHeight

func (i *ConfirmModal) SetHeight(height int)

SetHeight set the height of the modal to height

func (*ConfirmModal) SetID

func (i *ConfirmModal) SetID(newID string)

SetID sets this control's ID

func (*ConfirmModal) SetTabSkip

func (i *ConfirmModal) SetTabSkip(b bool)

SetTabSkip sets the tabskip flag for this control

func (*ConfirmModal) SetText

func (i *ConfirmModal) SetText(s string)

SetText sets the text of the modal to s

func (*ConfirmModal) SetTitle

func (i *ConfirmModal) SetTitle(s string)

SetTitle sets the current title of the modal to s

func (*ConfirmModal) SetWidth

func (i *ConfirmModal) SetWidth(width int)

SetWidth sets the current modal width to width

func (*ConfirmModal) SetX

func (i *ConfirmModal) SetX(x int)

SetX sets the current x coordinate of the modal to x

func (*ConfirmModal) SetY

func (i *ConfirmModal) SetY(y int)

SetY sets the current y coordinate of the modal to y

func (*ConfirmModal) Show

func (i *ConfirmModal) Show()

Show sets the visibility flag of the modal to true

func (*ConfirmModal) ShowHelp

func (i *ConfirmModal) ShowHelp(b bool)

ShowHelp sets whether or not to display the help text

type DropMenu

type DropMenu struct {
	// contains filtered or unexported fields
}

DropMenu is a title that, when active drops a menu down

func CreateDropMenu

func CreateDropMenu(title string, options []string, x, y, width, height int, fg, bg, cursorFg, cursorBg termbox.Attribute) *DropMenu

CreateDropMenu Creates a menu with the specified attributes

func (*DropMenu) Draw

func (c *DropMenu) Draw()

Draw draws the menu

func (*DropMenu) GetBgColor

func (c *DropMenu) GetBgColor() termbox.Attribute

GetBgColor returns the background color

func (*DropMenu) GetFgColor

func (c *DropMenu) GetFgColor() termbox.Attribute

GetFgColor returns the foreground color

func (*DropMenu) GetHeight

func (c *DropMenu) GetHeight() int

GetHeight returns the current height of the menu

func (*DropMenu) GetID

func (c *DropMenu) GetID() string

GetID returns this control's ID

func (*DropMenu) GetMenu

func (c *DropMenu) GetMenu() *Menu

GetMenu returns the menu for this dropmenu

func (*DropMenu) GetTitle

func (c *DropMenu) GetTitle() string

GetTitle returns the current title of the menu

func (*DropMenu) GetWidth

func (c *DropMenu) GetWidth() int

GetWidth returns the current width of the menu

func (*DropMenu) GetX

func (c *DropMenu) GetX() int

GetX returns the current x coordinate of the menu

func (*DropMenu) GetY

func (c *DropMenu) GetY() int

GetY returns the current y coordinate of the menu

func (*DropMenu) HandleEvent

func (c *DropMenu) HandleEvent(event termbox.Event) bool

HandleEvent handles the termbox event and returns whether it was consumed

func (*DropMenu) HideMenu

func (c *DropMenu) HideMenu()

HideMenu tells the menu to hide the options

func (*DropMenu) IsActive

func (c *DropMenu) IsActive() bool

func (*DropMenu) IsBordered

func (c *DropMenu) IsBordered() bool

IsBordered returns the bordered flag

func (*DropMenu) IsDone

func (c *DropMenu) IsDone() bool

IsDone returns whether the user has answered the modal

func (*DropMenu) IsTabSkipped

func (c *DropMenu) IsTabSkipped() bool

IsTabSkipped returns whether this modal has it's tabskip flag set

func (*DropMenu) SetActive

func (c *DropMenu) SetActive(a bool)

func (*DropMenu) SetActiveBgColor

func (c *DropMenu) SetActiveBgColor(bg termbox.Attribute)

func (*DropMenu) SetActiveFgColor

func (c *DropMenu) SetActiveFgColor(fg termbox.Attribute)

func (*DropMenu) SetBgColor

func (c *DropMenu) SetBgColor(bg termbox.Attribute)

SetBgColor sets the current background color

func (*DropMenu) SetBordered

func (c *DropMenu) SetBordered(b bool)

SetBordered sets the bordered flag

func (*DropMenu) SetDone

func (c *DropMenu) SetDone(b bool)

SetDone sets whether the modal has completed it's purpose

func (*DropMenu) SetFgColor

func (c *DropMenu) SetFgColor(fg termbox.Attribute)

SetFgColor sets the foreground color

func (*DropMenu) SetHeight

func (c *DropMenu) SetHeight(height int)

SetHeight set the height of the menu to height

func (*DropMenu) SetID

func (c *DropMenu) SetID(newID string)

SetID sets this control's ID

func (*DropMenu) SetTabSkip

func (c *DropMenu) SetTabSkip(b bool)

SetTabSkip sets the tabskip flag for this control

func (*DropMenu) SetTitle

func (c *DropMenu) SetTitle(s string)

SetTitle sets the current title of the menu to s

func (*DropMenu) SetWidth

func (c *DropMenu) SetWidth(width int)

SetWidth sets the current menu width to width

func (*DropMenu) SetX

func (c *DropMenu) SetX(x int)

SetX sets the current x coordinate of the menu to x

func (*DropMenu) SetY

func (c *DropMenu) SetY(y int)

SetY sets the current y coordinate of the menu to y

func (*DropMenu) ShowMenu

func (c *DropMenu) ShowMenu()

ShowMenu tells the menu to draw the options

type Frame

type Frame struct {
	// contains filtered or unexported fields
}

Frame is a frame for holding other elements It manages it's own x/y, tab index

func CreateFrame

func CreateFrame(x, y, w, h int, fg, bg termbox.Attribute) *Frame

CreateFrame creates a Frame at x, y that is w by h

func (*Frame) AddControl

func (c *Frame) AddControl(t termboxControl)

AddControl adds a control to the frame

func (*Frame) Draw

func (c *Frame) Draw()

Draw outputs the Scoll Frame on the screen

func (*Frame) DrawControl

func (c *Frame) DrawControl(t termboxControl)

DrawControl figures out the relative position of the control, sets it, draws it, then resets it.

func (*Frame) FindNextTabStop

func (c *Frame) FindNextTabStop() bool

FindNextTabStop finds the next control that can be tabbed to A return of true means it found a different one than we started on.

func (*Frame) GetActiveControl

func (c *Frame) GetActiveControl() termboxControl

GetActiveControl returns the control at tabIdx

func (*Frame) GetBgColor

func (c *Frame) GetBgColor() termbox.Attribute

GetBgColor returns the background color

func (*Frame) GetBottomY

func (c *Frame) GetBottomY() int

GetBottomY returns the y of the lowest control in the frame

func (*Frame) GetControl

func (c *Frame) GetControl(idx int) termboxControl

GetControl returns the control at index i

func (*Frame) GetControlCount

func (c *Frame) GetControlCount() int

GetControlCount returns the number of controls contained

func (*Frame) GetControls

func (c *Frame) GetControls() []termboxControl

GetControls returns a slice of all controls

func (*Frame) GetFgColor

func (c *Frame) GetFgColor() termbox.Attribute

GetFgColor returns the foreground color

func (*Frame) GetHeight

func (c *Frame) GetHeight() int

GetHeight returns the current height of the frame

func (*Frame) GetID

func (c *Frame) GetID() string

GetID returns this control's ID

func (*Frame) GetLastControl

func (c *Frame) GetLastControl() termboxControl

GetLastControl returns the last control contained

func (*Frame) GetWidth

func (c *Frame) GetWidth() int

GetWidth returns the current width of the frame

func (*Frame) GetX

func (c *Frame) GetX() int

GetX returns the x position of the frame

func (*Frame) GetY

func (c *Frame) GetY() int

GetY returns the y position of the frame

func (*Frame) HandleEvent

func (c *Frame) HandleEvent(event termbox.Event) bool

HandleEvent accepts the termbox event and returns whether it was consumed

func (*Frame) IsActive

func (c *Frame) IsActive() bool

func (*Frame) IsBordered

func (c *Frame) IsBordered() bool

IsBordered returns true or false if this frame has a border

func (*Frame) IsOnLastControl

func (c *Frame) IsOnLastControl() bool

IsOnLastControl returns true if the active control is the last control that isn't tab skippable.

func (*Frame) IsTabSkipped

func (c *Frame) IsTabSkipped() bool

IsTabSkipped returns whether this modal has it's tabskip flag set

func (*Frame) RemoveAllControls

func (c *Frame) RemoveAllControls()

RemoveAllControls clears the control slice

func (*Frame) ResetTabIndex

func (c *Frame) ResetTabIndex()

func (*Frame) SetActive

func (c *Frame) SetActive(a bool)

func (*Frame) SetActiveBgColor

func (c *Frame) SetActiveBgColor(bg termbox.Attribute)

func (*Frame) SetActiveFgColor

func (c *Frame) SetActiveFgColor(fg termbox.Attribute)

Setting color attributes on a frame trickles down to its controls

func (*Frame) SetBgColor

func (c *Frame) SetBgColor(bg termbox.Attribute)

SetBgColor sets the current background color

func (*Frame) SetBordered

func (c *Frame) SetBordered(b bool)

SetBordered sets whether we render a border around the frame

func (*Frame) SetFgColor

func (c *Frame) SetFgColor(fg termbox.Attribute)

SetFgColor sets the foreground color

func (*Frame) SetHeight

func (c *Frame) SetHeight(h int)

SetHeight sets the current height of the frame

func (*Frame) SetID

func (c *Frame) SetID(newID string)

SetID sets this control's ID

func (*Frame) SetStatus

func (c *Frame) SetStatus(status string)

func (*Frame) SetTabSkip

func (c *Frame) SetTabSkip(b bool)

SetTabSkip sets the tabskip flag for this control

func (*Frame) SetTitle

func (c *Frame) SetTitle(title string)

func (*Frame) SetWidth

func (c *Frame) SetWidth(w int)

SetWidth sets the current width of the frame

func (*Frame) SetX

func (c *Frame) SetX(x int)

SetX sets the x position of the frame

func (*Frame) SetY

func (c *Frame) SetY(y int)

SetY sets the y position of the frame

type InputField

type InputField struct {
	// contains filtered or unexported fields
}

InputField is a field for inputting text

func CreateInputField

func CreateInputField(x, y, w, h int, fg, bg termbox.Attribute) *InputField

CreateInputField creates an input field at x, y that is w by h

func ToInputField

func ToInputField(c termboxControl) (*InputField, error)

func (*InputField) DoesWrap

func (c *InputField) DoesWrap() bool

DoesWrap returns true or false if this input field wraps text

func (*InputField) Draw

func (c *InputField) Draw()

Draw outputs the input field on the screen

func (*InputField) GetBgColor

func (c *InputField) GetBgColor() termbox.Attribute

GetBgColor returns the background color

func (*InputField) GetCursorBg

func (c *InputField) GetCursorBg() termbox.Attribute

func (*InputField) GetCursorFg

func (c *InputField) GetCursorFg() termbox.Attribute

func (*InputField) GetFgColor

func (c *InputField) GetFgColor() termbox.Attribute

GetFgColor returns the foreground color

func (*InputField) GetHeight

func (c *InputField) GetHeight() int

GetHeight returns the current height of the input field

func (*InputField) GetID

func (c *InputField) GetID() string

GetID returns this control's ID

func (*InputField) GetValue

func (c *InputField) GetValue() string

GetValue gets the current text that is in the InputField

func (*InputField) GetWidth

func (c *InputField) GetWidth() int

GetWidth returns the current width of the input field

func (*InputField) GetX

func (c *InputField) GetX() int

GetX returns the x position of the input field

func (*InputField) GetY

func (c *InputField) GetY() int

GetY returns the y position of the input field

func (*InputField) HandleEvent

func (c *InputField) HandleEvent(event termbox.Event) bool

HandleEvent accepts the termbox event and returns whether it was consumed

func (*InputField) InputFieldNumberFilter

func (c *InputField) InputFieldNumberFilter(fld *InputField, o, n string) string

Some handy text filters

func (*InputField) IsActive

func (c *InputField) IsActive() bool

func (*InputField) IsBordered

func (c *InputField) IsBordered() bool

IsBordered returns true or false if this input field has a border

func (*InputField) IsMultiline

func (c *InputField) IsMultiline() bool

IsMultiline returns true or false if this field can have multiple lines

func (*InputField) IsTabSkipped

func (c *InputField) IsTabSkipped() bool

IsTabSkipped returns whether this modal has it's tabskip flag set

func (*InputField) SetActive

func (c *InputField) SetActive(a bool)

func (*InputField) SetActiveBgColor

func (c *InputField) SetActiveBgColor(bg termbox.Attribute)

func (*InputField) SetActiveFgColor

func (c *InputField) SetActiveFgColor(fg termbox.Attribute)

func (*InputField) SetBgColor

func (c *InputField) SetBgColor(bg termbox.Attribute)

SetBgColor sets the current background color

func (*InputField) SetBordered

func (c *InputField) SetBordered(b bool)

SetBordered sets whether we render a border around the input field

func (*InputField) SetCursorBg

func (c *InputField) SetCursorBg(bg termbox.Attribute)

func (*InputField) SetCursorFg

func (c *InputField) SetCursorFg(fg termbox.Attribute)

func (*InputField) SetFgColor

func (c *InputField) SetFgColor(fg termbox.Attribute)

SetFgColor sets the foreground color

func (*InputField) SetHeight

func (c *InputField) SetHeight(h int)

SetHeight sets the current height of the input field

func (*InputField) SetID

func (c *InputField) SetID(newID string)

SetID sets this control's ID

func (*InputField) SetJustified

func (c *InputField) SetJustified(b bool)

func (*InputField) SetMultiline

func (c *InputField) SetMultiline(b bool)

SetMultiline sets whether the field can have multiple lines

func (*InputField) SetTabSkip

func (c *InputField) SetTabSkip(b bool)

SetTabSkip sets the tabskip flag for this control

func (*InputField) SetTextFilter

func (c *InputField) SetTextFilter(filter func(*InputField, string, string) string)

func (*InputField) SetTitle

func (c *InputField) SetTitle(title string)

func (*InputField) SetValue

func (c *InputField) SetValue(s string)

SetValue sets the current text in the InputField to s

func (*InputField) SetWidth

func (c *InputField) SetWidth(w int)

SetWidth sets the current width of the input field

func (*InputField) SetWrap

func (c *InputField) SetWrap(b bool)

SetWrap sets whether we wrap the text at width.

func (*InputField) SetX

func (c *InputField) SetX(x int)

SetX sets the x position of the input field

func (*InputField) SetY

func (c *InputField) SetY(y int)

SetY sets the y position of the input field

type InputModal

type InputModal struct {
	// contains filtered or unexported fields
}

InputModal A modal for text input

func CreateInputModal

func CreateInputModal(title string, x, y, width, height int, fg, bg termbox.Attribute) *InputModal

CreateInputModal Create an input modal with the given attributes

func (*InputModal) Clear

func (c *InputModal) Clear()

Clear Resets all non-positional parameters of the modal

func (*InputModal) Draw

func (c *InputModal) Draw()

Draw Draw the modal

func (*InputModal) GetBgColor

func (c *InputModal) GetBgColor() termbox.Attribute

GetBgColor returns the background color

func (*InputModal) GetFgColor

func (c *InputModal) GetFgColor() termbox.Attribute

GetFgColor returns the foreground color

func (*InputModal) GetHeight

func (c *InputModal) GetHeight() int

GetHeight Return the height of the modal

func (*InputModal) GetID

func (c *InputModal) GetID() string

GetID returns this control's ID

func (*InputModal) GetText

func (c *InputModal) GetText() string

GetText Return the text of the modal

func (*InputModal) GetTitle

func (c *InputModal) GetTitle() string

GetTitle Return the title of the modal

func (*InputModal) GetValue

func (c *InputModal) GetValue() string

GetValue Return the current value of the input

func (*InputModal) GetWidth

func (c *InputModal) GetWidth() int

GetWidth Return the width of the modal

func (*InputModal) GetX

func (c *InputModal) GetX() int

GetX Return the x position of the modal

func (*InputModal) GetY

func (c *InputModal) GetY() int

GetY Return the y position of the modal

func (*InputModal) HandleEvent

func (c *InputModal) HandleEvent(event termbox.Event) bool

HandleEvent Handle the termbox event, return true if it was consumed

func (*InputModal) HelpIsShown

func (c *InputModal) HelpIsShown() bool

HelpIsShown Returns whether the modal is showing it's help text or not

func (*InputModal) Hide

func (c *InputModal) Hide()

Hide Sets the visibility flag to false

func (*InputModal) IsAccepted

func (c *InputModal) IsAccepted() bool

IsAccepted Returns whether the modal has been accepted

func (*InputModal) IsActive

func (c *InputModal) IsActive() bool

func (*InputModal) IsBordered

func (c *InputModal) IsBordered() bool

IsBordered returns whether this control is bordered or not

func (*InputModal) IsDone

func (c *InputModal) IsDone() bool

IsDone Returns the "isDone" flag

func (*InputModal) IsMultiline

func (c *InputModal) IsMultiline() bool

IsMultiline returns whether this is a multiline modal

func (*InputModal) IsTabSkipped

func (c *InputModal) IsTabSkipped() bool

IsTabSkipped returns whether this control has it's tabskip flag set

func (*InputModal) IsVisible

func (c *InputModal) IsVisible() bool

IsVisible returns the isVisible flag

func (*InputModal) SetActive

func (c *InputModal) SetActive(a bool)

func (*InputModal) SetActiveBgColor

func (c *InputModal) SetActiveBgColor(bg termbox.Attribute)

func (*InputModal) SetActiveFgColor

func (c *InputModal) SetActiveFgColor(fg termbox.Attribute)

func (*InputModal) SetBgColor

func (c *InputModal) SetBgColor(bg termbox.Attribute)

SetBgColor sets the current background color

func (*InputModal) SetBordered

func (c *InputModal) SetBordered(b bool)

SetBordered sets whether we render a border around the frame

func (*InputModal) SetDone

func (c *InputModal) SetDone(b bool)

SetDone Sets the flag that tells whether this modal has completed it's purpose

func (*InputModal) SetFgColor

func (c *InputModal) SetFgColor(fg termbox.Attribute)

SetFgColor sets the foreground color

func (*InputModal) SetHeight

func (c *InputModal) SetHeight(height int)

SetHeight Set the height of the modal to height

func (*InputModal) SetID

func (c *InputModal) SetID(newID string)

SetID sets this control's ID

func (*InputModal) SetInputWrap

func (c *InputModal) SetInputWrap(b bool)

SetInputWrap sets whether the input field will wrap long text or not

func (*InputModal) SetMultiline

func (c *InputModal) SetMultiline(m bool)

SetMultiline returns whether this is a multiline modal

func (*InputModal) SetTabSkip

func (c *InputModal) SetTabSkip(b bool)

SetTabSkip sets the tabskip flag for this control

func (*InputModal) SetText

func (c *InputModal) SetText(s string)

SetText Set the text of the modal to s

func (*InputModal) SetTitle

func (c *InputModal) SetTitle(s string)

SetTitle Sets the title of the modal to s

func (*InputModal) SetValue

func (c *InputModal) SetValue(s string)

SetValue Sets the value of the input to s

func (*InputModal) SetWidth

func (c *InputModal) SetWidth(width int)

SetWidth Set the width of the modal to width

func (*InputModal) SetX

func (c *InputModal) SetX(x int)

SetX set the x position of the modal to x

func (*InputModal) SetY

func (c *InputModal) SetY(y int)

SetY Set the y position of the modal to y

func (*InputModal) Show

func (c *InputModal) Show()

Show Sets the visibility flag to true

func (*InputModal) ShowHelp

func (c *InputModal) ShowHelp(b bool)

ShowHelp Set the "Show Help" flag

type Label

type Label struct {
	// contains filtered or unexported fields
}

Label is a field for inputting text

func CreateLabel

func CreateLabel(lbl string, x, y, w, h int, fg, bg termbox.Attribute) *Label

CreateLabel creates an input field at x, y that is w by h

func ToLabel

func ToLabel(c termboxControl) (*Label, error)

func (*Label) DoesWrap

func (c *Label) DoesWrap() bool

DoesWrap returns true or false if this input field wraps text

func (*Label) Draw

func (c *Label) Draw()

Draw outputs the input field on the screen

func (*Label) GetBgColor

func (c *Label) GetBgColor() termbox.Attribute

GetBgColor returns the background color

func (*Label) GetFgColor

func (c *Label) GetFgColor() termbox.Attribute

GetFgColor returns the foreground color

func (*Label) GetHeight

func (c *Label) GetHeight() int

GetHeight returns the current height of the input field

func (*Label) GetID

func (c *Label) GetID() string

GetID returns this control's ID

func (*Label) GetValue

func (c *Label) GetValue() string

GetValue gets the current text that is in the Label

func (*Label) GetWidth

func (c *Label) GetWidth() int

GetWidth returns the current width of the input field

func (*Label) GetX

func (c *Label) GetX() int

GetX returns the x position of the input field

func (*Label) GetY

func (c *Label) GetY() int

GetY returns the y position of the input field

func (*Label) HandleEvent

func (c *Label) HandleEvent(event termbox.Event) bool

HandleEvent accepts the termbox event and returns whether it was consumed

func (*Label) IsActive

func (c *Label) IsActive() bool

func (*Label) IsBordered

func (c *Label) IsBordered() bool

IsBordered returns true or false if this input field has a border

func (*Label) IsMultiline

func (c *Label) IsMultiline() bool

IsMultiline returns true or false if this field can have multiple lines

func (*Label) IsTabSkipped

func (c *Label) IsTabSkipped() bool

IsTabSkipped is always true for a label

func (*Label) SetActive

func (c *Label) SetActive(a bool)

func (*Label) SetActiveBgColor

func (c *Label) SetActiveBgColor(bg termbox.Attribute)

func (*Label) SetActiveFgColor

func (c *Label) SetActiveFgColor(fg termbox.Attribute)

func (*Label) SetBgColor

func (c *Label) SetBgColor(bg termbox.Attribute)

SetBgColor sets the current background color

func (*Label) SetBordered

func (c *Label) SetBordered(b bool)

SetBordered sets whether we render a border around the input field

func (*Label) SetFgColor

func (c *Label) SetFgColor(fg termbox.Attribute)

SetFgColor sets the foreground color

func (*Label) SetHeight

func (c *Label) SetHeight(h int)

SetHeight sets the current height of the input field

func (*Label) SetID

func (c *Label) SetID(newID string)

SetID sets this control's ID

func (*Label) SetMultiline

func (c *Label) SetMultiline(b bool)

SetMultiline sets whether the field can have multiple lines

func (*Label) SetTabSkip

func (c *Label) SetTabSkip(b bool)

This doesn't do anything for a label

func (*Label) SetValue

func (c *Label) SetValue(s string)

SetValue sets the current text in the Label to s

func (*Label) SetWidth

func (c *Label) SetWidth(w int)

SetWidth sets the current width of the input field

func (*Label) SetWrap

func (c *Label) SetWrap(b bool)

SetWrap sets whether we wrap the text at width.

func (*Label) SetX

func (c *Label) SetX(x int)

SetX sets the x position of the input field

func (*Label) SetY

func (c *Label) SetY(y int)

SetY sets the y position of the input field

type Menu struct {
	// contains filtered or unexported fields
}

Menu is a menu with a list of options

func CreateMenu

func CreateMenu(title string, options []string, x, y, width, height int, fg, bg termbox.Attribute) *Menu

CreateMenu Creates a menu with the specified attributes

func (c *Menu) DisableVimMode()

DisableVimMode Disables h,j,k,l navigation

func (c *Menu) Draw()

Draw draws the modal

func (c *Menu) EnableVimMode()

EnableVimMode Enables h,j,k,l navigation

func (c *Menu) GetBgColor() termbox.Attribute
func (c *Menu) GetDisabledBgColor() termbox.Attribute
func (c *Menu) GetDisabledFgColor() termbox.Attribute
func (c *Menu) GetFgColor() termbox.Attribute
func (c *Menu) GetHeight() int

GetHeight returns the current height of the menu

func (c *Menu) GetID() string

GetID returns this control's ID

func (c *Menu) GetOptionFromIndex(idx int) *MenuOption

GetOptionFromIndex Returns the

func (c *Menu) GetOptionFromText(v string) *MenuOption

GetOptionFromText Returns the first option with the text v

func (c *Menu) GetOptions() []MenuOption

GetOptions returns the current options of the menu

func (c *Menu) GetSelectedBgColor() termbox.Attribute
func (c *Menu) GetSelectedDisabledBgColor() termbox.Attribute
func (c *Menu) GetSelectedDisabledFgColor() termbox.Attribute
func (c *Menu) GetSelectedFgColor() termbox.Attribute
func (c *Menu) GetSelectedIndex() int

GetSelectedIndex returns the index of the selected option Returns -1 if nothing is selected

func (c *Menu) GetSelectedOption() *MenuOption

GetSelectedOption returns the current selected option

func (c *Menu) GetTitle() string

GetTitle returns the current title of the menu

func (c *Menu) GetWidth() int

GetWidth returns the current width of the menu

func (c *Menu) GetX() int

GetX returns the current x coordinate of the menu

func (c *Menu) GetY() int

GetY returns the current y coordinate of the menu

func (c *Menu) HandleEvent(event termbox.Event) bool

HandleEvent handles the termbox event and returns whether it was consumed

func (c *Menu) HelpIsShown() bool

HelpIsShown returns true or false if the help is displayed

func (c *Menu) IsActive() bool
func (c *Menu) IsBordered() bool

IsBordered returns true or false if this menu has a border

func (c *Menu) IsDone() bool

IsDone returns whether the user has answered the modal

func (c *Menu) IsTabSkipped() bool
func (c *Menu) SelectFirstOption()

SelectFirstOption Goes to the top

func (c *Menu) SelectLastOption()

SelectLastOption Goes to the bottom

func (c *Menu) SelectNextOption()

SelectNextOption Increments the selected option (if it can)

func (c *Menu) SelectPageDownOption()

SelectPageDownOption Goes down 'menu height' options

func (c *Menu) SelectPageUpOption()

SelectPageUpOption Goes up 'menu height' options

func (c *Menu) SelectPrevOption()

SelectPrevOption Decrements the selected option (if it can)

func (c *Menu) SetActive(a bool)
func (c *Menu) SetActiveBgColor(bg termbox.Attribute)
func (c *Menu) SetActiveFgColor(fg termbox.Attribute)
func (c *Menu) SetBgColor(bg termbox.Attribute)
func (c *Menu) SetBordered(b bool)

SetBordered sets whether we render a border around the menu

func (c *Menu) SetCanSelectDisabled(b bool)
func (c *Menu) SetDisabledBgColor(bg termbox.Attribute)
func (c *Menu) SetDisabledFgColor(fg termbox.Attribute)
func (c *Menu) SetDone(b bool)

SetDone sets whether the modal has completed it's purpose

func (c *Menu) SetFgColor(fg termbox.Attribute)
func (c *Menu) SetHeight(height int)

SetHeight set the height of the menu to height

func (c *Menu) SetID(newID string)

SetID sets this control's ID

func (c *Menu) SetOptionDisabled(idx int)

SetOptionDisabled Disables the specified option

func (c *Menu) SetOptionEnabled(idx int)

SetOptionEnabled Enables the specified option

func (c *Menu) SetOptions(opts []MenuOption)

SetOptions set the menu's options to opts

func (c *Menu) SetOptionsFromStrings(opts []string)

SetOptionsFromStrings sets the options of this menu from a slice of strings

func (c *Menu) SetSelectedBgColor(bg termbox.Attribute)
func (c *Menu) SetSelectedDisabledBgColor(bg termbox.Attribute)
func (c *Menu) SetSelectedDisabledFgColor(fg termbox.Attribute)
func (c *Menu) SetSelectedFgColor(fg termbox.Attribute)
func (c *Menu) SetSelectedIndex(idx int)

SetSelectedIndex sets the selection to setIdx

func (c *Menu) SetSelectedOption(v *MenuOption)

SetSelectedOption sets the current selected option to v (if it's valid)

func (c *Menu) SetTabSkip(b bool)
func (c *Menu) SetTitle(s string)

SetTitle sets the current title of the menu to s

func (c *Menu) SetWidth(width int)

SetWidth sets the current menu width to width

func (c *Menu) SetX(x int)

SetX sets the current x coordinate of the menu to x

func (c *Menu) SetY(y int)

SetY sets the current y coordinate of the menu to y

func (c *Menu) ShowHelp(b bool)

ShowHelp sets whether or not to display the help text

type MenuOption struct {
	// contains filtered or unexported fields
}

MenuOption An option in the menu

func CreateOptionFromText

func CreateOptionFromText(s string) *MenuOption

CreateOptionFromText just returns a MenuOption object That only has it's text value set.

func (c *MenuOption) AddToSubMenu(sub *MenuOption)

AddToSubMenu adds a slice of MenuOptions to this option

func (c *MenuOption) Disable()

Disable Sets this option to disabled

func (c *MenuOption) Enable()

Enable Sets this option to enabled

func (c *MenuOption) GetHelpText() string

GetHelpText Returns the help text for this option

func (c *MenuOption) GetText() string

GetText Returns the text for this option

func (c *MenuOption) IsDisabled() bool

IsDisabled returns whether this option is enabled

func (c *MenuOption) IsSelected() bool

IsSelected Returns whether this option is selected

func (c *MenuOption) Select()

Select Sets this option to selected

func (c *MenuOption) SetHelpText(s string)

SetHelpText Sets this option's help text to s

func (c *MenuOption) SetText(s string)

SetText Sets the text for this option

func (c *MenuOption) Unselect()

Unselect Sets this option to not selected

type ProgressBar

type ProgressBar struct {
	// contains filtered or unexported fields
}

ProgressBar Just contains the data needed to display a progress bar

func CreateProgressBar

func CreateProgressBar(tot, x, y int, fg, bg termbox.Attribute) *ProgressBar

CreateProgressBar Create a progress bar object

func (*ProgressBar) Align

func (c *ProgressBar) Align(a TextAlignment)

Align Tells which direction the progress bar empties

func (*ProgressBar) DecrProgress

func (c *ProgressBar) DecrProgress()

DecrProgress decrements the current progress of the bar

func (*ProgressBar) DisableOverflow

func (c *ProgressBar) DisableOverflow()

DisableOverflow Tells the progress bar that it can NOT go over the total

func (*ProgressBar) DisableUnderflow

func (c *ProgressBar) DisableUnderflow()

DisableUnderflow Tells the progress bar that it can NOT go below zero

func (*ProgressBar) Draw

func (c *ProgressBar) Draw()

Draw outputs the input field on the screen

func (*ProgressBar) EnableOverflow

func (c *ProgressBar) EnableOverflow()

EnableOverflow Tells the progress bar that it can go over the total

func (*ProgressBar) EnableUnderflow

func (c *ProgressBar) EnableUnderflow()

EnableUnderflow Tells the progress bar that it can go below zero

func (*ProgressBar) GetBgColor

func (c *ProgressBar) GetBgColor() termbox.Attribute

GetBgColor returns the background color

func (*ProgressBar) GetEmptyChar

func (c *ProgressBar) GetEmptyChar() rune

GetEmptyChar gets the rune used for 'empty'

func (*ProgressBar) GetFgColor

func (c *ProgressBar) GetFgColor() termbox.Attribute

GetFgColor returns the foreground color

func (*ProgressBar) GetFullChar

func (c *ProgressBar) GetFullChar() rune

GetFullChar returns the rune used for 'full'

func (*ProgressBar) GetHeight

func (c *ProgressBar) GetHeight() int

GetHeight returns the height of the progress bar Defaults to 1 (3 if bordered)

func (*ProgressBar) GetID

func (c *ProgressBar) GetID() string

GetID returns this control's ID

func (*ProgressBar) GetPercent

func (c *ProgressBar) GetPercent() int

GetPercent returns the percent full of the bar

func (*ProgressBar) GetProgress

func (c *ProgressBar) GetProgress() int

GetProgress returns the curret progress value

func (*ProgressBar) GetWidth

func (c *ProgressBar) GetWidth() int

GetWidth returns the width of the progress bar

func (*ProgressBar) GetX

func (c *ProgressBar) GetX() int

GetX Return the x position of the Progress Bar

func (*ProgressBar) GetY

func (c *ProgressBar) GetY() int

GetY Return the y position of the ProgressBar

func (*ProgressBar) HandleEvent

func (c *ProgressBar) HandleEvent(event termbox.Event) bool

HandleEvent accepts the termbox event and returns whether it was consumed

func (*ProgressBar) IncrProgress

func (c *ProgressBar) IncrProgress()

IncrProgress increments the current progress of the bar

func (*ProgressBar) IsActive

func (c *ProgressBar) IsActive() bool

func (*ProgressBar) SetActive

func (c *ProgressBar) SetActive(a bool)

func (*ProgressBar) SetActiveBgColor

func (c *ProgressBar) SetActiveBgColor(bg termbox.Attribute)

func (*ProgressBar) SetActiveFgColor

func (c *ProgressBar) SetActiveFgColor(fg termbox.Attribute)

func (*ProgressBar) SetBgColor

func (c *ProgressBar) SetBgColor(bg termbox.Attribute)

SetBgColor sets the current background color

func (*ProgressBar) SetColorized

func (c *ProgressBar) SetColorized(color bool)

SetColorized sets whether the progress bar should be colored depending on how full it is:

 10% - Red
	50% - Yellow
	80% - Green

func (*ProgressBar) SetEmptyChar

func (c *ProgressBar) SetEmptyChar(f rune)

SetEmptyChar sets the rune used for 'empty'

func (*ProgressBar) SetFgColor

func (c *ProgressBar) SetFgColor(fg termbox.Attribute)

SetFgColor sets the foreground color

func (*ProgressBar) SetFullChar

func (c *ProgressBar) SetFullChar(f rune)

SetFullChar sets the rune used for 'full'

func (*ProgressBar) SetHeight

func (c *ProgressBar) SetHeight(h int)

SetHeight Sets the height of the progress bar

func (*ProgressBar) SetID

func (c *ProgressBar) SetID(newID string)

SetID sets this control's ID

func (*ProgressBar) SetProgress

func (c *ProgressBar) SetProgress(p int)

SetProgress sets the current progress of the bar

func (*ProgressBar) SetWidth

func (c *ProgressBar) SetWidth(w int)

SetWidth Sets the width of the progress bar

func (*ProgressBar) SetX

func (c *ProgressBar) SetX(x int)

SetX set the x position of the ProgressBar to x

func (*ProgressBar) SetY

func (c *ProgressBar) SetY(y int)

SetY Set the y position of the ProgressBar to y

type ScrollFrame

type ScrollFrame struct {
	// contains filtered or unexported fields
}

ScrollFrame is a frame for holding other elements It manages it's own x/y, tab index

func CreateScrollFrame

func CreateScrollFrame(x, y, w, h int, fg, bg termbox.Attribute) *ScrollFrame

CreateScrollFrame creates Scrolling Frame at x, y that is w by h

func (*ScrollFrame) AddControl

func (c *ScrollFrame) AddControl(t termboxControl)

AddControl adds a control to the frame

func (*ScrollFrame) Draw

func (c *ScrollFrame) Draw()

Draw outputs the Scoll Frame on the screen

func (*ScrollFrame) DrawControl

func (c *ScrollFrame) DrawControl(t termboxControl)

DrawControl figures out the relative position of the control, sets it, draws it, then resets it.

func (*ScrollFrame) DrawToStrings

func (c *ScrollFrame) DrawToStrings() []string

DrawToStrings generates a slice of strings with what should be drawn to the screen

func (*ScrollFrame) GetBgColor

func (c *ScrollFrame) GetBgColor() termbox.Attribute

GetBgColor returns the background color

func (*ScrollFrame) GetFgColor

func (c *ScrollFrame) GetFgColor() termbox.Attribute

GetFgColor returns the foreground color

func (*ScrollFrame) GetHeight

func (c *ScrollFrame) GetHeight() int

GetHeight returns the current height of the scroll frame

func (*ScrollFrame) GetID

func (c *ScrollFrame) GetID() string

GetID returns this control's ID

func (*ScrollFrame) GetScrollX

func (c *ScrollFrame) GetScrollX() int

GetScrollX returns the x distance scrolled

func (*ScrollFrame) GetScrollY

func (c *ScrollFrame) GetScrollY() int

GetScrollY returns the y distance scrolled

func (*ScrollFrame) GetWidth

func (c *ScrollFrame) GetWidth() int

GetWidth returns the current width of the scroll frame

func (*ScrollFrame) GetX

func (c *ScrollFrame) GetX() int

GetX returns the x position of the scroll frame

func (*ScrollFrame) GetY

func (c *ScrollFrame) GetY() int

GetY returns the y position of the scroll frame

func (*ScrollFrame) HandleEvent

func (c *ScrollFrame) HandleEvent(event termbox.Event) bool

HandleEvent accepts the termbox event and returns whether it was consumed

func (*ScrollFrame) IsBordered

func (c *ScrollFrame) IsBordered() bool

IsBordered returns true or false if this scroll frame has a border

func (*ScrollFrame) IsVisible

func (c *ScrollFrame) IsVisible(t termboxControl) bool

IsVisible takes a Termbox Control and returns whether that control would be visible in the frame

func (*ScrollFrame) ScrollDown

func (c *ScrollFrame) ScrollDown()

ScrollDown scrolls the frame down

func (*ScrollFrame) ScrollLeft

func (c *ScrollFrame) ScrollLeft()

ScrollLeft scrolls the frame left

func (*ScrollFrame) ScrollRight

func (c *ScrollFrame) ScrollRight()

ScrollRight scrolls the frame right

func (*ScrollFrame) ScrollUp

func (c *ScrollFrame) ScrollUp()

ScrollUp scrolls the frame up

func (*ScrollFrame) SetBgColor

func (c *ScrollFrame) SetBgColor(bg termbox.Attribute)

SetBgColor sets the current background color

func (*ScrollFrame) SetBordered

func (c *ScrollFrame) SetBordered(b bool)

SetBordered sets whether we render a border around the scroll frame

func (*ScrollFrame) SetFgColor

func (c *ScrollFrame) SetFgColor(fg termbox.Attribute)

SetFgColor sets the foreground color

func (*ScrollFrame) SetHeight

func (c *ScrollFrame) SetHeight(h int)

SetHeight sets the current height of the scroll frame

func (*ScrollFrame) SetID

func (c *ScrollFrame) SetID(newID string)

SetID sets this control's ID

func (*ScrollFrame) SetWidth

func (c *ScrollFrame) SetWidth(w int)

SetWidth sets the current width of the scroll frame

func (*ScrollFrame) SetX

func (c *ScrollFrame) SetX(x int)

SetX sets the x position of the scroll frame

func (*ScrollFrame) SetY

func (c *ScrollFrame) SetY(y int)

SetY sets the y position of the scroll frame

type TextAlignment

type TextAlignment int

TextAlignment is an int value for how we're aligning text

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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