components

package
v0.0.0-...-ddd5301 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package components is standard component library of GoVision.

Index

Constants

View Source
const (
	// BorderTypeSingle border with single line.
	BorderTypeSingle = 0
	// BorderTypeDouble border with double line.
	BorderTypeDouble = 1
	// BorderTypeEmpty border without line.
	BorderTypeEmpty = 2

	// ULCorner upper left corner.
	ULCorner = 0
	// HLine horizontal line.
	HLine = 1
	// CloseLeft close character left.
	CloseLeft = 2
	// CloseRight close character right.
	CloseRight = 3
	// Close close character.
	Close = 4
	// URCorner upper right corner.
	URCorner = 5
	// CaptionSpace space before/after caption in title bar.
	CaptionSpace = 6
	// LLCorner lower left corner.
	LLCorner = 7
	// LRCorner lower right corner.
	LRCorner = 8
	// VLine vertical line.
	VLine = 9
)

Variables

This section is empty.

Functions

func BuildCreateWindowMessage

func BuildCreateWindowMessage(w *Window) base.Message

BuildCreateWindowMessage return a message when create window.

func BuildDestroyWindowMessage

func BuildDestroyWindowMessage(w *Window) base.Message

BuildDestroyWindowMessage return a message when destroy window.

func DefaultDrawBottomBar

func DefaultDrawBottomBar(canvas base.TCanvas, bottomBounds base.Rect, borders []rune)

DefaultDrawBottomBar draw bottom border of window. Give └───────────┘

func DefaultDrawLeftOrRightBorder

func DefaultDrawLeftOrRightBorder(canvas base.TCanvas, bounds base.Rect, borders []rune)

DefaultDrawLeftOrRightBorder draw left or right border of window.

func DefaultDrawTitleBar

func DefaultDrawTitleBar(canvas base.TCanvas, titleBounds base.Rect, caption string, borders []rune)

DefaultDrawTitleBar default draw for title bar. Give ┌─[■]─ My title ─┐

Types

type BorderType

type BorderType int

BorderType border of window.

type OnTimer

type OnTimer func(*Timer)

OnTimer is callback when timer is done.

type Timer

type Timer struct {

	// OnTimer is callback when timer is done.
	OnTimer OnTimer

	base.Component
	// contains filtered or unexported fields
}

Timer is the base object of all widget.

func NewTimer

func NewTimer(name string, interval time.Duration, message base.Bus) Timer

NewTimer create new timer.

func (*Timer) GetIntervale

func (t *Timer) GetIntervale() time.Duration

GetIntervale return interval value.

func (*Timer) SetEnabled

func (t *Timer) SetEnabled(status bool)

SetEnabled active or disable timer.

func (*Timer) SetIntervale

func (t *Timer) SetIntervale(interval time.Duration)

SetIntervale set new interval and reset timer.

type Window

type Window struct {
	// Window title.
	Caption string
	// Border
	Border WindowBorder
	// contains filtered or unexported fields
}

Window is the base object of all widget.

func NewWindow

func NewWindow(name string, message base.Bus, parentCanvas base.TCanvas) Window

NewWindow create new window.

func (*Window) AddChild

func (w *Window) AddChild(c base.TComponent)

AddChild add a child to component.

func (*Window) Canvas

func (w *Window) Canvas() base.TCanvas

Canvas of view.

func (*Window) Children

func (w *Window) Children() []base.TComponent

Children return list of children of component.

func (*Window) ClientCanvas

func (w *Window) ClientCanvas() base.TCanvas

ClientCanvas return client canvas of view.

func (*Window) Draw

func (w *Window) Draw()

Draw the view.

func (*Window) GetBackgroundColor

func (w *Window) GetBackgroundColor() tcell.Color

GetBackgroundColor return background color.

func (*Window) GetBounds

func (w *Window) GetBounds() base.Rect

GetBounds return view size.

func (*Window) GetClientBounds

func (w *Window) GetClientBounds() base.Rect

