Package ui

import "github.com/BurntSushi/ui"
Overview
Index

Overview ▾

Variables

var DefaultTopConfig = TopConfig{
    IgnoreWM: false,
}
var DefaultTopTheme = TopTheme{
    BgColor: color.RGBA{0xee, 0xee, 0xee, 0xff},
    BgImage: nil,
}

type Geometry

type Geometry struct {
    Width, Height int
}

type Top

type Top struct {
    Config TopConfig
    Theme  TopTheme
    X      *xgbutil.XUtil
    Win    *xwindow.Window
    Child  Widget
    // contains filtered or unexported fields
}

func NewTop

func NewTop(conf TopConfig, theme TopTheme) (*Top, error)

func (*Top) Hide

func (t *Top) Hide()

func (*Top) SetChild

func (t *Top) SetChild(newChild Widget)

SetChild sets the child widget for a top level window. If this widget already has a child, it is hidden before it is removed.

It is the caller's responsibility to make sure that 'newChild' is visible.

func (*Top) Show

func (t *Top) Show()

type TopConfig

type TopConfig struct {
    // When set, the window manager will be instructed to ignore this
    // window. (i.e., the override redirect flag will be set.) This is useful
    // for top-level menu windows and popup messages.
    IgnoreWM bool
}

type TopTheme

type TopTheme struct {
    BgColor color.Color
    BgImage *xgraphics.Image
}

type Widget

type Widget interface {
    // Returns 0 or more children of this widget.
    Children() []Widget

    // Given available space, the width/height of the widget is returned.
    // The available space is necessary when a widget is given a fluid width
    // or height.
    Geom(space int) Geometry

    // Show will map the given widget. All widgets start in a hidden state,
    // which takes up no geometry.
    Show()

    // Hide will unmap the given widget. It will take up no space.
    Hide()
}