Documentation ¶
Overview ¶
Package wm is a terminal window manager.
Screenshot ¶
An example content of a terminal window (colors cannot be shown here):
Use mouse to resize the window or scroll the view. Arrow keys change the viewport of the focused window. To focus the desktop, click on it. <Esc> or 'q' to quit. ┌ view_demo.go ─────────────────────────────────────────────────────[X]┐ │ ▴│ │ ░│ ┌ view.go ─────────│Use mouse to resize the window or scroll the view. ░│ │ "github.co│e the viewport of the focused window. ▒│ │ "github.co│ktop, click on it. ▒│ │) │quit.` ░│ │ │ ░│ │// Meter provides │ ░│────[X]┐ │type Meter interfa│'\n'} ░│ ▴│ │ // Metrics│ ░│ ░│ │ // result │arent *wm.Window, x, y int, title string, src []byte) { ░│ ░│ │ // reflect│rent.Size() ░│ ░│ │ // values │ || y < 0 { ░│, len(░│ │ // output │x = rand.Intn(sz.Width - sz.Width/5) ░│ ░│ │ Metrics(vi│y = rand.Intn(sz.Height - sz.Height/5) ░│) ░│ │} │ ░│s:%d: ░│ │ │ent.NewChild(wm.Rectangle{wm.Position{x, y}, wm.Size{0, 0}}) ░│ ░│ │// View displays c│seButton(true) ░│ ░│ │◂▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│le(title) ░│ ░│ └──────────────────│.HasSuffix(src, nl) { ░│ ▒│ │src = src[:len(src)-1] ░│ ▒│ │ ▾│OOK ▒│ │◂░░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░░░░░░░▸ │) ▒│ └──────────────────────────────────────────────────────────────────────┘%d:\n"▒│
Changelog ¶
2016-12-16: Initial release of the accompanying toolkit package: http://modernc.org/wm/tree/master/tk
2016-11-25: Windows now support views (viewports). See Windows.Origin and friends.
2015-12-11: WM now uses no locks and renders 2 to 3 times faster. The price is that any methods of Application, Desktop or Window must be called only from a function that was enqueued by Application.Post or Application.PostWait.
Index ¶
- func AddOnMouseHandler(l **OnMouseHandlerList, h OnMouseHandler, finalizer func())
- func AddOnPaintHandler(l **OnPaintHandlerList, h OnPaintHandler, finalizer func())
- func AddOnSetBoolHandler(l **OnSetBoolHandlerList, h OnSetBoolHandler, finalizer func())
- func AddOnSetIntHandler(l **OnSetIntHandlerList, h OnSetIntHandler, finalizer func())
- func AddOnSetPositionHandler(l **OnSetPositionHandlerList, h OnSetPositionHandler, finalizer func())
- func AddOnSetSizeHandler(l **OnSetSizeHandlerList, h OnSetSizeHandler, finalizer func())
- func AddOnSetStyleHandler(l **OnSetStyleHandlerList, h OnSetStyleHandler, finalizer func())
- func RemoveOnMouseHandler(l **OnMouseHandlerList)
- func RemoveOnPaintHandler(l **OnPaintHandlerList)
- func RemoveOnSetBoolHandler(l **OnSetBoolHandlerList)
- func RemoveOnSetIntHandler(l **OnSetIntHandlerList)
- func RemoveOnSetPositionHandler(l **OnSetPositionHandlerList)
- func RemoveOnSetSizeHandler(l **OnSetSizeHandlerList)
- func RemoveOnSetStyleHandler(l **OnSetStyleHandlerList)
- type Application
- func (a *Application) BeginUpdate()
- func (a *Application) ChildWindowStyle() WindowStyle
- func (a *Application) ClickDuration() time.Duration
- func (a *Application) Colors() int
- func (a *Application) Desktop() (d *Desktop)
- func (a *Application) DesktopStyle() WindowStyle
- func (a *Application) DoubleClickDuration() time.Duration
- func (a *Application) EndUpdate()
- func (a *Application) Exit(err error)
- func (a *Application) NewDesktop() *Desktop
- func (a *Application) OnKey(h OnKeyHandler, finalize func())
- func (a *Application) OnSetClickDuration(h OnSetDurationHandler, finalize func())
- func (a *Application) OnSetDesktop(h OnSetDesktopHandler, finalize func())
- func (a *Application) OnSetDoubleClickDuration(h OnSetDurationHandler, finalize func())
- func (a *Application) OnSetSize(h OnSetSizeHandler, finalize func())
- func (a *Application) Post(f func())
- func (a *Application) PostWait(f func())
- func (a *Application) RemoveOnKey()
- func (a *Application) RemoveOnSetClickDuration()
- func (a *Application) RemoveOnSetDesktop()
- func (a *Application) RemoveOnSetDoubleClickDuration()
- func (a *Application) RemoveOnSetSize()
- func (a *Application) Run(setup func()) error
- func (a *Application) SetClickDuration(d time.Duration)
- func (a *Application) SetDesktop(d *Desktop)
- func (a *Application) SetDoubleClickDuration(d time.Duration)
- func (a *Application) Size() (s Size)
- func (a *Application) Sync()
- func (a *Application) Wait() error
- type Desktop
- func (d *Desktop) FocusedWindow() *Window
- func (d *Desktop) OnSetFocusedWindow(h OnSetWindowHandler, finalize func())
- func (d *Desktop) OnSetSelection(h OnSetRectangleHandler, finalize func())
- func (d *Desktop) RemoveOnSetFocusedWindow()
- func (d *Desktop) RemoveOnSetSelection()
- func (d *Desktop) Root() *Window
- func (d *Desktop) Selection() Rectangle
- func (d *Desktop) SetFocusedWindow(w *Window)
- func (d *Desktop) SetSelection(area Rectangle)
- func (d *Desktop) Show()
- type OnCloseHandler
- type OnKeyHandler
- type OnMouseHandler
- type OnMouseHandlerList
- type OnPaintHandler
- type OnPaintHandlerList
- type OnSetBoolHandler
- type OnSetBoolHandlerList
- type OnSetDesktopHandler
- type OnSetDurationHandler
- type OnSetIntHandler
- type OnSetIntHandlerList
- type OnSetPositionHandler
- type OnSetPositionHandlerList
- type OnSetRectangleHandler
- type OnSetSizeHandler
- type OnSetSizeHandlerList
- type OnSetStringHandler
- type OnSetStyleHandler
- type OnSetStyleHandlerList
- type OnSetWindowHandler
- type OnSetWindowStyleHandler
- type PaintContext
- type Position
- type Rectangle
- type Size
- type Style
- type Theme
- type Window
- func (w *Window) Area() Rectangle
- func (w *Window) BeginUpdate()
- func (w *Window) BorderBottom() int
- func (w *Window) BorderBottomArea() (r Rectangle)
- func (w *Window) BorderLeft() int
- func (w *Window) BorderLeftArea() (r Rectangle)
- func (w *Window) BorderRight() int
- func (w *Window) BorderRightArea() (r Rectangle)
- func (w *Window) BorderStyle() Style
- func (w *Window) BorderTop() int
- func (w *Window) BorderTopArea() (r Rectangle)
- func (w *Window) BringToFront()
- func (w *Window) Child(n int) (r *Window)
- func (w *Window) Children() (r int)
- func (w *Window) ClientArea() Rectangle
- func (w *Window) ClientAreaStyle() Style
- func (w *Window) ClientPosition() Position
- func (w *Window) ClientSize() Size
- func (w *Window) Close()
- func (w *Window) CloseButton() bool
- func (w *Window) Desktop() *Desktop
- func (w *Window) EndUpdate()
- func (w *Window) Focus() bool
- func (w *Window) Invalidate(area Rectangle)
- func (w *Window) InvalidateClientArea(area Rectangle)
- func (w *Window) NewChild(area Rectangle) *Window
- func (w *Window) OnClick(h OnMouseHandler, finalize func())
- func (w *Window) OnClickBorder(h OnMouseHandler, finalize func())
- func (w *Window) OnClose(h OnCloseHandler, finalize func())
- func (w *Window) OnDoubleClick(h OnMouseHandler, finalize func())
- func (w *Window) OnDoubleClickBorder(h OnMouseHandler, finalize func())
- func (w *Window) OnDrag(h OnMouseHandler, finalize func())
- func (w *Window) OnDragBorder(h OnMouseHandler, finalize func())
- func (w *Window) OnDrop(h OnMouseHandler, finalize func())
- func (w *Window) OnKey(h OnKeyHandler, finalize func())
- func (w *Window) OnMouseMove(h OnMouseHandler, finalize func())
- func (w *Window) OnPaintBorderBottom(h OnPaintHandler, finalize func())
- func (w *Window) OnPaintBorderLeft(h OnPaintHandler, finalize func())
- func (w *Window) OnPaintBorderRight(h OnPaintHandler, finalize func())
- func (w *Window) OnPaintBorderTop(h OnPaintHandler, finalize func())
- func (w *Window) OnPaintClientArea(h OnPaintHandler, finalize func())
- func (w *Window) OnPaintTitle(h OnPaintHandler, finalize func())
- func (w *Window) OnSetBorderBottom(h OnSetIntHandler, finalize func())
- func (w *Window) OnSetBorderLeft(h OnSetIntHandler, finalize func())
- func (w *Window) OnSetBorderRight(h OnSetIntHandler, finalize func())
- func (w *Window) OnSetBorderStyle(h OnSetStyleHandler, finalize func())
- func (w *Window) OnSetBorderTop(h OnSetIntHandler, finalize func())
- func (w *Window) OnSetClientAreaStyle(h OnSetStyleHandler, finalize func())
- func (w *Window) OnSetClientSize(h OnSetSizeHandler, finalize func())
- func (w *Window) OnSetCloseButton(h OnSetBoolHandler, finalize func())
- func (w *Window) OnSetFocus(h OnSetBoolHandler, finalize func())
- func (w *Window) OnSetOrigin(h OnSetPositionHandler, finalize func())
- func (w *Window) OnSetPosition(h OnSetPositionHandler, finalize func())
- func (w *Window) OnSetSize(h OnSetSizeHandler, finalize func())
- func (w *Window) OnSetStyle(h OnSetWindowStyleHandler, finalize func())
- func (w *Window) OnSetTitle(h OnSetStringHandler, finalize func())
- func (w *Window) Origin() Position
- func (w *Window) Parent() *Window
- func (w *Window) Position() Position
- func (w *Window) Printf(x, y int, style Style, format string, arg ...interface{})
- func (w *Window) RemoveOnClick()
- func (w *Window) RemoveOnClickBorder()
- func (w *Window) RemoveOnClose()
- func (w *Window) RemoveOnDoubleClick()
- func (w *Window) RemoveOnDoubleClickBorder()
- func (w *Window) RemoveOnDrag()
- func (w *Window) RemoveOnDragBorder()
- func (w *Window) RemoveOnDrop()
- func (w *Window) RemoveOnKey()
- func (w *Window) RemoveOnMouseMove()
- func (w *Window) RemoveOnPaintBorderBottom()
- func (w *Window) RemoveOnPaintBorderLeft()
- func (w *Window) RemoveOnPaintBorderRight()
- func (w *Window) RemoveOnPaintBorderTop()
- func (w *Window) RemoveOnPaintClientArea()
- func (w *Window) RemoveOnPaintTitle()
- func (w *Window) RemoveOnSetBorderBottom()
- func (w *Window) RemoveOnSetBorderLeft()
- func (w *Window) RemoveOnSetBorderRight()
- func (w *Window) RemoveOnSetBorderStyle()
- func (w *Window) RemoveOnSetBorderTop()
- func (w *Window) RemoveOnSetClientAreaStyle()
- func (w *Window) RemoveOnSetClientSize()
- func (w *Window) RemoveOnSetCloseButton()
- func (w *Window) RemoveOnSetFocus()
- func (w *Window) RemoveOnSetOrigin()
- func (w *Window) RemoveOnSetPosition()
- func (w *Window) RemoveOnSetSize()
- func (w *Window) RemoveOnSetStyle()
- func (w *Window) RemoveOnSetTitle()
- func (w *Window) Rendered() time.Duration
- func (w *Window) SetBorderBottom(v int)
- func (w *Window) SetBorderLeft(v int)
- func (w *Window) SetBorderRight(v int)
- func (w *Window) SetBorderStyle(s Style)
- func (w *Window) SetBorderTop(v int)
- func (w *Window) SetCell(x, y int, mainc rune, combc []rune, style tcell.Style)
- func (w *Window) SetClientAreaStyle(s Style)
- func (w *Window) SetClientSize(s Size)
- func (w *Window) SetCloseButton(v bool)
- func (w *Window) SetFocus(v bool)
- func (w *Window) SetOrigin(p Position)
- func (w *Window) SetPosition(p Position)
- func (w *Window) SetSize(s Size)
- func (w *Window) SetStyle(s WindowStyle)
- func (w *Window) SetTitle(s string)
- func (w *Window) Size() Size
- func (w *Window) Style() WindowStyle
- func (w *Window) Title() string
- type WindowStyle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOnMouseHandler ¶
func AddOnMouseHandler(l **OnMouseHandlerList, h OnMouseHandler, finalizer func())
AddOnMouseHandler adds a handler to the handler list.
func AddOnPaintHandler ¶
func AddOnPaintHandler(l **OnPaintHandlerList, h OnPaintHandler, finalizer func())
AddOnPaintHandler adds a handler to the handler list.
func AddOnSetBoolHandler ¶
func AddOnSetBoolHandler(l **OnSetBoolHandlerList, h OnSetBoolHandler, finalizer func())
AddOnSetBoolHandler adds a handler to the handler list.
func AddOnSetIntHandler ¶
func AddOnSetIntHandler(l **OnSetIntHandlerList, h OnSetIntHandler, finalizer func())
AddOnSetIntHandler adds a handler to the handler list.
func AddOnSetPositionHandler ¶
func AddOnSetPositionHandler(l **OnSetPositionHandlerList, h OnSetPositionHandler, finalizer func())
AddOnSetPositionHandler adds a handler to the handler list.
func AddOnSetSizeHandler ¶
func AddOnSetSizeHandler(l **OnSetSizeHandlerList, h OnSetSizeHandler, finalizer func())
AddOnSetSizeHandler adds a handler to the handler list.
func AddOnSetStyleHandler ¶
func AddOnSetStyleHandler(l **OnSetStyleHandlerList, h OnSetStyleHandler, finalizer func())
AddOnSetStyleHandler adds a handler to the handler list.
func RemoveOnMouseHandler ¶
func RemoveOnMouseHandler(l **OnMouseHandlerList)
RemoveOnMouseHandler undoes the most recent call to AddOnMouseHandler.
func RemoveOnPaintHandler ¶
func RemoveOnPaintHandler(l **OnPaintHandlerList)
RemoveOnPaintHandler undoes the most recent call to AddOnPaintHandler.
func RemoveOnSetBoolHandler ¶
func RemoveOnSetBoolHandler(l **OnSetBoolHandlerList)
RemoveOnSetBoolHandler undoes the most recent call to AddOnSetBoolHandler.
func RemoveOnSetIntHandler ¶
func RemoveOnSetIntHandler(l **OnSetIntHandlerList)
RemoveOnSetIntHandler undoes the most recent call to AddOnSetIntHandler.
func RemoveOnSetPositionHandler ¶
func RemoveOnSetPositionHandler(l **OnSetPositionHandlerList)
RemoveOnSetPositionHandler undoes the most recent call to AddOnSetPositionHandler.
func RemoveOnSetSizeHandler ¶
func RemoveOnSetSizeHandler(l **OnSetSizeHandlerList)
RemoveOnSetSizeHandler undoes the most recent call to AddOnSetSizeHandler.
func RemoveOnSetStyleHandler ¶
func RemoveOnSetStyleHandler(l **OnSetStyleHandlerList)
RemoveOnSetStyleHandler undoes the most recent call to AddOnSetStyleHandler.
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application represents an interactive terminal application.
Application methods must be called only directly from an event handler goroutine or from a function that was enqueued using Application.Post or Application.PostWait. The only exception is Application.Wait, it can be called from any goroutine.
var ( // App is the instance of Application created by NewApplication. App *Application )
func NewApplication ¶
func NewApplication(theme *Theme) (*Application, error)
NewApplication returns a newly created Application or an error, if any.
// Skeleton example. func main() { app, err := wm.NewApplication(theme) if err != nil { log.Fatalf("error: %v", err) } ... if err = app.Wait(); err != nil { log.Fatal(err) } }
Calling this function more than once will panic.
func (*Application) BeginUpdate ¶
func (a *Application) BeginUpdate()
BeginUpdate marks the start of one or more updates to the application screen.
Failing to properly pair BeginUpdate with a corresponding EndUpdate will cause application screen corruption and/or freeze.
func (*Application) ChildWindowStyle ¶
func (a *Application) ChildWindowStyle() WindowStyle
ChildWindowStyle returns the style assigned to new child windows.
func (*Application) ClickDuration ¶
func (a *Application) ClickDuration() time.Duration
ClickDuration returns the maximum duration of a single click. Holding a mouse button for any longer duration generates a drag event instead.
func (*Application) Colors ¶
func (a *Application) Colors() int
Colors returns the number of colors the host terminal supports. All colors are assumed to use the ANSI color map. If a terminal is monochrome, it will return 0.
func (*Application) Desktop ¶
func (a *Application) Desktop() (d *Desktop)
Desktop returns the currently active desktop.
func (*Application) DesktopStyle ¶
func (a *Application) DesktopStyle() WindowStyle
DesktopStyle returns the style assigned to new desktops.
func (*Application) DoubleClickDuration ¶
func (a *Application) DoubleClickDuration() time.Duration
DoubleClickDuration returns the maximum duration of a double click. Mouse click not followed by another one within the DoubleClickDuration is a single click.
func (*Application) EndUpdate ¶
func (a *Application) EndUpdate()
EndUpdate marks the end of one or more updates to the application screen.
Failing to properly pair BeginUpdate with a corresponding EndUpdate will cause application screen corruption and/or freeze.
func (*Application) Exit ¶
func (a *Application) Exit(err error)
Exit terminates the interactive terminal application and returns err from Wait(). Only the first call of this method is considered.
func (*Application) NewDesktop ¶
func (a *Application) NewDesktop() *Desktop
NewDesktop returns a newly created desktop.
func (*Application) OnKey ¶
func (a *Application) OnKey(h OnKeyHandler, finalize func())
OnKey sets a key event handler. When the event handler is removed, finalize is called, if not nil.
func (*Application) OnSetClickDuration ¶
func (a *Application) OnSetClickDuration(h OnSetDurationHandler, finalize func())
OnSetClickDuration sets a handler invoked on SetClickDuration. When the event handler is removed, finalize is called, if not nil.
func (*Application) OnSetDesktop ¶
func (a *Application) OnSetDesktop(h OnSetDesktopHandler, finalize func())
OnSetDesktop sets a handler invoked on SetDesktop. When the event handler is removed, finalize is called, if not nil.
func (*Application) OnSetDoubleClickDuration ¶
func (a *Application) OnSetDoubleClickDuration(h OnSetDurationHandler, finalize func())
OnSetDoubleClickDuration sets a handler invoked on SetDoubleClickDuration. When the event handler is removed, finalize is called, if not nil.
func (*Application) OnSetSize ¶
func (a *Application) OnSetSize(h OnSetSizeHandler, finalize func())
OnSetSize sets a handler invoked on resizing the application screen. When the event handler is removed, finalize is called, if not nil.
func (*Application) Post ¶
func (a *Application) Post(f func())
Post puts f in the event queue, if the queue is not full, and executes it on dequeuing the event.
func (*Application) PostWait ¶
func (a *Application) PostWait(f func())
PostWait puts f in the event queue and executes it on dequeuing the event.
func (*Application) RemoveOnKey ¶
func (a *Application) RemoveOnKey()
RemoveOnKey undoes the most recent OnKey call. The function will panic if there is no handler set.
func (*Application) RemoveOnSetClickDuration ¶
func (a *Application) RemoveOnSetClickDuration()
RemoveOnSetClickDuration undoes the most recent OnSetClickDuration call. The function will panic if there is no handler set.
func (*Application) RemoveOnSetDesktop ¶
func (a *Application) RemoveOnSetDesktop()
RemoveOnSetDesktop undoes the most recent OnSetDesktop call. The function will panic if there is no handler set.
func (*Application) RemoveOnSetDoubleClickDuration ¶
func (a *Application) RemoveOnSetDoubleClickDuration()
RemoveOnSetDoubleClickDuration undoes the most recent OnSetDoubleClickDuration call. The function will panic if there is no handler set.
func (*Application) RemoveOnSetSize ¶
func (a *Application) RemoveOnSetSize()
RemoveOnSetSize undoes the most recent OnSetSize call. The function will panic if there is no handler set.
func (*Application) Run ¶
func (a *Application) Run(setup func()) error
Run is a shorthand for
app.PostWait(setup) return app.Wait()
func (*Application) SetClickDuration ¶
func (a *Application) SetClickDuration(d time.Duration)
SetClickDuration sets the maximum duration of a single click. Holding a mouse button for any longer duration generates a drag event instead.
func (*Application) SetDesktop ¶
func (a *Application) SetDesktop(d *Desktop)
SetDesktop sets the currently active desktop. Passing nil d will panic.
func (*Application) SetDoubleClickDuration ¶
func (a *Application) SetDoubleClickDuration(d time.Duration)
SetDoubleClickDuration sets the maximum duration of a single click. Mouse click not followed by another one within the DoubleClickDuration is a single click.
Note: Setting DoubleClickDuration to zero disables double click support.
func (*Application) Size ¶
func (a *Application) Size() (s Size)
Size returns the size of the terminal the application runs in.
func (*Application) Sync ¶
func (a *Application) Sync()
Sync updates every character cell of the application screen.
func (*Application) Wait ¶
func (a *Application) Wait() error
Wait blocks until the interactive terminal application terminates.
Calling this method more than once will panic.
type Desktop ¶
type Desktop struct {
// contains filtered or unexported fields
}
Desktop represents a virtual screen. An application has one or more independent desktops, of which only one is visible at any given moment.
A desktop initially contains only the automatically created root window.
Desktop methods must be called only directly from an event handler goroutine or from a function that was enqueued using Application.Post or Application.PostWait.
func (*Desktop) FocusedWindow ¶
FocusedWindow returns the window with focus, if any.
func (*Desktop) OnSetFocusedWindow ¶
func (d *Desktop) OnSetFocusedWindow(h OnSetWindowHandler, finalize func())
OnSetFocusedWindow sets a handler invoked on SetFocusedWindow. When the event handler is removed, finalize is called, if not nil.
func (*Desktop) OnSetSelection ¶
func (d *Desktop) OnSetSelection(h OnSetRectangleHandler, finalize func())
OnSetSelection sets a handler invoked on SetSelection. When the event handler is removed, finalize is called, if not nil.
func (*Desktop) RemoveOnSetFocusedWindow ¶
func (d *Desktop) RemoveOnSetFocusedWindow()
RemoveOnSetFocusedWindow undoes the most recent OnSetFocusedWindow call. The function will panic if there is no handler set.
func (*Desktop) RemoveOnSetSelection ¶
func (d *Desktop) RemoveOnSetSelection()
RemoveOnSetSelection undoes the most recent OnSetSelection call. The function will panic if there is no handler set.
func (*Desktop) SetFocusedWindow ¶
SetFocusedWindow sets the focused window.
func (*Desktop) SetSelection ¶
SetSelection sets the area of the desktop shown in reverse.
type OnCloseHandler ¶
type OnCloseHandler func(w *Window, prev OnCloseHandler)
OnCloseHandler is called on window close. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution.
type OnKeyHandler ¶
OnKeyHandler handles key events. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution. The handler should return true if it consumes the event and it should not be considered by other subscribed handlers.
type OnMouseHandler ¶
type OnMouseHandler func(w *Window, prev OnMouseHandler, button tcell.ButtonMask, screenPos, winPos Position, mods tcell.ModMask) bool
OnMouseHandler handles mouse events. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution. The handler should return true if it consumes the event and it should not be considered by other subscribed handlers.
type OnMouseHandlerList ¶
type OnMouseHandlerList struct {
// contains filtered or unexported fields
}
OnMouseHandlerList represents a list of handlers subscribed to an event.
func (*OnMouseHandlerList) Clear ¶
func (l *OnMouseHandlerList) Clear()
Clear calls any finalizers on the handler list.
func (*OnMouseHandlerList) Handle ¶
func (l *OnMouseHandlerList) Handle(w *Window, button tcell.ButtonMask, screenPos, winPos Position, mods tcell.ModMask) bool
Handle performs handling mouse events.
type OnPaintHandler ¶
type OnPaintHandler func(w *Window, prev OnPaintHandler, ctx PaintContext)
OnPaintHandler handles paint requests. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution.
OnPaint handlers can safely try to modify window cells outside of the area argument as such attempts will be silently ignored. In other words, an OnPaintHandler cannot affect any window cell outside of the area argument.
type OnPaintHandlerList ¶
type OnPaintHandlerList struct {
// contains filtered or unexported fields
}
OnPaintHandlerList represents a list of handlers subscribed to an event.
func (*OnPaintHandlerList) Clear ¶
func (l *OnPaintHandlerList) Clear()
Clear calls any finalizers on the handler list.
func (*OnPaintHandlerList) Handle ¶
func (l *OnPaintHandlerList) Handle(w *Window, ctx PaintContext)
Handle performs painting of ctx.
type OnSetBoolHandler ¶
type OnSetBoolHandler func(w *Window, prev OnSetBoolHandler, dst *bool, src bool)
OnSetBoolHandler handles requests to change values of type bool. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution.
type OnSetBoolHandlerList ¶
type OnSetBoolHandlerList struct {
// contains filtered or unexported fields
}
OnSetBoolHandlerList represents a list of handlers subscribed to an event.
func (*OnSetBoolHandlerList) Clear ¶
func (l *OnSetBoolHandlerList) Clear()
Clear calls any finalizers on the handler list.
type OnSetDesktopHandler ¶
type OnSetDesktopHandler func(w *Window, prev OnSetDesktopHandler, dst **Desktop, src *Desktop)
OnSetDesktopHandler handles requests to change values of type *Desktop. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution.
type OnSetDurationHandler ¶
type OnSetDurationHandler func(w *Window, prev OnSetDurationHandler, dst *time.Duration, src time.Duration)
OnSetDurationHandler handles requests to change values of type time.Duration. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution.
type OnSetIntHandler ¶
type OnSetIntHandler func(w *Window, prev OnSetIntHandler, dst *int, src int)
OnSetIntHandler handles requests to change values of type int. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution.
type OnSetIntHandlerList ¶
type OnSetIntHandlerList struct {
// contains filtered or unexported fields
}
OnSetIntHandlerList represents a list of handlers subscribed to an event.
func (*OnSetIntHandlerList) Clear ¶
func (l *OnSetIntHandlerList) Clear()
Clear calls any finalizers on the handler list.
type OnSetPositionHandler ¶
type OnSetPositionHandler func(w *Window, prev OnSetPositionHandler, dst *Position, src Position)
OnSetPositionHandler handles requests to change values of type Position. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution.
type OnSetPositionHandlerList ¶
type OnSetPositionHandlerList struct {
// contains filtered or unexported fields
}
OnSetPositionHandlerList represents a list of handlers subscribed to an event.
func (*OnSetPositionHandlerList) Clear ¶
func (l *OnSetPositionHandlerList) Clear()
Clear calls any finalizers on the handler list.
type OnSetRectangleHandler ¶
type OnSetRectangleHandler func(w *Window, prev OnSetRectangleHandler, dst *Rectangle, src Rectangle)
OnSetRectangleHandler handles requests to change values of type Rectangle. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution.
type OnSetSizeHandler ¶
type OnSetSizeHandler func(w *Window, prev OnSetSizeHandler, dst *Size, src Size)
OnSetSizeHandler handles requests to change values of type Size. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution.
type OnSetSizeHandlerList ¶
type OnSetSizeHandlerList struct {
// contains filtered or unexported fields
}
OnSetSizeHandlerList represents a list of handlers subscribed to an event.
func (*OnSetSizeHandlerList) Clear ¶
func (l *OnSetSizeHandlerList) Clear()
Clear calls any finalizers on the handler list.
type OnSetStringHandler ¶
type OnSetStringHandler func(w *Window, prev OnSetStringHandler, dst *string, src string)
OnSetStringHandler handles requests to change values of type String. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution.
type OnSetStyleHandler ¶
type OnSetStyleHandler func(w *Window, prev OnSetStyleHandler, dst *Style, src Style)
OnSetStyleHandler handles requests to change values of type Style. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution.
type OnSetStyleHandlerList ¶
type OnSetStyleHandlerList struct {
// contains filtered or unexported fields
}
OnSetStyleHandlerList represents a list of handlers subscribed to an event.
func (*OnSetStyleHandlerList) Clear ¶
func (l *OnSetStyleHandlerList) Clear()
Clear calls any finalizers on the handler list.
type OnSetWindowHandler ¶
type OnSetWindowHandler func(w *Window, prev OnSetWindowHandler, dst **Window, src *Window)
OnSetWindowHandler handles requests to change values of type *Window. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution.
type OnSetWindowStyleHandler ¶
type OnSetWindowStyleHandler func(w *Window, prev OnSetWindowStyleHandler, dst *WindowStyle, src WindowStyle)
OnSetWindowStyleHandler handles requests to change values of type WindowStyle. If there was a previous handler installed, it's passed in prev. The handler then has the opportunity to call the previous handler before or after its own execution.
type PaintContext ¶
type PaintContext struct { Rectangle // contains filtered or unexported fields }
PaintContext represents the context passed to paint handlers.
type Rectangle ¶
Rectangle represents a 2D area.
func NewRectangle ¶
NewRectangle returns a Rectangle from 4 coordinates.
type Style ¶
Style represents a text style.
func (Style) TCellStyle ¶
TCellStyle converts a Style to a tcell.Style value.
type Theme ¶
type Theme struct { ChildWindow WindowStyle Desktop WindowStyle }
Theme represents visual styles of UI elements.
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window represents a rectangular area of a screen. A window can have borders on all of its sides and a title.
Window methods must be called only directly from an event handler goroutine or from a function that was enqueued using Application.Post or Application.PostWait.
func (*Window) BeginUpdate ¶
func (w *Window) BeginUpdate()
BeginUpdate marks the start of one or more updates to w.
Failing to properly pair BeginUpdate with a corresponding EndUpdate will cause application screen corruption and/or freeze.
func (*Window) BorderBottom ¶
BorderBottom returns the height of the bottom border.
func (*Window) BorderBottomArea ¶
BorderBottomArea returns the area of the bottom border.
func (*Window) BorderLeft ¶
BorderLeft returns the width of the left border.
func (*Window) BorderLeftArea ¶
BorderLeftArea returns the area of the left border.
func (*Window) BorderRight ¶
BorderRight returns the width of the right border.
func (*Window) BorderRightArea ¶
BorderRightArea returns the area of the right border.
func (*Window) BorderStyle ¶
BorderStyle returns the border style.
func (*Window) BorderTopArea ¶
BorderTopArea returns the area of the top border.
func (*Window) BringToFront ¶
func (w *Window) BringToFront()
BringToFront puts a child window on top of all its siblings. The method has no effect if w is a root window.
func (*Window) ClientArea ¶
ClientArea returns the client area.
func (*Window) ClientAreaStyle ¶
ClientAreaStyle returns the client area style.
func (*Window) ClientPosition ¶
ClientPosition returns the position of the client area relative to w.
func (*Window) ClientSize ¶
ClientSize returns the size of the client area.
func (*Window) CloseButton ¶
CloseButton returns whether the window shows a close button.
func (*Window) EndUpdate ¶
func (w *Window) EndUpdate()
EndUpdate marks the end of one or more updates to w.
Failing to properly pair BeginUpdate with a corresponding EndUpdate will cause application screen corruption and/or freeze.
func (*Window) Invalidate ¶
Invalidate marks a window area for repaint.
func (*Window) InvalidateClientArea ¶
InvalidateClientArea marks an area of the client area for repaint.
func (*Window) OnClick ¶
func (w *Window) OnClick(h OnMouseHandler, finalize func())
OnClick sets a mouse click event handler. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnClickBorder ¶
func (w *Window) OnClickBorder(h OnMouseHandler, finalize func())
OnClickBorder sets a mouse click border event handler. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnClose ¶
func (w *Window) OnClose(h OnCloseHandler, finalize func())
OnClose sets a window close event handler. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnDoubleClick ¶
func (w *Window) OnDoubleClick(h OnMouseHandler, finalize func())
OnDoubleClick sets a mouse double click event handler. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnDoubleClickBorder ¶
func (w *Window) OnDoubleClickBorder(h OnMouseHandler, finalize func())
OnDoubleClickBorder sets a mouse double click border event handler. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnDrag ¶
func (w *Window) OnDrag(h OnMouseHandler, finalize func())
OnDrag sets a mouse drag event handler. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnDragBorder ¶
func (w *Window) OnDragBorder(h OnMouseHandler, finalize func())
OnDragBorder sets a mouse drag border event handler. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnDrop ¶
func (w *Window) OnDrop(h OnMouseHandler, finalize func())
OnDrop sets a mouse drop event handler. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnKey ¶
func (w *Window) OnKey(h OnKeyHandler, finalize func())
OnKey sets a key event handler. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnMouseMove ¶
func (w *Window) OnMouseMove(h OnMouseHandler, finalize func())
OnMouseMove sets a mouse move event handler. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnPaintBorderBottom ¶
func (w *Window) OnPaintBorderBottom(h OnPaintHandler, finalize func())
OnPaintBorderBottom sets a bottom border paint handler. When the event handler is removed, finalize is called, if not nil. Example:
func onPaintBorderBottom(w *wm.Window, prev wm.OnPaintHandler, area wm.Rectangle) { if prev != nil { prev(w, nil, area) } style := w.Style().TCellStyle() w := w.BorderBottomArea().Width for x := 0; x < w; x++ { var r rune switch x { case 0: r = tcell.RuneLLCorner case w - 1: r = tcell.RuneLRCorner default: r = tcell.RuneHLine } w.SetCell(x, 0, r, nil, style) } } ... w.OnPaintBorderBottom(onPaintBorderBottom, nil) w.SetBorderBottom(1)
func (*Window) OnPaintBorderLeft ¶
func (w *Window) OnPaintBorderLeft(h OnPaintHandler, finalize func())
OnPaintBorderLeft sets a left border paint handler. When the event handler is removed, finalize is called, if not nil. Example:
func onPaintBorderLeft(w *wm.Window, prev wm.OnPaintHandler, area wm.Rectangle) { if prev != nil { prev(w, nil, area) } style := w.Style().TCellStyle() h := w.BorderLeftArea().Height for y := 0; y < h; y++ { var r rune switch y { case 0: r = tcell.RuneULCorner case h - 1: r = tcell.RuneLLCorner default: r = tcell.RuneVLine } w.SetCell(0, y, r, nil, style) } } ... w.OnPaintBorderLeft(onPaintBorderLeft, nil) w.SetBorderLeft(1)
func (*Window) OnPaintBorderRight ¶
func (w *Window) OnPaintBorderRight(h OnPaintHandler, finalize func())
OnPaintBorderRight sets a right border paint handler. When the event handler is removed, finalize is called, if not nil. Example:
func onPaintBorderRight(w *wm.Window, prev wm.OnPaintHandler, area wm.Rectangle) { if prev != nil { prev(w, nil, area) } style := w.Style().TCellStyle() h := w.BorderRightArea().Height for y := 0; y < h; y++ { var r rune switch y { case 0: r = tcell.RuneURCorner case h - 1: r = tcell.RuneLRCorner default: r = tcell.RuneVLine } w.SetCell(0, y, r, nil, style) } } ... w.OnPaintBorderRight(onPaintBorderRight, nil) w.SetBorderRight(1)
func (*Window) OnPaintBorderTop ¶
func (w *Window) OnPaintBorderTop(h OnPaintHandler, finalize func())
OnPaintBorderTop sets a top border paint handler. When the event handler is removed, finalize is called, if not nil. Example:
func onPaintBorderTop(w *wm.Window, prev wm.OnPaintHandler, area wm.Rectangle) { if prev != nil { prev(w, nil, area) } style := w.Style().TCellStyle() w := w.BorderTopArea().Width for x := 0; x < w; x++ { var r rune switch x { case 0: r = tcell.RuneULCorner case w - 1: r = tcell.RuneURCorner default: r = tcell.RuneHLine } w.SetCell(x, 0, r, nil, style) } } ... w.OnPaintBorderTop(onPaintBorderTop, nil) w.SetBorderTop(1)
func (*Window) OnPaintClientArea ¶
func (w *Window) OnPaintClientArea(h OnPaintHandler, finalize func())
OnPaintClientArea sets a client area paint handler. When the event handler is removed, finalize is called, if not nil. Example:
func onPaintClientArea(w *wm.Window, prev wm.OnPaintHandler, area wm.Rectangle) { if prev != nil { prev(w, nil, area) } w.Printf(0, 0, w.Style(), "Hello 世界!\nTime: %s", time.Now()) } ... w.OnPaintClientArea(onPaintClientArea, nil)
func (*Window) OnPaintTitle ¶
func (w *Window) OnPaintTitle(h OnPaintHandler, finalize func())
OnPaintTitle sets a window title paint handler. When the event handler is removed, finalize is called, if not nil. Example:
if s := w.Title(); s != "" { w.Printf(0, 0, w.Style().Title, " %s ", s) }
func (*Window) OnSetBorderBottom ¶
func (w *Window) OnSetBorderBottom(h OnSetIntHandler, finalize func())
OnSetBorderBottom sets a handler invoked on SetBorderBottom. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnSetBorderLeft ¶
func (w *Window) OnSetBorderLeft(h OnSetIntHandler, finalize func())
OnSetBorderLeft sets a handler invoked on SetBorderLeft. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnSetBorderRight ¶
func (w *Window) OnSetBorderRight(h OnSetIntHandler, finalize func())
OnSetBorderRight sets a handler invoked on SetBorderRight. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnSetBorderStyle ¶
func (w *Window) OnSetBorderStyle(h OnSetStyleHandler, finalize func())
OnSetBorderStyle sets a handler invoked on SetBorderStyle. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnSetBorderTop ¶
func (w *Window) OnSetBorderTop(h OnSetIntHandler, finalize func())
OnSetBorderTop sets a handler invoked on SetBorderTop. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnSetClientAreaStyle ¶
func (w *Window) OnSetClientAreaStyle(h OnSetStyleHandler, finalize func())
OnSetClientAreaStyle sets a handler invoked on SetClientAreaStyle. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnSetClientSize ¶
func (w *Window) OnSetClientSize(h OnSetSizeHandler, finalize func())
OnSetClientSize sets a handler invoked on SetClientSize. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnSetCloseButton ¶
func (w *Window) OnSetCloseButton(h OnSetBoolHandler, finalize func())
OnSetCloseButton sets a handler invoked on SetCloseButton. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnSetFocus ¶
func (w *Window) OnSetFocus(h OnSetBoolHandler, finalize func())
OnSetFocus sets a handler invoked on SetFocus. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnSetOrigin ¶
func (w *Window) OnSetOrigin(h OnSetPositionHandler, finalize func())
OnSetOrigin sets a handler invoked on SetOrigin. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnSetPosition ¶
func (w *Window) OnSetPosition(h OnSetPositionHandler, finalize func())
OnSetPosition sets a handler invoked on SetPosition. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnSetSize ¶
func (w *Window) OnSetSize(h OnSetSizeHandler, finalize func())
OnSetSize sets a handler invoked on SetSize. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnSetStyle ¶
func (w *Window) OnSetStyle(h OnSetWindowStyleHandler, finalize func())
OnSetStyle sets a handler invoked on SetStyle. When the event handler is removed, finalize is called, if not nil.
func (*Window) OnSetTitle ¶
func (w *Window) OnSetTitle(h OnSetStringHandler, finalize func())
OnSetTitle sets a handler invoked on SetTitle. When the event handler is removed, finalize is called, if not nil.
func (*Window) Printf ¶
Printf prints format with arguments at x, y. Calling this method outside of an OnPaint handler is ignored.
Special handling:
'\t' x, y = x + 8 - x%8, y '\n' x, y = 0, y+1 '\r' x, y = 0, y
func (*Window) RemoveOnClick ¶
func (w *Window) RemoveOnClick()
RemoveOnClick undoes the most recent OnClick call. The function will panic if there is no handler set.
func (*Window) RemoveOnClickBorder ¶
func (w *Window) RemoveOnClickBorder()
RemoveOnClickBorder undoes the most recent OnClickBorder call. The function will panic if there is no handler set.
func (*Window) RemoveOnClose ¶
func (w *Window) RemoveOnClose()
RemoveOnClose undoes the most recent OnClose call. The function will panic if there is no handler set.
func (*Window) RemoveOnDoubleClick ¶
func (w *Window) RemoveOnDoubleClick()
RemoveOnDoubleClick undoes the most recent OnDoubleClick call. The function will panic if there is no handler set.
func (*Window) RemoveOnDoubleClickBorder ¶
func (w *Window) RemoveOnDoubleClickBorder()
RemoveOnDoubleClickBorder undoes the most recent OnDoubleClickBorder call. The function will panic if there is no handler set.
func (*Window) RemoveOnDrag ¶
func (w *Window) RemoveOnDrag()
RemoveOnDrag undoes the most recent OnDrag call. The function will panic if there is no handler set.
func (*Window) RemoveOnDragBorder ¶
func (w *Window) RemoveOnDragBorder()
RemoveOnDragBorder undoes the most recent OnDragBorder call. The function will panic if there is no handler set.
func (*Window) RemoveOnDrop ¶
func (w *Window) RemoveOnDrop()
RemoveOnDrop undoes the most recent OnDrop call. The function will panic if there is no handler set.
func (*Window) RemoveOnKey ¶
func (w *Window) RemoveOnKey()
RemoveOnKey undoes the most recent OnKey call. The function will panic if there is no handler set.
func (*Window) RemoveOnMouseMove ¶
func (w *Window) RemoveOnMouseMove()
RemoveOnMouseMove undoes the most recent OnMouseMove call. The function will panic if there is no handler set.
func (*Window) RemoveOnPaintBorderBottom ¶
func (w *Window) RemoveOnPaintBorderBottom()
RemoveOnPaintBorderBottom undoes the most recent OnPaintBorderBottom call. The function will panic if there is no handler set.
func (*Window) RemoveOnPaintBorderLeft ¶
func (w *Window) RemoveOnPaintBorderLeft()
RemoveOnPaintBorderLeft undoes the most recent OnPaintBorderLeft call. The function will panic if there is no handler set.
func (*Window) RemoveOnPaintBorderRight ¶
func (w *Window) RemoveOnPaintBorderRight()
RemoveOnPaintBorderRight undoes the most recent OnPaintBorderRight call. The function will panic if there is no handler set.
func (*Window) RemoveOnPaintBorderTop ¶
func (w *Window) RemoveOnPaintBorderTop()
RemoveOnPaintBorderTop undoes the most recent OnPaintBorderTop call. The function will panic if there is no handler set.
func (*Window) RemoveOnPaintClientArea ¶
func (w *Window) RemoveOnPaintClientArea()
RemoveOnPaintClientArea undoes the most recent OnPaintClientArea call. The function will panic if there is no handler set.
func (*Window) RemoveOnPaintTitle ¶
func (w *Window) RemoveOnPaintTitle()
RemoveOnPaintTitle undoes the most recent OnPaintTitle call. The function will panic if there is no handler set.
func (*Window) RemoveOnSetBorderBottom ¶
func (w *Window) RemoveOnSetBorderBottom()
RemoveOnSetBorderBottom undoes the most recent OnSetBorderBottom call. The function will panic if there is no handler set.
func (*Window) RemoveOnSetBorderLeft ¶
func (w *Window) RemoveOnSetBorderLeft()
RemoveOnSetBorderLeft undoes the most recent OnSetBorderLeft call. The function will panic if there is no handler set.
func (*Window) RemoveOnSetBorderRight ¶
func (w *Window) RemoveOnSetBorderRight()
RemoveOnSetBorderRight undoes the most recent OnSetBorderRight call. The function will panic if there is no handler set.
func (*Window) RemoveOnSetBorderStyle ¶
func (w *Window) RemoveOnSetBorderStyle()
RemoveOnSetBorderStyle undoes the most recent OnSetBorderStyle call. The function will panic if there is no handler set.
func (*Window) RemoveOnSetBorderTop ¶
func (w *Window) RemoveOnSetBorderTop()
RemoveOnSetBorderTop undoes the most recent OnSetBorderTop call. The function will panic if there is no handler set.
func (*Window) RemoveOnSetClientAreaStyle ¶
func (w *Window) RemoveOnSetClientAreaStyle()
RemoveOnSetClientAreaStyle undoes the most recent OnSetClientAreaStyle call. The function will panic if there is no handler set.
func (*Window) RemoveOnSetClientSize ¶
func (w *Window) RemoveOnSetClientSize()
RemoveOnSetClientSize undoes the most recent OnSetClientSize call. The function will panic if there is no handler set.
func (*Window) RemoveOnSetCloseButton ¶
func (w *Window) RemoveOnSetCloseButton()
RemoveOnSetCloseButton undoes the most recent OnSetCloseButton call. The function will panic if there is no handler set.
func (*Window) RemoveOnSetFocus ¶
func (w *Window) RemoveOnSetFocus()
RemoveOnSetFocus undoes the most recent OnSetFocus call. The function will panic if there is no handler set.
func (*Window) RemoveOnSetOrigin ¶
func (w *Window) RemoveOnSetOrigin()
RemoveOnSetOrigin undoes the most recent OnSetOrigin call. The function will panic if there is no handler set.
func (*Window) RemoveOnSetPosition ¶
func (w *Window) RemoveOnSetPosition()
RemoveOnSetPosition undoes the most recent OnSetPosition call. The function will panic if there is no handler set.
func (*Window) RemoveOnSetSize ¶
func (w *Window) RemoveOnSetSize()
RemoveOnSetSize undoes the most recent OnSetSize call. The function will panic if there is no handler set.
func (*Window) RemoveOnSetStyle ¶
func (w *Window) RemoveOnSetStyle()
RemoveOnSetStyle undoes the most recent OnSetStyle call. The function will panic if there is no handler set.
func (*Window) RemoveOnSetTitle ¶
func (w *Window) RemoveOnSetTitle()
RemoveOnSetTitle undoes the most recent OnSetTitle call. The function will panic if there is no handler set.
func (*Window) Rendered ¶
Rendered returns how long the last desktop rendering took. Valid only for desktop's root window.
func (*Window) SetBorderBottom ¶
SetBorderBottom sets the height of the bottom border.
func (*Window) SetBorderLeft ¶
SetBorderLeft sets the width of the left border.
func (*Window) SetBorderRight ¶
SetBorderRight sets the width of the right border.
func (*Window) SetBorderStyle ¶
SetBorderStyle sets the border style.
func (*Window) SetBorderTop ¶
SetBorderTop sets the height of the top border.
func (*Window) SetCell ¶
SetCell renders a single character cell. Calling this method outside of an OnPaint* handler is ignored.
func (*Window) SetClientAreaStyle ¶
SetClientAreaStyle sets the client area style.
func (*Window) SetClientSize ¶
SetClientSize sets the size of the client area.
func (*Window) SetCloseButton ¶
SetCloseButton sets whether the window shows a close button.
func (*Window) SetOrigin ¶
SetOrigin sets the origin of the window. By default the origin of a window is (0, 0). When a paint handler is invoked the window's origin is subtracted from the coordinates the handler paints to. Also, the PaintContext.Rectangle value passed to the handler is adjusted accordingly.
Setting origin other than (0, 0) provides a view into the content created by the respective paint handlers. The mechanism aids in displaying scrolling content.
Negative values of p.X or p.Y are ignored.
func (*Window) SetPosition ¶
SetPosition sets the window position relative to its parent.
type WindowStyle ¶
WindowStyle represents visual styles of a Window.