Documentation
¶
Index ¶
- func MixColors(first, second gctx2d.Color, amount float32) (color gctx2d.Color)
- type Align
- type Axis
- type Button
- type CheckState
- type Checkbox
- type ClickAnimation
- type ClickAnimationStyle
- type Clipboard
- type Container
- func (container *Container) Add(item LayoutItem, grow float32) *Container
- func (container *Container) Clear() *Container
- func (container *Container) Count() int
- func (container *Container) GetBounds() Rect
- func (container *Container) Layout()
- func (container *Container) Remove(item LayoutItem) *Container
- func (container *Container) SetBounds(bounds Rect)
- type Cursor
- type Dropdown
- type Easing
- type Element
- func (element *Element) BringToFront()
- func (element *Element) ContainsPoint(x, y float32) (contains bool)
- func (element *Element) GetBounds() Rect
- func (element *Element) Remove()
- func (element *Element) SetBounds(bounds Rect)
- func (element *Element) SetDisabled(disabled bool) *Element
- func (element *Element) SetPosition(x, y float32) *Element
- func (element *Element) SetSize(width, height float32) *Element
- type Form
- type Insets
- type Justify
- type Label
- type LabelSide
- type LayoutItem
- type Numeric
- type Panel
- type Radio
- type RadioGroup
- type Rect
- type Select
- type Slider
- type Style
- type Switcher
- type TextInput
- func (input *TextInput) Blur() *TextInput
- func (input *TextInput) Cursor() int
- func (input *TextInput) Focus() *TextInput
- func (input *TextInput) Focused() bool
- func (input *TextInput) Select(start, end int) *TextInput
- func (input *TextInput) SelectAll() *TextInput
- func (input *TextInput) SelectedText() (text string)
- func (input *TextInput) Selection() (start, end int)
- func (input *TextInput) SetCursor(cursor int) *TextInput
- func (input *TextInput) SetDisabled(disabled bool) *TextInput
- func (input *TextInput) SetMaxLength(maxLength int) *TextInput
- func (input *TextInput) SetValue(value string) *TextInput
- type TextInputAnimationStyle
- type TextStyle
- type Toggle
- type TransitionMode
- type TransitionStyle
- type UserInterface
- func (ui *UserInterface) Clear()
- func (ui *UserInterface) ClearWindowDragArea() *UserInterface
- func (ui *UserInterface) Column(bounds Rect) (container *Container)
- func (ui *UserInterface) Context() (ctx *gctx2d.Context)
- func (ui *UserInterface) Draw()
- func (ui *UserInterface) DrawTo(ctx *gctx2d.Context)
- func (ui *UserInterface) FocusedInput() *TextInput
- func (ui *UserInterface) Form(bounds Rect) (form *Form)
- func (ui *UserInterface) Hide(onHidden ...func()) *UserInterface
- func (ui *UserInterface) Migrate(ctx *gctx2d.Context) *UserInterface
- func (ui *UserInterface) NewButton(bounds Rect, text string, onClick func(self *Button)) (button *Button)
- func (ui *UserInterface) NewCheckbox(bounds Rect, label string, checked bool, ...) (checkbox *Checkbox)
- func (ui *UserInterface) NewDropdown(bounds Rect, options []string, selected int, ...) (dropdown *Dropdown)
- func (ui *UserInterface) NewLabel(bounds Rect, text string) (label *Label)
- func (ui *UserInterface) NewPanel(bounds Rect) (panel *Panel)
- func (ui *UserInterface) NewRadio(bounds Rect, label string, group string, checked bool, ...) (radio *Radio)
- func (ui *UserInterface) NewRadioGroup(bounds Rect, label string, choices []string, selected int, ...) (group *RadioGroup)
- func (ui *UserInterface) NewSelect(bounds Rect, label string, options []string, selected int, ...) (selectInput *Select)
- func (ui *UserInterface) NewSlider(bounds Rect, label string, minimum, maximum, value float32, ...) (slider *Slider[float32])
- func (ui *UserInterface) NewSwitcher(bounds Rect, options []string, selected int, ...) (switcher *Switcher)
- func (ui *UserInterface) NewTextInput(bounds Rect, placeholder string, onChange func(self *TextInput, value string)) (input *TextInput)
- func (ui *UserInterface) NewToggle(bounds Rect, label string, checked bool, ...) (toggle *Toggle)
- func (ui *UserInterface) OnKeyPress(key gpucontext.Key, mods gpucontext.Modifiers) (handled bool)
- func (ui *UserInterface) OnKeyRelease(key gpucontext.Key, mods gpucontext.Modifiers) (handled bool)
- func (ui *UserInterface) OnMouseMove(x, y float64) (handled bool)
- func (ui *UserInterface) OnMousePress(button gpucontext.MouseButton, x, y float64) (handled bool)
- func (ui *UserInterface) OnMouseRelease(button gpucontext.MouseButton, x, y float64) (handled bool)
- func (ui *UserInterface) OnScroll(deltaX, deltaY float64) bool
- func (ui *UserInterface) OnTextInput(text string) (handled bool)
- func (ui *UserInterface) ResetWindowOffset() *UserInterface
- func (ui *UserInterface) Row(bounds Rect) (container *Container)
- func (ui *UserInterface) SetActive(active bool) *UserInterface
- func (ui *UserInterface) SetClipboard(clipboard Clipboard) *UserInterface
- func (ui *UserInterface) SetContext(ctx *gctx2d.Context) *UserInterface
- func (ui *UserInterface) SetCursor(cursor Cursor) *UserInterface
- func (ui *UserInterface) SetVisible(visible bool) *UserInterface
- func (ui *UserInterface) SetWindowAnimation(style WindowAnimationStyle) *UserInterface
- func (ui *UserInterface) SetWindowDragArea(area Rect) *UserInterface
- func (ui *UserInterface) SetWindowDragHandle(handle LayoutItem) *UserInterface
- func (ui *UserInterface) SetWindowOffset(x, y float32) *UserInterface
- func (ui *UserInterface) Show() *UserInterface
- func (ui *UserInterface) WidgetCount() int
- func (ui *UserInterface) WindowOffset() (x, y float32)
- func (ui *UserInterface) WindowState() WindowState
- type WindowAnimationStyle
- type WindowState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Button ¶
Button is a retained clickable button.
func (*Button) SetDisabled ¶
SetDisabled updates the button's disabled state.
type CheckState ¶
type CheckState uint8
CheckState is the exact state of a two- or three-state checkbox.
const ( CheckUnchecked CheckState = iota CheckChecked CheckIndeterminate )
type Checkbox ¶
type Checkbox struct {
*Element
Label string
TextStyle TextStyle
UncheckedStyle, CheckedStyle, IndeterminateStyle Style
CheckColor gctx2d.Color
State CheckState
Checked, ThreeState bool
OnChange func(self *Checkbox, checked bool)
OnStateChange func(self *Checkbox, state CheckState)
// contains filtered or unexported fields
}
Checkbox is a retained boolean input with an optional label.
func (*Checkbox) SetChecked ¶
SetChecked updates the checkbox and notifies its change handler.
func (*Checkbox) SetState ¶
func (checkbox *Checkbox) SetState(state CheckState) *Checkbox
SetState updates the exact checkbox state and notifies its handlers.
func (*Checkbox) SetThreeState ¶
SetThreeState controls whether pointer activation cycles through indeterminate.
type ClickAnimation ¶
type ClickAnimation uint8
ClickAnimation selects the visual feedback produced by activation.
const ( ClickAnimationNone ClickAnimation = iota ClickAnimationScale ClickAnimationPulse ClickAnimationBounce )
type ClickAnimationStyle ¶
type ClickAnimationStyle struct {
Type ClickAnimation
Duration time.Duration
Easing Easing
Scale float32
MixAmount float32
}
ClickAnimationStyle controls press and activation feedback.
func DefaultClickAnimationStyle ¶
func DefaultClickAnimationStyle() (style ClickAnimationStyle)
DefaultClickAnimationStyle returns the standard button press animation.
type Clipboard ¶
type Clipboard interface {
ClipboardRead() (text string, err error)
ClipboardWrite(text string) error
}
Clipboard is implemented by gogpu.App and gpucontext platform providers.
type Container ¶
type Container struct {
Bounds Rect
Direction Axis
Padding Insets
Gap float32
Align Align
Justify Justify
// contains filtered or unexported fields
}
Container applies a lightweight row or column layout to retained items.
func (*Container) Add ¶
func (container *Container) Add(item LayoutItem, grow float32) *Container
Add appends an item; positive grow values divide remaining primary-axis space.
func (*Container) Layout ¶
func (container *Container) Layout()
Layout positions all items without allocating.
func (*Container) Remove ¶
func (container *Container) Remove(item LayoutItem) *Container
Remove detaches an item from this layout.
type Cursor ¶
type Cursor interface {
SetCursor(cursor gpucontext.CursorShape)
}
Cursor changes the platform pointer shape; gogpu.App implements it.
type Dropdown ¶
type Dropdown struct {
*Element
Options []string
Selected int
Expanded bool
TextStyle TextStyle
OptionHeight float32
OnChange func(self *Dropdown, selected int, value string)
// contains filtered or unexported fields
}
Dropdown is an expandable fixed-option selection input.
func (*Dropdown) SetSelected ¶
SetSelected updates the dropdown selection and notifies its handler.
type Easing ¶
type Easing uint8
Easing controls how an animated value advances through a transition.
type Element ¶
type Element struct {
Bounds Rect
Style Style
Visible, Disabled, Interactive bool
Hovered, Pressed bool
// contains filtered or unexported fields
}
Element holds the state shared by every interactive element.
func (*Element) BringToFront ¶
func (element *Element) BringToFront()
BringToFront moves the element to the top of draw and hit-test order.
func (*Element) ContainsPoint ¶
ContainsPoint performs a rounded-rectangle hit test.
func (*Element) SetDisabled ¶
SetDisabled updates the common disabled state.
func (*Element) SetPosition ¶
SetPosition updates an element's position without changing its size.
type Form ¶
type Form struct {
Bounds Rect
LabelSide LabelSide
LabelWidth float32
RowHeight float32
Gap, RowGap float32
// contains filtered or unexported fields
}
Form aligns corresponding labels and controls into consistent rows.
func (*Form) Add ¶
func (form *Form) Add(label *Label, control LayoutItem) *Form
Add appends a corresponding label and control row.
type Insets ¶
type Insets struct {
Top, Right, Bottom, Left float32
}
Insets describes spacing on each edge of a rectangle.
type LabelSide ¶
type LabelSide uint8
LabelSide selects which side of a form row contains its label.
type LayoutItem ¶
LayoutItem can be positioned by a Container.
type Numeric ¶
type Numeric interface {
~int | ~int8 | ~int16 | ~int32 | ~int64 |
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr |
~float32 | ~float64
}
Numeric is the set of integer and floating-point values supported by Slider.
type Radio ¶
type Radio struct {
*Element
Label string
Group string
TextStyle TextStyle
Checked bool
OnChange func(self *Radio, checked bool)
// contains filtered or unexported fields
}
Radio is a retained mutually exclusive choice within a named group.
func (*Radio) SetChecked ¶
SetChecked updates this radio and enforces its group exclusivity.
type RadioGroup ¶
type RadioGroup struct {
*Element
Label string
Choices []string
Selected int
LabelStyle, TextStyle TextStyle
OnChange func(self *RadioGroup, selected int, value string)
// contains filtered or unexported fields
}
RadioGroup owns a labeled, mutually exclusive set of radio options.
func (*RadioGroup) SetSelected ¶
func (group *RadioGroup) SetSelected(selected int) *RadioGroup
SetSelected updates the selected radio option and notifies its handler.
func (*RadioGroup) Value ¶
func (group *RadioGroup) Value() (value string)
Value returns the currently selected radio option.
type Rect ¶
type Rect struct {
X, Y, Width, Height float32
}
Rect describes an element's position and size in pixels.
type Select ¶
type Select struct {
*Element
Label, ValueSeparator string
Options []string
Selected int
TextStyle TextStyle
OnChange func(self *Select, selected int, value string)
// contains filtered or unexported fields
}
Select is a retained input that cycles through a fixed set of options.
func (*Select) SetSelected ¶
SetSelected updates the selected option and notifies its change handler.
type Slider ¶
type Slider[T Numeric] struct { *Element Label string TextStyle TextStyle Min, Max, Step, Value T SnapStep bool TrackColor, ProgressColor gctx2d.Color TrackWidth, KnobRadius float32 ValueWidth, ValueGap float32 OnChange func(self *Slider[T], value T) // contains filtered or unexported fields }
Slider is a retained numeric input controlled by pointer dragging.
func NewSlider ¶
func NewSlider[T Numeric](ui *UserInterface, bounds Rect, label string, minimum, maximum, value T, onChange func(self *Slider[T], value T)) (slider *Slider[T])
NewSlider adds a bounded slider whose values and callback retain numeric type T.
func (*Slider[T]) SetStep ¶
SetStep sets the value interval and optionally disables pointer snapping.
func (*Slider[T]) SetValue ¶
SetValue clamps and optionally snaps the slider value, then notifies its handler.
func (*Slider[T]) SetValueFormat ¶
SetValueFormat applies a type-compatible numeric format or panics.
func (*Slider[T]) ValueFormat ¶
ValueFormat returns the format used for the displayed slider value.
type Style ¶
type Style struct {
FillColor, BorderColor, HoverMixColor, DisabledMixColor gctx2d.Color
FocusBorderColor gctx2d.Color
BorderWidth, BorderRadius float32
HoverMixAmount, PressMixAmount, DisabledMixAmount float32
Transition TransitionStyle
Click ClickAnimationStyle
}
Style controls the shared box styling for interactive elements.
func DefaultButtonStyle ¶
func DefaultButtonStyle() (style Style)
DefaultButtonStyle returns the original render-package button styling.
func DefaultCheckboxStyles ¶
func DefaultCheckboxStyles() (unchecked, checked, indeterminate Style)
DefaultCheckboxStyles returns distinct visual styles for every checkbox state.
func DefaultControlStyle ¶
func DefaultControlStyle() (style Style)
DefaultControlStyle returns a transparent style for standalone controls.
func DefaultPanelStyle ¶
func DefaultPanelStyle() (style Style)
DefaultPanelStyle returns a dark modal-surface style.
func DefaultTextInputStyle ¶
func DefaultTextInputStyle() (style Style)
DefaultTextInputStyle returns a button-compatible text input style.
type Switcher ¶
type Switcher = Select
Switcher is the descriptive name for the cycling Select control.
type TextInput ¶
type TextInput struct {
*Element
Value, Placeholder string
TextStyle TextStyle
Animation TextInputAnimationStyle
PlaceholderColor, CursorColor, SelectionColor gctx2d.Color
Padding Insets
MaxLength int
OnChange func(self *TextInput, value string)
OnSubmit func(self *TextInput, value string)
// contains filtered or unexported fields
}
TextInput is a retained, single-line editable text field.
func (*TextInput) Blur ¶
func (input *TextInput) Blur() *TextInput
Blur removes keyboard focus from this input.
func (*TextInput) Cursor ¶
func (input *TextInput) Cursor() int
Cursor returns the insertion point as a rune index.
func (*TextInput) Focus ¶
func (input *TextInput) Focus() *TextInput
Focus gives this input keyboard and text input focus.
func (*TextInput) Focused ¶
func (input *TextInput) Focused() bool
Focused reports whether this input currently receives keyboard events.
func (*TextInput) Select ¶
func (input *TextInput) Select(start, end int) *TextInput
Select sets a rune-indexed selection with the caret at end.
func (*TextInput) SelectAll ¶
func (input *TextInput) SelectAll() *TextInput
SelectAll selects the complete input value.
func (*TextInput) SelectedText ¶
func (input *TextInput) SelectedText() (text string)
SelectedText returns the currently selected text.
func (*TextInput) Selection ¶
func (input *TextInput) Selection() (start, end int)
Selection returns the ordered rune range of the current selection.
func (*TextInput) SetCursor ¶
func (input *TextInput) SetCursor(cursor int) *TextInput
SetCursor moves the insertion point and clears the selection.
func (*TextInput) SetDisabled ¶
func (input *TextInput) SetDisabled(disabled bool) *TextInput
SetDisabled updates the input's disabled state.
func (*TextInput) SetMaxLength ¶
func (input *TextInput) SetMaxLength(maxLength int) *TextInput
SetMaxLength limits the value by rune count; zero means unlimited.
type TextInputAnimationStyle ¶
type TextInputAnimationStyle struct {
Cursor TransitionStyle
CursorBlink time.Duration
CursorBlinkFade time.Duration
Highlight TransitionStyle
}
TextInputAnimationStyle controls caret and selection-highlight animation.
func DefaultTextInputAnimationStyle ¶
func DefaultTextInputAnimationStyle() (style TextInputAnimationStyle)
DefaultTextInputAnimationStyle returns smooth caret and highlight animation.
type TextStyle ¶
type TextStyle struct {
Color gctx2d.Color
BorderColor gctx2d.Color
Font *gctx2d.FontHandle
FontSize float64
BorderWidth float32
Weight gctx2d.FontWeight
Align gctx2d.TextAlign
Baseline gctx2d.TextBaseline
BorderCap gctx2d.LineCap
BorderJoin gctx2d.LineJoin
Kerning bool
}
TextStyle controls font, fill, and optional border styling.
func DefaultButtonTextStyle ¶
func DefaultButtonTextStyle() (style TextStyle)
DefaultButtonTextStyle returns centered blue button text styling.
func DefaultInputTextStyle ¶
func DefaultInputTextStyle() (style TextStyle)
DefaultInputTextStyle returns left-aligned black input text styling.
type Toggle ¶
type Toggle struct {
*Element
Label string
TextStyle TextStyle
Checked bool
OnChange func(self *Toggle, checked bool)
// contains filtered or unexported fields
}
Toggle is a retained boolean input rendered as an on/off switch.
func (*Toggle) SetChecked ¶
SetChecked updates the toggle and notifies its change handler.
type TransitionMode ¶
type TransitionMode uint8
TransitionMode selects how controls with multiple visual states animate.
const ( TransitionInterpolate TransitionMode = iota TransitionCrossFade )
type TransitionStyle ¶
type TransitionStyle struct {
Duration time.Duration
Easing Easing
Mode TransitionMode
}
TransitionStyle controls the duration and easing of visual state changes.
func DefaultTransitionStyle ¶
func DefaultTransitionStyle() (style TransitionStyle)
DefaultTransitionStyle returns the standard control-state transition.
type UserInterface ¶
type UserInterface struct {
WindowAnimation WindowAnimationStyle
Active, Visible bool
// contains filtered or unexported fields
}
UserInterface owns a reusable, independently switchable set of widgets.
func NewUserInterface ¶
NewUserInterface is the descriptive alias for New.
func (*UserInterface) Clear ¶
func (ui *UserInterface) Clear()
Clear removes every widget and layout while retaining the UI allocation.
func (*UserInterface) ClearWindowDragArea ¶
func (ui *UserInterface) ClearWindowDragArea() *UserInterface
ClearWindowDragArea removes window-position containment.
func (*UserInterface) Column ¶
Column creates a vertical container that is laid out before every UI draw.
func (*UserInterface) Draw ¶
func (ui *UserInterface) Draw()
Draw emits this UI at the current point in the caller's scene draw.
func (*UserInterface) FocusedInput ¶
func (ui *UserInterface) FocusedInput() *TextInput
FocusedInput returns the text input that currently owns keyboard focus.
func (*UserInterface) Hide ¶
func (ui *UserInterface) Hide(onHidden ...func()) *UserInterface
Hide disables input and begins closing, then invokes onHidden after dismissal.
func (*UserInterface) Migrate ¶
Migrate changes the default draw context while preserving the retained UI.
func (*UserInterface) NewButton ¶
func (ui *UserInterface) NewButton(bounds Rect, text string, onClick func(self *Button)) (button *Button)
NewButton adds a button to the top of this UI's draw and hit-test order.
func (*UserInterface) NewCheckbox ¶
func (ui *UserInterface) NewCheckbox(bounds Rect, label string, checked bool, onChange func(self *Checkbox, checked bool)) (checkbox *Checkbox)
NewCheckbox adds a boolean input to this UI.
func (*UserInterface) NewDropdown ¶
func (ui *UserInterface) NewDropdown(bounds Rect, options []string, selected int, onChange func(self *Dropdown, selected int, value string)) (dropdown *Dropdown)
NewDropdown adds an expandable fixed-option input.
func (*UserInterface) NewLabel ¶
NewLabel adds non-interactive text that can participate in layouts.
func (*UserInterface) NewRadio ¶
func (ui *UserInterface) NewRadio(bounds Rect, label string, group string, checked bool, onChange func(self *Radio, checked bool)) (radio *Radio)
NewRadio adds a mutually exclusive choice to this UI.
func (*UserInterface) NewRadioGroup ¶
func (ui *UserInterface) NewRadioGroup(bounds Rect, label string, choices []string, selected int, onChange func(self *RadioGroup, selected int, value string)) (group *RadioGroup)
NewRadioGroup adds a labeled set of mutually exclusive options.
func (*UserInterface) NewSelect ¶
func (ui *UserInterface) NewSelect(bounds Rect, label string, options []string, selected int, onChange func(self *Select, selected int, value string)) (selectInput *Select)
NewSelect adds a cycling fixed-option input for backwards compatibility.
func (*UserInterface) NewSlider ¶
func (ui *UserInterface) NewSlider(bounds Rect, label string, minimum, maximum, value float32, onChange func(self *Slider[float32], value float32)) (slider *Slider[float32])
NewSlider adds a float32 slider using the UI method compatibility API.
func (*UserInterface) NewSwitcher ¶
func (ui *UserInterface) NewSwitcher(bounds Rect, options []string, selected int, onChange func(self *Switcher, selected int, value string)) (switcher *Switcher)
NewSwitcher adds a cycling fixed-option input.
func (*UserInterface) NewTextInput ¶
func (ui *UserInterface) NewTextInput(bounds Rect, placeholder string, onChange func(self *TextInput, value string)) (input *TextInput)
NewTextInput adds a single-line text input to this UI.
func (*UserInterface) NewToggle ¶
func (ui *UserInterface) NewToggle(bounds Rect, label string, checked bool, onChange func(self *Toggle, checked bool)) (toggle *Toggle)
NewToggle adds an on/off switch to this UI.
func (*UserInterface) OnKeyPress ¶
func (ui *UserInterface) OnKeyPress(key gpucontext.Key, mods gpucontext.Modifiers) (handled bool)
OnKeyPress edits the focused input and handles focus traversal.
func (*UserInterface) OnKeyRelease ¶
func (ui *UserInterface) OnKeyRelease(key gpucontext.Key, mods gpucontext.Modifiers) (handled bool)
OnKeyRelease reports keyboard capture while a text input is focused.
func (*UserInterface) OnMouseMove ¶
OnMouseMove updates hover and captured-press state.
func (*UserInterface) OnMousePress ¶
func (ui *UserInterface) OnMousePress(button gpucontext.MouseButton, x, y float64) (handled bool)
OnMousePress captures the topmost enabled widget under the pointer.
func (*UserInterface) OnMouseRelease ¶
func (ui *UserInterface) OnMouseRelease(button gpucontext.MouseButton, x, y float64) (handled bool)
OnMouseRelease activates a captured widget when released over the same widget.
func (*UserInterface) OnScroll ¶
OnScroll is reserved for scrollable widgets and currently reports no handling.
func (*UserInterface) OnTextInput ¶
OnTextInput inserts composed text into the focused field.
func (*UserInterface) ResetWindowOffset ¶
func (ui *UserInterface) ResetWindowOffset() *UserInterface
ResetWindowOffset returns the window to its retained layout position.
func (*UserInterface) Row ¶
Row creates a horizontal container that is laid out before every UI draw.
func (*UserInterface) SetActive ¶
func (ui *UserInterface) SetActive(active bool) *UserInterface
SetActive controls whether the UI accepts input.
func (*UserInterface) SetClipboard ¶
func (ui *UserInterface) SetClipboard(clipboard Clipboard) *UserInterface
SetClipboard enables copy, cut, and paste shortcuts using a gogpu clipboard provider.
func (*UserInterface) SetContext ¶
SetContext changes the default draw context without rebuilding the UI.
func (*UserInterface) SetCursor ¶
func (ui *UserInterface) SetCursor(cursor Cursor) *UserInterface
SetCursor enables automatic pointer-shape updates for this UI.
func (*UserInterface) SetVisible ¶
func (ui *UserInterface) SetVisible(visible bool) *UserInterface
SetVisible controls whether Draw emits this UI.
func (*UserInterface) SetWindowAnimation ¶
func (ui *UserInterface) SetWindowAnimation(style WindowAnimationStyle) *UserInterface
SetWindowAnimation changes the popup transition used by Show and Hide.
func (*UserInterface) SetWindowDragArea ¶
func (ui *UserInterface) SetWindowDragArea(area Rect) *UserInterface
SetWindowDragArea constrains the complete window to an on-screen rectangle.
func (*UserInterface) SetWindowDragHandle ¶
func (ui *UserInterface) SetWindowDragHandle(handle LayoutItem) *UserInterface
SetWindowDragHandle enables dragging from an otherwise non-interactive layout item.
func (*UserInterface) SetWindowOffset ¶
func (ui *UserInterface) SetWindowOffset(x, y float32) *UserInterface
SetWindowOffset positions the window relative to its retained layout.
func (*UserInterface) Show ¶
func (ui *UserInterface) Show() *UserInterface
Show makes the UI visible and begins its configured opening transition.
func (*UserInterface) WidgetCount ¶
func (ui *UserInterface) WidgetCount() int
WidgetCount returns the number of retained widgets.
func (*UserInterface) WindowOffset ¶
func (ui *UserInterface) WindowOffset() (x, y float32)
WindowOffset returns the current drag translation.
func (*UserInterface) WindowState ¶
func (ui *UserInterface) WindowState() WindowState
WindowState returns whether the UI is hidden, opening, open, or closing.
type WindowAnimationStyle ¶
type WindowAnimationStyle struct {
Open, Close TransitionStyle
MinScale float32
OffsetY float32
Fade bool
}
WindowAnimationStyle controls UI-level popup opening and closing.
func DefaultWindowAnimationStyle ¶
func DefaultWindowAnimationStyle() (style WindowAnimationStyle)
DefaultWindowAnimationStyle returns a clean scale, lift, and fade transition.
type WindowState ¶
type WindowState uint8
WindowState describes the current UI-level window transition.
const ( WindowHidden WindowState = iota WindowOpening WindowOpen WindowClosing )