GetClientBounds return client bounds.

func (*Window) GetEnabled

func (w *Window) GetEnabled() bool

GetEnabled return is component is enable.

func (*Window) GetFocused

func (w *Window) GetFocused() bool

GetFocused return true if component has focus.

func (*Window) GetForegroundColor

func (w *Window) GetForegroundColor() tcell.Color

GetForegroundColor return text color.

func (*Window) GetMessageBus

func (w *Window) GetMessageBus() base.Bus

GetMessageBus return application bus.

func (*Window) GetOnActivate

func (w *Window) GetOnActivate() base.OnActivate

GetOnActivate return OnActivate event.

func (*Window) GetOnChangeBounds

func (w *Window) GetOnChangeBounds() base.OnChangeBounds

GetOnChangeBounds return OnChangeBounds event.

func (*Window) GetOnDraw

func (w *Window) GetOnDraw() base.OnDraw

GetOnDraw get ondraw callback.

func (*Window) GetOnEnabled

func (w *Window) GetOnEnabled() base.OnEnabled

GetOnEnabled return function to be execute when receive enable message.

func (*Window) GetOnReceiveMessage

func (w *Window) GetOnReceiveMessage() base.OnReceiveMessage

GetOnReceiveMessage return function to be execute when receive message.

func (*Window) GetParent

func (w *Window) GetParent() base.TComponent

GetParent get parent component.

func (*Window) GetVisible

func (w *Window) GetVisible() bool

GetVisible if component is visible.

func (*Window) GetZorder

func (w *Window) GetZorder() int

GetZorder return odrer of draw.

func (*Window) HandleMessage

func (w *Window) HandleMessage(msg base.Message) bool

HandleMessage is use to manage message.

func (*Window) Handler

func (w *Window) Handler() uuid.UUID

Handler of component (UUID).

func (*Window) Name

func (w *Window) Name() string

Name of component.

func (*Window) RemoveChild

func (w *Window) RemoveChild(c base.TComponent)

RemoveChild remove a child to component.

func (*Window) SetBackgroundColor

func (w *Window) SetBackgroundColor(c tcell.Color)

SetBackgroundColor change background color.

func (*Window) SetBounds

func (w *Window) SetBounds(r base.Rect)

SetBounds set view size.

func (*Window) SetEnabled

func (w *Window) SetEnabled(e bool)

SetEnabled enable component.

func (*Window) SetFocused

func (w *Window) SetFocused(f bool)

SetFocused of component.

func (*Window) SetForegroundColor

func (w *Window) SetForegroundColor(c tcell.Color)

SetForegroundColor change text color.

func (*Window) SetOnActivate

func (w *Window) SetOnActivate(f base.OnActivate)

SetOnActivate set OnActivate event.

func (*Window) SetOnChangeBounds

func (w *Window) SetOnChangeBounds(f base.OnChangeBounds)

SetOnChangeBounds set OnChangeBounds event.

func (*Window) SetOnDraw

func (w *Window) SetOnDraw(f base.OnDraw)

SetOnDraw set ondraw callback.

func (*Window) SetOnEnabled

func (w *Window) SetOnEnabled(f base.OnEnabled)

SetOnEnabled set function when set enable.

func (*Window) SetOnReceiveMessage

func (w *Window) SetOnReceiveMessage(f base.OnReceiveMessage)

SetOnReceiveMessage set function when receive message.

func (*Window) SetParent

func (w *Window) SetParent(p base.TComponent)

SetParent set parent component.

func (*Window) SetVisible

func (w *Window) SetVisible(s bool)

SetVisible if component is visible.

func (*Window) SetZorder

func (w *Window) SetZorder(o int)

SetZorder set the new odrer of draw.

type WindowBorder

type WindowBorder struct {
	// Border type.
	Type BorderType
	// Border color.
	BackgroundColor tcell.Color
	// Border color.
	ForegroundColor tcell.Color
}

WindowBorder is border style

Jump to

Keyboard shortcuts

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