basicwidget

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

README

NotoSans.ttf

v2.015

SIL OPEN FONT LICENSE Version 1.1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Color

func Color(colorMode guigui.ColorMode, typ ColorType, lightnessInLightMode float64) color.Color

func Color2

func Color2(colorMode guigui.ColorMode, typ ColorType, lightnessInLightMode, lightnessInDarkMode float64) color.Color

func DefaultActiveListItemTextColor

func DefaultActiveListItemTextColor(context *guigui.Context) color.Color

func DefaultDisabledListItemTextColor

func DefaultDisabledListItemTextColor(context *guigui.Context) color.Color

func DefaultTextColor

func DefaultTextColor(context *guigui.Context) color.Color

func DrawBlurredImage

func DrawBlurredImage(dst *ebiten.Image, src *ebiten.Image, rate float64)

func DrawRoundedRect

func DrawRoundedRect(context *guigui.Context, dst *ebiten.Image, rect image.Rectangle, clr color.Color, radius int)

func DrawRoundedRectBorder

func DrawRoundedRectBorder(context *guigui.Context, dst *ebiten.Image, rect image.Rectangle, clr color.Color, radius int, borderWidth float32, borderType RoundedRectBorderType)

func FillBackground

func FillBackground(dst *ebiten.Image, context *guigui.Context)

func FontSize

func FontSize(context *guigui.Context) float64

func LineHeight

func LineHeight(context *guigui.Context) float64

func RegisterFaceSource

func RegisterFaceSource(faceSource *text.GoTextFaceSource, priority func(hint FaceSourceHint) float64)

func RoundedCornerRadius

func RoundedCornerRadius(context *guigui.Context) int

func UnitSize

func UnitSize(context *guigui.Context) int

Types

type Button

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

func (*Button) CursorShape

func (b *Button) CursorShape(context *guigui.Context) (ebiten.CursorShapeType, bool)

func (*Button) Draw

func (b *Button) Draw(context *guigui.Context, dst *ebiten.Image)

func (*Button) Layout

func (b *Button) Layout(context *guigui.Context, appender *guigui.ChildWidgetAppender)

func (*Button) SetOnDown

func (b *Button) SetOnDown(f func())

func (*Button) SetOnUp

func (b *Button) SetOnUp(f func())

func (*Button) SetSize

func (b *Button) SetSize(context *guigui.Context, width, height int)

func (*Button) Size

func (b *Button) Size(context *guigui.Context) (int, int)

type ColorType

type ColorType int
const (
	ColorTypeBase ColorType = iota
	ColorTypeAccent
	ColorTypeInfo
	ColorTypeSuccess
	ColorTypeWarning
	ColorTypeDanger
)

type ContainerChildWidgetAppender

type ContainerChildWidgetAppender struct {
	// contains filtered or unexported fields
}

func (*ContainerChildWidgetAppender) AppendChildWidget

func (c *ContainerChildWidgetAppender) AppendChildWidget(widget guigui.Widget)

type DragDropOverlay

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

func (*DragDropOverlay) HandleInput

func (d *DragDropOverlay) HandleInput(context *guigui.Context) guigui.HandleInputResult

func (*DragDropOverlay) IsDragging

func (d *DragDropOverlay) IsDragging() bool

func (*DragDropOverlay) SetOnDropped

func (d *DragDropOverlay) SetOnDropped(f func(object any))

func (*DragDropOverlay) Start

func (d *DragDropOverlay) Start(object any)
type DropdownList struct {
	guigui.DefaultWidget
	// contains filtered or unexported fields
}
func (d *DropdownList) Layout(context *guigui.Context, appender *guigui.ChildWidgetAppender)
func (d *DropdownList) SelectedItemIndex() int
func (d *DropdownList) SetItemsByStrings(items []string)
func (d *DropdownList) SetOnValueChanged(f func(index int))
func (d *DropdownList) SetSelectedItemIndex(index int)
func (d *DropdownList) Size(context *guigui.Context) (int, int)

type FaceSourceHint

type FaceSourceHint struct {
	Size   float64
	Weight text.Weight
	Locale language.Tag
}

type FaceSourceQueryResult

type FaceSourceQueryResult struct {
	FaceSource *text.GoTextFaceSource
	Priority   float64
}

type Form

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

func (*Form) Draw

