Documentation ¶
Index ¶
- type Button
- type Calendar
- type Checkbox
- type Container
- type Dialog
- func NewDialog(kind DialogKind, parent tomo.Window, title, message string, ...) (*Dialog, error)
- func NewDialogOk(kind DialogKind, parent tomo.Window, title, message string, onOk func()) (*Dialog, error)
- func NewDialogOkCancel(kind DialogKind, parent tomo.Window, title, message string, onOk func()) (*Dialog, error)
- type DialogKind
- type Heading
- type Icon
- type Label
- type LabelCheckbox
- type Menu
- type MenuItem
- type NumberInput
- type ScrollContainer
- type ScrollSide
- type Scrollbar
- type Separator
- type Slider
- type SliderHandle
- type TabbedContainer
- type TextInput
- type TextView
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Button ¶
type Button struct { tomo.ContainerBox // contains filtered or unexported fields }
Button is a clickable button.
type Calendar ¶ added in v0.18.0
type Calendar struct { tomo.ContainerBox // contains filtered or unexported fields }
Calendar is an object that can display a date and allow the user to change it. It can display one month at a time.
func NewCalendar ¶ added in v0.18.0
NewCalendar creates a new calendar with the specified date.
type Checkbox ¶ added in v0.10.0
Checkbox is a control that can be toggled.
func NewCheckbox ¶ added in v0.10.0
NewCheckbox creates a new checkbox with the specified value.
func (*Checkbox) OnValueChange ¶ added in v0.10.0
OnValueChange specifies a function to be called when the checkbox's value changes.
type Container ¶
type Container struct {
tomo.ContainerBox
}
Container is an object that can contain other objects. It can be used as a primitive for building more complex layouts. It has two variants: an outer container, and an inner container. The outer container has padding around its edges, whereas the inner container does not. The container will have a corresponding object role variation of either "outer" or "inner".
func NewInnerContainer ¶
NewInnerContainer creates a new container that has no padding around it.
func NewOuterContainer ¶
NewOuterContainer creates a new container that has padding around it, as well as a solid background color. It is meant to be used as a root container for a window, tab pane, etc.
type Dialog ¶ added in v0.13.0
Dialog is a modal dialog window.
func NewDialog ¶ added in v0.13.0
func NewDialog(kind DialogKind, parent tomo.Window, title, message string, options ...tomo.Object) (*Dialog, error)
NewDialog creates a new dialog window given a dialog kind.
func NewDialogOk ¶ added in v0.13.0
func NewDialogOk(kind DialogKind, parent tomo.Window, title, message string, onOk func()) (*Dialog, error)
NewDialogOk creates a new dialog window with an OK option.
func NewDialogOkCancel ¶ added in v0.13.0
func NewDialogOkCancel(kind DialogKind, parent tomo.Window, title, message string, onOk func()) (*Dialog, error)
NewDialogOkCancel creates a new dialog window with OK and Cancel options.
type DialogKind ¶ added in v0.13.0
type DialogKind int
DialogKind defines the semantic role of a dialog window.
const ( DialogInformation DialogKind = iota DialogQuestion DialogWarning DialogError )
type Heading ¶
Heading is a label that denotes the start of some section of content. It can have a level from 0 to 2, with 0 being the most prominent and 2 being the most subtle. The level is described in the role variation.
func NewHeading ¶
NewHeading creates a new section heading. The level can be from 0 to 2.
type Icon ¶ added in v0.5.0
Icon displays a single icon.
func NewMimeIcon ¶ added in v0.5.0
NewMimeIcon creates a new icon from a MIME type.
func (*Icon) SetTexture ¶ added in v0.5.0
type LabelCheckbox ¶ added in v0.10.0
type LabelCheckbox struct { tomo.ContainerBox // contains filtered or unexported fields }
LabelCheckbox is a checkbox with a label.
func NewLabelCheckbox ¶ added in v0.10.0
func NewLabelCheckbox(value bool, text string) *LabelCheckbox
NewLabelCheckbox creates a new labeled checkbox with the specified value and label text.
func (*LabelCheckbox) OnValueChange ¶ added in v0.10.0
func (this *LabelCheckbox) OnValueChange(callback func()) event.Cookie
OnValueChange specifies a function to be called when the checkbox's value changes.
func (*LabelCheckbox) SetValue ¶ added in v0.10.0
func (this *LabelCheckbox) SetValue(value bool)
SetValue sets the value of the checkbox.
func (*LabelCheckbox) Toggle ¶ added in v0.10.0
func (this *LabelCheckbox) Toggle()
Toggle toggles the value of the checkbox between true and false.
func (*LabelCheckbox) Value ¶ added in v0.10.0
func (this *LabelCheckbox) Value() bool
Value returns the value of the checkbox.
type Menu ¶ added in v0.17.0
Menu is a menu window.
type MenuItem ¶ added in v0.17.0
type MenuItem struct { tomo.ContainerBox // contains filtered or unexported fields }
MenuItem is a clickable button.
func NewMenuItem ¶ added in v0.17.0
NewMenuItem creates a new menu item with the specified text.
func (*MenuItem) OnClick ¶ added in v0.17.0
OnClick specifies a function to be called when the menu item is clicked.
type NumberInput ¶ added in v0.10.0
type NumberInput struct { tomo.ContainerBox // contains filtered or unexported fields }
NumberInput is an editable text box which accepts only numbers, and has controls to increment and decrement its value.
func NewNumberInput ¶ added in v0.10.0
func NewNumberInput(value float64) *NumberInput
NewNumberInput creates a new number input with the specified value.
func (*NumberInput) OnEdit ¶ added in v0.10.0
func (this *NumberInput) OnEdit(callback func()) event.Cookie
OnEdit specifies a function to be called when the user edits the input value.
func (*NumberInput) OnEnter ¶ added in v0.10.0
func (this *NumberInput) OnEnter(callback func()) event.Cookie
OnEnter specifies a function to be called when the user presses enter within the text input.
func (*NumberInput) SetValue ¶ added in v0.10.0
func (this *NumberInput) SetValue(value float64)
SetValue sets the value of the input.
func (*NumberInput) Value ¶ added in v0.10.0
func (this *NumberInput) Value() float64
Value returns the value of the input.
type ScrollContainer ¶ added in v0.7.0
type ScrollContainer struct { tomo.ContainerBox // contains filtered or unexported fields }
ScrollContainer couples a ContentBox with one or two Scrollbars.
func NewScrollContainer ¶ added in v0.7.0
func NewScrollContainer(sides ScrollSide) *ScrollContainer
NewScrollContainer creates a new scroll container.
func (*ScrollContainer) SetRoot ¶ added in v0.7.0
func (this *ScrollContainer) SetRoot(root tomo.ContentObject)
SetRoot sets the root child of the ScrollContainer. There can only be one at a time, and setting it will remove and unlink the current child if there is one.
func (*ScrollContainer) SetValue ¶ added in v0.12.0
func (this *ScrollContainer) SetValue(x, y float64)
SetValue sets the horizontal and vertical scrollbar values where 0 is all the way to the left/top, and 1 is all the way to the right/bottom.
func (*ScrollContainer) Value ¶ added in v0.12.0
func (this *ScrollContainer) Value() (x, y float64)
Value returns the horizontal and vertical scrollbar values where 0 is all the way to the left/top, and 1 is all the way to the right/bottom.
type ScrollSide ¶ added in v0.7.0
type ScrollSide int
ScrollSide determines which Scrollbars are active in a ScrollContainer.
const ( ScrollVertical ScrollSide = 1 << iota ScrollHorizontal ScrollBoth = ScrollVertical | ScrollHorizontal )
func (ScrollSide) Horizontal ¶ added in v0.7.0
func (sides ScrollSide) Horizontal() bool
Horizontal returns true if the side includes a horizontal bar.
func (ScrollSide) String ¶ added in v0.7.0
func (sides ScrollSide) String() string
String returns one of:
- both
- horizontal
- vertical
- none
func (ScrollSide) Vertical ¶ added in v0.7.0
func (sides ScrollSide) Vertical() bool
Vertical returns true if the side includes a vertical bar.
type Scrollbar ¶ added in v0.6.0
type Scrollbar struct { tomo.ContainerBox // contains filtered or unexported fields }
Scrollbar is a special type of slider that can control the scroll of any overflowing ContainerBox.
func NewHorizontalScrollbar ¶ added in v0.6.0
func NewHorizontalScrollbar() *Scrollbar
NewHorizontalScrollbar creates a new horizontal scrollbar.
func NewVerticalScrollbar ¶ added in v0.6.0
func NewVerticalScrollbar() *Scrollbar
NewVerticalScrollbar creates a new vertical scrollbar.
func (*Scrollbar) Link ¶ added in v0.6.0
func (this *Scrollbar) Link(box tomo.ContentObject) event.Cookie
Link assigns this scrollbar to a ContentObject. Closing the returned cookie will unlink it.
func (*Scrollbar) OnValueChange ¶ added in v0.6.0
OnValueChange specifies a function to be called when the position of the scrollbar changes.
type Slider ¶
type Slider struct { tomo.ContainerBox // contains filtered or unexported fields }
Slider is a control that selects a numeric value between 0 and 1.
func NewHorizontalSlider ¶
NewHorizontalSlider creates a new horizontal slider with the specified value.
func NewVerticalSlider ¶
NewVerticalSlider creates a new vertical slider with the specified value.
func (*Slider) OnSlide ¶ added in v0.10.0
OnValueChange specifies a function to be called when the user moves the slider.
type SliderHandle ¶
SliderHandle is a simple object that serves as a handle for sliders and scrollbars. It is completely inert.
type TabbedContainer ¶ added in v0.19.0
type TabbedContainer struct { tomo.ContainerBox // contains filtered or unexported fields }
func NewTabbedContainer ¶ added in v0.19.0
func NewTabbedContainer() *TabbedContainer
func (*TabbedContainer) Activate ¶ added in v0.19.0
func (this *TabbedContainer) Activate(name string)
func (*TabbedContainer) AddTab ¶ added in v0.19.0
func (this *TabbedContainer) AddTab(name string, root tomo.Object)
func (*TabbedContainer) ClearTabs ¶ added in v0.19.0
func (this *TabbedContainer) ClearTabs()
func (*TabbedContainer) RemoveTab ¶ added in v0.19.0
func (this *TabbedContainer) RemoveTab(name string)
type TextInput ¶
TextInput is a single-line editable text box.
func NewTextInput ¶
NewTextInput creates a new text input containing the specified text.
func (*TextInput) OnEdit ¶ added in v0.10.0
OnEdit specifies a function to be called when the user edits the input text.
func (*TextInput) OnEnter ¶
OnEnter specifies a function to be called when the user presses enter within the text input.