widgets

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: BSD-3-Clause Imports: 37 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: Unlicense OR MIT Copied from: gioui material/radiobutton.go with some modifications

Index

Constants

View Source
const (
	CodeLanguageJSON   = "JSON"
	CodeLanguageYAML   = "YAML"
	CodeLanguageXML    = "XML"
	CodeLanguagePython = "Python"
)
View Source
const (
	FlatButtonIconStart = 0
	FlatButtonIconEnd   = 1
	FlatButtonIconTop   = 2
	FlatButtonIconDown  = 3
)
View Source
const (
	MessageModalTypeInfo = "info"
	MessageModalTypeWarn = "warn"
	MessageModalTypeErr  = "err"
)
View Source
const (
	ModalTypeInfo = "info"
	ModalTypeWarn = "warn"
	ModalTypeErr  = "err"
)

Prompt is a modal dialog that prompts the user for a response.

View Source
const (
	ItemTypeText    = "text"
	ItemTypeFile    = "file"
	ItemTypeBool    = "bool"
	ItemTypeLNumber = "number"
)
View Source
const (
	IconPositionStart = 0
	IconPositionEnd   = 1
)

Variables

View Source
var ArrowDropDownIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.NavigationArrowDropDown)
	return icon
}()
View Source
var CircleIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ImageLens)
	return icon
}()
View Source
var CleanIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.EditorFormatColorText)
	return icon
}()
View Source
var CloseIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.NavigationClose)
	return icon
}()
View Source
var ConsoleIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.HardwareDesktopMac)
	return icon
}()
View Source
var CopyIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ContentContentCopy)
	return icon
}()
View Source
var DarkIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ActionSubject)
	return icon
}()
View Source
var DeleteIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ActionDelete)
	return icon
}()
View Source
var EditIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ContentCreate)
	return icon
}()
View Source
var ExpandIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.NavigationExpandMore)
	return icon
}()
View Source
var FileFolderIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.FileFolder)
	return icon
}()
View Source
var ForwardIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.NavigationChevronRight)
	return icon
}()
View Source
var HeartIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ActionFavorite)
	return icon
}()
View Source
var HomeIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ActionHome)
	return icon
}()
View Source
var LogsIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ActionSubject)
	return icon
}()
View Source
var MenuIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.NavigationMenu)
	return icon
}()
View Source
var MoreVertIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.NavigationMoreVert)
	return icon
}()
View Source
var OtherIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ActionHelp)
	return icon
}()
View Source
var PlusIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ContentAdd)
	return icon
}()
View Source
var RefreshIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.NavigationRefresh)
	return icon
}()
View Source
var SaveIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ContentSave)
	return icon
}()
View Source
var SearchIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ActionSearch)
	return icon
}()
View Source
var SendIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ContentSend)
	return icon
}()
View Source
var SettingsIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ActionSettings)
	return icon
}()
View Source
var SwapHoriz *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ActionSwapHoriz)
	return icon
}()
View Source
var TunnelIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ActionSwapVerticalCircle)
	return icon
}()
View Source
var UploadIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.FileFileUpload)
	return icon
}()
View Source
var VisibilityIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.ActionVisibility)
	return icon
}()
View Source
var WorkspacesIcon *widget.Icon = func() *widget.Icon {
	icon, _ := widget.NewIcon(icons.NavigationApps)
	return icon
}()

Functions

func Clickable

func Clickable(gtx layout.Context, button *widget.Clickable, w layout.Widget) layout.Dimensions

Clickable lays out a rectangular clickable widget without further decoration.

func Disabled

func Disabled(c color.NRGBA) (d color.NRGBA)

Disabled blends color towards the luminance and multiplies alpha. Blending towards luminance will desaturate the color. Multiplying alpha blends the color together more with the background.

func DrawLine

func DrawLine(gtx layout.Context, background color.NRGBA, height, width unit.Dp) layout.Dimensions

func DrawLineFlex

func DrawLineFlex(background color.NRGBA, height, width unit.Dp) layout.FlexChild

func DrawRect

func DrawRect(gtx layout.Context, background color.NRGBA, size f32.Point, radii float32) layout.Dimensions

DrawRect creates a rectangle of the provided background color with Dimensions specified by size and a corner radius (on all corners) specified by radii.

func Hovered

