Documentation ¶
Index ¶
- Constants
- Variables
- func AddTimeout(delay time.Duration, fn TimerCallbackFn) (id uuid.UUID)
- func CancelAllTimeouts()
- func DescribeButton(button ButtonMask) string
- func GetEncoding(charset string) encoding.Encoding
- func Init()
- func ListEncodings() []string
- func LookupKeyName(key Key) string
- func RegisterEncoding(charset string, enc encoding.Encoding)
- func SetEncodingFallback(fb EncodingFallback)
- func StopTimeout(id uuid.UUID)
- func TestingMakesActiveWindow(d Display) error
- func TestingMakesNoContent(d Display) error
- func UnregisterEncoding(charset string)
- func WithApp(initFn DisplayInitFn, action AppFn) func()
- func WithDisplayManager(action DisplayManagerFn) func()
- type App
- type AppContext
- type AppFn
- type AppServer
- type ButtonMask
- type CApp
- func (app *CApp) AddCommand(command *cli.Command)
- func (app *CApp) AddCommands(commands []*cli.Command)
- func (app *CApp) AddFlag(flag cli.Flag)
- func (app *CApp) AddFlags(flags []cli.Flag)
- func (app *CApp) CLI() *cli.App
- func (app *CApp) Description() string
- func (app *CApp) Destroy()
- func (app *CApp) Display() *CDisplay
- func (app *CApp) GetContext() *cli.Context
- func (app *CApp) InitUI() error
- func (app *CApp) MainActionFn(ctx *cli.Context) error
- func (app *CApp) Name() string
- func (app *CApp) Run(args []string) (err error)
- func (app *CApp) SetupDisplay()
- func (app *CApp) Tag() string
- func (app *CApp) Title() string
- func (app *CApp) Usage() string
- func (app *CApp) Version() string
- type CAppServer
- func (s *CAppServer) App() *CApp
- func (s *CAppServer) Daemon() (err error)
- func (s *CAppServer) Display() *CDisplay
- func (s *CAppServer) GetClient(id uuid.UUID) (*cAppServerClient, error)
- func (s *CAppServer) GetClients() (clients []uuid.UUID)
- func (s *CAppServer) GetListenAddress() (address string)
- func (s *CAppServer) GetListenPort() (port int)
- func (s *CAppServer) Init()
- func (s *CAppServer) SetListenAddress(address string)
- func (s *CAppServer) SetListenPort(port int)
- func (s *CAppServer) Start() (err error)
- func (s *CAppServer) Stop() (err error)
- type CDisplay
- func (d *CDisplay) ActiveWindow() Window
- func (d *CDisplay) AddQuitHandler(tag string, fn func())
- func (d *CDisplay) AddWindow(w Window)
- func (d *CDisplay) AddWindowOverlay(pid uuid.UUID, overlay Window, region ptypes.Region)
- func (d *CDisplay) App() *CApp
- func (d *CDisplay) AsyncCall(fn DisplayCallbackFn) error
- func (d *CDisplay) AwaitCall(fn DisplayCallbackFn) error
- func (d *CDisplay) CaptureCtrlC()
- func (d *CDisplay) CaptureDisplay() (err error)
- func (d *CDisplay) Colors() (numberOfColors int)
- func (d *CDisplay) DefaultTheme() paint.Theme
- func (d *CDisplay) Destroy()
- func (d *CDisplay) DisplayCaptured() bool
- func (d *CDisplay) DrawScreen() enums.EventFlag
- func (d *CDisplay) GetEventFocus() (widget interface{})
- func (d *CDisplay) GetPriorEvent() (event Event)
- func (d *CDisplay) GetTitle() string
- func (d *CDisplay) GetTtyHandle() *os.File
- func (d *CDisplay) GetTtyPath() string
- func (d *CDisplay) GetWindowOverlayRegion(windowId, overlayId uuid.UUID) (region ptypes.Region)
- func (d *CDisplay) GetWindowOverlays(id uuid.UUID) (windows []Window)
- func (d *CDisplay) GetWindowTopOverlay(id uuid.UUID) (window Window)
- func (d *CDisplay) GetWindows() (windows []Window)
- func (d *CDisplay) Init() (already bool)
- func (d *CDisplay) IsMonochrome() bool
- func (d *CDisplay) IsRunning() bool
- func (d *CDisplay) PostEvent(evt Event) error
- func (d *CDisplay) ProcessEvent(evt Event) enums.EventFlag
- func (d *CDisplay) ReleaseCtrlC()
- func (d *CDisplay) ReleaseDisplay()
- func (d *CDisplay) RemoveQuitHandler(tag string)
- func (d *CDisplay) RemoveWindow(wid uuid.UUID)
- func (d *CDisplay) RemoveWindowOverlay(pid, oid uuid.UUID)
- func (d *CDisplay) RequestDraw()
- func (d *CDisplay) RequestQuit()
- func (d *CDisplay) RequestShow()
- func (d *CDisplay) RequestSync()
- func (d *CDisplay) Run() error
- func (d *CDisplay) Screen() Screen
- func (d *CDisplay) SetActiveWindow(w Window)
- func (d *CDisplay) SetEventFocus(widget interface{}) error
- func (d *CDisplay) SetTitle(title string)
- func (d *CDisplay) SetTtyHandle(ttyHandle *os.File)
- func (d *CDisplay) SetTtyPath(ttyPath string)
- func (d *CDisplay) SetWindowOverlayRegion(windowId, overlayId uuid.UUID, region ptypes.Region)
- type CMetaData
- func (o *CMetaData) GetBoolProperty(name Property) (value bool, err error)
- func (o *CMetaData) GetColorProperty(name Property) (value paint.Color, err error)
- func (o *CMetaData) GetFloat64Property(name Property) (value float64, err error)
- func (o *CMetaData) GetFloatProperty(name Property) (value float64, err error)
- func (o *CMetaData) GetIntProperty(name Property) (value int, err error)
- func (o *CMetaData) GetPointProperty(name Property) (value ptypes.Point2I, err error)
- func (o *CMetaData) GetProperty(name Property) *CProperty
- func (o *CMetaData) GetRectangleProperty(name Property) (value ptypes.Rectangle, err error)
- func (o *CMetaData) GetRegionProperty(name Property) (value ptypes.Region, err error)
- func (o *CMetaData) GetStringProperty(name Property) (value string, err error)
- func (o *CMetaData) GetStructProperty(name Property) (value interface{}, err error)
- func (o *CMetaData) GetStyleProperty(name Property) (value paint.Style, err error)
- func (o *CMetaData) GetThemeProperty(name Property) (value paint.Theme, err error)
- func (o *CMetaData) Init() (already bool)
- func (o *CMetaData) InstallBuildableProperty(name Property, kind PropertyType, write bool, def interface{}) error
- func (o *CMetaData) InstallProperty(name Property, kind PropertyType, write bool, def interface{}) error
- func (o *CMetaData) IsBuildableProperty(name Property) bool
- func (o *CMetaData) IsProperty(name Property) bool
- func (o *CMetaData) ListBuildableProperties() (properties []Property)
- func (o *CMetaData) ListProperties() (properties []Property)
- func (o *CMetaData) OverloadProperty(name Property, kind PropertyType, write bool, buildable bool, def interface{}) error
- func (o *CMetaData) SetBoolProperty(name Property, value bool) error
- func (o *CMetaData) SetColorProperty(name Property, value paint.Color) error
- func (o *CMetaData) SetFloatProperty(name Property, value float64) error
- func (o *CMetaData) SetIntProperty(name Property, value int) error
- func (o *CMetaData) SetPointProperty(name Property, value ptypes.Point2I) error
- func (o *CMetaData) SetProperties(properties map[Property]string) (err error)
- func (o *CMetaData) SetProperty(name Property, value interface{}) error
- func (o *CMetaData) SetPropertyFromString(name Property, value string) error
- func (o *CMetaData) SetRectangleProperty(name Property, value ptypes.Rectangle) error
- func (o *CMetaData) SetRegionProperty(name Property, value ptypes.Region) error
- func (o *CMetaData) SetStringProperty(name Property, value string) error
- func (o *CMetaData) SetStructProperty(name Property, value interface{}) error
- func (o *CMetaData) SetStyleProperty(name Property, value paint.Style) error
- func (o *CMetaData) SetThemeProperty(name Property, value paint.Theme) error
- type CObject
- func (o *CObject) Destroy()
- func (o *CObject) GetName() (name string)
- func (o *CObject) GetTheme() (theme paint.Theme)
- func (o *CObject) GetThemeRequest() (theme paint.Theme)
- func (o *CObject) Init() (already bool)
- func (o *CObject) InitWithProperties(properties map[Property]string) (already bool, err error)
- func (o *CObject) SetName(name string)
- func (o *CObject) SetTheme(theme paint.Theme)
- func (o *CObject) SetThemeRequest(theme paint.Theme)
- type COffScreen
- func (o *COffScreen) Beep() error
- func (o *COffScreen) CanDisplay(r rune, checkFallbacks bool) bool
- func (o *COffScreen) CharacterSet() string
- func (o *COffScreen) Clear()
- func (o *COffScreen) Close()
- func (o *COffScreen) Colors() int
- func (o *COffScreen) DisableMouse()
- func (o *COffScreen) DisablePaste()
- func (o *COffScreen) EnableMouse(_ ...MouseFlags)
- func (o *COffScreen) EnablePaste()
- func (o *COffScreen) Export() *CellBuffer
- func (o *COffScreen) Fill(r rune, style paint.Style)
- func (o *COffScreen) GetContent(x, y int) (mc rune, comb []rune, style paint.Style, width int)
- func (o *COffScreen) GetContents() ([]OffscreenCell, int, int)
- func (o *COffScreen) GetCursor() (int, int, bool)
- func (o *COffScreen) HasKey(Key) bool
- func (o *COffScreen) HasMouse() bool
- func (o *COffScreen) HideCursor()
- func (o *COffScreen) Import(cb *CellBuffer)
- func (o *COffScreen) Init() error
- func (o *COffScreen) InitWithFileHandle(ttyHandle *os.File) (err error)
- func (o *COffScreen) InitWithFilePath(ttyFile string) (err error)
- func (o *COffScreen) InjectKey(key Key, r rune, mod ModMask)
- func (o *COffScreen) InjectKeyBytes(b []byte) bool
- func (o *COffScreen) InjectMouse(x, y int, buttons ButtonMask, mod ModMask)
- func (o *COffScreen) PollEvent() Event
- func (d *COffScreen) PollEventChan() (next chan Event)
- func (o *COffScreen) PostEvent(ev Event) error
- func (o *COffScreen) PostEventWait(ev Event)
- func (o *COffScreen) RegisterRuneFallback(r rune, subst string)
- func (o *COffScreen) Resize(int, int, int, int)
- func (o *COffScreen) SetCell(x, y int, style paint.Style, ch ...rune)
- func (o *COffScreen) SetContent(x, y int, mc rune, comb []rune, st paint.Style)
- func (o *COffScreen) SetSize(w, h int)
- func (o *COffScreen) SetStyle(style paint.Style)
- func (o *COffScreen) Show()
- func (o *COffScreen) ShowCursor(x, y int)
- func (o *COffScreen) Size() (w, h int)
- func (o *COffScreen) Sync()
- func (o *COffScreen) UnregisterRuneFallback(r rune)
- type COffscreenWindow
- func (w *COffscreenWindow) Draw() enums.EventFlag
- func (w *COffscreenWindow) GetDisplay() Display
- func (w *COffscreenWindow) GetTitle() string
- func (w *COffscreenWindow) Init() bool
- func (w *COffscreenWindow) ProcessEvent(evt Event) enums.EventFlag
- func (w *COffscreenWindow) SetDisplay(d Display)
- func (w *COffscreenWindow) SetTitle(title string)
- type CProperty
- func (p *CProperty) Buildable() bool
- func (p *CProperty) Clone() *CProperty
- func (p *CProperty) Default() (def interface{})
- func (p *CProperty) Name() Property
- func (p *CProperty) ReadOnly() bool
- func (p *CProperty) Set(value interface{}) error
- func (p *CProperty) SetFromString(value string) error
- func (p *CProperty) Type() PropertyType
- func (p *CProperty) Value() (value interface{})
- type CScreen
- func (d *CScreen) Beep() error
- func (d *CScreen) CanDisplay(r rune, checkFallbacks bool) bool
- func (d *CScreen) CharacterSet() string
- func (d *CScreen) Clear()
- func (d *CScreen) Close()
- func (d *CScreen) Colors() int
- func (d *CScreen) DisableMouse()
- func (d *CScreen) DisablePaste()
- func (d *CScreen) EnableGPM()
- func (d *CScreen) EnableMouse(flags ...MouseFlags)
- func (d *CScreen) EnablePaste()
- func (d *CScreen) Export() *CellBuffer
- func (d *CScreen) Fill(r rune, style paint.Style)
- func (d *CScreen) GetContent(x, y int) (rune, []rune, paint.Style, int)
- func (d *CScreen) HasKey(k Key) bool
- func (d *CScreen) HasMouse() bool
- func (d *CScreen) HideCursor()
- func (d *CScreen) Import(cb *CellBuffer)
- func (d *CScreen) Init() error
- func (d *CScreen) InitWithFileHandle(fh *os.File) error
- func (d *CScreen) InitWithFilePath(fp string) error
- func (d *CScreen) PollEvent() Event
- func (d *CScreen) PollEventChan() (next chan Event)
- func (d *CScreen) PostEvent(ev Event) error
- func (d *CScreen) PostEventWait(ev Event)
- func (d *CScreen) RegisterRuneFallback(orig rune, fallback string)
- func (d *CScreen) SetCell(x, y int, style paint.Style, ch ...rune)
- func (d *CScreen) SetContent(x, y int, mc rune, comb []rune, style paint.Style)
- func (d *CScreen) SetStyle(style paint.Style)
- func (d *CScreen) Show()
- func (d *CScreen) ShowCursor(x, y int)
- func (d *CScreen) Size() (w, h int)
- func (d *CScreen) Sync()
- func (d *CScreen) TPuts(s string)
- func (d *CScreen) UnregisterRuneFallback(orig rune)
- type CSignalListener
- type CSignaling
- func (o *CSignaling) Connect(signal Signal, handle string, c SignalListenerFn, data ...interface{})
- func (o *CSignaling) Disconnect(signal Signal, handle string) error
- func (o *CSignaling) Emit(signal Signal, argv ...interface{}) enums.EventFlag
- func (o *CSignaling) Freeze()
- func (o *CSignaling) Handled(signal Signal, handle string) (found bool)
- func (o *CSignaling) Init() (already bool)
- func (o *CSignaling) IsFrozen() bool
- func (o *CSignaling) IsSignalPassed(signal Signal) bool
- func (o *CSignaling) IsSignalStopped(signal Signal) bool
- func (o *CSignaling) PassSignal(signal Signal)
- func (o *CSignaling) ResumeSignal(signal Signal)
- func (o *CSignaling) StopSignal(signal Signal)
- func (o *CSignaling) Thaw()
- type CType
- type CTypeItem
- func (o *CTypeItem) DestroyObject() (err error)
- func (o *CTypeItem) GetName() string
- func (o *CTypeItem) GetTypeTag() TypeTag
- func (o *CTypeItem) Init() (already bool)
- func (o *CTypeItem) InitTypeItem(tag TypeTag, thing interface{}) (already bool)
- func (o *CTypeItem) IsValid() bool
- func (o *CTypeItem) LogDebug(format string, argv ...interface{})
- func (o *CTypeItem) LogErr(err error)
- func (o *CTypeItem) LogError(format string, argv ...interface{})
- func (o *CTypeItem) LogInfo(format string, argv ...interface{})
- func (o *CTypeItem) LogTag() string
- func (o *CTypeItem) LogTrace(format string, argv ...interface{})
- func (o *CTypeItem) LogWarn(format string, argv ...interface{})
- func (o *CTypeItem) ObjectID() uuid.UUID
- func (o *CTypeItem) ObjectName() string
- func (o *CTypeItem) Self() (this interface{})
- func (o *CTypeItem) SetName(name string)
- func (o *CTypeItem) String() string
- type CTypeItemList
- type CTypeRegistry
- func (r *CTypeRegistry) AddType(tag TypeTag, constructor func() interface{}, aliases ...string) error
- func (r *CTypeRegistry) AddTypeAlias(tag TypeTag, aliases ...string)
- func (r *CTypeRegistry) AddTypeItem(tag TypeTag, item interface{}) (id uuid.UUID, err error)
- func (r *CTypeRegistry) GetBuildableInfo() (info map[string]TypeTag)
- func (r *CTypeRegistry) GetType(tag TypeTag) (t Type, ok bool)
- func (r *CTypeRegistry) GetTypeItemByID(id uuid.UUID) interface{}
- func (r *CTypeRegistry) GetTypeItemByName(name string) interface{}
- func (r *CTypeRegistry) GetTypeItems(tag TypeTag) []interface{}
- func (r *CTypeRegistry) GetTypeTagByAlias(alias string) (tt TypeTag, ok bool)
- func (r *CTypeRegistry) GetTypeTags() (tags []TypeTag)
- func (r *CTypeRegistry) HasID(index uuid.UUID) bool
- func (r *CTypeRegistry) HasType(tag TypeTag) (exists bool)
- func (r *CTypeRegistry) MakeType(tag TypeTag) (thing interface{}, err error)
- func (r *CTypeRegistry) RemoveTypeItem(tag TypeTag, item TypeItem) error
- type CTypeTag
- type CWindow
- func (w *CWindow) Destroy()
- func (w *CWindow) Draw() enums.EventFlag
- func (w *CWindow) GetDisplay() Display
- func (w *CWindow) GetTitle() string
- func (w *CWindow) Init() bool
- func (w *CWindow) ProcessEvent(evt Event) enums.EventFlag
- func (w *CWindow) SetDisplay(d Display)
- func (w *CWindow) SetTitle(title string)
- type CellBuffer
- func (cb *CellBuffer) Dirty(x, y int) bool
- func (cb *CellBuffer) Fill(r rune, style paint.Style)
- func (cb *CellBuffer) GetCell(x, y int) (mainc rune, combc []rune, style paint.Style, width int)
- func (cb *CellBuffer) Invalidate()
- func (cb *CellBuffer) Resize(w, h int)
- func (cb *CellBuffer) SetCell(x int, y int, mainc rune, combc []rune, style paint.Style)
- func (cb *CellBuffer) SetDirty(x, y int, dirty bool)
- func (cb *CellBuffer) Size() (w, h int)
- type Config
- type Display
- type DisplayCallbackFn
- type DisplayInitFn
- type DisplayManagerFn
- type EncodingFallback
- type Event
- type EventError
- type EventHandler
- type EventInterrupt
- type EventKey
- type EventMask
- type EventMouse
- func (ev *EventMouse) Button() ButtonMask
- func (ev *EventMouse) ButtonHas(check ButtonMask) bool
- func (ev *EventMouse) ButtonPressed() ButtonMask
- func (ev *EventMouse) Buttons() ButtonMask
- func (ev *EventMouse) Clone() Event
- func (ev *EventMouse) CloneForPosition(x, y int) Event
- func (ev *EventMouse) IsDragStarted() bool
- func (ev *EventMouse) IsDragStopped() bool
- func (ev *EventMouse) IsDragging() bool
- func (ev *EventMouse) IsMoving() bool
- func (ev *EventMouse) IsPressed() bool
- func (ev *EventMouse) IsReleased() bool
- func (ev *EventMouse) IsWheelImpulse() bool
- func (ev *EventMouse) Modifiers() ModMask
- func (ev *EventMouse) Position() (x, y int)
- func (ev *EventMouse) Report() string
- func (ev *EventMouse) State() MouseState
- func (ev *EventMouse) StateHas(check MouseState) bool
- func (ev *EventMouse) WheelImpulse() ButtonMask
- func (ev *EventMouse) When() time.Time
- type EventPaste
- type EventResize
- type EventTime
- type IButtonMask
- type IMouseState
- type Key
- type MetaData
- type ModMask
- type MouseFlags
- type MouseState
- type Object
- type OffScreen
- type OffscreenCell
- type OffscreenWindow
- type Property
- type PropertyType
- type Screen
- type ScreenStateReq
- type Sensitive
- type Signal
- type SignalListenerData
- type SignalListenerFn
- type Signaling
- type TimerCallbackFn
- type Type
- type TypeItem
- type TypeRegistry
- type TypeTag
- type Window
Constants ¶
const ( TypeDisplayManager CTypeTag = "cdk-display-manager" SignalDisplayInit Signal = "display-init" SignalDisplayCaptured Signal = "display-captured" SignalInterrupt Signal = "sigint" SignalEvent Signal = "event" SignalEventError Signal = "event-error" SignalEventKey Signal = "event-key" SignalEventMouse Signal = "event-mouse" SignalEventResize Signal = "event-resize" SignalSetEventFocus Signal = "set-event-focus" )
const ( // EncodingFallbackFail behavior causes GetEncoding to fail // when it cannot find an encoding. EncodingFallbackFail = iota // EncodingFallbackASCII behaviore causes GetEncoding to fall back // to a 7-bit ASCII encoding, if no other encoding can be found. EncodingFallbackASCII // EncodingFallbackUTF8 behavior causes GetEncoding to assume // UTF8 can pass unmodified upon failure. Note that this behavior // is not recommended, unless you are sure your terminal can cope // with real UTF8 sequences. EncodingFallbackUTF8 )
const ( KeyBackspace = KeyBS KeyTab = KeyTAB KeyEsc = KeyESC KeyEscape = KeyESC KeyEnter = KeyCR KeyBackspace2 = KeyDEL )
These keys are aliases for other names.
const ( TypeMetaData CTypeTag = "cdk-metadata" SignalSetProperty Signal = "set-property" )
const ( MouseButtonEvents = MouseFlags(1) // Click events only MouseDragEvents = MouseFlags(2) // Click-drag events (includes button events) MouseMotionEvents = MouseFlags(4) // All mouse events (includes click and drag events) )
const ( TypeSignaling CTypeTag = "cdk-signaling" SignalSignalingInit Signal = "signaling-init" )
const ( TypeWindow CTypeTag = "cdk-window" SignalDraw Signal = "draw" SignalSetTitle Signal = "set-title" SignalSetDisplay Signal = "set-display" )
const ObjectSetPropertyHandle = "object-set-property-handle"
const OffscreenTtyPath = "<offscreen>"
Variables ¶
var ( // DisplayCallQueueCapacity limits the number of concurrent calls on the main thread DisplayCallQueueCapacity = 16 // DisplayStartupDelay is the delay for triggering screen resize events during initialization DisplayStartupDelay = time.Millisecond * 128 )
Global configuration variables
var ( // ErrTermNotFound indicates that a suitable terminal entry could // not be found. This can result from either not having TERM set, // or from the TERM failing to support certain minimal functionality, // in particular absolute cursor addressability (the cup capability) // is required. For example, legacy "adm3" lacks this capability, // whereas the slightly newer "adm3a" supports it. This failure // occurs most often with "dumb". ErrTermNotFound = terminfo.ErrTermNotFound // ErrNoDisplay indicates that no suitable display could be found. // This may result from attempting to run on a platform where there // is no support for either termios or console I/O (such as nacl), // or from running in an environment where there is no access to // a suitable console/terminal device. (For example, running on // without a controlling TTY or with no /dev/tty on POSIX platforms.) ErrNoDisplay = errors.New("no suitable display available") // ErrNoCharset indicates that the locale environment the // program is not supported by the program, because no suitable // encoding was found for it. This problem never occurs if // the environment is UTF-8 or UTF-16. ErrNoCharset = errors.New("character set not supported") // ErrEventQFull indicates that the event queue is full, and // cannot accept more events. ErrEventQFull = errors.New("event queue full") )
var ( EventQueueSize = 10 EventKeyQueueSize = 10 EventKeyTiming = time.Millisecond * 50 SignalQueueSize = 10 )
var Build = Config{ Profiling: false, LogFile: false, LogFormat: false, LogFullPaths: false, LogLevel: false, LogLevels: false, LogTimestamps: false, LogTimestampFormat: false, LogOutput: false, }
var (
DefaultGoProfilePath = os.TempDir() + string(os.PathSeparator) + "cdk.pprof"
)
var KeyNames = map[Key]string{}/* 118 elements not displayed */
KeyNames holds the written names of special keys. Useful to echo back a key name, or to look up a key from a string value.
var (
MOUSE_STATES map[MouseState]string = map[MouseState]string{
MOUSE_NONE: "None",
MOUSE_MOVE: "Move",
BUTTON_PRESS: "Pressed",
BUTTON_RELEASE: "Released",
WHEEL_PULSE: "Impulse",
DRAG_START: "DragStart",
DRAG_MOVE: "DragMove",
DRAG_STOP: "DragStop",
}
)
var (
TypesManager = NewTypeRegistry()
)
Functions ¶
func AddTimeout ¶
func AddTimeout(delay time.Duration, fn TimerCallbackFn) (id uuid.UUID)
func CancelAllTimeouts ¶
func CancelAllTimeouts()
func DescribeButton ¶
func DescribeButton(button ButtonMask) string
func GetEncoding ¶
GetEncoding is used by Display implementors who want to locate an encoding for the given character set name. Note that this will return nil for either the Unicode (UTF-8) or ASCII encodings, since we don't use encodings for them but instead have our own native methods.
func ListEncodings ¶
func ListEncodings() []string
func LookupKeyName ¶
func RegisterEncoding ¶
RegisterEncoding may be called by the application to register an encoding. The presence of additional encodings will facilitate application usage with terminal environments where the I/O subsystem does not support Unicode.
Windows systems use Unicode natively, and do not need any of the encoding subsystem when using Windows Console screens.
Please see the Go documentation for golang.org/x/text/encoding -- most of the common ones exist already as stock variables. For example, ISO8859-15 can be registered using the following code:
import "golang.org/x/text/encoding/charmap" ... RegisterEncoding("ISO8859-15", charmap.ISO8859_15)
Aliases can be registered as well, for example "8859-15" could be an alias for "ISO8859-15".
For POSIX systems, the cdk package will check the environment variables LC_ALL, LC_CTYPE, and LANG (in that order) to determine the character set. These are expected to have the following pattern:
$language[.$codeset[@$variant]
We extract only the $codeset part, which will usually be something like UTF-8 or ISO8859-15 or KOI8-R. Note that if the locale is either "POSIX" or "C", then we assume US-ASCII (the POSIX 'portable character set' and assume all other characters are somehow invalid.)
Modern POSIX systems and terminal emulators may use UTF-8, and for those systems, this API is also unnecessary. For example, Darwin (MacOS X) and modern Linux running modern xterm generally will out of the box without any of this. Use of UTF-8 is recommended when possible, as it saves quite a lot processing overhead.
Note that some encodings are quite large (for example GB18030 which is a superset of Unicode) and so the application size can be expected ot increase quite a bit as each encoding is added. The East Asian encodings have been seen to add 100-200K per encoding to the application size.
func SetEncodingFallback ¶
func SetEncodingFallback(fb EncodingFallback)
SetEncodingFallback changes the behavior of GetEncoding when a suitable encoding is not found. The default is EncodingFallbackFail, which causes GetEncoding to simply return nil.
func StopTimeout ¶
func TestingMakesNoContent ¶
func UnregisterEncoding ¶
func UnregisterEncoding(charset string)
func WithApp ¶
func WithApp(initFn DisplayInitFn, action AppFn) func()
func WithDisplayManager ¶
func WithDisplayManager(action DisplayManagerFn) func()
Types ¶
type App ¶
type App interface { GetContext() *cli.Context Tag() string Title() string Name() string Usage() string Description() string Display() *CDisplay CLI() *cli.App Version() string SetupDisplay() InitUI() error AddFlag(f cli.Flag) AddCommand(c *cli.Command) Run(args []string) error MainActionFn(c *cli.Context) error }
type AppContext ¶
func GetLocalContext ¶
func GetLocalContext() (ac *AppContext, err error)
type ButtonMask ¶
type ButtonMask int16
ButtonMask is a mask of mouse buttons and wheel events. Mouse button presses are normally delivered as both press and release events. Mouse wheel events are normally just single impulse events. Windows supports up to eight separate buttons plus all four wheel directions, but XTerm can only support mouse buttons 1-3 and wheel up/down. Its not unheard of for terminals to support only one or two buttons (think Macs). Old terminals, and true emulations (such as vt100) won't support mice at all, of course.
const ( Button1 ButtonMask = 1 << iota // Usually left mouse button. Button2 // Usually the middle mouse button. Button3 // Usually the right mouse button. Button4 // Often a side button (thumb/next). Button5 // Often a side button (thumb/prev). Button6 Button7 Button8 WheelUp // Wheel motion up/away from user. WheelDown // Wheel motion down/towards user. WheelLeft // Wheel motion to left. WheelRight // Wheel motion to right. LastButtonMask // Highest mask value ButtonNone ButtonMask = 0 // No button or wheel events. ButtonPrimary = Button1 ButtonSecondary = Button2 ButtonMiddle = Button3 )
These are the actual button values. Note that tcell version 1.x reversed buttons two and three on *nix based terminals. We use button 1 as the primary, and button 2 as the secondary, and button 3 (which is often missing) as the middle.
func (ButtonMask) Clear ¶
func (i ButtonMask) Clear(m ButtonMask) ButtonMask
return a button mask with the given flags cleared, does not modify itself
func (ButtonMask) Has ¶
func (i ButtonMask) Has(m ButtonMask) bool
check if the mask has the given flag(s)
func (ButtonMask) Set ¶
func (i ButtonMask) Set(m ButtonMask) ButtonMask
return a button mask with the given flags set, does not modify itself
func (ButtonMask) String ¶
func (i ButtonMask) String() string
func (ButtonMask) Toggle ¶
func (i ButtonMask) Toggle(m ButtonMask) ButtonMask
return a button mask with the give flags reversed, does not modify itself
type CApp ¶
type CApp struct {
// contains filtered or unexported fields
}
func NewApp ¶
func NewApp(name, usage, description, version, tag, title, ttyPath string, initFn DisplayInitFn) *CApp
func (*CApp) AddCommand ¶
func (app *CApp) AddCommand(command *cli.Command)
func (*CApp) AddCommands ¶
func (app *CApp) AddCommands(commands []*cli.Command)
func (*CApp) Description ¶
func (*CApp) GetContext ¶
func (app *CApp) GetContext() *cli.Context
func (*CApp) MainActionFn ¶
func (*CApp) SetupDisplay ¶
func (app *CApp) SetupDisplay()
type CAppServer ¶
type CAppServer struct {
// contains filtered or unexported fields
}
func NewAppServer ¶
func NewAppServer(name, usage, description, version, tag, title string, clientInitFn DisplayInitFn, serverInitFn DisplayInitFn, htpasswdPath, privateKeyPath string) *CAppServer
func (*CAppServer) App ¶
func (s *CAppServer) App() *CApp
func (*CAppServer) Daemon ¶
func (s *CAppServer) Daemon() (err error)
func (*CAppServer) Display ¶
func (s *CAppServer) Display() *CDisplay
func (*CAppServer) GetClient ¶
func (s *CAppServer) GetClient(id uuid.UUID) (*cAppServerClient, error)
func (*CAppServer) GetClients ¶
func (s *CAppServer) GetClients() (clients []uuid.UUID)
func (*CAppServer) GetListenAddress ¶
func (s *CAppServer) GetListenAddress() (address string)
func (*CAppServer) GetListenPort ¶
func (s *CAppServer) GetListenPort() (port int)
func (*CAppServer) Init ¶
func (s *CAppServer) Init()
func (*CAppServer) SetListenAddress ¶
func (s *CAppServer) SetListenAddress(address string)
func (*CAppServer) SetListenPort ¶
func (s *CAppServer) SetListenPort(port int)
func (*CAppServer) Start ¶
func (s *CAppServer) Start() (err error)
func (*CAppServer) Stop ¶
func (s *CAppServer) Stop() (err error)
type CDisplay ¶
type CDisplay struct { CObject // contains filtered or unexported fields }
Basic display type
func GetDefaultDisplay ¶
func GetDefaultDisplay() (dm *CDisplay)
GetDefaultDisplay returns the default display for the current app context
func NewDisplay ¶
func NewDisplayWithHandle ¶
func (*CDisplay) ActiveWindow ¶
func (*CDisplay) AddQuitHandler ¶
func (*CDisplay) AddWindowOverlay ¶
func (*CDisplay) AsyncCall ¶
func (d *CDisplay) AsyncCall(fn DisplayCallbackFn) error
AsyncCall - run given function on the UI (main) thread, non-blocking
func (*CDisplay) AwaitCall ¶
func (d *CDisplay) AwaitCall(fn DisplayCallbackFn) error
AwaitCall - run given function on the UI (main) thread, blocking
func (*CDisplay) CaptureCtrlC ¶
func (d *CDisplay) CaptureCtrlC()
func (*CDisplay) CaptureDisplay ¶
func (*CDisplay) DefaultTheme ¶
func (*CDisplay) DisplayCaptured ¶
func (*CDisplay) DrawScreen ¶
func (*CDisplay) GetEventFocus ¶
func (d *CDisplay) GetEventFocus() (widget interface{})
func (*CDisplay) GetPriorEvent ¶
func (*CDisplay) GetTtyHandle ¶
func (*CDisplay) GetTtyPath ¶
func (*CDisplay) GetWindowOverlayRegion ¶
func (*CDisplay) GetWindowOverlays ¶
func (*CDisplay) GetWindowTopOverlay ¶
func (*CDisplay) GetWindows ¶
func (*CDisplay) IsMonochrome ¶
func (*CDisplay) ReleaseCtrlC ¶
func (d *CDisplay) ReleaseCtrlC()
func (*CDisplay) ReleaseDisplay ¶
func (d *CDisplay) ReleaseDisplay()
func (*CDisplay) RemoveQuitHandler ¶
func (*CDisplay) RemoveWindow ¶
func (*CDisplay) RemoveWindowOverlay ¶
func (*CDisplay) RequestDraw ¶
func (d *CDisplay) RequestDraw()
func (*CDisplay) RequestQuit ¶
func (d *CDisplay) RequestQuit()
func (*CDisplay) RequestShow ¶
func (d *CDisplay) RequestShow()
func (*CDisplay) RequestSync ¶
func (d *CDisplay) RequestSync()
func (*CDisplay) SetActiveWindow ¶
func (*CDisplay) SetEventFocus ¶
func (*CDisplay) SetTtyHandle ¶
func (*CDisplay) SetTtyPath ¶
type CMetaData ¶
type CMetaData struct { CSignaling // contains filtered or unexported fields }
func (*CMetaData) GetBoolProperty ¶
func (*CMetaData) GetColorProperty ¶
func (*CMetaData) GetFloat64Property ¶
func (*CMetaData) GetFloatProperty ¶
func (*CMetaData) GetIntProperty ¶
func (*CMetaData) GetPointProperty ¶
func (*CMetaData) GetProperty ¶
func (*CMetaData) GetRectangleProperty ¶
func (*CMetaData) GetRegionProperty ¶
func (*CMetaData) GetStringProperty ¶
func (*CMetaData) GetStructProperty ¶
func (*CMetaData) GetStyleProperty ¶
func (*CMetaData) GetThemeProperty ¶
func (*CMetaData) InstallBuildableProperty ¶
func (o *CMetaData) InstallBuildableProperty(name Property, kind PropertyType, write bool, def interface{}) error
func (*CMetaData) InstallProperty ¶
func (o *CMetaData) InstallProperty(name Property, kind PropertyType, write bool, def interface{}) error
func (*CMetaData) IsBuildableProperty ¶
func (*CMetaData) IsProperty ¶
func (*CMetaData) ListBuildableProperties ¶
func (*CMetaData) ListProperties ¶
func (*CMetaData) OverloadProperty ¶
func (*CMetaData) SetBoolProperty ¶
func (*CMetaData) SetColorProperty ¶
func (*CMetaData) SetFloatProperty ¶
func (*CMetaData) SetIntProperty ¶
func (*CMetaData) SetPointProperty ¶
func (*CMetaData) SetProperties ¶
func (*CMetaData) SetProperty ¶
func (*CMetaData) SetPropertyFromString ¶
func (*CMetaData) SetRectangleProperty ¶
func (*CMetaData) SetRegionProperty ¶
func (*CMetaData) SetStringProperty ¶
func (*CMetaData) SetStructProperty ¶
func (*CMetaData) SetStyleProperty ¶
type CObject ¶
type CObject struct {
CMetaData
}
func (*CObject) GetThemeRequest ¶
func (*CObject) InitWithProperties ¶
func (*CObject) SetThemeRequest ¶
type COffScreen ¶
func (*COffScreen) Beep ¶
func (o *COffScreen) Beep() error
func (*COffScreen) CanDisplay ¶
func (o *COffScreen) CanDisplay(r rune, checkFallbacks bool) bool
func (*COffScreen) CharacterSet ¶
func (o *COffScreen) CharacterSet() string
func (*COffScreen) Clear ¶
func (o *COffScreen) Clear()
func (*COffScreen) Close ¶
func (o *COffScreen) Close()
func (*COffScreen) Colors ¶
func (o *COffScreen) Colors() int
func (*COffScreen) DisableMouse ¶
func (o *COffScreen) DisableMouse()
func (*COffScreen) DisablePaste ¶
func (o *COffScreen) DisablePaste()
func (*COffScreen) EnableMouse ¶
func (o *COffScreen) EnableMouse(_ ...MouseFlags)
func (*COffScreen) EnablePaste ¶
func (o *COffScreen) EnablePaste()
func (*COffScreen) Export ¶
func (o *COffScreen) Export() *CellBuffer
func (*COffScreen) GetContent ¶
func (*COffScreen) GetContents ¶
func (o *COffScreen) GetContents() ([]OffscreenCell, int, int)
func (*COffScreen) HasKey ¶
func (o *COffScreen) HasKey(Key) bool
func (*COffScreen) HasMouse ¶
func (o *COffScreen) HasMouse() bool
func (*COffScreen) HideCursor ¶
func (o *COffScreen) HideCursor()
func (*COffScreen) Import ¶
func (o *COffScreen) Import(cb *CellBuffer)
func (*COffScreen) Init ¶
func (o *COffScreen) Init() error
func (*COffScreen) InitWithFileHandle ¶
func (o *COffScreen) InitWithFileHandle(ttyHandle *os.File) (err error)
func (*COffScreen) InitWithFilePath ¶
func (o *COffScreen) InitWithFilePath(ttyFile string) (err error)
func (*COffScreen) InjectKeyBytes ¶
func (o *COffScreen) InjectKeyBytes(b []byte) bool
func (*COffScreen) InjectMouse ¶
func (o *COffScreen) InjectMouse(x, y int, buttons ButtonMask, mod ModMask)
func (*COffScreen) PollEvent ¶
func (o *COffScreen) PollEvent() Event
func (*COffScreen) PollEventChan ¶
func (d *COffScreen) PollEventChan() (next chan Event)
func (*COffScreen) PostEvent ¶
func (o *COffScreen) PostEvent(ev Event) error
func (*COffScreen) PostEventWait ¶
func (o *COffScreen) PostEventWait(ev Event)
func (*COffScreen) RegisterRuneFallback ¶
func (o *COffScreen) RegisterRuneFallback(r rune, subst string)
func (*COffScreen) SetContent ¶
func (*COffScreen) SetSize ¶
func (o *COffScreen) SetSize(w, h int)
func (*COffScreen) SetStyle ¶
func (o *COffScreen) SetStyle(style paint.Style)
func (*COffScreen) Show ¶
func (o *COffScreen) Show()
func (*COffScreen) ShowCursor ¶
func (o *COffScreen) ShowCursor(x, y int)
func (*COffScreen) Size ¶
func (o *COffScreen) Size() (w, h int)
func (*COffScreen) Sync ¶
func (o *COffScreen) Sync()
func (*COffScreen) UnregisterRuneFallback ¶
func (o *COffScreen) UnregisterRuneFallback(r rune)
type COffscreenWindow ¶
type COffscreenWindow struct { CObject // contains filtered or unexported fields }
Basic window type
func (*COffscreenWindow) Draw ¶
func (w *COffscreenWindow) Draw() enums.EventFlag
func (*COffscreenWindow) GetDisplay ¶
func (w *COffscreenWindow) GetDisplay() Display
func (*COffscreenWindow) GetTitle ¶
func (w *COffscreenWindow) GetTitle() string
func (*COffscreenWindow) Init ¶
func (w *COffscreenWindow) Init() bool
func (*COffscreenWindow) ProcessEvent ¶
func (w *COffscreenWindow) ProcessEvent(evt Event) enums.EventFlag
func (*COffscreenWindow) SetDisplay ¶
func (w *COffscreenWindow) SetDisplay(d Display)
func (*COffscreenWindow) SetTitle ¶
func (w *COffscreenWindow) SetTitle(title string)
type CProperty ¶
type CProperty struct {
// contains filtered or unexported fields
}
func NewProperty ¶
func NewProperty(name Property, kind PropertyType, write bool, buildable bool, def interface{}) (property *CProperty)
func (*CProperty) SetFromString ¶
func (*CProperty) Type ¶
func (p *CProperty) Type() PropertyType
type CScreen ¶
CScreen represents a screen backed by a terminfo implementation.
func (*CScreen) CharacterSet ¶
func (*CScreen) DisableMouse ¶
func (d *CScreen) DisableMouse()
func (*CScreen) DisablePaste ¶
func (d *CScreen) DisablePaste()
func (*CScreen) EnableMouse ¶
func (d *CScreen) EnableMouse(flags ...MouseFlags)
func (*CScreen) EnablePaste ¶
func (d *CScreen) EnablePaste()
func (*CScreen) Export ¶
func (d *CScreen) Export() *CellBuffer
func (*CScreen) GetContent ¶
func (*CScreen) HideCursor ¶
func (d *CScreen) HideCursor()
func (*CScreen) Import ¶
func (d *CScreen) Import(cb *CellBuffer)
func (*CScreen) InitWithFilePath ¶
func (*CScreen) PollEventChan ¶
func (*CScreen) PostEventWait ¶
func (*CScreen) RegisterRuneFallback ¶
func (*CScreen) SetContent ¶
func (*CScreen) ShowCursor ¶
func (*CScreen) UnregisterRuneFallback ¶
type CSignalListener ¶
type CSignalListener struct {
// contains filtered or unexported fields
}
type CSignaling ¶
type CSignaling struct { CTypeItem // contains filtered or unexported fields }
func (*CSignaling) Connect ¶
func (o *CSignaling) Connect(signal Signal, handle string, c SignalListenerFn, data ...interface{})
Connect callback to signal, identified by handle
func (*CSignaling) Disconnect ¶
func (o *CSignaling) Disconnect(signal Signal, handle string) error
Disconnect callback from signal identified by handle
func (*CSignaling) Emit ¶
func (o *CSignaling) Emit(signal Signal, argv ...interface{}) enums.EventFlag
Emit a signal event to all connected listener callbacks
func (*CSignaling) Freeze ¶
func (o *CSignaling) Freeze()
func (*CSignaling) Handled ¶
func (o *CSignaling) Handled(signal Signal, handle string) (found bool)
func (*CSignaling) Init ¶
func (o *CSignaling) Init() (already bool)
func (*CSignaling) IsFrozen ¶
func (o *CSignaling) IsFrozen() bool
func (*CSignaling) IsSignalPassed ¶
func (o *CSignaling) IsSignalPassed(signal Signal) bool
func (*CSignaling) IsSignalStopped ¶
func (o *CSignaling) IsSignalStopped(signal Signal) bool
func (*CSignaling) PassSignal ¶
func (o *CSignaling) PassSignal(signal Signal)
func (*CSignaling) ResumeSignal ¶
func (o *CSignaling) ResumeSignal(signal Signal)
Enable propagation of the given signal
func (*CSignaling) StopSignal ¶
func (o *CSignaling) StopSignal(signal Signal)
Disable propagation of the given signal
func (*CSignaling) Thaw ¶
func (o *CSignaling) Thaw()
type CTypeItem ¶
func (*CTypeItem) DestroyObject ¶
func (*CTypeItem) GetTypeTag ¶
func (*CTypeItem) InitTypeItem ¶
func (*CTypeItem) ObjectName ¶
type CTypeItemList ¶
type CTypeItemList []TypeItem
func (CTypeItemList) Index ¶
func (t CTypeItemList) Index(item TypeItem) int
type CTypeRegistry ¶
func (*CTypeRegistry) AddType ¶
func (r *CTypeRegistry) AddType(tag TypeTag, constructor func() interface{}, aliases ...string) error
func (*CTypeRegistry) AddTypeAlias ¶
func (r *CTypeRegistry) AddTypeAlias(tag TypeTag, aliases ...string)
func (*CTypeRegistry) AddTypeItem ¶
func (r *CTypeRegistry) AddTypeItem(tag TypeTag, item interface{}) (id uuid.UUID, err error)
func (*CTypeRegistry) GetBuildableInfo ¶
func (r *CTypeRegistry) GetBuildableInfo() (info map[string]TypeTag)
func (*CTypeRegistry) GetTypeItemByID ¶
func (r *CTypeRegistry) GetTypeItemByID(id uuid.UUID) interface{}
func (*CTypeRegistry) GetTypeItemByName ¶
func (r *CTypeRegistry) GetTypeItemByName(name string) interface{}
func (*CTypeRegistry) GetTypeItems ¶
func (r *CTypeRegistry) GetTypeItems(tag TypeTag) []interface{}
func (*CTypeRegistry) GetTypeTagByAlias ¶
func (r *CTypeRegistry) GetTypeTagByAlias(alias string) (tt TypeTag, ok bool)
func (*CTypeRegistry) GetTypeTags ¶
func (r *CTypeRegistry) GetTypeTags() (tags []TypeTag)
func (*CTypeRegistry) HasType ¶
func (r *CTypeRegistry) HasType(tag TypeTag) (exists bool)
func (*CTypeRegistry) MakeType ¶
func (r *CTypeRegistry) MakeType(tag TypeTag) (thing interface{}, err error)
func (*CTypeRegistry) RemoveTypeItem ¶
func (r *CTypeRegistry) RemoveTypeItem(tag TypeTag, item TypeItem) error
type CTypeTag ¶
type CTypeTag string
denotes a concrete type identity
const (
TypeNil CTypeTag = ""
)
const TypeObject CTypeTag = "cdk-object"
const (
TypeOffscreenWindow CTypeTag = "cdk-offscreen-window"
)
func (CTypeTag) GladeString ¶
returns a string representation of this type tag, translated for Gtk class naming conventions (ie: GtkCamelCase)
type CWindow ¶
type CWindow struct { CObject // contains filtered or unexported fields }
Basic window type
func (*CWindow) GetDisplay ¶
func (*CWindow) SetDisplay ¶
type CellBuffer ¶
CellBuffer represents a two dimensional array of character cells. This is primarily intended for use by Screen implementors; it contains much of the common code they need. To create one, just declare a variable of its type; no explicit initialization is necessary.
CellBuffer should be thread safe, original tcell is not.
func NewCellBuffer ¶
func NewCellBuffer() *CellBuffer
func (*CellBuffer) Dirty ¶
func (cb *CellBuffer) Dirty(x, y int) bool
Dirty checks if a character at the given location needs an to be refreshed on the physical display. This returns true if the cell content is different since the last time it was marked clean.
func (*CellBuffer) Fill ¶
func (cb *CellBuffer) Fill(r rune, style paint.Style)
Fill fills the entire cell buffer array with the specified character and style. Normally choose ' ' to clear the display. This API doesn't support combining characters, or characters with a width larger than one.
func (*CellBuffer) GetCell ¶
GetCell returns the contents of a character cell, including the primary rune, any combining character runes (which will usually be nil), the style, and the display width in cells. (The width can be either 1, normally, or 2 for East Asian full-width characters.)
func (*CellBuffer) Invalidate ¶
func (cb *CellBuffer) Invalidate()
Invalidate marks all characters within the buffer as dirty.
func (*CellBuffer) Resize ¶
func (cb *CellBuffer) Resize(w, h int)
Resize is used to resize the cells array, with different dimensions, while preserving the original contents. The cells will be invalidated so that they can be redrawn.
func (*CellBuffer) SetCell ¶
SetCell sets the contents (primary rune, combining runes, and style) for a cell at a given location.
func (*CellBuffer) SetDirty ¶
func (cb *CellBuffer) SetDirty(x, y int, dirty bool)
SetDirty is normally used to indicate that a cell has been displayed (in which case dirty is false), or to manually force a cell to be marked dirty.
func (*CellBuffer) Size ¶
func (cb *CellBuffer) Size() (w, h int)
Size returns the (width, height) in cells of the buffer.
type Display ¶
type Display interface { Object Init() (already bool) Destroy() GetTitle() string SetTitle(title string) GetTtyPath() string SetTtyPath(ttyPath string) GetTtyHandle() *os.File SetTtyHandle(ttyHandle *os.File) Screen() Screen DisplayCaptured() bool CaptureDisplay() (err error) ReleaseDisplay() IsMonochrome() bool Colors() (numberOfColors int) CaptureCtrlC() ReleaseCtrlC() DefaultTheme() paint.Theme ActiveWindow() Window SetActiveWindow(w Window) AddWindow(w Window) RemoveWindow(wid uuid.UUID) AddWindowOverlay(pid uuid.UUID, overlay Window, region ptypes.Region) RemoveWindowOverlay(pid, oid uuid.UUID) GetWindows() (windows []Window) GetWindowOverlays(id uuid.UUID) (windows []Window) GetWindowTopOverlay(id uuid.UUID) (window Window) GetWindowOverlayRegion(windowId, overlayId uuid.UUID) (region ptypes.Region) SetWindowOverlayRegion(windowId, overlayId uuid.UUID, region ptypes.Region) App() *CApp SetEventFocus(widget interface{}) error GetEventFocus() (widget interface{}) GetPriorEvent() (event Event) ProcessEvent(evt Event) enums.EventFlag DrawScreen() enums.EventFlag RequestDraw() RequestShow() RequestSync() RequestQuit() AsyncCall(fn DisplayCallbackFn) error AwaitCall(fn DisplayCallbackFn) error PostEvent(evt Event) error AddQuitHandler(tag string, fn func()) RemoveQuitHandler(tag string) Run() error IsRunning() bool }
type DisplayCallbackFn ¶
type DisplayInitFn ¶
type DisplayManagerFn ¶
type DisplayManagerFn func(d Display)
type EncodingFallback ¶
type EncodingFallback int
EncodingFallback describes how the system behavees when the locale requires a character set that we do not support. The system always supports UTF-8 and US-ASCII. On Windows consoles, UTF-16LE is also supported automatically. Other character sets must be added using the RegisterEncoding API. (A large group of nearly all of them can be added using the RegisterAll function in the encoding sub package.)
type EventError ¶
type EventError struct {
// contains filtered or unexported fields
}
An EventError is an event representing some sort of error, and carries an error payload.
func NewEventError ¶
func NewEventError(err error) *EventError
NewEventError creates an ErrorEvent with the given error payload.
func (*EventError) Clone ¶
func (ev *EventError) Clone() *EventError
func (*EventError) Err ¶
func (ev *EventError) Err() error
func (*EventError) When ¶
func (ev *EventError) When() time.Time
When returns the time when the event was created.
type EventHandler ¶
EventHandler is anything that handles events. If the handler has consumed the event, it should return true. False otherwise.
type EventInterrupt ¶
type EventInterrupt struct {
// contains filtered or unexported fields
}
EventInterrupt is a generic wakeup event. Its can be used to to request a redraw. It can carry an arbitrary payload, as well.
func NewEventInterrupt ¶
func NewEventInterrupt(data interface{}) *EventInterrupt
NewEventInterrupt creates an EventInterrupt with the given payload.
func (*EventInterrupt) Data ¶
func (ev *EventInterrupt) Data() interface{}
Data is used to obtain the opaque event payload.
func (*EventInterrupt) When ¶
func (ev *EventInterrupt) When() time.Time
When returns the time when this event was created.
type EventKey ¶
type EventKey struct {
// contains filtered or unexported fields
}
EventKey represents a key press. Usually this is a key press followed by a key release, but since terminal programs don't have a way to report key release events, we usually get just one event. If a key is held down then the terminal may synthesize repeated key presses at some predefined rate. We have no control over that, nor visibility into it.
In some cases, we can have a modifier key, such as ModAlt, that can be generated with a key press. (This usually is represented by having the high bit set, or in some cases, by sending an ESC prior to the rune.)
If the value of Key() is KeyRune, then the actual key value will be available with the Rune() method. This will be the case for most keys. In most situations, the modifiers will not be set. For example, if the rune is 'A', this will be reported without the ModShift bit set, since really can't tell if the Shift key was pressed (it might have been CAPSLOCK, or a terminal that only can send capitals, or keyboard with separate capital letters from lower case letters).
Generally, terminal applications have far less visibility into keyboard activity than graphical applications. Hence, they should avoid depending overly much on availability of modifiers, or the availability of any specific keys.
func NewEventKey ¶
NewEventKey attempts to create a suitable event. It parses the various ASCII control sequences if KeyRune is passed for Key, but if the caller has more precise information it should set that specifically. Callers that aren't sure about modifier state (most) should just pass ModNone.
func (*EventKey) Key ¶
Key returns a virtual key code. We use this to identify specific key codes, such as KeyEnter, etc. Most control and function keys are reported with unique Key values. Normal alphanumeric and punctuation keys will generally return KeyRune here; the specific key can be further decoded using the Rune() function.
func (*EventKey) Modifiers ¶
Modifiers returns the modifiers that were present with the key press. Note that not all platforms and terminals support this equally well, and some cases we will not not know for sure. Hence, applications should avoid using this in most circumstances.
func (*EventKey) Name ¶
Name returns a printable value or the key stroke. This can be used when printing the event, for example.
type EventMouse ¶
type EventMouse struct {
// contains filtered or unexported fields
}
EventMouse is a mouse event. It is sent on either mouse up or mouse down events. It is also sent on mouse motion events - if the terminal supports it. We make every effort to ensure that mouse release events are delivered. Hence, click drag can be identified by a motion event with the mouse down, without any intervening button release. On some terminals only the initiating press and terminating release event will be delivered.
Mouse wheel events, when reported, may appear on their own as individual impulses; that is, there will normally not be a release event delivered for mouse wheel movements.
Most terminals cannot report the state of more than one button at a time -- and some cannot report motion events unless a button is pressed.
Applications can inspect the time between events to resolve double or triple clicks.
func NewEventMouse ¶
func NewEventMouse(x, y int, btn ButtonMask, mod ModMask) *EventMouse
NewEventMouse is used to create a new mouse event. Applications shouldn't need to use this; its mostly for display implementors.
func (*EventMouse) Button ¶
func (ev *EventMouse) Button() ButtonMask
func (*EventMouse) ButtonHas ¶
func (ev *EventMouse) ButtonHas(check ButtonMask) bool
func (*EventMouse) ButtonPressed ¶
func (ev *EventMouse) ButtonPressed() ButtonMask
func (*EventMouse) Buttons ¶
func (ev *EventMouse) Buttons() ButtonMask
Buttons returns the list of buttons that were pressed or wheel motions.
func (*EventMouse) Clone ¶
func (ev *EventMouse) Clone() Event
func (*EventMouse) CloneForPosition ¶
func (ev *EventMouse) CloneForPosition(x, y int) Event
func (*EventMouse) IsDragStarted ¶
func (ev *EventMouse) IsDragStarted() bool
func (*EventMouse) IsDragStopped ¶
func (ev *EventMouse) IsDragStopped() bool
func (*EventMouse) IsDragging ¶
func (ev *EventMouse) IsDragging() bool
func (*EventMouse) IsMoving ¶
func (ev *EventMouse) IsMoving() bool
func (*EventMouse) IsPressed ¶
func (ev *EventMouse) IsPressed() bool
func (*EventMouse) IsReleased ¶
func (ev *EventMouse) IsReleased() bool
func (*EventMouse) IsWheelImpulse ¶
func (ev *EventMouse) IsWheelImpulse() bool
func (*EventMouse) Modifiers ¶
func (ev *EventMouse) Modifiers() ModMask
Modifiers returns a list of keyboard modifiers that were pressed with the mouse button(s).
func (*EventMouse) Position ¶
func (ev *EventMouse) Position() (x, y int)
Position returns the mouse position in character cells. The origin 0, 0 is at the upper left corner.
func (*EventMouse) Report ¶
func (ev *EventMouse) Report() string
func (*EventMouse) State ¶
func (ev *EventMouse) State() MouseState
func (*EventMouse) StateHas ¶
func (ev *EventMouse) StateHas(check MouseState) bool
func (*EventMouse) WheelImpulse ¶
func (ev *EventMouse) WheelImpulse() ButtonMask
func (*EventMouse) When ¶
func (ev *EventMouse) When() time.Time
When returns the time when this EventMouse was created.
type EventPaste ¶
type EventPaste struct {
// contains filtered or unexported fields
}
EventPaste is used to mark the start and end of a bracketed paste. An event with .MainInit() true will be sent to mark the start. Then a number of keys will be sent to indicate that the content is pasted in. At the end, an event with .MainInit() false will be sent.
func NewEventPaste ¶
func NewEventPaste(start bool) *EventPaste
NewEventPaste returns a new EventPaste.
func (*EventPaste) End ¶
func (ev *EventPaste) End() bool
End returns true if this is the end of a paste.
func (*EventPaste) Start ¶
func (ev *EventPaste) Start() bool
MainInit returns true if this is the start of a paste.
func (*EventPaste) When ¶
func (ev *EventPaste) When() time.Time
When returns the time when this EventMouse was created.
type EventResize ¶
type EventResize struct {
// contains filtered or unexported fields
}
EventResize is sent when the window size changes.
func NewEventResize ¶
func NewEventResize(width, height int) *EventResize
NewEventResize creates an EventResize with the new updated window size, which is given in character cells.
func (*EventResize) Size ¶
func (ev *EventResize) Size() (w, h int)
Size returns the new window size as width, height in character cells.
func (*EventResize) When ¶
func (ev *EventResize) When() time.Time
When returns the time when the Event was created.
type EventTime ¶
type EventTime struct {
// contains filtered or unexported fields
}
EventTime is a simple base event class, suitable for easy reuse. It can be used to deliver actual timer events as well.
func NewEventTime ¶
NewEventTime creates a Time Event for the given time
func (*EventTime) SetEventNow ¶
func (e *EventTime) SetEventNow()
SetEventNow sets the time of occurrence for the event to the current time.
func (*EventTime) SetEventTime ¶
SetEventTime sets the time of occurrence for the event.
type IButtonMask ¶
type IButtonMask interface { Has(m ButtonMask) bool Set(m ButtonMask) ButtonMask Clear(m ButtonMask) ButtonMask Toggle(m ButtonMask) ButtonMask String() string }
type IMouseState ¶
type IMouseState interface { Has(m MouseState) bool Set(m MouseState) MouseState Clear(m MouseState) MouseState Toggle(m MouseState) MouseState String() string }
type Key ¶
type Key int16
Key is a generic value for representing keys, and especially special keys (function keys, cursor movement keys, etc.) For normal keys, like ASCII letters, we use KeyRune, and then expect the application to inspect the Rune() member of the EventKey.
const ( KeyRune Key = iota + 256 KeyUp KeyDown KeyRight KeyLeft KeyUpLeft KeyUpRight KeyDownLeft KeyDownRight KeyCenter KeyPgUp KeyPgDn KeyHome KeyEnd KeyInsert KeyDelete KeyHelp KeyExit KeyClear KeyCancel KeyPrint KeyPause KeyBacktab KeyF1 KeyF2 KeyF3 KeyF4 KeyF5 KeyF6 KeyF7 KeyF8 KeyF9 KeyF10 KeyF11 KeyF12 KeyF13 KeyF14 KeyF15 KeyF16 KeyF17 KeyF18 KeyF19 KeyF20 KeyF21 KeyF22 KeyF23 KeyF24 KeyF25 KeyF26 KeyF27 KeyF28 KeyF29 KeyF30 KeyF31 KeyF32 KeyF33 KeyF34 KeyF35 KeyF36 KeyF37 KeyF38 KeyF39 KeyF40 KeyF41 KeyF42 KeyF43 KeyF44 KeyF45 KeyF46 KeyF47 KeyF48 KeyF49 KeyF50 KeyF51 KeyF52 KeyF53 KeyF54 KeyF55 KeyF56 KeyF57 KeyF58 KeyF59 KeyF60 KeyF61 KeyF62 KeyF63 KeyF64 )
This is the list of named keys. KeyRune is special however, in that it is a place holder key indicating that a printable character was sent. The actual value of the rune will be transported in the Rune of the associated EventKey.
const ( KeyCtrlSpace Key = iota KeyCtrlA KeyCtrlB KeyCtrlC KeyCtrlD KeyCtrlE KeyCtrlF KeyCtrlG KeyCtrlH KeyCtrlI KeyCtrlJ KeyCtrlK KeyCtrlL KeyCtrlM KeyCtrlN KeyCtrlO KeyCtrlP KeyCtrlQ KeyCtrlR KeyCtrlS KeyCtrlT KeyCtrlU KeyCtrlV KeyCtrlW KeyCtrlX KeyCtrlY KeyCtrlZ KeyCtrlLeftSq // Escape KeyCtrlBackslash KeyCtrlRightSq KeyCtrlCarat KeyCtrlUnderscore )
These are the control keys. Note that they overlap with other keys, perhaps. For example, KeyCtrlH is the same as KeyBackspace.
const ( KeyNUL Key = iota KeySOH KeySTX KeyETX KeyEOT KeyENQ KeyACK KeyBEL KeyBS KeyTAB KeyLF KeyVT KeyFF KeyCR KeySO KeySI KeyDLE KeyDC1 KeyDC2 KeyDC3 KeyDC4 KeyNAK KeySYN KeyETB KeyCAN KeyEM KeySUB KeyESC KeyFS KeyGS KeyRS KeyUS KeyDEL Key = 0x7F )
These are the defined ASCII values for key codes. They generally match with KeyCtrl values.
const ( KeySpacebar Key = KeyRune KeySpace Key = 32 KeyExclamationMark Key = 33 KeyDoubleQuote Key = 34 KeyNumber Key = 35 KeyDollarSign Key = 36 KeyPercent Key = 37 KeyAmpersand Key = 38 KeySingleQuote Key = 39 KeyLeftParenthesis Key = 40 KeyRightParenthesis Key = 41 KeyAsterisk Key = 42 KeyPlus Key = 43 KeyComma Key = 44 KeyMinus Key = 45 KeyPeriod Key = 46 KeySlash Key = 47 KeyZero Key = 48 KeyOne Key = 49 KeyTwo Key = 50 KeyThree Key = 51 KeyFour Key = 52 KeyFive Key = 53 KeySix Key = 54 KeySeven Key = 55 KeyEight Key = 56 KeyNine Key = 57 KeyColon Key = 58 KeySemicolon Key = 59 KeyLessThan Key = 60 KeyEqualitySign Key = 61 KeyGreaterThan Key = 62 KeyQuestionMark Key = 63 KeyAtSign Key = 64 KeyCapitalA Key = 65 KeyCapitalB Key = 66 KeyCapitalC Key = 67 KeyCapitalD Key = 68 KeyCapitalE Key = 69 KeyCapitalF Key = 70 KeyCapitalG Key = 71 KeyCapitalH Key = 72 KeyCapitalI Key = 73 KeyCapitalJ Key = 74 KeyCapitalK Key = 75 KeyCapitalL Key = 76 KeyCapitalM Key = 77 KeyCapitalN Key = 78 KeyCapitalO Key = 79 KeyCapitalP Key = 80 KeyCapitalQ Key = 81 KeyCapitalR Key = 82 KeyCapitalS Key = 83 KeyCapitalT Key = 84 KeyCapitalU Key = 85 KeyCapitalV Key = 86 KeyCapitalW Key = 87 KeyCapitalX Key = 88 KeyCapitalY Key = 89 KeyCapitalZ Key = 90 KeyLeftSquareBracket Key = 91 KeyBackslash Key = 92 KeyRightSquareBracket Key = 93 KeyCaretCircumflex Key = 94 KeyUnderscore Key = 95 KeyGraveAccent Key = 96 KeySmallA Key = 97 KeySmallB Key = 98 KeySmallC Key = 99 KeySmallD Key = 100 KeySmallE Key = 101 KeySmallF Key = 102 KeySmallG Key = 103 KeySmallH Key = 104 KeySmallI Key = 105 KeySmallJ Key = 106 KeySmallK Key = 107 KeySmallL Key = 108 KeySmallM Key = 109 KeySmallN Key = 110 KeySmallO Key = 111 KeySmallP Key = 112 KeySmallQ Key = 113 KeySmallR Key = 114 KeySmallS Key = 115 KeySmallT Key = 116 KeySmallU Key = 117 KeySmallV Key = 118 KeySmallW Key = 119 KeySmallX Key = 120 KeySmallY Key = 121 KeySmallZ Key = 122 KeyLeftCurlyBracket Key = 123 KeyVerticalBar Key = 124 KeyRightCurlyBracket Key = 125 KeyTilde Key = 126 )
ASCII Keys
func LookupKeyRune ¶
type MetaData ¶
type MetaData interface { Signaling Init() (already bool) InstallProperty(name Property, kind PropertyType, write bool, def interface{}) error InstallBuildableProperty(name Property, kind PropertyType, write bool, def interface{}) error OverloadProperty(name Property, kind PropertyType, write bool, buildable bool, def interface{}) error ListProperties() (properties []Property) ListBuildableProperties() (properties []Property) SetProperties(properties map[Property]string) (err error) IsProperty(name Property) bool IsBuildableProperty(name Property) bool GetProperty(name Property) *CProperty SetPropertyFromString(name Property, value string) error SetProperty(name Property, value interface{}) error GetBoolProperty(name Property) (value bool, err error) SetBoolProperty(name Property, value bool) error GetStringProperty(name Property) (value string, err error) SetStringProperty(name Property, value string) error GetIntProperty(name Property) (value int, err error) SetIntProperty(name Property, value int) error GetFloatProperty(name Property) (value float64, err error) SetFloatProperty(name Property, value float64) error GetColorProperty(name Property) (value paint.Color, err error) SetColorProperty(name Property, value paint.Color) error GetStyleProperty(name Property) (value paint.Style, err error) SetStyleProperty(name Property, value paint.Style) error GetThemeProperty(name Property) (value paint.Theme, err error) SetThemeProperty(name Property, value paint.Theme) error GetPointProperty(name Property) (value ptypes.Point2I, err error) SetPointProperty(name Property, value ptypes.Point2I) error GetRectangleProperty(name Property) (value ptypes.Rectangle, err error) SetRectangleProperty(name Property, value ptypes.Rectangle) error GetRegionProperty(name Property) (value ptypes.Region, err error) SetRegionProperty(name Property, value ptypes.Region) error GetStructProperty(name Property) (value interface{}, err error) SetStructProperty(name Property, value interface{}) error }
type ModMask ¶
type ModMask int16
ModMask is a mask of modifier keys. Note that it will not always be possible to report modifier keys.
These are the modifiers keys that can be sent either with a key press, or a mouse event. Note that as of now, due to the confusion associated with Meta, and the lack of support for it on many/most platforms, the current implementations never use it. Instead, they use ModAlt, even for events that could possibly have been distinguished from ModAlt.
type MouseFlags ¶
type MouseFlags int
MouseFlags are options to modify the handling of mouse events. Actual events can be or'd together.
type MouseState ¶
type MouseState uint64
const ( MOUSE_NONE MouseState = 0 MOUSE_MOVE MouseState = 1 << iota BUTTON_PRESS BUTTON_RELEASE WHEEL_PULSE DRAG_START DRAG_MOVE DRAG_STOP )
func (MouseState) Clear ¶
func (i MouseState) Clear(m MouseState) MouseState
func (MouseState) Has ¶
func (i MouseState) Has(m MouseState) bool
func (MouseState) Set ¶
func (i MouseState) Set(m MouseState) MouseState
func (MouseState) String ¶
func (i MouseState) String() string
func (MouseState) Toggle ¶
func (i MouseState) Toggle(m MouseState) MouseState
type Object ¶
type Object interface { MetaData Init() (already bool) InitWithProperties(properties map[Property]string) (already bool, err error) Destroy() GetName() (name string) SetName(name string) GetTheme() (theme paint.Theme) SetTheme(theme paint.Theme) GetThemeRequest() (theme paint.Theme) SetThemeRequest(theme paint.Theme) }
This is the base type for all complex CDK object types. The Object type provides a means of installing properties, getting and setting property values
type OffScreen ¶
type OffScreen interface { // InjectKeyBytes injects a stream of bytes corresponding to // the native encoding (see charset). It turns true if the entire // set of bytes were processed and delivered as KeyEvents, false // if any bytes were not fully understood. Any bytes that are not // fully converted are discarded. InjectKeyBytes(buf []byte) bool // InjectKey injects a key event. The rune is a UTF-8 rune, post // any translation. InjectKey(key Key, r rune, mod ModMask) // InjectMouse injects a mouse event. InjectMouse(x, y int, buttons ButtonMask, mod ModMask) // SetSize resizes the underlying physical screen. It also causes // a resize event to be injected during the next Show() or Sync(). // A new physical contents array will be allocated (with data from // the old copied), so any prior value obtained with GetContents // won't be used anymore SetSize(width, height int) // GetContents returns screen contents as an array of // cells, along with the physical width & height. Note that the // physical contents will be used until the next time SetSize() // is called. GetContents() (cells []OffscreenCell, width int, height int) // GetCursor returns the cursor details. GetCursor() (x int, y int, visible bool) Screen }
OffScreen represents a screen simulation. This is intended to be a superset of normal Screens, but also adds some important interfaces for testing.
func MakeOffScreen ¶
func NewOffScreen ¶
NewOffScreen returns a OffScreen. Note that OffScreen is also a Display.
type OffscreenCell ¶
type OffscreenCell struct { // Bytes is the actual character bytes. Normally this is // rune data, but it could be be data in another encoding system. Bytes []byte // Style is the style used to display the data. Style paint.Style // Runes is the list of runes, unadulterated, in UTF-8. Runes []rune }
OffscreenCell represents a simulated screen cell. The purpose of this is to track on screen content.
type OffscreenWindow ¶
type OffscreenWindow interface { Object GetTitle() string SetTitle(title string) GetDisplay() Display SetDisplay(d Display) Draw() enums.EventFlag ProcessEvent(evt Event) enums.EventFlag }
Basic window interface
type Property ¶
type Property string
const PropertyDebug Property = "debug"
request that the object be rendered with additional features useful to debugging custom Widget development
const PropertyDisplayHost Property = "display-host"
const PropertyDisplayName Property = "display-name"
const PropertyDisplayUser Property = "display-user"
const PropertyName Property = "name"
property wrapper around the CTypeItem name field
const PropertyTheme Property = "theme"
const PropertyThemeRequest Property = "theme-request"
type PropertyType ¶
type PropertyType string
const ( BoolProperty PropertyType = "bool" StringProperty PropertyType = "string" IntProperty PropertyType = "int" FloatProperty PropertyType = "float" ColorProperty PropertyType = "color" StyleProperty PropertyType = "style" ThemeProperty PropertyType = "theme" PointProperty PropertyType = "point" RectangleProperty PropertyType = "rectangle" RegionProperty PropertyType = "region" StructProperty PropertyType = "struct" )
func (PropertyType) String ¶
func (p PropertyType) String() string
type Screen ¶
type Screen interface { // Init initializes the screen for use. Init() error InitWithFilePath(fp string) error InitWithFileHandle(fh *os.File) error // Close finalizes the screen also releasing resources. Close() // Clear erases the screen. The contents of any screen buffers // will also be cleared. This has the logical effect of // filling the screen with spaces, using the global default style. Clear() // Fill fills the screen with the given character and style. Fill(rune, paint.Style) // SetCell is an older API, and will be removed. Please use // SetContent instead; SetCell is implemented in terms of SetContent. SetCell(x int, y int, style paint.Style, ch ...rune) // GetContent returns the contents at the given location. If the // coordinates are out of range, then the values will be 0, nil, // StyleDefault. Note that the contents returned are logical contents // and may not actually be what is displayed, but rather are what will // be displayed if Show() or Sync() is called. The width is the width // in screen cells; most often this will be 1, but some East Asian // characters require two cells. GetContent(x, y int) (mainc rune, combc []rune, style paint.Style, width int) // SetContent sets the contents of the given cell location. If // the coordinates are out of range, then the operation is ignored. // // The first rune is the primary non-zero width rune. The array // that follows is a possible list of combining characters to append, // and will usually be nil (no combining characters.) // // The results are not displayed until Show() or Sync() is called. // // Note that wide (East Asian full width) runes occupy two cells, // and attempts to place character at next cell to the right will have // undefined effects. Wide runes that are printed in the // last column will be replaced with a single width space on output. SetContent(x int, y int, mainc rune, combc []rune, style paint.Style) // SetStyle sets the default style to use when clearing the screen // or when StyleDefault is specified. If it is also StyleDefault, // then whatever system/terminal default is relevant will be used. SetStyle(style paint.Style) // ShowCursor is used to display the cursor at a given location. // If the coordinates -1, -1 are given or are otherwise outside the // dimensions of the screen, the cursor will be hidden. ShowCursor(x int, y int) // HideCursor is used to hide the cursor. It's an alias for // ShowCursor(-1, -1). HideCursor() // Size returns the screen size as width, height. This changes in // response to a call to Clear or Flush. Size() (w, h int) // PollEvent waits for events to arrive. Main application loops // must spin on this to prevent the application from stalling. // Furthermore, this will return nil if the Screen is finalized. PollEvent() Event // PollEventChan provides a PollEvent() call response through a channel // for the purposes of using a select statement to poll for new events PollEventChan() (next chan Event) // PostEvent tries to post an event into the event stream. This // can fail if the event queue is full. In that case, the event // is dropped, and ErrEventQFull is returned. PostEvent(ev Event) error // EnableMouse enables the mouse. (If your terminal supports it.) // If no flags are specified, then all events are reported, if the // terminal supports them. EnableMouse(...MouseFlags) // DisableMouse disables the mouse. DisableMouse() // EnablePaste enables bracketed paste mode, if supported. EnablePaste() // DisablePaste disables bracketed paste mode. DisablePaste() // HasMouse returns true if the terminal (apparently) supports a // mouse. Note that the a return value of true doesn't guarantee that // a mouse/pointing device is present; a false return definitely // indicates no mouse support is available. HasMouse() bool // Colors returns the number of colors. All colors are assumed to // use the ANSI color map. If a terminal is monochrome, it will // return 0. Colors() int // Show makes all the content changes made using SetContent() visible // on the screen. // // It does so in the most efficient and least visually disruptive // manner possible. Show() // Sync works like Show(), but it updates every visible cell on the // physical screen, assuming that it is not synchronized with any // internal model. This may be both expensive and visually jarring, // so it should only be used when believed to actually be necessary. // // Typically, this is called as a result of a user-requested redraw // (e.g. to clear up on screen corruption caused by some other program), // or during a resize event. Sync() // CharacterSet returns information about the character set. // This isn't the full locale, but it does give us the input/output // character set. Note that this is just for diagnostic purposes, // we normally translate input/output to/from UTF-8, regardless of // what the user's environment is. CharacterSet() string // RegisterRuneFallback adds a fallback for runes that are not // part of the character set -- for example one could register // o as a fallback for ø. This should be done cautiously for // characters that might be displayed ordinarily in language // specific text -- characters that could change the meaning of // of written text would be dangerous. The intention here is to // facilitate fallback characters in pseudo-graphical applications. // // If the terminal has fallbacks already in place via an alternate // character set, those are used in preference. Also, standard // fallbacks for graphical characters in the ACSC terminfo string // are registered implicitly. // // The display string should be the same width as original rune. // This makes it possible to register two character replacements // for full width East Asian characters, for example. // // It is recommended that replacement strings consist only of // 7-bit ASCII, since other characters may not display everywhere. RegisterRuneFallback(r rune, subst string) // UnregisterRuneFallback unmaps a replacement. It will unmap // the implicit ASCII replacements for alternate characters as well. // When an unmapped char needs to be displayed, but no suitable // glyph is available, '?' is emitted instead. It is not possible // to "disable" the use of alternate characters that are supported // by your terminal except by changing the terminal database. UnregisterRuneFallback(r rune) // CanDisplay returns true if the given rune can be displayed on // this screen. Note that this is a best guess effort -- whether // your fonts support the character or not may be questionable. // Mostly this is for folks who work outside of Unicode. // // If checkFallbacks is true, then if any (possibly imperfect) // fallbacks are registered, this will return true. This will // also return true if the terminal can replace the glyph with // one that is visually indistinguishable from the one requested. CanDisplay(r rune, checkFallbacks bool) bool // HasKey returns true if the keyboard is believed to have the // key. In some cases a keyboard may have keys with this name // but no support for them, while in others a key may be reported // as supported but not actually be usable (such as some emulators // that hijack certain keys). Its best not to depend to strictly // on this function, but it can be used for hinting when building // menus, displayed hot-keys, etc. Note that KeyRune (literal // runes) is always true. HasKey(Key) bool // Beep attempts to sound an OS-dependent audible alert and returns an error // when unsuccessful. Beep() error Export() *CellBuffer Import(cb *CellBuffer) }
Screen represents the physical (or emulated) display. This can be a terminal window or a physical console. Platforms implement this differently.
func NewScreen ¶
NewScreen returns a Screen that uses the stock TTY interface and POSIX terminal control, combined with a terminfo description taken from the $TERM environment variable. It returns an error if the terminal is not supported for any reason.
For terminals that do not support dynamic resize events, the $LINES $COLUMNS environment variables can be set to the actual window size, otherwise defaults taken from the terminal database are used.
type ScreenStateReq ¶
type ScreenStateReq uint64
const ( NullRequest ScreenStateReq = 1 << iota DrawRequest ShowRequest SyncRequest QuitRequest )
type Signal ¶
type Signal string
const SignalDestroy Signal = "destroy"
emitted when the object instance is destroyed
type SignalListenerData ¶
type SignalListenerData []interface{}
type SignalListenerFn ¶
type Signaling ¶
type Signaling interface { TypeItem Connect(signal Signal, handle string, c SignalListenerFn, data ...interface{}) Disconnect(signal Signal, handle string) error Emit(signal Signal, argv ...interface{}) enums.EventFlag StopSignal(signal Signal) IsSignalStopped(signal Signal) bool PassSignal(signal Signal) IsSignalPassed(signal Signal) bool ResumeSignal(signal Signal) Freeze() Thaw() IsFrozen() bool }
type TimerCallbackFn ¶
type Type ¶
type TypeItem ¶
type TypeItem interface { sync.Locker InitTypeItem(tag TypeTag, thing interface{}) (already bool) Init() (already bool) IsValid() bool Self() (this interface{}) String() string GetTypeTag() TypeTag GetName() string SetName(name string) ObjectID() uuid.UUID ObjectName() string DestroyObject() (err error) LogTag() string LogTrace(format string, argv ...interface{}) LogDebug(format string, argv ...interface{}) LogInfo(format string, argv ...interface{}) LogWarn(format string, argv ...interface{}) LogError(format string, argv ...interface{}) LogErr(err error) }
func NewTypeItem ¶
type TypeRegistry ¶
type TypeRegistry interface { GetTypeTags() (tags []TypeTag) GetBuildableInfo() (info map[string]TypeTag) MakeType(tag TypeTag) (thing interface{}, err error) AddType(tag TypeTag, constructor func() interface{}, aliases ...string) error HasType(tag TypeTag) (exists bool) GetType(tag TypeTag) (t Type, ok bool) AddTypeAlias(tag TypeTag, alias ...string) GetTypeTagByAlias(alias string) (tt TypeTag, ok bool) AddTypeItem(tag TypeTag, item interface{}) (id uuid.UUID, err error) HasID(index uuid.UUID) bool GetTypeItems(tag TypeTag) []interface{} GetTypeItemByID(id uuid.UUID) interface{} GetTypeItemByName(name string) interface{} RemoveTypeItem(tag TypeTag, item TypeItem) error }
func NewTypeRegistry ¶
func NewTypeRegistry() TypeRegistry
type TypeTag ¶
Source Files ¶
- app.go
- app_build_config.go
- app_cli_flags.go
- app_context.go
- app_server.go
- buttonmask.go
- cdk.go
- cell.go
- cell_buffer.go
- ctype.go
- ctype_item.go
- ctype_item_list.go
- ctype_registry.go
- ctype_tag.go
- display.go
- encoding.go
- event.go
- event_error.go
- event_interrupt.go
- event_key.go
- event_mask.go
- event_mouse.go
- event_paste.go
- event_resize.go
- metadata.go
- mouse_flags.go
- mouse_state.go
- object.go
- offscreen.go
- offscreen_window.go
- property.go
- property_type.go
- screen.go
- screen_unix.go
- sensitive.go
- signal.go
- signal_listener.go
- signaling.go
- terms_default.go
- terms_dynamic.go
- testing.go
- timing.go
- window.go