property

package
v0.0.0-...-41cf20a Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPropertyHeight  = unit.Dp(30)
	DefaultHandleBarWidth  = unit.Dp(3)
	DefaultHandleBarHeight = unit.Dp(35)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type C

type C = layout.Context

type D

type D = layout.Dimensions
type DropDown struct {
	Selected int
	// contains filtered or unexported fields
}

func NewDropDown

func NewDropDown(items []string) *DropDown
func (a *DropDown) Layout(th *material.Theme, pgtx, gtx C) D

type Float64

type Float64 struct {
	*Text
}

func NewFloat64

func NewFloat64(val float64) *Float64

func (*Float64) SetFormat

func (f *Float64) SetFormat(fmt byte, prec int)

SetFormat sets the format to use when converting the floating point value to string. fmt and prec as defined per strconv.FormatFloat(). By default, fmt is 'f' and prec is 3.

func (*Float64) SetValue

func (f *Float64) SetValue(val float64)

func (*Float64) Value

func (f *Float64) Value() float64

type FocusBorderStyle

type FocusBorderStyle struct {
	Focused     bool
	BorderWidth unit.Dp
	Color       color.NRGBA
}

FocusBorderStyle implements styling of a focused widget.

func FocusBorder

func FocusBorder(th *material.Theme, focused bool) FocusBorderStyle

FocusBorder creates a focus border for a focused widget.

func (FocusBorderStyle) Layout

Layout adds a focus border and styling.

type Int

type Int struct {
	*Text
}

func NewInt

func NewInt(val int) *Int

func (*Int) SetValue

func (i *Int) SetValue(val int)

func (*Int) Value

func (i *Int) Value() int

type List

type List struct {

	// PropertyHeight is the height of a single property. All properties have
	// the same dimensions. The width depends of the horizontal space available
	// for the list
	PropertyHeight unit.Dp

	// HandleBarWidth is the width of the handlebar used to resize the columns.
	HandleBarWidth unit.Dp

	// HandleBarHeight is the width of the handlebar.
	HandleBarHeight unit.Dp
	// contains filtered or unexported fields
}

A List holds and presents a vertical, scrollable list of properties. A List is divided into into 2 columns: property names on the left and widgets for property values on the right. These 2 sections can be resized thanks to a divider, which can be dragged.

func NewList

func NewList() *List

NewList creates a new List.

func (*List) Add

func (plist *List) Add(name string, widget Widget)

Add adds a new property to the list.

func (*List) Layout

func (plist *List) Layout(th *material.Theme, gtx C) D

func (*List) LayoutName

func (plist *List) LayoutName(idx int, th *material.Theme, gtx C) D

type String

type String struct {
	*Text
}

func NewString

func NewString(val string) *String

func NewStringWithFilter

func NewStringWithFilter(val, filter string) *String

func (*String) SetValue

func (s *String) SetValue(val string)

func (*String) Value

func (s *String) Value() string

type Stringer

type Stringer interface {
	String() string
	Set(string) error
}

Stringer is the interface implemented by objects that can converted themselves to and from string.

type Text

type Text struct {
	Editable bool
	// contains filtered or unexported fields
}

Text is a widget that holds, displays and edits a property shown converted to its textual representation. It's edited using a standard gio editor or laid out as a label when not editable.

func NewText

func NewText(val Stringer, filter string) *Text

NewText creates a Text property and assigns it a value. filter is the list of characters allowed in the Editor. If empty all characters are allowed.

func (*Text) Layout

func (t *Text) Layout(th *material.Theme, _, gtx C) D

type Uint

type Uint struct {
	*Text
}

func NewUInt

func NewUInt(val uint) *Uint

func (*Uint) SetValue

func (i *Uint) SetValue(val uint)

func (*Uint) Value

func (i *Uint) Value() uint

type Widget

type Widget interface {
	// Layout lays out the property widget using gtx which is the
	// property-specific context, and pgtx which is the parent context (useful
	// for properties that require more space during edition).
	Layout(th *material.Theme, pgtx, gtx layout.Context) D
}

Widget shows the value of a property and handles user actions to edit it.

Jump to

Keyboard shortcuts

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