func Hovered(c color.NRGBA) (h color.NRGBA)

Hovered blends dark colors towards white, and light colors towards black. It is approximate because it operates in non-linear sRGB space.

func MaterialIcons

func MaterialIcons(name string, theme *chapartheme.Theme) material.LabelStyle

func MulAlpha

func MulAlpha(c color.NRGBA, alpha uint8) color.NRGBA

MulAlpha applies the alpha to the color.

func SaveButtonLayout

func SaveButtonLayout(gtx layout.Context, theme *chapartheme.Theme, clickable *widget.Clickable) layout.Dimensions

Types

type BadgeInput

type BadgeInput struct {
	Items []*BadgeInputItem
	// contains filtered or unexported fields
}

func NewBadgeInput

func NewBadgeInput(items ...*BadgeInputItem) *BadgeInput

func (*BadgeInput) AddItem

func (b *BadgeInput) AddItem(identifier, value string)

func (*BadgeInput) GetValues

func (b *BadgeInput) GetValues() map[string]string

func (*BadgeInput) Layout

func (b *BadgeInput) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

func (*BadgeInput) SetOnChange

func (b *BadgeInput) SetOnChange(f func(values map[string]string))

type BadgeInputItem

type BadgeInputItem struct {
	Identifier string
	Value      string
	// contains filtered or unexported fields
}

type ButtonLayoutStyle

type ButtonLayoutStyle struct {
	Background   color.NRGBA
	CornerRadius unit.Dp
	Button       *widget.Clickable
}

func (ButtonLayoutStyle) Layout

type ButtonStyle

type ButtonStyle struct {
	Text         string
	Icon         *widget.Icon
	IconPosition int
	// Color is the text color.
	Color        color.NRGBA
	Font         font.Font
	TextSize     unit.Sp
	Background   color.NRGBA
	CornerRadius unit.Dp
	Inset        layout.Inset
	Button       *widget.Clickable
	// contains filtered or unexported fields
}

func Button

func Button(th *material.Theme, button *widget.Clickable, icon *widget.Icon, iconPosition int, txt string) ButtonStyle

func (ButtonStyle) Layout

type CheckBoxStyle

type CheckBoxStyle struct {
	CheckBox *widget.Bool
	// contains filtered or unexported fields
}

func CheckBox

func CheckBox(th *material.Theme, checkBox *widget.Bool, label string) CheckBoxStyle

func (CheckBoxStyle) Layout

Layout updates the checkBox and displays it.

type CodeEditor

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

func NewCodeEditor

func NewCodeEditor(code string, lang string, theme *chapartheme.Theme) *CodeEditor

func (*CodeEditor) Code

func (c *CodeEditor) Code() string

func (*CodeEditor) Layout

func (c *CodeEditor) Layout(gtx layout.Context, theme *chapartheme.Theme, hint string) layout.Dimensions

func (*CodeEditor) SetCode

func (c *CodeEditor) SetCode(code string)

func (*CodeEditor) SetLanguage

func (c *CodeEditor) SetLanguage(lang string)

func (*CodeEditor) SetOnBeautify

func (c *CodeEditor) SetOnBeautify(f func())

func (*CodeEditor) SetOnChanged

func (c *CodeEditor) SetOnChanged(f func(text string))

func (*CodeEditor) SetOnLoadExample

func (c *CodeEditor) SetOnLoadExample(f func())
type DropDown struct {
	MinWidth unit.Dp
	MaxWidth unit.Dp
	// contains filtered or unexported fields
}

func NewDropDown

func NewDropDown(theme *chapartheme.Theme, options ...*DropDownOption) *DropDown

func NewDropDownWithoutBorder

func NewDropDownWithoutBorder(theme *chapartheme.Theme, options ...*DropDownOption) *DropDown
func (c *DropDown) GetSelected() *DropDownOption
func (c *DropDown) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

Layout the DropDown.

func (c *DropDown) SelectedIndex() int
func (c *DropDown) SetOnChanged(f func(value string))
func (c *DropDown) SetOptions(options ...*DropDownOption)
func (c *DropDown) SetSelected(index int)
func (c *DropDown) SetSelectedByIdentifier(identifier string)
func (c *DropDown) SetSelectedByTitle(title string)
func (c *DropDown) SetSelectedByValue(value string)
func (c *DropDown) SetSize(size image.Point)
type DropDownOption struct {
	Text       string
	Value      string
	Identifier string

	Icon      *widget.Icon
	IconColor color.NRGBA
	IconSize  unit.Dp
	// contains filtered or unexported fields
}

