widgets

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: BSD-3-Clause Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

widgets

Widget collection for GUIGUI

Documentation

Index

Constants

View Source
const (
	ContextMenuItemCopy context_menu_item = iota + 0
	ContextMenuItemPaste
	ContextMenuItemCut
	ContextMenuItemSelectAll
	ContextMenuItemUndo
	ContextMenuItemRedo
	DefualtContextMenuItemEnd
)

Variables

View Source
var (
	DefualtURL_Style basicwidget.TextStyle = basicwidget.TextStyle{}
)

Functions

func ChangeImageDetails

func ChangeImageDetails(file_path string, fs fs.FS, details any) (ok bool)

Types

type Button

type Button struct {
	basicwidget.Button
	// contains filtered or unexported fields
}

func (*Button) Build

func (d *Button) Build(context *guigui.Context, adder *guigui.ChildAdder) error

func (*Button) Layout

func (d *Button) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)

func (*Button) SetTooltip

func (d *Button) SetTooltip(text string)

type Icon

type Icon struct {
	guigui.DefaultWidget
	// contains filtered or unexported fields
}

TODO: Add an transparency option for icon TODO: Add a cache for icons.

func (*Icon) Build

func (icon_ref *Icon) Build(context *guigui.Context, adder *guigui.ChildAdder) error

func (*Icon) Clickable

func (icon_ref *Icon) Clickable() bool

func (*Icon) CursorShape

func (icon_ref *Icon) CursorShape(context *guigui.Context, widgetBounds *guigui.WidgetBounds) (ebiten.CursorShapeType, bool)

func (*Icon) HandlePointingInput

func (icon_ref *Icon) HandlePointingInput(context *guigui.Context, widgetBounds *guigui.WidgetBounds) guigui.HandleInputResult

func (*Icon) HasIcon

func (icon_ref *Icon) HasIcon() bool

func (*Icon) Layout

func (icon_ref *Icon) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)

func (*Icon) Load

func (icon_ref *Icon) Load(icon string, fs fs.FS, size image.Point) error

func (*Icon) Measure

func (icon_ref *Icon) Measure(context *guigui.Context, constraints guigui.Constraints) image.Point

func (*Icon) OnClick

func (icon_ref *Icon) OnClick(fn func(context *guigui.Context, icon_ref *Icon))

func (*Icon) SetClickable

func (icon_ref *Icon) SetClickable(clickable bool)

type ImageDetails

type ImageDetails struct {
	Img     *ebiten.Image
	Details any
	Cache   bool
}

func OpenImage

func OpenImage(file_path string, fs fs.FS) (*ImageDetails, error)

TODO: use program path as defualt fs.FS if the fs is nil.

type InfiniteLoadingBar

type InfiniteLoadingBar struct {
	guigui.DefaultWidget
	// contains filtered or unexported fields
}

func (*InfiniteLoadingBar) Build

func (d *InfiniteLoadingBar) Build(context *guigui.Context, adder *guigui.ChildAdder) error

func (*InfiniteLoadingBar) Draw

func (d *InfiniteLoadingBar) Draw(context *guigui.Context, widgetBounds *guigui.WidgetBounds, dst *ebiten.Image)

func (*InfiniteLoadingBar) Layout

func (d *InfiniteLoadingBar) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)

func (*InfiniteLoadingBar) Measure

func (d *InfiniteLoadingBar) Measure(context *guigui.Context, constraints guigui.Constraints) image.Point

func (*InfiniteLoadingBar) Tick

func (d *InfiniteLoadingBar) Tick(context *guigui.Context, widgetBounds *guigui.WidgetBounds) error

type InfoHint

type InfoHint struct {
	guigui.DefaultWidget
	// contains filtered or unexported fields
}

func (*InfoHint) Build

func (infohint *InfoHint) Build(context *guigui.Context, adder *guigui.ChildAdder) error

func (*InfoHint) Layout

func (infohint *InfoHint) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)

func (*InfoHint) Measure

func (infohint *InfoHint) Measure(context *guigui.Context, constraints guigui.Constraints) image.Point

func (*InfoHint) SetText

func (infohint *InfoHint) SetText(text string)

type LabeledToggle

type LabeledToggle struct {
	guigui.DefaultWidget
	// contains filtered or unexported fields
}

func (*LabeledToggle) Build

func (d *LabeledToggle) Build(context *guigui.Context, adder *guigui.ChildAdder) error

func (*LabeledToggle) Layout

func (d *LabeledToggle) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)

func (*LabeledToggle) Measure

func (d *LabeledToggle) Measure(context *guigui.Context, constraints guigui.Constraints) image.Point

func (*LabeledToggle) SetLabel

func (d *LabeledToggle) SetLabel(label string)

func (*LabeledToggle) Toggle

func (d *LabeledToggle) Toggle() *basicwidget.Toggle

type LazyWidget

type LazyWidget[T guigui.Widget] struct {
	// contains filtered or unexported fields
}

SPDX-License-Identifier: Apache-2.0 SPDX-FileCopyrightText: 2024 The Guigui Authors Original code belongs to @hajime-hojshi

func (*LazyWidget[T]) Widget

func (l *LazyWidget[T]) Widget() T
type Link struct {
	basicwidget.Text
	// contains filtered or unexported fields
}

Note: This can alos open file paths so be makesure the url is what you want to open. If text value != url a tooltip will show the url otherwise the tooltip will not show.

func (*Link) Build

func (d *Link) Build(context *guigui.Context, adder *guigui.ChildAdder) error

func (*Link) HandlePointingInput

func (d *Link) HandlePointingInput(context *guigui.Context, widgetBounds *guigui.WidgetBounds) guigui.HandleInputResult

