Documentation ¶
Index ¶
- type Button
- type Calendar
- type Checkbox
- type Container
- func (this *Container) Add(object tomo.Object)
- func (this *Container) At(index int) tomo.Object
- func (this *Container) Clear()
- func (this *Container) ContentBounds() image.Rectangle
- func (this *Container) GetBox() tomo.Box
- func (this *Container) Insert(child tomo.Object, before tomo.Object)
- func (this *Container) Len() int
- func (this *Container) OnContentBoundsChange(callback func()) event.Cookie
- func (this *Container) Remove(object tomo.Object)
- func (this *Container) ScrollTo(position image.Point)
- func (this *Container) SetAlign(x, y tomo.Align)
- func (this *Container) SetLayout(layout tomo.Layout)
- func (this *Container) SetOverflow(x, y bool)
- 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 Dropdown
- type File
- type HSVAColorPicker
- func (this *HSVAColorPicker) GetBox() tomo.Box
- func (this *HSVAColorPicker) OnValueChange(callback func()) event.Cookie
- func (this *HSVAColorPicker) RGBA() (r, g, b, a uint32)
- func (this *HSVAColorPicker) SetFocused(focused bool)
- func (this *HSVAColorPicker) SetValue(value color.Color)
- func (this *HSVAColorPicker) Value() color.Color
- type Heading
- type Icon
- type Label
- func (this *Label) Dot() text.Dot
- func (this *Label) GetBox() tomo.Box
- func (this *Label) OnDotChange(callback func()) event.Cookie
- func (this *Label) Select(dot text.Dot)
- func (this *Label) SetAlign(x, y tomo.Align)
- func (this *Label) SetFocused(focused bool)
- func (this *Label) SetOverflow(x, y bool)
- func (this *Label) SetText(text string)
- type LabelCheckbox
- func (this *LabelCheckbox) GetBox() tomo.Box
- func (this *LabelCheckbox) OnValueChange(callback func()) event.Cookie
- func (this *LabelCheckbox) SetFocused(focused bool)
- func (this *LabelCheckbox) SetText(text string)
- func (this *LabelCheckbox) SetValue(value bool)
- func (this *LabelCheckbox) Toggle()
- func (this *LabelCheckbox) Value() bool
- type LabelSwatch
- func (this *LabelSwatch) GetBox() tomo.Box
- func (this *LabelSwatch) OnConfirm(callback func()) event.Cookie
- func (this *LabelSwatch) OnValueChange(callback func()) event.Cookie
- func (this *LabelSwatch) RGBA() (r, g, b, a uint32)
- func (this *LabelSwatch) SetFocused(focused bool)
- func (this *LabelSwatch) SetText(text string)
- func (this *LabelSwatch) SetValue(value color.Color)
- func (this *LabelSwatch) Value() color.Color
- type Menu
- type MenuItem
- type MimeIcon
- type Notebook
- type NumberInput
- func (this *NumberInput) Dot() text.Dot
- func (this *NumberInput) GetBox() tomo.Box
- func (this *NumberInput) OnConfirm(callback func()) event.Cookie
- func (this *NumberInput) OnValueChange(callback func()) event.Cookie
- func (this *NumberInput) Select(dot text.Dot)
- func (this *NumberInput) SetFocused(focused bool)
- func (this *NumberInput) SetValue(value float64)
- func (this *NumberInput) Value() float64
- type Pegboard
- func (this *Pegboard) Add(object tomo.Object)
- func (this *Pegboard) At(index int) tomo.Object
- func (this *Pegboard) Clear()
- func (this *Pegboard) ContentBounds() image.Rectangle
- func (this *Pegboard) GetBox() tomo.Box
- func (this *Pegboard) Insert(child tomo.Object, before tomo.Object)
- func (this *Pegboard) Len() int
- func (this *Pegboard) OnContentBoundsChange(callback func()) event.Cookie
- func (this *Pegboard) Remove(object tomo.Object)
- func (this *Pegboard) ScrollTo(position image.Point)
- func (this *Pegboard) SetAlign(x, y tomo.Align)
- func (this *Pegboard) SetLayout(layout tomo.Layout)
- func (this *Pegboard) SetOverflow(x, y bool)
- type Root
- func (this *Root) Add(object tomo.Object)
- func (this *Root) At(index int) tomo.Object
- func (this *Root) Clear()
- func (this *Root) ContentBounds() image.Rectangle
- func (this *Root) GetBox() tomo.Box
- func (this *Root) Insert(child tomo.Object, before tomo.Object)
- func (this *Root) Len() int
- func (this *Root) OnContentBoundsChange(callback func()) event.Cookie
- func (this *Root) Remove(object tomo.Object)
- func (this *Root) ScrollTo(position image.Point)
- func (this *Root) SetAlign(x, y tomo.Align)
- func (this *Root) SetLayout(layout tomo.Layout)
- func (this *Root) SetOverflow(x, y bool)
- type ScrollContainer
- func (this *ScrollContainer) GetBox() tomo.Box
- 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
- func (this *Scrollbar) GetBox() tomo.Box
- func (this *Scrollbar) Link(box tomo.ContentObject) event.Cookie
- func (this *Scrollbar) OnValueChange(callback func()) event.Cookie
- func (this *Scrollbar) PageSize() int
- func (this *Scrollbar) SetValue(value float64)
- func (this *Scrollbar) StepSize() int
- func (this *Scrollbar) Value() float64
- type Segment
- func NewCommandSegment(layout tomo.Layout, children ...tomo.Object) *Segment
- func NewContentSegment(layout tomo.Layout, children ...tomo.Object) *Segment
- func NewOptionSegment(layout tomo.Layout, children ...tomo.Object) *Segment
- func NewStatusSegment(layout tomo.Layout, children ...tomo.Object) *Segment
- func (this *Segment) Add(object tomo.Object)
- func (this *Segment) At(index int) tomo.Object
- func (this *Segment) Clear()
- func (this *Segment) ContentBounds() image.Rectangle
- func (this *Segment) GetBox() tomo.Box
- func (this *Segment) Insert(child tomo.Object, before tomo.Object)
- func (this *Segment) Len() int
- func (this *Segment) OnContentBoundsChange(callback func()) event.Cookie
- func (this *Segment) Remove(object tomo.Object)
- func (this *Segment) ScrollTo(position image.Point)
- func (this *Segment) SetAlign(x, y tomo.Align)
- func (this *Segment) SetLayout(layout tomo.Layout)
- func (this *Segment) SetOverflow(x, y bool)
- type Separator
- type Slider
- type Swatch
- func (this *Swatch) Choose()
- func (this *Swatch) Draw(can canvas.Canvas)
- func (this *Swatch) GetBox() tomo.Box
- 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) SetFocused(focused bool)
- func (this *Swatch) SetValue(value color.Color)
- func (this *Swatch) Value() color.Color
- type TextInput
- func (this *TextInput) ContentBounds() image.Rectangle
- func (this *TextInput) Dot() text.Dot
- func (this *TextInput) GetBox() tomo.Box
- func (this *TextInput) OnConfirm(callback func()) event.Cookie
- func (this *TextInput) OnContentBoundsChange(callback func()) event.Cookie
- func (this *TextInput) OnDotChange(callback func()) event.Cookie
- func (this *TextInput) OnValueChange(callback func()) event.Cookie
- func (this *TextInput) Redo()
- func (this *TextInput) ScrollTo(position image.Point)
- func (this *TextInput) Select(dot text.Dot)
- func (this *TextInput) SetAlign(x, y tomo.Align)
- func (this *TextInput) SetFocused(focused bool)
- func (this *TextInput) SetValue(text string)
- func (this *TextInput) Type(char rune)
- func (this *TextInput) Undo()
- func (this *TextInput) Value() string
- type TextView
- func (this *TextView) ContentBounds() image.Rectangle
- func (this *TextView) Dot() text.Dot
- func (this *TextView) GetBox() tomo.Box
- func (this *TextView) OnContentBoundsChange(callback func()) event.Cookie
- func (this *TextView) OnDotChange(callback func()) event.Cookie
- func (this *TextView) ScrollTo(position image.Point)
- func (this *TextView) Select(dot text.Dot)
- func (this *TextView) SetAlign(x, y tomo.Align)
- func (this *TextView) SetFocused(focused bool)
- func (this *TextView) SetText(text string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Button ¶
type Button struct {
// contains filtered or unexported fields
}
Button is a clickable button.
Tags:
- [icon] The button has an icon.
func (*Button) SetFocused ¶ added in v0.23.0
SetFocused sets whether or not this button has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
type Calendar ¶ added in v0.18.0
type Calendar struct {
// 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.
Sub-components:
- CalendarGrid organizes the days into a grid.
- CalendarWeekdayHeader appears at the top of each grid column, and shows the day of the week that column represents.
- CalendarDay appears within the grid for each day of the current month.
CalendarDay tags:
- [weekend] The day is a weekend.
- [weekday] The day is a weekday.
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
type Checkbox struct {
// contains filtered or unexported fields
}
Checkbox is a control that can be toggled.
Tags:
- [checked] The checkbox's value is true.
- [unchecked] The checkbox's value is false.
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.
func (*Checkbox) SetFocused ¶ added in v0.23.0
SetFocused sets whether or not this checkbox has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container is an object that can contain other objects. It is plain looking, and is intended to be used within other containers as a primitive for building more complex layouts.
func NewContainer ¶ added in v0.24.0
NewContainer creates a new container.
func (*Container) Add ¶ added in v0.23.0
Add appends a child object. If the object is already a child of another object, it will be removed from that object first.
func (*Container) Clear ¶ added in v0.23.0
func (this *Container) Clear()
Clear removes all child objects.
func (*Container) ContentBounds ¶ added in v0.23.0
ContentBounds returns the bounds of the inner content of the container relative to the container's InnerBounds.
func (*Container) Insert ¶ added in v0.23.0
Insert inserts a child object before a specified object. If the before object is nil or is not contained within this container, the inserted object is appended. If the inserted object is already a child of another object, it will be removed from that object first.
func (*Container) Len ¶ added in v0.23.0
func (this *Container) Len() int
Len returns hte amount of child objects.
func (*Container) OnContentBoundsChange ¶ added in v0.23.0
OnContentBoundsChange specifies a function to be called when the container's ContentBounds or InnerBounds changes.
func (*Container) Remove ¶ added in v0.23.0
Remove removes a child object, if it is a child of this container.
func (*Container) ScrollTo ¶ added in v0.23.0
ScrollTo shifts the origin of the container's content to the origin of the container's InnerBounds, offset by the given point.
func (*Container) SetOverflow ¶ added in v0.23.0
func (this *Container) SetOverflow(x, y bool)
SetOverflow sets the X and Y overflow of the container.
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 Dropdown ¶ added in v0.22.0
type Dropdown struct {
// contains filtered or unexported fields
}
Dropdown is a non-editable text input that allows the user to pick a value from a list.
func NewDropdown ¶ added in v0.22.0
NewDropdown creates a new dropdown input with the specified items
func (*Dropdown) Choose ¶ added in v0.22.0
func (this *Dropdown) Choose()
Choose creates a menu that allows the user to pick a value.
func (*Dropdown) SetFocused ¶ added in v0.23.0
SetFocused sets whether or not this dropdown has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
func (*Dropdown) SetItems ¶ added in v0.22.0
SetItems sets the items from which the user is able to pick.
type File ¶ added in v0.23.0
type File struct {
// contains filtered or unexported fields
}
File is a representation of a file or directory.
func (*File) OnDoubleClick ¶ added in v0.23.0
OnDoubleClick specifies a function to be called when the file is double-clicked.
func (*File) SetFocused ¶ added in v0.23.0
SetFocused sets whether or not this file has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
type HSVAColorPicker ¶ added in v0.22.0
type HSVAColorPicker struct {
// contains filtered or unexported fields
}
HSVAColorPicker allows the user to pick a color by controlling its HSVA parameters.
Sub-components:
- ColorPickerMap is a rectangular control where the X axis controls saturation and the Y axis controls value.
func NewHSVAColorPicker ¶ added in v0.22.0
func NewHSVAColorPicker(value color.Color) *HSVAColorPicker
NewHSVAColorPicker creates a new color picker with the specified color.
func (*HSVAColorPicker) GetBox ¶ added in v0.23.0
func (this *HSVAColorPicker) GetBox() tomo.Box
GetBox returns the underlying box.
func (*HSVAColorPicker) OnValueChange ¶ added in v0.22.0
func (this *HSVAColorPicker) OnValueChange(callback func()) event.Cookie
OnValueChange specifies a function to be called when the user changes the swatch's color.
func (*HSVAColorPicker) RGBA ¶ added in v0.22.0
func (this *HSVAColorPicker) RGBA() (r, g, b, a uint32)
RGBA satisfies the color.Color interface
func (*HSVAColorPicker) SetFocused ¶ added in v0.23.0
func (this *HSVAColorPicker) SetFocused(focused bool)
SetFocused sets whether or not this color picker has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
func (*HSVAColorPicker) SetValue ¶ added in v0.22.0
func (this *HSVAColorPicker) SetValue(value color.Color)
SetValue sets the color of the picker.
func (*HSVAColorPicker) Value ¶ added in v0.22.0
func (this *HSVAColorPicker) Value() color.Color
Value returns the color of the picker.
type Heading ¶
type Heading struct {
// contains filtered or unexported fields
}
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.
Tags:
- [0] The heading has a level of 0 (most prominent).
- [1] The heading has a level of 1.
- [2] The heading has a level of 2 (least prominent).
func NewHeading ¶
NewHeading creates a new section heading. The level can be from 0 to 2.
func NewMenuHeading ¶ added in v0.22.0
NewMenuHeading creatss a new heading for use in menus.
func (*Heading) OnDotChange ¶ added in v0.23.0
OnDotChange specifies a function to be called when the text cursor or selection changes.
func (*Heading) SetFocused ¶ added in v0.23.0
SetFocused sets whether or not this heading has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
type Icon ¶ added in v0.5.0
type Icon struct {
// contains filtered or unexported fields
}
Icon displays a single icon.
Tags:
- [large] The icon is large sized.
- [medium] The icon is medium sized.
- [small] The icon is small sized.
type Label ¶
type Label struct {
// contains filtered or unexported fields
}
Label is a simple text label.
func (*Label) OnDotChange ¶ added in v0.23.0
OnDotChange specifies a function to be called when the text cursor or selection changes.
func (*Label) SetFocused ¶ added in v0.23.0
SetFocused sets whether or not this label has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
func (*Label) SetOverflow ¶ added in v0.24.0
SetOverflow sets the X and Y overflow of the label.
type LabelCheckbox ¶ added in v0.10.0
type LabelCheckbox struct {
// 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) GetBox ¶ added in v0.23.0
func (this *LabelCheckbox) GetBox() tomo.Box
GetBox returns the underlying box.
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) SetFocused ¶ added in v0.23.0
func (this *LabelCheckbox) SetFocused(focused bool)
SetFocused sets whether or not this checkbox has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
func (*LabelCheckbox) SetText ¶ added in v0.23.0
func (this *LabelCheckbox) SetText(text string)
SetText sets the text label of 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 {
// 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) GetBox ¶ added in v0.23.0
func (this *LabelSwatch) GetBox() tomo.Box
GetBox returns the underlying box.
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) SetFocused ¶ added in v0.23.0
func (this *LabelSwatch) SetFocused(focused bool)
SetFocused sets whether or not this swatch has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
func (*LabelSwatch) SetText ¶ added in v0.23.0
func (this *LabelSwatch) SetText(text string)
SetText sets the text label of the swatch.
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.
Sub-components:
- Root is the root of the window. It is differentiated from a normal Root object in that it has the [menu] tag. If the menu has been torn off, it will have the [torn] tag.
- TearLine is a horizontal line at the top of the menu that, when clicked, causes the menu to be "torn off" into a movable window.
func NewAnchoredMenu ¶ added in v0.22.0
NewAnchoredMenu creates a new menu with the specified items. The menu will appear directly under the anchor.
type MenuItem ¶ added in v0.17.0
type MenuItem struct {
// contains filtered or unexported fields
}
MenuItem is a selectable memu item.
func NewIconMenuItem ¶ added in v0.22.0
NewIconMenuItem creates a new menu item with the specified icon and text.
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.
func (*MenuItem) SetFocused ¶ added in v0.23.0
SetFocused sets whether or not this menu item has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
type MimeIcon ¶ added in v0.21.0
type MimeIcon struct {
// contains filtered or unexported fields
}
MimeIcon displays an icon of a MIME type.
func NewMimeIcon ¶ added in v0.5.0
NewMimeIcon creates a new icon from a MIME type.
type Notebook ¶ added in v0.24.0
type Notebook struct {
// contains filtered or unexported fields
}
Notebook holds multiple objects, each in their own page. The user can click the tab bar at the top to choose which one is activated.
Sub-components:
- TabRow sits at the top of the container and contains a row of tabs.
- TabSpacer sits at either end of the tab row, bookending the list of tabs.
- Tab appears in the tab row for each tab in the notebook. The user can click on the tab to switch to it.
TabSpacer tags:
- [left] The spacer is on the left.
- [right] The spacer is on the right.
Tab tags:
- [active] The tab is currently active and its page is visible.
func NewNotebook ¶ added in v0.24.0
func NewNotebook() *Notebook
NewNotebook creates a new tabbed notebook.
type NumberInput ¶ added in v0.10.0
type NumberInput struct {
// 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) Dot ¶ added in v0.23.0
func (this *NumberInput) Dot() text.Dot
Dot returns the text cursor or selection.
func (*NumberInput) GetBox ¶ added in v0.23.0
func (this *NumberInput) GetBox() tomo.Box
GetBox returns the underlying box.
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) Select ¶ added in v0.23.0
func (this *NumberInput) Select(dot text.Dot)
Select sets the text cursor or selection.
func (*NumberInput) SetFocused ¶ added in v0.23.0
func (this *NumberInput) SetFocused(focused bool)
SetFocused sets whether or not this number input has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
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 Pegboard ¶ added in v0.24.0
type Pegboard struct {
// contains filtered or unexported fields
}
Pegboard is an object that can contain other objects. It is intended to contain a flowed list of objects which represent some data, such as files.
func NewPegboard ¶ added in v0.24.0
NewPegboard creates a new pegboard. If the provided layout is nil, it will use a FlowHorizontal layout.
func (*Pegboard) Add ¶ added in v0.24.0
Add appends a child object. If the object is already a child of another object, it will be removed from that object first.
func (*Pegboard) Clear ¶ added in v0.24.0
func (this *Pegboard) Clear()
Clear removes all child objects.
func (*Pegboard) ContentBounds ¶ added in v0.24.0
ContentBounds returns the bounds of the inner content of the container relative to the container's InnerBounds.
func (*Pegboard) Insert ¶ added in v0.24.0
Insert inserts a child object before a specified object. If the before object is nil or is not contained within this container, the inserted object is appended. If the inserted object is already a child of another object, it will be removed from that object first.
func (*Pegboard) Len ¶ added in v0.24.0
func (this *Pegboard) Len() int
Len returns hte amount of child objects.
func (*Pegboard) OnContentBoundsChange ¶ added in v0.24.0
OnContentBoundsChange specifies a function to be called when the container's ContentBounds or InnerBounds changes.
func (*Pegboard) Remove ¶ added in v0.24.0
Remove removes a child object, if it is a child of this container.
func (*Pegboard) ScrollTo ¶ added in v0.24.0
ScrollTo shifts the origin of the container's content to the origin of the container's InnerBounds, offset by the given point.
func (*Pegboard) SetOverflow ¶ added in v0.24.0
func (this *Pegboard) SetOverflow(x, y bool)
SetOverflow sets the X and Y overflow of the container.
type Root ¶ added in v0.24.0
type Root struct {
// contains filtered or unexported fields
}
Root is an object that can contain other objects. It is intended to be used as the root of a window in order to contain its segments.
func (*Root) Add ¶ added in v0.24.0
Add appends a child object. If the object is already a child of another object, it will be removed from that object first.
func (*Root) ContentBounds ¶ added in v0.24.0
ContentBounds returns the bounds of the inner content of the container relative to the container's InnerBounds.
func (*Root) Insert ¶ added in v0.24.0
Insert inserts a child object before a specified object. If the before object is nil or is not contained within this container, the inserted object is appended. If the inserted object is already a child of another object, it will be removed from that object first.
func (*Root) Len ¶ added in v0.24.0
func (this *Root) Len() int
Len returns hte amount of child objects.
func (*Root) OnContentBoundsChange ¶ added in v0.24.0
OnContentBoundsChange specifies a function to be called when the container's ContentBounds or InnerBounds changes.
func (*Root) Remove ¶ added in v0.24.0
Remove removes a child object, if it is a child of this container.
func (*Root) ScrollTo ¶ added in v0.24.0
ScrollTo shifts the origin of the container's content to the origin of the container's InnerBounds, offset by the given point.
func (*Root) SetOverflow ¶ added in v0.24.0
func (this *Root) SetOverflow(x, y bool)
SetOverflow sets the X and Y overflow of the container.
type ScrollContainer ¶ added in v0.7.0
type ScrollContainer struct {
// 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) GetBox ¶ added in v0.23.0
func (this *ScrollContainer) GetBox() tomo.Box
GetBox returns the underlying box.
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 {
// contains filtered or unexported fields
}
Scrollbar is a special type of slider that can control the scroll of any overflowing ContainerObject.
Sub-components:
- ScrollbarHandle is the grabbable handle of the scrollbar.
Tags:
- [vertical] The scrollbar is oriented vertically.
- [horizontall] The scrollbar is oriented horizontally.
ScrollbarHandle tags:
- [vertical] The handle is oriented vertically.
- [horizontall] The handle is oriented horizontally.
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 Segment ¶ added in v0.24.0
type Segment struct {
// contains filtered or unexported fields
}
Segment is an object that can contain other objects, and provides a way to categorize the functionality of a window. Segments are typically laid out vertically in a window. There are several variants, the main one being the content segment. They can all be created using specialized constructors.
The following is a brief visual discription of how they are typically used, and in what order:
┌──────────────────────────┐ │ ┌──┐ ┌──┐ ┌────────────┐ ├─ command │ │◄─│ │─►│ │/foo/bar/baz│ │ │ └──┘ └──┘ └────────────┘ │ ├──────────────────────────┤ │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ├─ content │ │ │ │ │ │ │ │ │ │ │ └───┘ └───┘ └───┘ └───┘ │ │ ┌───┐ │ │ │ │ │ │ └───┘ │ ├──────────────────────────┤ │ 5 items, 4KiB ├─ status └──────────────────────────┘ ┌─────────────────┐ │ ┌───┐ │ │ │ ! │ Continue? │ │ └───┘ │ ├─────────────────┤ │ ┌──┐ ┌───┐ ├────────── option │ │No│ │Yes│ │ │ └──┘ └───┘ │ └─────────────────┘
Tags:
- [command] The segment is a command segment.
- [content] The segment is a content segment.
- [status] The segment is a status segment.
- [option] The segment is an option segment.
func NewCommandSegment ¶ added in v0.24.0
NewCommandSegment creates a new segment intended to hold the window's navigational controls and command functionality. If the provided layout is nil, it will use a ContractHorizontal layout.
func NewContentSegment ¶ added in v0.24.0
NewContentSegment creates a new segment intended to hold the window's main content. If the provided layout is nil, it will use a ContractVertical layout.
func NewOptionSegment ¶ added in v0.24.0
NewOptionSegment creates a new segment intended to hold the window's options. This is typically used for dialog boxes. If the provided layout is nil, it will use a ContractHorizontal layout. By default, it is end-aligned.
func NewStatusSegment ¶ added in v0.24.0
NewStatusSegment creates a new segment intended to display the window's status. If the provided layout is nil, it will use a ContractHorizontal layout.
func (*Segment) Add ¶ added in v0.24.0
Add appends a child object. If the object is already a child of another object, it will be removed from that object first.
func (*Segment) Clear ¶ added in v0.24.0
func (this *Segment) Clear()
Clear removes all child objects.
func (*Segment) ContentBounds ¶ added in v0.24.0
ContentBounds returns the bounds of the inner content of the container relative to the container's InnerBounds.
func (*Segment) Insert ¶ added in v0.24.0
Insert inserts a child object before a specified object. If the before object is nil or is not contained within this container, the inserted object is appended. If the inserted object is already a child of another object, it will be removed from that object first.
func (*Segment) Len ¶ added in v0.24.0
func (this *Segment) Len() int
Len returns hte amount of child objects.
func (*Segment) OnContentBoundsChange ¶ added in v0.24.0
OnContentBoundsChange specifies a function to be called when the container's ContentBounds or InnerBounds changes.
func (*Segment) Remove ¶ added in v0.24.0
Remove removes a child object, if it is a child of this container.
func (*Segment) ScrollTo ¶ added in v0.24.0
ScrollTo shifts the origin of the container's content to the origin of the container's InnerBounds, offset by the given point.
func (*Segment) SetOverflow ¶ added in v0.24.0
func (this *Segment) SetOverflow(x, y bool)
SetOverflow sets the X and Y overflow of the container.
type Separator ¶
type Separator struct {
// contains filtered or unexported fields
}
Separator is a line for visually separating elements.
type Slider ¶
type Slider struct {
// contains filtered or unexported fields
}
Slider is a control that selects a numeric value between 0 and 1.
Sub-components:
- SliderHandle is the grabbable handle of the slider.
Tags:
- [vertical] The slider is oriented vertically.
- [horizontall] The slider is oriented horizontally.
SliderHandle tags:
- [vertical] The handle is oriented vertically.
- [horizontall] The handle is oriented horizontally.
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.
func (*Slider) SetFocused ¶ added in v0.23.0
SetFocused sets whether or not this slider has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
type Swatch ¶ added in v0.20.0
type Swatch struct {
// contains filtered or unexported fields
}
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.
func (*Swatch) SetFocused ¶ added in v0.23.0
SetFocused sets whether or not this swatch has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
type TextInput ¶
type TextInput struct {
// contains filtered or unexported fields
}
TextInput is a single-line editable text box.
func NewMultilineTextInput ¶ added in v0.23.0
NewMultilineTextInput creates a new multiline text input containing the specified text.
func NewTextInput ¶
NewTextInput creates a new text input containing the specified text.
func (*TextInput) ContentBounds ¶ added in v0.23.0
ContentBounds returns the bounds of the inner content of the text input relative to the input's InnerBounds.
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) OnContentBoundsChange ¶ added in v0.23.0
OnContentBoundsChange specifies a function to be called when the text input's ContentBounds or InnerBounds changes.
func (*TextInput) OnDotChange ¶ added in v0.23.0
OnDotChange specifies a function to be called when the text cursor or selection changes.
func (*TextInput) OnValueChange ¶ added in v0.20.0
OnValueChange specifies a function to be called when the user edits the input text.
func (*TextInput) Redo ¶ added in v0.24.0
func (this *TextInput) Redo()
Redo redoes the last previously undone action.
func (*TextInput) ScrollTo ¶ added in v0.23.0
ScrollTo shifts the origin of the text input's content to the origin of the inputs's InnerBounds, offset by the given point.
func (*TextInput) SetAlign ¶ added in v0.23.0
SetAlign sets the X and Y alignment of the text input.
func (*TextInput) SetFocused ¶ added in v0.23.0
SetFocused sets whether or not this text input has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
type TextView ¶ added in v0.7.0
type TextView struct {
// contains filtered or unexported fields
}
TextView is an area for displaying a large amount of multi-line text.
func NewTextView ¶ added in v0.7.0
NewTextView creates a new text view.
func (*TextView) ContentBounds ¶ added in v0.23.0
ContentBounds returns the bounds of the inner content of the text view relative to the text view's InnerBounds.
func (*TextView) OnContentBoundsChange ¶ added in v0.23.0
OnContentBoundsChange specifies a function to be called when the text view's ContentBounds or InnerBounds changes.
func (*TextView) OnDotChange ¶ added in v0.23.0
OnDotChange specifies a function to be called when the text cursor or selection changes.
func (*TextView) ScrollTo ¶ added in v0.23.0
ScrollTo shifts the origin of the text view's content to the origin of the text view's InnerBounds, offset by the given point.
func (*TextView) SetFocused ¶ added in v0.23.0
SetFocused sets whether or not this text view has keyboard focus. If set to true, this method will steal focus away from whichever object currently has focus.
Source Files ¶
- abstractcontainer.go
- button.go
- calendar.go
- checkbox.go
- colorpicker.go
- container.go
- dialog.go
- dropdown.go
- file.go
- heading.go
- icon.go
- input.go
- label.go
- labelcheckbox.go
- labelswatch.go
- menu.go
- menuitem.go
- mimeicon.go
- notebook.go
- numberinput.go
- pegboard.go
- root.go
- scrollbar.go
- scrollcontainer.go
- segment.go
- separator.go
- slider.go
- swatch.go
- textinput.go
- textview.go