func NewDropDownDivider

func NewDropDownDivider() *DropDownOption

func NewDropDownOption

func NewDropDownOption(text string) *DropDownOption
func (o *DropDownOption) DefaultSelected() *DropDownOption
func (o *DropDownOption) GetText() string
func (o *DropDownOption) GetValue() string
func (o *DropDownOption) WithIcon(icon *widget.Icon, color color.NRGBA, size unit.Dp) *DropDownOption
func (o *DropDownOption) WithIdentifier(identifier string) *DropDownOption
func (o *DropDownOption) WithValue(value string) *DropDownOption

type EditableLabel

type EditableLabel struct {
	Text string
	// contains filtered or unexported fields
}

func NewEditableLabel

func NewEditableLabel(text string) *EditableLabel

func (*EditableLabel) Layout

func (*EditableLabel) SetEditing

func (e *EditableLabel) SetEditing(editing bool)

func (*EditableLabel) SetOnChanged

func (e *EditableLabel) SetOnChanged(f func(text string))

func (*EditableLabel) SetReadOnly

func (e *EditableLabel) SetReadOnly(readOnly bool)

func (*EditableLabel) SetText

func (e *EditableLabel) SetText(text string)

type FileSelector

type FileSelector struct {
	FileName string
	// contains filtered or unexported fields
}

FileSelector is a widget that allows the user to select a file. it handles the file selection and display the file name.

func NewFileSelector

func NewFileSelector(filename string, explorer *explorer.Explorer, extensions ...string) *FileSelector

func (*FileSelector) Changed

func (b *FileSelector) Changed() bool

func (*FileSelector) GetFilePath

func (b *FileSelector) GetFilePath() string

func (*FileSelector) Layout

func (b *FileSelector) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

func (*FileSelector) RemoveFile

func (b *FileSelector) RemoveFile()

func (*FileSelector) SetExplorer

func (b *FileSelector) SetExplorer(explorer *explorer.Explorer)

func (*FileSelector) SetFileName

func (b *FileSelector) SetFileName(name string)

func (*FileSelector) SetOnChanged added in v0.2.5

func (b *FileSelector) SetOnChanged(f func(filePath string))

func (*FileSelector) SetOnSelectFile

func (b *FileSelector) SetOnSelectFile(f func())

type FlatButton

type FlatButton struct {
	Icon         *widget.Icon
	IconPosition int
	SpaceBetween unit.Dp

	Clickable *widget.Clickable

	MinWidth        unit.Dp
	BackgroundColor color.NRGBA
	TextColor       color.NRGBA
	Text            string

	CornerRadius      int
	BackgroundPadding unit.Dp
	ContentPadding    unit.Dp
}

func (*FlatButton) Layout

func (f *FlatButton) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

func (*FlatButton) SetIcon

func (f *FlatButton) SetIcon(icon *widget.Icon, position int, spaceBetween unit.Dp)

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 IconButton

type IconButton struct {
	Icon                 *widget.Icon
	Size                 unit.Dp
	Color                color.NRGBA
	BackgroundColor      color.NRGBA
	BackgroundColorHover color.NRGBA

	SkipFocus bool
	Clickable *widget.Clickable

	OnClick func()
}

func (*IconButton) Layout

func (ib *IconButton) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

type IconButtonStyle

type IconButtonStyle struct {
	Background color.NRGBA
	// Color is the icon color.
	Color color.NRGBA
	Icon  *widget.Icon
	// Size is the icon size.
	Size        unit.Dp
	Inset       layout.Inset
	Button      *widget.Clickable
	Description string
}

type InputModal added in v0.2.5

type InputModal struct {
	Title string
	// contains filtered or unexported fields
}

func NewInputModal added in v0.2.5

func NewInputModal(title, placeholder string) *InputModal

func (*InputModal) Layout added in v0.2.5

func (i *InputModal) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

func (*InputModal) SetOnAdd added in v0.2.5

func (i *InputModal) SetOnAdd(f func(text string))

