Documentation
¶
Index ¶
- Variables
- type Desktop
- func (d *Desktop) AddWindow(win *Window) *Desktop
- func (d *Desktop) BottomWindow() *Window
- func (d *Desktop) Draw(screen tcell.Screen)
- func (d *Desktop) Focus(delegate func(p tview.Primitive))
- func (d *Desktop) GetClient() tview.Primitive
- func (d *Desktop) HasFocus() bool
- func (d *Desktop) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (d *Desktop) MouseHandler() ...
- func (d *Desktop) RemoveWindow(win *Window) *Desktop
- func (d *Desktop) SetBorder(show bool) *Desktop
- func (d *Desktop) SetClient(client tview.Primitive, fullSize bool)
- func (d *Desktop) SetRect(x, y, width, height int)
- func (d *Desktop) SetWindowManager(wm WindowManager)
- func (d *Desktop) TopWindow() *Window
- type Window
- func (win *Window) Activate(setFocus func(p tview.Primitive)) *Window
- func (win *Window) BringToFront() *Window
- func (win *Window) Desktop(d *Desktop)
- func (win *Window) Draw(screen tcell.Screen)
- func (win *Window) Focus(delegate func(p tview.Primitive))
- func (win *Window) GetChildren() []tview.Primitive
- func (win *Window) GetClient() tview.Primitive
- func (win *Window) GetDesktop() *Desktop
- func (win *Window) GetRestoredRect() (int, int, int, int)
- func (win *Window) GetState() WindowState
- func (win *Window) GetTitle() string
- func (win *Window) HasFocus() bool
- func (win *Window) InitWindow()
- func (win *Window) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (win *Window) MouseHandler() ...
- func (win *Window) NextWindow() *Window
- func (win *Window) PrevWindow() *Window
- func (win *Window) SetAutoActivate(on bool) *Window
- func (win *Window) SetAutoPosition(on bool) *Window
- func (win *Window) SetBorder(show bool) *Window
- func (win *Window) SetClient(client tview.Primitive, fullSize bool)
- func (win *Window) SetRect(x, y, width, height int)
- func (win *Window) SetResizable(on bool) *Window
- func (win *Window) SetRestoredRect(x, y, width, height int)
- func (win *Window) SetState(state WindowState) *Window
- func (win *Window) SetTitle(title string) *Window
- type WindowManager
- type WindowState
- type WindowTheme
Constants ¶
This section is empty.
Variables ¶
var DefaultWindowManager = defWinMgr
DefaultWindowManager is the default window manager. Most likely when making your own window manager, you'll want to embed this one.
var DefaultWindowTheme = WindowTheme{ TitleAlign: tview.AlignLeft, ActiveCaptionTextColor: tcell.ColorValid + 230, ActiveCaptionColor: tcell.ColorValid + 26, InactiveCaptionTextColor: tcell.ColorValid + 15, InactiveCaptionColor: tcell.ColorValid + 239, }
DefaultWindowTheme is the default desktop theme. These colors were chosen to look decent and readable in most color counts.
Functions ¶
This section is empty.
Types ¶
type Desktop ¶
Desktop represents an area where windows go.
func NewDesktop ¶
func NewDesktop() *Desktop
NewDesktop creates a new desktop, it needs to be added to an Application.
func (*Desktop) AddWindow ¶
AddWindow adds a window to the desktop. If the window already belongs to a desktop, it is first removed. The window is added to the top of the stack, but it is not activated.
func (*Desktop) BottomWindow ¶
BottomWindow gets the bottom window, lowest in z-order.
func (*Desktop) GetClient ¶
GetClient gets the client primitive previously set by SetClient, or nil.
func (*Desktop) InputHandler ¶
func (*Desktop) MouseHandler ¶
func (*Desktop) RemoveWindow ¶
RemoveWindow removes a window from the desktop. The window should be blurred before calling this.
func (*Desktop) SetClient ¶
SetClient sets a desktop client primitive. A desktop client can be a way to show desktop icons or widgets behind windows. The client can avoid drawing its background to inherit the desktop background.
func (*Desktop) SetWindowManager ¶
func (d *Desktop) SetWindowManager(wm WindowManager)
SetWindowManager changes the WindowManager; see DefaultWindowManager
type Window ¶
Window is a window.
func (*Window) BringToFront ¶
func (*Window) GetChildren ¶
func (*Window) GetDesktop ¶
GetDesktop gets the desktop, or nil.
func (*Window) GetRestoredRect ¶
GetRestoredRect gets the rect of the window as if it were restored.
func (*Window) GetState ¶
func (win *Window) GetState() WindowState
func (*Window) InitWindow ¶
func (win *Window) InitWindow()
InitWindow is called by the Desktop to initialize the window. Do not call directly!
func (*Window) InputHandler ¶
func (*Window) MouseHandler ¶
func (*Window) NextWindow ¶
func (*Window) PrevWindow ¶
func (*Window) SetAutoActivate ¶
SetAutoActivate determines if the window will automatically activate.
func (*Window) SetAutoPosition ¶
SetAutoPosition sets whether or not the desktop decides where to put the window.
func (*Window) SetResizable ¶
SetResizable determines if the user is able to resize the window directly.
func (*Window) SetRestoredRect ¶
SetRestoredRect sets the rect of the restored window, if it is not restored, it will be the size when it is later restored.
func (*Window) SetState ¶
func (win *Window) SetState(state WindowState) *Window
type WindowManager ¶
type WindowManager interface { Added(win *Window) // window added to desktop Removed(win *Window) // window removed from desktop Resized(win *Window) // window resized TitleChanged(win *Window) // window title changed StateChanged(win *Window) // window state changed GetTheme() WindowTheme SetTheme(theme WindowTheme) DesktopResized(d *Desktop) DesktopDraw(d *Desktop, screen tcell.Screen) // allows drawing a wallpaper, etc DefaultDraw(win *Window, screen tcell.Screen) // for a window DefaultInputHandler(win *Window, event *tcell.EventKey, setFocus func(p tview.Primitive)) (consumed bool) DefaultMouseHandler(win *Window, action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive) }
WindowManager represents the management of windows on a desktop. Note that many Window calls call into the window manager, so if the window manager needs to make changes, it could call back recursively.
type WindowState ¶
type WindowState byte
WindowState is a state of the window, managed by the window manager.
const ( Restored WindowState = iota Minimized Maximized )
type WindowTheme ¶
type WindowTheme struct { TitleAlign int ActiveCaptionTextColor tcell.Color ActiveCaptionColor tcell.Color InactiveCaptionTextColor tcell.Color InactiveCaptionColor tcell.Color }