func (f *Form) Draw(context *guigui.Context, dst *ebiten.Image)

func (*Form) Layout

func (f *Form) Layout(context *guigui.Context, appender *guigui.ChildWidgetAppender)

func (*Form) SetItems

func (f *Form) SetItems(items []*FormItem)

func (*Form) SetWidth

func (f *Form) SetWidth(context *guigui.Context, width int)

func (*Form) Size

func (f *Form) Size(context *guigui.Context) (int, int)

type FormItem

type FormItem struct {
	PrimaryWidget   guigui.Widget
	SecondaryWidget guigui.Widget
}

type HorizontalAlign

type HorizontalAlign int
const (
	HorizontalAlignStart HorizontalAlign = iota
	HorizontalAlignCenter
	HorizontalAlignEnd
)

type Image

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

func (*Image) Draw

func (i *Image) Draw(context *guigui.Context, dst *ebiten.Image)

func (*Image) HasImage

func (i *Image) HasImage() bool

func (*Image) SetImage

func (i *Image) SetImage(image *ebiten.Image)

func (*Image) SetSize

func (i *Image) SetSize(context *guigui.Context, width, height int)

func (*Image) Size

func (i *Image) Size(context *guigui.Context) (int, int)

type List

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

func (*List) AddItem

func (l *List) AddItem(item ListItem, index int)

func (*List) Draw

func (l *List) Draw(context *guigui.Context, dst *ebiten.Image)

func (*List) HandleInput

func (l *List) HandleInput(context *guigui.Context) guigui.HandleInputResult

func (*List) HoveredItemIndex

func (l *List) HoveredItemIndex() int

func (*List) ItemAt

func (l *List) ItemAt(index int) (ListItem, bool)

func (*List) JumpToItemIndex

func (l *List) JumpToItemIndex(index int)

func (*List) Layout

func (l *List) Layout(context *guigui.Context, appender *guigui.ChildWidgetAppender)

func (*List) MoveItem

func (l *List) MoveItem(from int, to int)

func (*List) RemoveItem

func (l *List) RemoveItem(index int)

func (*List) ResetHeight

func (l *List) ResetHeight()

func (*List) ResetWidth

func (l *List) ResetWidth()

func (*List) SelectedItem

func (l *List) SelectedItem() (ListItem, bool)

func (*List) SelectedItemIndex

func (l *List) SelectedItemIndex() int

func (*List) SetHeight

func (l *List) SetHeight(height int)

func (*List) SetItem

func (l *List) SetItem(item ListItem, index int)

func (*List) SetItems

func (l *List) SetItems(items []ListItem)

func (*List) SetOnItemSelected

func (l *List) SetOnItemSelected(f func(index int))

func (*List) SetSelectedItemIndex

func (l *List) SetSelectedItemIndex(index int)

func (*List) SetSize

func (l *List) SetSize(width, height int)

func (*List) SetStyle

func (l *List) SetStyle(style ListStyle)

func (*List) SetWidth

func (l *List) SetWidth(width int)

func (*List) ShowItemBorders

func (l *List) ShowItemBorders(show bool)

func (*List) Size

func (l *List) Size(context *guigui.Context) (int, int)

func (*List) Style

func (l *List) Style() ListStyle

func (*List) Update

func (l *List) Update(context *guigui.Context) error

type ListItem

type ListItem struct {
	Content    guigui.Widget
	Selectable bool
	Wide       bool
	Draggable  bool
	Tag        any
}

type ListStyle

type ListStyle int
const (
	ListStyleNormal ListStyle = iota
	ListStyleSidebar
	ListStyleMenu
)
type Popup struct {
	guigui.DefaultWidget
	// contains filtered or unexported fields
}

func (*Popup) Close

func (p *Popup) Close()

func (*Popup) CursorShape

func (p *Popup) CursorShape(context *guigui.Context) (ebiten.CursorShapeType, bool)

func (*Popup) HandleInput

func (p *Popup) HandleInput(context *guigui.Context) guigui.HandleInputResult

func (*Popup) IsPopup

func (p *Popup) IsPopup() bool

func (*Popup) Layout

func (p *Popup) Layout(context *guigui.Context, appender *guigui.ChildWidgetAppender)

func (*Popup) Open

func (p *Popup) Open()

func (*Popup) SetBackgroundBlurred

func (p *Popup) SetBackgroundBlurred(blurBackground bool)

func (*Popup) SetCloseByClickingOutside

func (p *Popup) SetCloseByClickingOutside(closeByClickingOutside bool)

func (*Popup) SetContent

func (p *Popup) SetContent(f func(context *guigui.Context, childAppender *ContainerChildWidgetAppender))

func (*Popup) SetContentBounds

func (p *Popup) SetContentBounds(bounds image.Rectangle)

func (*Popup) Size

func (p *Popup) Size(context *guigui.Context) (int, int)

func (*Popup) Update

func (p *Popup) Update(context *guigui.Context) error

type PopupMenu

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

func (*PopupMenu) Close

func (p *PopupMenu) Close()

func (*PopupMenu) IsPopup

func (p *PopupMenu) IsPopup() bool

func (*PopupMenu) Layout

func (p *PopupMenu) Layout(context *guigui.Context, appender *guigui.ChildWidgetAppender)

func (*PopupMenu) Open

func (p *PopupMenu) Open(context *guigui.Context)

func (*PopupMenu) SelectedItem

func (p *PopupMenu) SelectedItem() (TextListItem, bool)

func (*PopupMenu) SelectedItemIndex

func (p *PopupMenu) SelectedItemIndex() int

func (*PopupMenu) SetItemsByStrings

func (p *PopupMenu) SetItemsByStrings(items []string)

func (*PopupMenu) SetOnClosed

func (p *PopupMenu) SetOnClosed(f func(index int))

func (*PopupMenu) SetSelectedItemIndex

func (p *PopupMenu) SetSelectedItemIndex(index int)

type RoundedRectBorderType

type RoundedRectBorderType int
const (
	RoundedRectBorderTypeRegular RoundedRectBorderType = iota
	RoundedRectBorderTypeInset
	RoundedRectBorderTypeOutset
)

type ScrollOverlay

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

func (*ScrollOverlay) CursorShape

func (s *ScrollOverlay) CursorShape(context *guigui.Context) (ebiten.CursorShapeType, bool)

func (*ScrollOverlay) Draw

func (s *ScrollOverlay) Draw(context *guigui.Context, dst *ebiten.Image)

func (*ScrollOverlay) HandleInput

func (s *ScrollOverlay) HandleInput(context *guigui.Context) guigui.HandleInputResult

func (*ScrollOverlay) Offset

func (s *ScrollOverlay) Offset() (float64, float64)

func (*ScrollOverlay) Reset

func (s *ScrollOverlay) Reset()

func (*ScrollOverlay) SetContentSize

func (s *ScrollOverlay) SetContentSize(contentWidth, contentHeight int)

func (*ScrollOverlay) SetOffset

func (s *ScrollOverlay) SetOffset(x, y float64)

func (*ScrollOverlay) SetOffsetByDelta

func (s *ScrollOverlay) SetOffsetByDelta(dx, dy float64)

func (*ScrollOverlay) SetOnScroll

func (s *ScrollOverlay) SetOnScroll(f func(offsetX, offsetY float64))

func (*ScrollOverlay) Update

func (s *ScrollOverlay) Update(context *guigui.Context) error

type ScrollablePanel

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

func (*ScrollablePanel) Layout

func (s *ScrollablePanel) Layout(context *guigui.Context, appender *guigui.ChildWidgetAppender)

func (*ScrollablePanel) SetContent

func (s *ScrollablePanel) SetContent(f func(context *guigui.Context, childAppender *ContainerChildWidgetAppender, offsetX, offsetY float64))

func (*ScrollablePanel) SetPadding

func (s *ScrollablePanel) SetPadding(paddingX, paddingY int)

func (*ScrollablePanel) SetSize

func (s *ScrollablePanel) SetSize(context *guigui.Context, width, height int)

func (*ScrollablePanel) Size

func (s *ScrollablePanel) Size(context *guigui.Context) (int, int)

func (*ScrollablePanel) Update

func (s *ScrollablePanel) Update(context *guigui.Context) error
type Sidebar struct {
	guigui.DefaultWidget
	// contains filtered or unexported fields
}

func (*Sidebar) Draw

func (s *Sidebar) Draw(context *guigui.Context, dst *ebiten.Image)

func (*Sidebar) Layout

func (s *Sidebar) Layout(context *guigui.Context, appender *guigui.ChildWidgetAppender)

func (*Sidebar) SetContent

func (s *Sidebar) SetContent(context *guigui.Context, f func(context *guigui.Context, childAppender *ContainerChildWidgetAppender, offsetX, offsetY float64))

func (*Sidebar) SetSize

func (s *Sidebar) SetSize(context *guigui.Context, width, height int)

func (*Sidebar) Size

func (s *Sidebar) Size(context *guigui.Context) (int, int)

type Text

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

func (*Text) CursorShape

func (t *Text) CursorShape(context *guigui.Context) (ebiten.CursorShapeType, bool)

func (*Text) Draw

func (t *Text) Draw(context *guigui.Context, dst *ebiten.Image)

func (*Text) HandleInput

func (t *Text) HandleInput(context *guigui.Context) guigui.HandleInputResult

func (*Text) IsMultiline

func (t *Text) IsMultiline() bool

func (*Text) Layout

func (t *Text) Layout(context *guigui.Context, appender *guigui.ChildWidgetAppender)

func (*Text) ResetSize

func (t *Text) ResetSize()

func (*Text) SetBold

func (t *Text) SetBold(bold bool)

func (*Text) SetColor

func (t *Text) SetColor(color color.Color)

func (*Text) SetEditable

func (t *Text) SetEditable(editable bool)

func (*Text) SetFilter

func (t *Text) SetFilter(filter TextFilter)

func (*Text) SetHeight

func (t *Text) SetHeight(height int)

func (*Text) SetHorizontalAlign

func (t *Text) SetHorizontalAlign(align HorizontalAlign)

func (*Text) SetLocales

func (t *Text) SetLocales(locales []language.Tag)

func (*Text) SetMultiline

func (t *Text) SetMultiline(multiline bool)

func (*Text) SetOnEnterPressed

func (t *Text) SetOnEnterPressed(f func(text string))

func (*Text) SetOpacity

func (t *Text) SetOpacity(opacity float64)

func (*Text) SetScale

func (t *Text) SetScale(scale float64)

func (*Text) SetScrollable

func (t *Text) SetScrollable(context *guigui.Context, scrollable bool)

func (*Text) SetSelectable

func (t *Text) SetSelectable(selectable bool)

func (*Text) SetSize

func (t *Text) SetSize(width, height int)

func (*Text) SetText

func (t *Text) SetText(text string)

func (*Text) SetVerticalAlign

func (t *Text) SetVerticalAlign(align VerticalAlign)

func (*Text) SetWidth

func (t *Text) SetWidth(width int)

func (*Text) Size

func (t *Text) Size(context *guigui.Context) (int, int)

func (*Text) Text

func (t *Text) Text() string

func (*Text) TextSize

func (t *Text) TextSize(context *guigui.Context) (int, int)

func (*Text) Update

func (t *Text) Update(context *guigui.Context) error

type TextButton

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

func (*TextButton) Layout

func (t *TextButton) Layout(context *guigui.Context, appender *guigui.ChildWidgetAppender)

func (*TextButton) ResetWidth

func (t *TextButton) ResetWidth()

func (*TextButton) SetImage

func (t *TextButton) SetImage(image *ebiten.Image)

func (*TextButton) SetOnDown

func (t *TextButton) SetOnDown(f func())

func (*TextButton) SetOnUp

func (t *TextButton) SetOnUp(f func())

func (*TextButton) SetText

func (t *TextButton) SetText(text string)

func (*TextButton) SetTextColor

func (t *TextButton) SetTextColor(clr color.Color)

func (*TextButton) SetWidth

func (t *TextButton) SetWidth(width int)

func (*TextButton) Size

func (t *TextButton) Size(context *guigui.Context) (int, int)

func (*TextButton) Update

func (t *TextButton) Update(context *guigui.Context) error

type TextField

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

func (*TextField) Draw

func (t *TextField) Draw(context *guigui.Context, dst *ebiten.Image)

func (*TextField) HandleInput

func (t *TextField) HandleInput(context *guigui.Context) guigui.HandleInputResult

func (*TextField) Layout

func (t *TextField) Layout(context *guigui.Context, appender *guigui.ChildWidgetAppender)

func (*TextField) SelectAll

func (t *TextField) SelectAll()

func (*TextField) SetEditable

func (t *TextField) SetEditable(editable bool)

func (*TextField) SetHorizontalAlign

func (t *TextField) SetHorizontalAlign(halign HorizontalAlign)

func (*TextField) SetMultiline

func (t *TextField) SetMultiline(multiline bool)

func (*TextField) SetOnEnterPressed

func (t *TextField) SetOnEnterPressed(f func(text string))

func (*TextField) SetSize

func (t *TextField) SetSize(context *guigui.Context, width, height int)

func (*TextField) SetText

func (t *TextField) SetText(text string)

func (*TextField) SetVerticalAlign

func (t *TextField) SetVerticalAlign(valign VerticalAlign)

func (*TextField) Size

func (t *TextField) Size(context *guigui.Context) (int, int)

func (*TextField) Text

func (t *TextField) Text() string

func (*TextField) Update

func (t *TextField) Update(context *guigui.Context) error

type TextFilter

type TextFilter func(text string, start, end int) (string, int, int)

type TextList

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

func (*TextList) AddItem

func (t *TextList) AddItem(item TextListItem, index int)

func (*TextList) AppendItem

func (t *TextList) AppendItem(item TextListItem)

func (*TextList) ItemAt

func (t *TextList) ItemAt(index int) (TextListItem, bool)

func (*TextList) ItemsCount

func (t *TextList) ItemsCount() int

func (*TextList) JumpToItemIndex

func (t *TextList) JumpToItemIndex(index int)

func (*TextList) Layout

func (t *TextList) Layout(context *guigui.Context, appender *guigui.ChildWidgetAppender)

func (*TextList) MoveItem

func (t *TextList) MoveItem(from, to int)

func (*TextList) RemoveItem

func (t *TextList) RemoveItem(index int)

func (*TextList) ResetHeight

func (t *TextList) ResetHeight()

func (*TextList) ResetWidth

func (t *TextList) ResetWidth()

func (*TextList) SelectedItem

func (t *TextList) SelectedItem() (TextListItem, bool)

func (*TextList) SelectedItemIndex

func (t *TextList) SelectedItemIndex() int

func (*TextList) SetHeight

func (t *TextList) SetHeight(height int)

func (*TextList) SetItemString

func (t *TextList) SetItemString(str string, index int)

func (*TextList) SetItems

func (t *TextList) SetItems(items []TextListItem)

func (*TextList) SetItemsByStrings

func (t *TextList) SetItemsByStrings(strs []string)

func (*TextList) SetSelectedItemIndex

func (t *TextList) SetSelectedItemIndex(index int)

func (*TextList) SetSize

func (t *TextList) SetSize(width, height int)

func (*TextList) SetStyle

func (t *TextList) SetStyle(style ListStyle)

func (*TextList) SetWidth

func (t *TextList) SetWidth(width int)

func (*TextList) Size

func (t *TextList) Size(context *guigui.Context) (int, int)

func (*TextList) Tag

func (t *TextList) Tag(index int) any

func (*TextList) Update

func (t *TextList) Update(context *guigui.Context) error

type TextListItem

type TextListItem struct {
	Text      string
	DummyText string
	Color     color.Color
	Header    bool
	Disabled  bool
	Border    bool
	Draggable bool
	Tag       any
}

type ToggleButton

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

func (*ToggleButton) CursorShape

func (t *ToggleButton) CursorShape(context *guigui.Context) (ebiten.CursorShapeType, bool)

func (*ToggleButton) Draw

func (t *ToggleButton) Draw(context *guigui.Context, dst *ebiten.Image)

func (*ToggleButton) Layout

func (t *ToggleButton) Layout(context *guigui.Context, appender *guigui.ChildWidgetAppender)

func (*ToggleButton) SetOnValueChanged

func (t *ToggleButton) SetOnValueChanged(f func(value bool))

func (*ToggleButton) SetValue

func (t *ToggleButton) SetValue(value bool)

func (*ToggleButton) Size

func (t *ToggleButton) Size(context *guigui.Context) (int, int)

func (*ToggleButton) Update

func (t *ToggleButton) Update(context *guigui.Context) error

func (*ToggleButton) Value

func (t *ToggleButton) Value() bool

type VerticalAlign

type VerticalAlign int
const (
	VerticalAlignTop VerticalAlign = iota
	VerticalAlignMiddle
	VerticalAlignBottom
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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