func (*InputModal) SetOnClose added in v0.2.5

func (i *InputModal) SetOnClose(f func())

func (*InputModal) SetText added in v0.2.5

func (i *InputModal) SetText(text string)

type JsonViewer

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

func NewJsonViewer

func NewJsonViewer() *JsonViewer

func (*JsonViewer) Layout

func (j *JsonViewer) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

func (*JsonViewer) SetData

func (j *JsonViewer) SetData(data string)

type KeyValue

type KeyValue struct {
	Items []*KeyValueItem
	// contains filtered or unexported fields
}

func NewKeyValue

func NewKeyValue(items ...*KeyValueItem) *KeyValue

func (*KeyValue) AddItem

func (kv *KeyValue) AddItem(item *KeyValueItem)

func (*KeyValue) Filter

func (kv *KeyValue) Filter(text string)

func (*KeyValue) GetItems

func (kv *KeyValue) GetItems() []*KeyValueItem

func (*KeyValue) Layout

func (kv *KeyValue) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

func (*KeyValue) SetItems

func (kv *KeyValue) SetItems(items []*KeyValueItem)

func (*KeyValue) SetOnChanged

func (kv *KeyValue) SetOnChanged(onChanged func(items []*KeyValueItem))

func (*KeyValue) WithAddLayout

func (kv *KeyValue) WithAddLayout(gtx layout.Context, title, hint string, theme *chapartheme.Theme) layout.Dimensions

type KeyValueItem

type KeyValueItem struct {
	Identifier string
	Key        string
	Value      string
	Active     bool
	// contains filtered or unexported fields
}

func NewKeyValueItem

func NewKeyValueItem(key, value, identifier string, active bool) *KeyValueItem

type LabeledInput

type LabeledInput struct {
	Label          string
	SpaceBetween   int
	MinEditorWidth unit.Dp
	MinLabelWidth  unit.Dp
	Editor         *PatternEditor
	Hint           string
}

func (*LabeledInput) Layout

func (l *LabeledInput) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

func (*LabeledInput) SetHint added in v0.2.4

func (l *LabeledInput) SetHint(hint string)

func (*LabeledInput) SetLabel added in v0.2.4

func (l *LabeledInput) SetLabel(label string)

func (*LabeledInput) SetOnChanged added in v0.2.4

func (l *LabeledInput) SetOnChanged(f func(text string))

func (*LabeledInput) SetText added in v0.2.4

func (l *LabeledInput) SetText(text string)

func (*LabeledInput) Text added in v0.2.4

func (l *LabeledInput) Text() string

type MessageModal added in v0.2.5

type MessageModal struct {
	Title string
	Body  string
	Type  string

	Visible bool
	// contains filtered or unexported fields
}

func NewMessageModal added in v0.2.5

func NewMessageModal(title, body, modalType string, onSubmit OnModalSubmit, options ...ModalOption) *MessageModal

func (*MessageModal) Hide added in v0.2.5

func (modal *MessageModal) Hide()

func (*MessageModal) Layout added in v0.2.5

func (modal *MessageModal) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

func (*MessageModal) Show added in v0.2.5

func (modal *MessageModal) Show()

type ModalOption added in v0.2.5

type ModalOption struct {
	Text   string
	Button widget.Clickable
	Icon   *widget.Icon
}

type Notif

type Notif struct {
	// Text is the text to display in the notification.
	Text string
	// Duration is the duration to display the notification.
	Duration time.Duration
}

type Notification

type Notification struct {
	Text  string
	EndAt time.Time
}

func (*Notification) Layout

func (n *Notification) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

type OnModalSubmit added in v0.2.5

type OnModalSubmit func(selectedOption string)

type Option

type Option struct {
	Text   string
	Button widget.Clickable
	Icon   *widget.Icon
}

type PatternEditor added in v0.2.4

type PatternEditor struct {
	*giovieweditor.Editor
	Keys map[string]string
	// contains filtered or unexported fields
}

PatternEditor is a widget that allows the user to edit a text like and highlight patterns like {{id}} or {name}

func NewPatternEditor added in v0.2.4

func NewPatternEditor() *PatternEditor

NewPatternEditor creates a new PatternEditor

func (*PatternEditor) Layout added in v0.2.4

