objects

package module
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

README

objects

Go Reference

Objects contains a standard collection of re-usable objects. All objects in this module visually conform to whatever the theme is set to.

Documentation

Index

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.

func NewButton

func NewButton(text string) *Button

NewButton creates a new button with the specified text.

func (*Button) OnClick

func (this *Button) OnClick(callback func()) event.Cookie

OnClick specifies a function to be called when the button is clicked.

func (*Button) SetIcon added in v0.6.0

func (this *Button) SetIcon(id theme.Icon)

SetIcon sets an icon for this button. Setting the icon to IconUnknown will remove it.

func (*Button) SetText added in v0.6.0

func (this *Button) SetText(text string)

SetText sets the text of the button's label.

type Checkbox added in v0.10.0

type Checkbox struct {
	tomo.Box
	// contains filtered or unexported fields
}

Checkbox is a control that can be toggled.

func NewCheckbox added in v0.10.0

func NewCheckbox(value bool) *Checkbox

NewCheckbox creates a new checkbox with the specified value.

func (*Checkbox) OnValueChange added in v0.10.0

func (this *Checkbox) OnValueChange(callback func()) event.Cookie

OnValueChange specifies a function to be called when the checkbox's value changes.

func (*Checkbox) SetValue added in v0.10.0

func (this *Checkbox) SetValue(value bool)

SetValue sets the value of the checkbox.

func (*Checkbox) Toggle added in v0.10.0

func (this *Checkbox) Toggle()

Toggle toggles the value of the checkbox between true and false.

func (*Checkbox) Value added in v0.10.0

func (this *Checkbox) Value() bool

Value returns the value of the checkbox.

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

func NewInnerContainer(layout tomo.Layout, children ...tomo.Object) *Container

NewInnerContainer creates a new container that has no padding around it.

func NewOuterContainer

func NewOuterContainer(layout tomo.Layout, children ...tomo.Object) *Container

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.

func NewSunkenContainer added in v0.11.0

func NewSunkenContainer(layout tomo.Layout, children ...tomo.Object) *Container

NewSunkenContainer creates a new container with a sunken style and padding around it. It is meant to be used as a root container for a ScrollContainer.

type Heading

type Heading struct {
	tomo.TextBox
}

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

func NewHeading(level int, text string) *Heading

NewHeading creates a new section heading. The level can be from 0 to 2.

type Icon added in v0.5.0

type Icon struct {
	tomo.Box
}

Icon displays a single icon.

func NewIcon added in v0.5.0

func NewIcon(id theme.Icon, size theme.IconSize) *Icon

NewIcon creates a new icon from an icon ID.

func NewMimeIcon added in v0.5.0

func NewMimeIcon(mime data.Mime, size theme.IconSize) *Icon

NewMimeIcon creates a new icon from a MIME type.

func (*Icon) SetTexture added in v0.5.0

func (this *Icon) SetTexture(texture canvas.Texture)

type Label

type Label struct {
	tomo.TextBox
}

Label is a simple text label.

func NewLabel

func NewLabel(text string) *Label

NewLabel creates a new text label.

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 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.ContentBox)

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.

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 (this *Scrollbar) Link(box tomo.ContentBox) event.Cookie

Link assigns this scrollbar to a ContentBox. Closing the returned cookie will unlink it.

func (*Scrollbar) OnValueChange added in v0.6.0

func (this *Scrollbar) OnValueChange(callback func()) event.Cookie

OnValueChange specifies a function to be called when the position of the scrollbar changes.

func (*Scrollbar) SetValue added in v0.6.0

func (this *Scrollbar) SetValue(value float64)

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.

func (*Scrollbar) Value added in v0.6.0

func (this *Scrollbar) Value() float64

Value returns 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 Separator

type Separator struct {
	tomo.Box
}

Separator is a line for visually separating elements.

func NewSeparator

func NewSeparator() *Separator

NewSeparator creates a new separator line.

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

func NewHorizontalSlider(value float64) *Slider

NewHorizontalSlider creates a new horizontal slider with the specified value.

func NewVerticalSlider

func NewVerticalSlider(value float64) *Slider

NewVerticalSlider creates a new vertical slider with the specified value.

func (*Slider) OnSlide added in v0.10.0

func (this *Slider) OnSlide(callback func()) event.Cookie

OnValueChange specifies a function to be called when the user moves the slider.

func (*Slider) SetValue

func (this *Slider) SetValue(value float64)

SetValue sets the value of the slider between 0 and 1.

func (*Slider) Value

func (this *Slider) Value() float64

Value returns the value of the slider between 0 and 1.

type SliderHandle

type SliderHandle struct {
	tomo.Box
}

SliderHandle is a simple object that serves as a handle for sliders and scrollbars. It is completely inert.

type TextInput

type TextInput struct {
	tomo.TextBox
	// contains filtered or unexported fields
}

TextInput is a single-line editable text box.

func NewTextInput

func NewTextInput(text string) *TextInput

NewTextInput creates a new text input containing the specified text.

func (*TextInput) OnEdit added in v0.10.0

func (this *TextInput) OnEdit(callback func()) event.Cookie

OnEdit specifies a function to be called when the user edits the input text.

func (*TextInput) OnEnter

func (this *TextInput) OnEnter(callback func()) event.Cookie

OnEnter specifies a function to be called when the user presses enter within the text input.

func (*TextInput) SetText

func (this *TextInput) SetText(text string)

SetText sets the text content of the input.

func (*TextInput) Text

func (this *TextInput) Text() string

Text returns the text content of the input.

type TextView added in v0.7.0

type TextView struct {
	tomo.TextBox
}

TextView is an area for displaying a large amount of multi-line text.

func NewTextView added in v0.7.0

func NewTextView(text string) *TextView

NewTextView creates a new text view.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL