objects

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: GPL-3.0 Imports: 10 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(icon *Icon)

SetIcon sets an icon for this button. TODO: use tomo.Icon instead, use small size icons

func (*Button) SetText added in v0.6.0

func (this *Button) SetText(text string)

SetText sets the text of the button's label.

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.

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.

type Icon added in v0.5.0

type Icon struct {
	tomo.Box
}

Icon displays a single icon.

func NewApplicationIcon added in v0.5.0

func NewApplicationIcon(id theme.ApplicationIcon, size theme.IconSize) *Icon

NewApplicationIcon creates a new icon from an application description.

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 NewHeading

func NewHeading(level int, text string) *Label

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

func NewLabel

func NewLabel(text string) *Label

NewLabel creates a new text label.

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) OnValueChange

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

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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