func (p *PatternEditor) Layout(gtx layout.Context, theme *chapartheme.Theme, hint string) layout.Dimensions

func (*PatternEditor) SetOnChanged added in v0.2.4

func (p *PatternEditor) SetOnChanged(onChange func(text string))

func (*PatternEditor) SetOnSubmit added in v0.2.4

func (p *PatternEditor) SetOnSubmit(onSubmit func())

func (*PatternEditor) SetText added in v0.2.4

func (p *PatternEditor) SetText(text string)

func (*PatternEditor) UpdateStyles added in v0.2.4

func (p *PatternEditor) UpdateStyles()

type Prompt

type Prompt struct {
	Title   string
	Content string
	Type    string
	Visible bool
	// contains filtered or unexported fields
}

func NewPrompt

func NewPrompt(title, content, modalType string, options ...Option) *Prompt

func (*Prompt) Hide

func (p *Prompt) Hide()

func (*Prompt) IsVisible

func (p *Prompt) IsVisible() bool

func (*Prompt) Layout

func (p *Prompt) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

func (*Prompt) Result

func (p *Prompt) Result() (string, bool)

func (*Prompt) SetOnSubmit

func (p *Prompt) SetOnSubmit(f func(selectedOption string, remember bool))

func (*Prompt) SetOptions

func (p *Prompt) SetOptions(options ...Option)

func (*Prompt) Show

func (p *Prompt) Show()

func (*Prompt) WithRememberBool

func (p *Prompt) WithRememberBool()

func (*Prompt) WithoutRememberBool

func (p *Prompt) WithoutRememberBool()

type RadioButtonStyle

type RadioButtonStyle struct {
	Key   string
	Group *widget.Enum
	// contains filtered or unexported fields
}

func RadioButton

func RadioButton(th *material.Theme, group *widget.Enum, key, label string) RadioButtonStyle

RadioButton returns a RadioButton with a label. The key specifies the value for the Enum.

func (RadioButtonStyle) Layout

Layout updates enum and displays the radio button.

type Rect

type Rect struct {
	Color color.NRGBA
	Size  f32.Point
	Radii float32
}

Rect creates a rectangle of the provided background color with Dimensions specified by size and a corner radius (on all corners) specified by radii.

func (Rect) Layout

func (r Rect) Layout(gtx layout.Context) layout.Dimensions

Layout renders the Rect into the provided context

type SettingItem

type SettingItem struct {
	Title       string
	Key         string
	Description string
	Type        string
	Value       any

	FileSelector *FileSelector
	// contains filtered or unexported fields
}

func NewBoolItem

func NewBoolItem(title, key, description string, value bool) *SettingItem

func NewFileItem

func NewFileItem(explorer *explorer.Explorer, title, key, description string, value string, extensions ...string) *SettingItem

func NewNumberItem

func NewNumberItem(title, key, description string, value int) *SettingItem

func NewTextItem

func NewTextItem(title, key, description string, value string) *SettingItem

func (*SettingItem) Layout

func (i *SettingItem) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

func (*SettingItem) SetVisibleWhen

func (i *SettingItem) SetVisibleWhen(f func(values map[string]any) bool) *SettingItem

type Settings

type Settings struct {
	Items []*SettingItem
	// contains filtered or unexported fields
}

func NewSettings

func NewSettings(items []*SettingItem) *Settings

func (*Settings) Layout

func (s *Settings) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

func (*Settings) SetOnChange

func (s *Settings) SetOnChange(f func(values map[string]any))

type SplitView

type SplitView struct {
	// Ratio keeps the current layout.
	// 0 is center, -1 completely to the left, 1 completely to the right.
	// Bar is the width for resizing the layout
	BarWidth unit.Dp
	component.Resize
}

func (*SplitView) Layout

func (s *SplitView) Layout(gtx layout.Context, theme *chapartheme.Theme, left, right layout.Widget) layout.Dimensions

type Tab

type Tab struct {
	Title      string
	Identifier string

	Closable       bool
	CloseClickable *widget.Clickable

	Meta *safemap.Map[string]
	// contains filtered or unexported fields
}

func (*Tab) GetIdentifier

func (tab *Tab) GetIdentifier() string

func (*Tab) IsDataChanged

func (tab *Tab) IsDataChanged() bool

func (*Tab) SetDataChanged

func (tab *Tab) SetDataChanged(changed bool)

func (*Tab) SetIdentifier

func (tab *Tab) SetIdentifier(id string)

func (*Tab) SetOnClose

func (tab *Tab) SetOnClose(f func(t *Tab))

type Tabs

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

func NewTabs

func NewTabs(items []*Tab, onSelectedChange func(int)) *Tabs

func (*Tabs) AddTab

func (tabs *Tabs) AddTab(tab *Tab) int

func (*Tabs) Layout

func (tabs *Tabs) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

func (*Tabs) RemoveTabByID

func (tabs *Tabs) RemoveTabByID(id string)

func (*Tabs) Selected

func (tabs *Tabs) Selected() int

func (*Tabs) SelectedTab

func (tabs *Tabs) SelectedTab() *Tab

func (*Tabs) SetMaxTitleWidth

func (tabs *Tabs) SetMaxTitleWidth(maxWidth int)

func (*Tabs) SetSelected

func (tabs *Tabs) SetSelected(index int)

func (*Tabs) SetSelectedByID

func (tabs *Tabs) SetSelectedByID(id string)

func (*Tabs) SetTabs

func (tabs *Tabs) SetTabs(items []*Tab)

type TextField

type TextField struct {
	Icon *widget.Icon

	IconPosition int

	Text        string
	Placeholder string
	// contains filtered or unexported fields
}

func NewTextField

func NewTextField(text, placeholder string) *TextField

func (*TextField) GetText added in v0.2.5

func (t *TextField) GetText() string

func (*TextField) Layout

func (t *TextField) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

func (*TextField) SetBorderColor

func (t *TextField) SetBorderColor(color color.NRGBA)

func (*TextField) SetIcon

func (t *TextField) SetIcon(icon *widget.Icon, position int)

func (*TextField) SetMinWidth

func (t *TextField) SetMinWidth(width int)

func (*TextField) SetOnIconClick

func (t *TextField) SetOnIconClick(f func())

func (*TextField) SetOnTextChange

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

func (*TextField) SetText

func (t *TextField) SetText(text string)

type TreeNode

type TreeNode struct {
	Text           string
	Prefix         string
	PrefixColor    color.NRGBA
	Identifier     string
	Children       []*TreeNode
	DiscloserState component.DiscloserState
	MenuOptions    []string

	Meta *safemap.Map[string]
	// contains filtered or unexported fields
}

func (*TreeNode) AddChildNode

func (tr *TreeNode) AddChildNode(child *TreeNode)

func (*TreeNode) SetIdentifier

func (tr *TreeNode) SetIdentifier(identifier string)

func (*TreeNode) SetPrefix

func (tr *TreeNode) SetPrefix(prefix string, color color.NRGBA)

type TreeView

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

func NewTreeView

func NewTreeView(nodes []*TreeNode) *TreeView

func (*TreeView) AddChildNode

func (t *TreeView) AddChildNode(parentIdentifier string, child *TreeNode)

func (*TreeView) AddNode

func (t *TreeView) AddNode(node *TreeNode)

func (*TreeView) ExpandNode

func (t *TreeView) ExpandNode(identifier string)

func (*TreeView) Filter

func (t *TreeView) Filter(text string)

func (*TreeView) Layout

func (t *TreeView) Layout(gtx layout.Context, theme *chapartheme.Theme) layout.Dimensions

func (*TreeView) LayoutTreeNode

func (t *TreeView) LayoutTreeNode(gtx layout.Context, theme *chapartheme.Theme, node *TreeNode) layout.Dimensions

LayoutTreeNode recursively lays out a tree of widgets described by TreeNodes.

func (*TreeView) OnNodeClick

func (t *TreeView) OnNodeClick(fn func(tr *TreeNode))

func (*TreeView) OnNodeDoubleClick

func (t *TreeView) OnNodeDoubleClick(fn func(tr *TreeNode))

func (*TreeView) RemoveNode

func (t *TreeView) RemoveNode(identifier string)

func (*TreeView) SetNodes

func (t *TreeView) SetNodes(nodes []*TreeNode)

func (*TreeView) SetOnMenuItemClick

func (t *TreeView) SetOnMenuItemClick(fn func(tr *TreeNode, item string))

Jump to

Keyboard shortcuts

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