Documentation ¶
Index ¶
- type Button
- type Calendar
- type Checkbox
- type ColorPicker
- 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 LabelSwatch
- type Menu
- type MenuItem
- type NumberInput
- type ScrollContainer
- func (this *ScrollContainer) OnValueChange(callback func()) event.Cookie
- func (this *ScrollContainer) PageSize() image.Point
- func (this *ScrollContainer) SetRoot(root tomo.ContentObject)
- func (this *ScrollContainer) SetValue(x, y float64)
- func (this *ScrollContainer) StepSize() image.Point
- func (this *ScrollContainer) Value() (x, y float64)
- type ScrollSide
- type Scrollbar
- type Separator
- type Slider
- type SliderHandle
- type Swatch
- func (this *Swatch) Choose()
- func (this *Swatch) Draw(can canvas.Canvas)
- func (this *Swatch) OnConfirm(callback func()) event.Cookie
- func (this *Swatch) OnValueChange(callback func()) event.Cookie
- func (this *Swatch) RGBA() (r, g, b, a uint32)
- func (this *Swatch) SetValue(value color.Color)
- func (this *Swatch) Value() color.Color
- 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.
func (*Calendar) OnValueChange ¶ added in v0.20.0
func (this *Calendar) OnValueChange(callback func())
OnValueChange sets a function to be called when the user changes the date on the calendar.
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 user checks or unchecks the checkbox.
type ColorPicker ¶ added in v0.20.0
type ColorPicker struct { tomo.ContainerBox // contains filtered or unexported fields }
ColorPicker allows the user to pick a color by controlling its HSBA parameters.
func NewColorPicker ¶ added in v0.20.0
func NewColorPicker(value color.Color) *ColorPicker
NewColorPicker creates a new color picker with the specified color.
func (*ColorPicker) OnValueChange ¶ added in v0.20.0
func (this *ColorPicker) OnValueChange(callback func()) event.Cookie
OnValueChange specifies a function to be called when the user changes the swatch's color.
func (*ColorPicker) RGBA ¶ added in v0.20.0
func (this *ColorPicker) RGBA() (r, g, b, a uint32)
RGBA satisfies the color.Color interface
func (*ColorPicker) SetValue ¶ added in v0.20.0
func (this *ColorPicker) SetValue(value color.Color)
SetValue sets the color of the picker.
func (*ColorPicker) Value ¶ added in v0.20.0
func (this *ColorPicker) Value() color.Color
Value returns the color of the picker.
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.
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 user checks or unchecks the checkbox.
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 LabelSwatch ¶ added in v0.20.0
type LabelSwatch struct { tomo.ContainerBox // contains filtered or unexported fields }
LabelSwatch is a swatch with a label.
func NewLabelSwatch ¶ added in v0.20.0
func NewLabelSwatch(value color.Color, text string) *LabelSwatch
NewLabelSwatch creates a new labeled swatch with the specified color and label text.
func (*LabelSwatch) OnConfirm ¶ added in v0.20.0
func (this *LabelSwatch) OnConfirm(callback func()) event.Cookie
OnConfirm specifies a function to be called when the user selects "OK" in the color picker.
func (*LabelSwatch) OnValueChange ¶ added in v0.20.0
func (this *LabelSwatch) OnValueChange(callback func()) event.Cookie
OnValueChange specifies a function to be called when the swatch's color is changed by the user.
func (*LabelSwatch) RGBA ¶ added in v0.20.0
func (this *LabelSwatch) RGBA() (r, g, b, a uint32)
RGBA satisfies the color.Color interface
func (*LabelSwatch) SetValue ¶ added in v0.20.0
func (this *LabelSwatch) SetValue(value color.Color)
SetValue sets the color of the swatch.
func (*LabelSwatch) Value ¶ added in v0.20.0
func (this *LabelSwatch) Value() color.Color
Value returns the color of the swatch.
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 selectable memu item.
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) OnConfirm ¶ added in v0.20.0
func (this *NumberInput) OnConfirm(callback func()) event.Cookie
OnConfirm specifies a function to be called when the user presses enter within the number input.
func (*NumberInput) OnValueChange ¶ added in v0.20.0
func (this *NumberInput) OnValueChange(callback func()) event.Cookie
OnValueChange specifies a function to be called when the user edits the input value.
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) OnValueChange ¶ added in v0.20.0
func (this *ScrollContainer) OnValueChange(callback func()) event.Cookie
OnValueChange specifies a function to be called when the user changes the position of the horizontal or vertical scrollbars.
func (*ScrollContainer) PageSize ¶ added in v0.20.0
func (this *ScrollContainer) PageSize() image.Point
PageSize returns the scroll distance of a page.
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) StepSize ¶ added in v0.20.0
func (this *ScrollContainer) StepSize() image.Point
StepSize returns the scroll distance of a step.
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 user changes the position of the scrollbar.
func (*Scrollbar) SetValue ¶ added in v0.6.0
SetValue sets the value of the scrollbar between 0 and 1, where 0 is scrolled all the way to the left/top, and 1 is scrolled all the way to the right/bottom.
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) OnConfirm ¶ added in v0.20.0
OnConfirm specifies a function to be called when the user stops moving the slider.
func (*Slider) OnValueChange ¶
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 Swatch ¶ added in v0.20.0
Swatch displays a color, allowing the user to edit it by clicking on it.
func (*Swatch) Choose ¶ added in v0.20.0
func (this *Swatch) Choose()
Choose creates a modal that allows the user to edit the color of the swatch.
func (*Swatch) OnConfirm ¶ added in v0.20.0
OnConfirm specifies a function to be called when the user selects "OK" in the color picker.
func (*Swatch) OnValueChange ¶ added in v0.20.0
OnValueChange specifies a function to be called when the swatch's color is changed by the user.
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) OnConfirm ¶ added in v0.20.0
OnConfirm specifies a function to be called when the user presses enter within the text input.
func (*TextInput) OnValueChange ¶ added in v0.20.0
OnValueChange specifies a function to be called when the user edits the input text.