func (*Link) Layout

func (d *Link) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)

func (*Link) SetBaseStyle

func (d *Link) SetBaseStyle(style *basicwidget.TextStyle)

func (*Link) SetURL

func (d *Link) SetURL(u *url.URL) error

func (*Link) SetURL_Str

func (d *Link) SetURL_Str(u string)

type SkeletonLoader

type SkeletonLoader[T guigui.Widget] struct {
	guigui.DefaultWidget
	// contains filtered or unexported fields
}

func (*SkeletonLoader[T]) Build

func (d *SkeletonLoader[T]) Build(context *guigui.Context, adder *guigui.ChildAdder) error

func (*SkeletonLoader[T]) Draw

func (d *SkeletonLoader[T]) Draw(context *guigui.Context, widgetBounds *guigui.WidgetBounds, dst *ebiten.Image)

func (*SkeletonLoader[T]) Layout

func (d *SkeletonLoader[T]) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)

func (*SkeletonLoader[T]) Loading

func (d *SkeletonLoader[T]) Loading() bool

func (*SkeletonLoader[T]) Measure

func (d *SkeletonLoader[T]) Measure(context *guigui.Context, constraints guigui.Constraints) image.Point

func (*SkeletonLoader[T]) SetLoading

func (d *SkeletonLoader[T]) SetLoading(loading bool)

func (*SkeletonLoader[T]) Tick

func (d *SkeletonLoader[T]) Tick(context *guigui.Context, widgetBounds *guigui.WidgetBounds) error

func (*SkeletonLoader[T]) Widget

func (d *SkeletonLoader[T]) Widget() T

type TabContainer

type TabContainer[T comparable] struct {
	guigui.DefaultWidget
	// contains filtered or unexported fields
}

func (*TabContainer[T]) Build

func (d *TabContainer[T]) Build(context *guigui.Context, adder *guigui.ChildAdder) error

func (*TabContainer[T]) Layout

func (d *TabContainer[T]) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)

func (*TabContainer[T]) Measure

func (d *TabContainer[T]) Measure(context *guigui.Context, constraints guigui.Constraints) image.Point

func (*TabContainer[T]) OnTabClose

func (d *TabContainer[T]) OnTabClose(fn func(context *guigui.Context, index int, data TabItem[T]))

func (*TabContainer[T]) OnTabSelect

func (d *TabContainer[T]) OnTabSelect(fn func(context *guigui.Context, index int, data TabItem[T]))

func (*TabContainer[T]) OnTabSwitch

func (d *TabContainer[T]) OnTabSwitch(fn func(context *guigui.Context, index1 int, data1 TabItem[T], index2 int, data2 TabItem[T]))

func (*TabContainer[T]) SelectTabItem

func (d *TabContainer[T]) SelectTabItem(index int)

func (*TabContainer[T]) SelectedTabItem

func (d *TabContainer[T]) SelectedTabItem() (index int, ok bool)

func (*TabContainer[T]) SetTabItems

func (d *TabContainer[T]) SetTabItems(items []TabItem[T])

func (*TabContainer[T]) SetUnselectedWidget

func (d *TabContainer[T]) SetUnselectedWidget(widget guigui.Widget)

func (*TabContainer[T]) TabItemsLenght

func (d *TabContainer[T]) TabItemsLenght() int

func (*TabContainer[T]) UnselectedWidget

func (d *TabContainer[T]) UnselectedWidget() guigui.Widget

type TabIcon

type TabIcon struct {
	Icon string
	Fs   fs.FS
}

type TabItem

type TabItem[T comparable] struct {
	Text              string
	Icon              TabIcon
	Closable, Movable bool
	Widget            guigui.Widget
	Value             T
}

type Text

type Text struct {
	guigui.DefaultWidget
	// contains filtered or unexported fields
}

func (*Text) Build

func (d *Text) Build(context *guigui.Context, adder *guigui.ChildAdder) error

func (*Text) Layout

func (d *Text) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)

func (*Text) Measure

func (d *Text) Measure(context *guigui.Context, constraints guigui.Constraints) image.Point

func (*Text) Text

func (d *Text) Text() *basicwidget.Text

type TextContent

type TextContent int
const (
	TextContentPlainText TextContent = iota + 0
	TextContentHTML
)

type TextInput

type TextInput struct {
	guigui.DefaultWidget
	// contains filtered or unexported fields
}

TextInput is a widget for text input with context menu support.

func (*TextInput) Build

func (d *TextInput) Build(context *guigui.Context, adder *guigui.ChildAdder) error

func (*TextInput) Disable

func (d *TextInput) Disable(item context_menu_item) bool

Only for defualt items. Returns whether the item is disabled.

func (*TextInput) Layout

func (d *TextInput) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)

func (*TextInput) Measure

func (d *TextInput) Measure(context *guigui.Context, constraints guigui.Constraints) image.Point

func (*TextInput) OnAdditionalItemSelected

func (d *TextInput) OnAdditionalItemSelected(fn func(context *guigui.Context, index int))

OnAdditionalItemSelected sets the callback for when an additional context menu item is selected.

func (*TextInput) SetAditionalItems

func (d *TextInput) SetAditionalItems(addition_items []basicwidget.PopupMenuItem[int])

SetAditionalItems sets the additional context menu items.

func (*TextInput) SetDisable

func (d *TextInput) SetDisable(item context_menu_item, disable bool)

Only for defualt items. Sets whether the item is disabled.

func (*TextInput) SetTextContent

func (d *TextInput) SetTextContent(textcontent TextContent)

func (*TextInput) TextContent

func (d *TextInput) TextContent() TextContent

func (*TextInput) TextInput

func (d *TextInput) TextInput() *basicwidget.TextInput

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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