ui

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: MIT Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Panel constants
	LOGO_PANEL           = "logo"
	SAVED_DIAGRAMS_PANEL = "saved_diagrams"
	LOG_PANEL            = "log"
	DIAGRAM_PANEL        = "diagram"
	PROGRESS_PANEL       = "progress"
	HELP_PANEL           = "help"
	SAVE_MODAL           = "save_modal"
	PROGRESS_MODAL       = "progress_modal"

	// Log messages
	ERROR_EMPTY  = "The editor should not be empty!"
	DIAGRAMS_DIR = "/diagrams"
)
View Source
const MinGUIWindow = 600

MinGUIWindow is the minimum window size

Variables

This section is empty.

Functions

func InitApp

func InitApp(fontPath string)

InitApp initialize the CLI application.

func NewButtonWidget

func NewButtonWidget(name string, x, y int, label string, handler func(g *gocui.Gui, v *gocui.View) error) *buttonWidget

NewButtonWidget returns a new button widget.

Types

type Cursors

type Cursors map[string]struct {
	// contains filtered or unexported fields
}

Cursors stores the cursor position for a specific panel view. Used to restore mouse position when click is detected.

func NewCursors

func NewCursors() Cursors

NewCursors instantiate Cursors map which contains the cursor current position.

func (Cursors) Get

func (c Cursors) Get(view string) (int, int)

Get returns the cursor current position.

func (Cursors) Restore

func (c Cursors) Restore(view *gocui.View) error

Restore restores cursor previous position.

func (Cursors) Set

func (c Cursors) Set(view string, x, y int)

Set defines the mouse position.

type Fn

type Fn func(*gocui.Gui, *gocui.View) error

Fn is a generic function acting as a closure function for event handlers.

type UI

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

UI defines the basic UI components.

func NewUI

func NewUI(fontPath string) *UI

NewUI returns a new UI component.

func (*UI) ClearView

func (ui *UI) ClearView(name string)

ClearView clears the panel view.

func (*UI) Close

func (ui *UI) Close()

Close closes the app.

func (*UI) DeleteView

func (ui *UI) DeleteView(name string)

DeleteView deletes the current view.

func (*UI) Init

func (ui *UI) Init()

Init initialize the UI component.

func (*UI) Layout

func (ui *UI) Layout(g *gocui.Gui) error

Layout initialize the panel views and associates the key bindings to them.

func (*UI) Loop

func (ui *UI) Loop()

Loop starts the GUI loop.

Jump to

Keyboard shortcuts

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