Documentation
¶
Index ¶
- Constants
- Variables
- func AddFallbackFont(family string)
- func ApplyBaseFontSize(fontSize float64)
- func ApplyDarkTheme()
- func ApplyLightTheme()
- func ApplyPalette(palette ThemePalette, dark bool)
- func ClipboardGetText() (string, error)
- func ClipboardSetText(text string)
- func CohenSutherland(x1, y1, x2, y2, left, top, right, bottom int) (int, int, int, int, bool)
- func ColorFromHex(hexStr string) color.RGBA
- func ColorToHex(col color.Color) string
- func DateOnly(t time.Time) time.Time
- func DefaultDateLayout() string
- func DrawText(rgba *image.RGBA, text string, textColor color.Color, fontFamily string, ...)
- func FirstDayOfWeek() time.Weekday
- func GetCharPositions(fontFamily string, fontSize float64, text string) ([]int, error)
- func GetThemeColor(name string, defaultColor color.RGBA) color.RGBA
- func GetThemeFloat(name string, defaultValue float64) float64
- func GetThemeInt(name string, defaultValue int) int
- func GetThemeString(name string, defaultValue string) string
- func Invoke(f func())
- func InvokeSync(f func())
- func IsUIThread() bool
- func Language() string
- func MakeLinesFromStringWithWordWrapping(text string, maxChars int) []string
- func MeasureText(fontFamily string, fontSize float64, text string) (int, int, error)
- func MixColors(a, b color.RGBA, t float64) color.RGBA
- func MouseCursorToString(c MouseCursor) string
- func NewComboBoxPopup() *comboBoxPopup
- func NewTabWidgetButton(text string) *tabWidgetButton
- func OpenURL(url string) error
- func ParseHexColor(s string) (color.RGBA, bool)
- func PopEvent()
- func PrintAllWidgets()
- func PushEvent(p any)
- func RecentColors() []color.RGBA
- func RegisterFont(family string, data []byte) error
- func RegisterSystemFont(family, name string) error
- func RegisterUIStrings(lang string, s UIStrings)
- func SetAppIcon(img image.Image)
- func SetLanguage(lang string)
- func ShowMessageBox(parentWidget Widgeter, title string, text string)
- func ShowQuestionMessageBoxOKCancel(parentWidget Widgeter, title string, text string, onOK func(), onCancel func())
- func ShowQuestionMessageBoxYesNo(parentWidget Widgeter, title string, text string, onYes func(), onNo func())
- func ShowToast(w Widgeter, text string, kind ToastKind)
- func SystemLanguage() string
- func SystemUIFontName() string
- func ThemeBackgroundColor(elevation int, role string) color.RGBA
- func ThemeBackgroundColorDarkTheme(elevation int, role string) color.RGBA
- func ThemeBackgroundColorLightTheme(elevation int, role string) color.RGBA
- func ThemeControlHeight() int
- func ThemeFontFamily() string
- func ThemeFontSize() float64
- func ThemeForegroundColor(role string) color.RGBA
- func ThemeForegroundColorDisabled() color.RGBA
- func ThemeIndicatorSize() int
- func ThemeLineHeight() int
- func ThemeRowHeight() int
- func UseBuiltinFont()
- func UseSystemFont(name string) error
- type Accordion
- func (c *Accordion) AddSection(title string) *Expander
- func (c *Accordion) Exclusive() bool
- func (c *Accordion) Expand(index int)
- func (c *Accordion) ExpandedIndex() int
- func (c *Accordion) Sections() []*Expander
- func (c *Accordion) SetExclusive(exclusive bool)
- func (c *Accordion) SetOnSectionChanged(f func(index int))
- type Button
- type ButtonImage
- func (c *ButtonImage) Image() image.Image
- func (c *ButtonImage) ImageHAlign() HAlign
- func (c *ButtonImage) ImageVAlign() VAlign
- func (c *ButtonImage) Press()
- func (c *ButtonImage) ProcessPropChange(key string, value interface{})
- func (c *ButtonImage) SetImage(img image.Image)
- func (c *ButtonImage) SetImageHAlign(align HAlign)
- func (c *ButtonImage) SetImageVAlign(align VAlign)
- func (c *ButtonImage) SetOnButtonClick(fn func(btn *ButtonImage))
- type Calendar
- func (c *Calendar) Date() time.Time
- func (c *Calendar) ProcessKeyDown(key Key, mods KeyModifiers) bool
- func (c *Calendar) SetDate(date time.Time)
- func (c *Calendar) SetFirstDayOfWeek(day time.Weekday)
- func (c *Calendar) SetMaxDate(date time.Time)
- func (c *Calendar) SetMinDate(date time.Time)
- func (c *Calendar) SetOnDateActivated(f func(date time.Time))
- func (c *Calendar) SetOnDateChanged(f func(date time.Time))
- func (c *Calendar) ShowMonth(year int, month time.Month)
- func (c *Calendar) ShownMonth() time.Time
- type Canvas
- func (c *Canvas) ClipH() int
- func (c *Canvas) ClipW() int
- func (c *Canvas) ClipX() int
- func (c *Canvas) ClipY() int
- func (c *Canvas) DrawImage(x int, y int, img image.Image)
- func (c *Canvas) DrawLine(x1 int, y1 int, x2 int, y2 int, width int, color color.Color)
- func (c *Canvas) DrawLineF(x1, y1, x2, y2 float64, col color.Color)
- func (c *Canvas) DrawRect(x int, y int, width int, height int)
- func (c *Canvas) DrawRoundedRect(x int, y int, width int, height int, radius int)
- func (c *Canvas) DrawText(x int, y int, width int, height int, text string)
- func (c *Canvas) FillFrame(x, y, width, height, radius int, fill, border color.Color)
- func (c *Canvas) FillRect(x int, y int, width int, height int, colr color.Color)
- func (c *Canvas) FillRoundedRect(x int, y int, width int, height int, radius int)
- func (c *Canvas) FillRoundedRectAA(x, y, width, height, radius int, col color.RGBA)
- func (c *Canvas) FillTriangle(x1, y1, x2, y2, x3, y3 int, colr color.Color)
- func (c *Canvas) Height() int
- func (c *Canvas) MakeScriptLine(x1, y1, x2, y2, width float64) *DrawScript
- func (c *Canvas) MakeScriptLineBresenham(x1 float64, y1 float64, x2 float64, y2 float64) *DrawScript
- func (c *Canvas) MakeScriptLineWu(x1, y1, x2, y2 float64) *DrawScript
- func (c *Canvas) MixPixel(x int, y int, rgba color.Color)
- func (c *Canvas) RGBA() *image.RGBA
- func (c *Canvas) Restore()
- func (c *Canvas) Save()
- func (c *Canvas) Scale() float64
- func (c *Canvas) SetColor(col color.Color)
- func (c *Canvas) SetDirectTranslateAndClip(x, y, w, h int)
- func (c *Canvas) SetFontFamily(fontFamily string)
- func (c *Canvas) SetFontSize(fontSize float64)
- func (c *Canvas) SetHAlign(hAlign HAlign)
- func (c *Canvas) SetPixel(x, y int)
- func (c *Canvas) SetUnderline(underline bool)
- func (c *Canvas) SetVAlign(vAlign VAlign)
- func (c *Canvas) TranslateAndClip(x, y int, w, h int)
- func (c *Canvas) TranslatedX() int
- func (c *Canvas) TranslatedY() int
- func (c *Canvas) Width() int
- type Chart
- type ChartPoint
- type Checkbox
- func (c *Checkbox) Checked() bool
- func (c *Checkbox) Indeterminate() bool
- func (c *Checkbox) SetChecked(checked bool)
- func (c *Checkbox) SetIndeterminate(indeterminate bool)
- func (c *Checkbox) SetOnStateChanged(fn func())
- func (c *Checkbox) SetText(text string)
- func (c *Checkbox) SetTextFunc(f func() string)
- func (c *Checkbox) SetTristate(tristate bool)
- func (c *Checkbox) Text() string
- func (c *Checkbox) Tristate() bool
- type ColorPicker
- func (c *ColorPicker) AlphaEnabled() bool
- func (c *ColorPicker) ClosePopup()
- func (c *ColorPicker) Color() color.RGBA
- func (c *ColorPicker) IsPopupOpen() bool
- func (c *ColorPicker) OpenPopup()
- func (c *ColorPicker) Palette() []color.RGBA
- func (c *ColorPicker) ProcessKeyDown(key Key, mods KeyModifiers) bool
- func (c *ColorPicker) SetAlphaEnabled(enabled bool)
- func (c *ColorPicker) SetColor(col color.Color)
- func (c *ColorPicker) SetOnColorChanged(f func(col color.RGBA))
- func (c *ColorPicker) SetPalette(colors []color.RGBA)
- type ComboBox
- func (c *ComboBox) AddItem(text string, data interface{})
- func (c *ComboBox) ItemCount() int
- func (c *ComboBox) OpenPopup()
- func (c *ComboBox) SelectedIndex() int
- func (c *ComboBox) SelectedItemData() interface{}
- func (c *ComboBox) SelectedItemText() string
- func (c *ComboBox) SetItemText(index int, text string)
- func (c *ComboBox) SetOnSelectedIndexChanged(f func())
- func (c *ComboBox) SetSelectedIndex(index int)
- type ComboBoxItem
- type ContainerGridColumnInfo
- type ContainerGridRowInfo
- type ContextMenu
- func (c *ContextMenu) AddItem(text string, onClick func()) *ContextMenuItem
- func (c *ContextMenu) AddItemWithSubmenu(text string, innerMenu *ContextMenu) *ContextMenuItem
- func (c *ContextMenu) AddSeparator() *ContextMenuItem
- func (c *ContextMenu) ClosePopup()
- func (c *ContextMenu) OnInit()
- func (c *ContextMenu) PopupFlipped() (int, int)
- func (c *ContextMenu) RemoveAllItems()
- func (c *ContextMenu) SetOnShow(f func())
- func (c *ContextMenu) ShowMenu(x int, y int)
- type ContextMenuItem
- func (c *ContextMenuItem) ControlType() string
- func (c *ContextMenuItem) Draw(ctx *Canvas)
- func (c *ContextMenuItem) Image() image.Image
- func (c *ContextMenuItem) IsSeparator() bool
- func (c *ContextMenuItem) MouseEnter()
- func (c *ContextMenuItem) MouseLeave()
- func (c *ContextMenuItem) MouseMove(x int, y int, mods KeyModifiers) bool
- func (c *ContextMenuItem) SetImage(img image.Image) *ContextMenuItem
- func (c *ContextMenuItem) SetInnerMenu(menu *ContextMenu)
- func (c *ContextMenuItem) SetShortcut(shortcut string) *ContextMenuItem
- func (c *ContextMenuItem) SetText(text string)
- func (c *ContextMenuItem) SetTextFunc(f func() string)
- func (c *ContextMenuItem) Shortcut() Shortcut
- func (c *ContextMenuItem) Text() string
- type DatePicker
- func (c *DatePicker) ClosePopup()
- func (c *DatePicker) Date() time.Time
- func (c *DatePicker) IsPopupOpen() bool
- func (c *DatePicker) OpenPopup()
- func (c *DatePicker) ProcessKeyDown(key Key, mods KeyModifiers) bool
- func (c *DatePicker) SetDate(date time.Time)
- func (c *DatePicker) SetFormat(layout string)
- func (c *DatePicker) SetMaxDate(date time.Time)
- func (c *DatePicker) SetMinDate(date time.Time)
- func (c *DatePicker) SetOnDateChanged(f func(date time.Time))
- func (c *DatePicker) Text() string
- type DialogContent
- type Dialoger
- type DragData
- type DrawScript
- type DrawScriptHorLine
- type DrawScriptPoint
- type EditableComboBox
- func (c *EditableComboBox) AddItem(text string)
- func (c *EditableComboBox) Focus()
- func (c *EditableComboBox) IsPopupOpen() bool
- func (c *EditableComboBox) Items() []string
- func (c *EditableComboBox) SetAutoComplete(enabled bool)
- func (c *EditableComboBox) SetEnabled(enabled bool)
- func (c *EditableComboBox) SetHint(hint string)
- func (c *EditableComboBox) SetItems(items []string)
- func (c *EditableComboBox) SetOnAccept(f func(text string))
- func (c *EditableComboBox) SetOnItemSelected(f func(index int, text string))
- func (c *EditableComboBox) SetOnTextChanged(f func())
- func (c *EditableComboBox) SetSize(w, h int)
- func (c *EditableComboBox) SetText(text string)
- func (c *EditableComboBox) Text() string
- func (c *EditableComboBox) TextBox() *TextBox
- type Event
- type EventCheckboxStateChanged
- type EventNumBoxValueChanged
- type EventTableCellMouseDblClick
- type EventTextboxKeyDown
- type Expander
- func (c *Expander) AddWidget(gridRow int, gridColumn int, w Widgeter)
- func (c *Expander) Content() *Panel
- func (c *Expander) Expanded() bool
- func (c *Expander) MaxHeight() int
- func (c *Expander) ProcessKeyDown(key Key, mods KeyModifiers) bool
- func (c *Expander) SetExpanded(expanded bool)
- func (c *Expander) SetOnExpandedChanged(f func())
- func (c *Expander) SetTitle(title string)
- func (c *Expander) SetTitleFunc(f func() string)
- func (c *Expander) Title() string
- type FileDialogFilter
- type Form
- func (c *Form) AddShortcut(shortcut string, f func())
- func (c *Form) Beep()
- func (c *Form) Close()
- func (c *Form) CloseTopPopup()
- func (c *Form) DrawWidgetDebugInfo(w Widgeter, cnv *Canvas)
- func (c *Form) Exec()
- func (c *Form) FocusedWidget() Widgeter
- func (c *Form) Hide()
- func (c *Form) Invoke(f func())
- func (c *Form) IsActive() bool
- func (c *Form) IsHidden() bool
- func (c *Form) IsMaximized() bool
- func (c *Form) KeyModifiers() KeyModifiers
- func (c *Form) LayoutingBlockPop()
- func (c *Form) LayoutingBlockPush()
- func (c *Form) Maximize()
- func (c *Form) MenuBar() *MenuBar
- func (c *Form) MinSize() (int, int)
- func (c *Form) Minimize()
- func (c *Form) Move(x, y int)
- func (c *Form) MoveToCenterOfParent()
- func (c *Form) OpenPopup(w Widgeter)
- func (c *Form) Panel() *Panel
- func (c *Form) ParentForm() *Form
- func (c *Form) Position() (int, int)
- func (c *Form) Print(job *PrintJob, onDone func(err error))
- func (c *Form) RemoveShortcut(shortcut string)
- func (c *Form) RequestAttention()
- func (c *Form) RequestClose() bool
- func (c *Form) Restore()
- func (c *Form) SetAcceptButton(button *Button)
- func (c *Form) SetAllowMaximize(allow bool)
- func (c *Form) SetAllowMinimize(allow bool)
- func (c *Form) SetAlwaysOnTop(onTop bool)
- func (c *Form) SetCancelButton(button *Button)
- func (c *Form) SetIcon(img image.Image)
- func (c *Form) SetMainWidget(w Widgeter)
- func (c *Form) SetMenuBar(bar *MenuBar)
- func (c *Form) SetOnActivated(f func())
- func (c *Form) SetOnDeactivated(f func())
- func (c *Form) SetOnFilesDropped(f func(files []string, x, y int))
- func (c *Form) SetOnGlobalKeyDown(onGlobalKeyDown func(keyCode Key, mods KeyModifiers) bool)
- func (c *Form) SetOnLanguageChanged(f func())
- func (c *Form) SetSize(width, height int)
- func (c *Form) SetTitle(title string)
- func (c *Form) SetTitleFunc(f func() string)
- func (c *Form) Show()
- func (c *Form) ShowContextMenu(menu *ContextMenu, x int, y int)
- func (c *Form) ShowMaximized()
- func (c *Form) ShowModal(parent *Form)
- func (c *Form) ShowOpenFileDialog(opts OpenFileDialogOptions, onResult func(paths []string, err error))
- func (c *Form) ShowSaveFileDialog(opts SaveFileDialogOptions, onResult func(path string, err error))
- func (c *Form) ShowSelectDirectoryDialog(opts SelectDirectoryDialogOptions, onResult func(path string, err error))
- func (c *Form) ShowToast(text string, kind ToastKind)
- func (c *Form) ShowToastFor(text string, kind ToastKind, duration time.Duration)
- func (c *Form) Size() (int, int)
- func (c *Form) SystemHandle() any
- func (c *Form) TopPopupWidget() Widgeter
- func (c *Form) Update()
- func (c *Form) UpdateBlockPop()
- func (c *Form) UpdateBlockPush()
- func (c *Form) UpdateLayout()
- func (c *Form) WidgetById(id string) Widgeter
- type Frame
- type GroupBox
- type HAlign
- type HSpacer
- type ImageBox
- func (c *ImageBox) Image() image.Image
- func (c *ImageBox) MaxHeight() int
- func (c *ImageBox) MaxWidth() int
- func (c *ImageBox) MinHeight() int
- func (c *ImageBox) MinWidth() int
- func (c *ImageBox) Scaling() ImageBoxScale
- func (c *ImageBox) SetImage(img image.Image)
- func (c *ImageBox) SetScaling(scaling ImageBoxScale)
- type ImageBoxScale
- type Key
- type KeyModifiers
- type Label
- func (c *Label) IsUnderline() bool
- func (c *Label) ProcessPropChange(key string, value interface{})
- func (c *Label) SetText(text string)
- func (c *Label) SetTextAlign(align HAlign)
- func (c *Label) SetTextFunc(f func() string)
- func (c *Label) SetUnderline(underline bool)
- func (c *Label) Text() string
- func (c *Label) TextAlign() HAlign
- type Link
- func (c *Link) Activate()
- func (c *Link) ProcessKeyDown(key Key, mods KeyModifiers) bool
- func (c *Link) SetOnClick(f func())
- func (c *Link) SetText(text string)
- func (c *Link) SetTextFunc(f func() string)
- func (c *Link) SetURL(url string)
- func (c *Link) Text() string
- func (c *Link) URL() string
- func (c *Link) Visited() bool
- type MenuBar
- type MenuBarItem
- type MouseButton
- type MouseCursor
- type NumBox
- func (c *NumBox) Decimals() int
- func (c *NumBox) GetValue() float64
- func (c *NumBox) IsCanBeFocused() bool
- func (c *NumBox) Max() float64
- func (c *NumBox) Min() float64
- func (c *NumBox) MouseCursor() MouseCursor
- func (c *NumBox) ProcessPropChange(key string, value interface{})
- func (c *NumBox) SetDecimals(decimals int)
- func (c *NumBox) SetMax(max float64)
- func (c *NumBox) SetMin(min float64)
- func (c *NumBox) SetOnChanged(f func())
- func (c *NumBox) SetOnValueChanged(f func())
- func (c *NumBox) SetStep(step float64)
- func (c *NumBox) SetText(text string)
- func (c *NumBox) SetValue(v float64)
- func (c *NumBox) Step() float64
- func (c *NumBox) Text() string
- func (c *NumBox) Value() float64
- type OpenFileDialogOptions
- type Panel
- type PaperSize
- type PopupCanceler
- type PopupPlacer
- type PrintJob
- type PrintPage
- type ProgressBar
- type Property
- func (p *Property) Category() string
- func (p *Property) Editor() Widgeter
- func (p *Property) Name() string
- func (p *Property) NotifyChanged()
- func (p *Property) SetDescription(text string)
- func (p *Property) SetOnChanged(f func())
- func (p *Property) SetReadOnly(readOnly bool)
- func (p *Property) SetValue(v any)
- func (p *Property) Value() any
- type PropertyGrid
- func (c *PropertyGrid) AddBool(category, name string, value bool) *Property
- func (c *PropertyGrid) AddChoice(category, name string, options []string, index int) *Property
- func (c *PropertyGrid) AddColor(category, name string, value color.RGBA) *Property
- func (c *PropertyGrid) AddCustom(category, name string, editor Widgeter) *Property
- func (c *PropertyGrid) AddDate(category, name string, value time.Time) *Property
- func (c *PropertyGrid) AddFloat(category, name string, value float64, decimals int) *Property
- func (c *PropertyGrid) AddInt(category, name string, value, min, max int) *Property
- func (c *PropertyGrid) AddString(category, name, value string) *Property
- func (c *PropertyGrid) Category(name string) *Expander
- func (c *PropertyGrid) Clear()
- func (c *PropertyGrid) Properties() []*Property
- func (c *PropertyGrid) Property(name string) *Property
- func (c *PropertyGrid) Refresh()
- func (c *PropertyGrid) SetObject(obj any) error
- func (c *PropertyGrid) SetOnChanged(f func(p *Property))
- type RadioButton
- type SaveFileDialogOptions
- type ScrollArea
- type SelectDirectoryDialogOptions
- type Shortcut
- type Slider
- func (c *Slider) IsVertical() bool
- func (c *Slider) Max() float64
- func (c *Slider) Min() float64
- func (c *Slider) ProcessKeyDown(key Key, mods KeyModifiers) bool
- func (c *Slider) SetMax(max float64)
- func (c *Slider) SetMin(min float64)
- func (c *Slider) SetOnValueChanged(f func())
- func (c *Slider) SetPageStep(step float64)
- func (c *Slider) SetRange(min, max float64)
- func (c *Slider) SetStep(step float64)
- func (c *Slider) SetTickInterval(interval float64)
- func (c *Slider) SetValue(value float64)
- func (c *Slider) SetVertical(vertical bool)
- func (c *Slider) Step() float64
- func (c *Slider) Value() float64
- type Space
- type Splitter
- func (c *Splitter) First() Widgeter
- func (c *Splitter) FirstSize() int
- func (c *Splitter) HandleSize() int
- func (c *Splitter) IsVertical() bool
- func (c *Splitter) MinHeight() int
- func (c *Splitter) MinWidth() int
- func (c *Splitter) Second() Widgeter
- func (c *Splitter) SecondSize() int
- func (c *Splitter) SetFirstSize(size int)
- func (c *Splitter) SetHandleSize(size int)
- func (c *Splitter) SetOnSplitChanged(fn func())
- func (c *Splitter) SetSecondSize(size int)
- func (c *Splitter) SetSize(w, h int)
- func (c *Splitter) SetWidgets(first, second Widgeter)
- func (c *Splitter) XExpandable() bool
- func (c *Splitter) YExpandable() bool
- type TabWidget
- type Table
- func (c *Table) AddWidgetOnTable(widget Widgeter, posCellRow int, posCellCol int, widthInCells int, ...)
- func (c *Table) CancelCellEditor()
- func (c *Table) CellBorderColor() color.Color
- func (c *Table) CellBorderWidth() int
- func (c *Table) CellPadding() int
- func (c *Table) ClearRows()
- func (c *Table) ClearSelection()
- func (c *Table) ClearSelectionOnEmptyClick() bool
- func (c *Table) ColumnCount() int
- func (c *Table) ColumnName(col int) string
- func (c *Table) ColumnWidth(col int) int
- func (c *Table) CopySelectionToClipboard()
- func (c *Table) CurrentColumn() int
- func (c *Table) CurrentRow() int
- func (c *Table) EditCell(row, col, colSpan int, text string, onDone func(text string, accepted bool)) *TextBox
- func (c *Table) EditCurrentCell(enteredText string)
- func (c *Table) GetCellData2(row int, col int) interface{}
- func (c *Table) GetCellText2(row int, col int) string
- func (c *Table) IsCellSelected(row int, col int) bool
- func (c *Table) IsEditingCell() bool
- func (c *Table) IsRowSelected(row int) bool
- func (c *Table) Multiselect() bool
- func (c *Table) PreviousCurrentCellX() int
- func (c *Table) PreviousCurrentCellY() int
- func (c *Table) ProcessKeyDown(key Key, mods KeyModifiers) bool
- func (c *Table) ProcessMouseDown(button MouseButton, x int, y int, mods KeyModifiers) bool
- func (c *Table) RowCount() int
- func (c *Table) RowHeight() int
- func (c *Table) ScrollToCell2(row, col int)
- func (c *Table) SelectAll()
- func (c *Table) SelectedCells() []TableCellPos
- func (c *Table) SelectedRows() []int
- func (c *Table) SelectingRows() bool
- func (c *Table) SetCellBorderColor(col color.RGBA)
- func (c *Table) SetCellBorderWidth(width int)
- func (c *Table) SetCellColor(row int, col int, color color.Color)
- func (c *Table) SetCellContraction(row int, col int, contraction bool)
- func (c *Table) SetCellData2(row int, col int, data interface{})
- func (c *Table) SetCellDisplayText(row int, col int, text string)
- func (c *Table) SetCellEditTriggerDoubleClick(row int, col int, enabled bool)
- func (c *Table) SetCellEditTriggerEnter(row int, col int, enabled bool)
- func (c *Table) SetCellEditTriggerF2(row int, col int, enabled bool)
- func (c *Table) SetCellEditTriggerKeyDown(row int, col int, enabled bool)
- func (c *Table) SetCellHAlign(row int, col int, align HAlign)
- func (c *Table) SetCellImage(row int, col int, img image.Image, imgWidth int)
- func (c *Table) SetCellOnDraw(row int, col int, onDraw func(cnv *Canvas))
- func (c *Table) SetCellPadding(padding int)
- func (c *Table) SetCellSelectionDisabled(row int, col int, disabled bool)
- func (c *Table) SetCellText2(row int, col int, text string)
- func (c *Table) SetCellVAlign(row int, col int, align VAlign)
- func (c *Table) SetClearSelectionOnEmptyClick(enabled bool)
- func (c *Table) SetColumnCellName2(row int, col int, name string)
- func (c *Table) SetColumnCount(count int)
- func (c *Table) SetColumnHAlign(col int, align HAlign)
- func (c *Table) SetColumnImage(col int, img image.Image, imgWidth int)
- func (c *Table) SetColumnName(col int, name string)
- func (c *Table) SetColumnWidth(col int, width int)
- func (c *Table) SetCurrentCell2(row int, col int)
- func (c *Table) SetEditTriggerDoubleClick(enabled bool)
- func (c *Table) SetEditTriggerEnter(enabled bool)
- func (c *Table) SetEditTriggerF2(enabled bool)
- func (c *Table) SetEditTriggerKeyDown(enabled bool)
- func (c *Table) SetHeaderCellSpan2(row int, col int, spanRow int, spanCol int)
- func (c *Table) SetHeaderRowCount(count int)
- func (c *Table) SetHotTracking(enabled bool)
- func (c *Table) SetModeLoading(loading bool, text string)
- func (c *Table) SetMultiselect(enabled bool)
- func (c *Table) SetOnCellChanged(callback func(row int, col int, text string, data interface{}) bool)
- func (c *Table) SetOnCellMouseDblClick(callback func())
- func (c *Table) SetOnCellMouseDown(...)
- func (c *Table) SetOnCellMouseUp(...)
- func (c *Table) SetOnColumnClick(callback func(col int))
- func (c *Table) SetOnColumnResize(callback func(col int, newWidth int))
- func (c *Table) SetOnSelectionChanged(callback func(x int, y int))
- func (c *Table) SetRowCount(count int)
- func (c *Table) SetRowHeight(height int)
- func (c *Table) SetSelectedRows(rows []int)
- func (c *Table) SetSelectingRows(selectingRows bool)
- func (c *Table) SetShowSelection(show bool)
- func (c *Table) SetStretchLastColumn(stretch bool)
- func (c *Table) ShowSelection() bool
- func (c *Table) TableSetLayoutXml(n *uiNode)
- type TableCellPos
- type TextBox
- func (c *TextBox) AcceptsReturn() bool
- func (c *TextBox) AssemblyText(lines []string) string
- func (c *TextBox) CanRedo() bool
- func (c *TextBox) CanUndo() bool
- func (c *TextBox) ClearUndo()
- func (c *TextBox) Draw(ctx *Canvas, width, height int)
- func (c *TextBox) Hint() string
- func (c *TextBox) KeyChar(ch rune, mods KeyModifiers)
- func (c *TextBox) KeyDown(key Key, mods KeyModifiers) bool
- func (c *TextBox) KeyUp(key Key, mods KeyModifiers)
- func (c *TextBox) Lines() []string
- func (c *TextBox) MinHeight() int
- func (c *TextBox) MouseDown(button MouseButton, x int, y int, mods KeyModifiers)
- func (c *TextBox) MouseMove(x int, y int, mods KeyModifiers)
- func (c *TextBox) MouseUp(button MouseButton, x int, y int, mods KeyModifiers)
- func (c *TextBox) MoveCursorToEnd()
- func (c *TextBox) Multiline() bool
- func (c *TextBox) OneLineHeight() int
- func (c *TextBox) ProcessPaint(cnv *Canvas)
- func (c *TextBox) ProcessPropChange(key string, value interface{})
- func (c *TextBox) ReadOnly() bool
- func (c *TextBox) Redo()
- func (c *TextBox) ScrollToBegin()
- func (c *TextBox) SelectAllText()
- func (c *TextBox) SelectRange(from, to int)
- func (c *TextBox) SelectedText() string
- func (c *TextBox) SetHint(text string)
- func (c *TextBox) SetHintFunc(f func() string)
- func (c *TextBox) SetIsPassword(isPassword bool)
- func (c *TextBox) SetMultiline(multiline bool)
- func (c *TextBox) SetOnTextBoxKeyDown(onKeyDown func())
- func (c *TextBox) SetOnTextChanged(onTextChanged func())
- func (c *TextBox) SetProp(key string, value any)
- func (c *TextBox) SetReadOnly(readonly bool)
- func (c *TextBox) SetText(text string)
- func (c *TextBox) Text() string
- func (c *TextBox) Undo()
- type TextBoxSelection
- type TextPrintOptions
- type ThemePalette
- type TimeChart
- func (c *TimeChart) AddArea() *TimeChartArea
- func (c *TimeChart) Areas() []*TimeChartArea
- func (c *TimeChart) ClearSelection()
- func (c *TimeChart) DefaultTimeRange() (from, to time.Time)
- func (c *TimeChart) IsDefaultView() bool
- func (c *TimeChart) ProcessMouseUp(button MouseButton, x int, y int, mods KeyModifiers, onlyForWidgetId string) bool
- func (c *TimeChart) RemoveAllAreas()
- func (c *TimeChart) ResetTimeRange()
- func (c *TimeChart) ResetZoom()
- func (c *TimeChart) Selection() (from, to time.Time, ok bool)
- func (c *TimeChart) SetDefaultTimeRange(from, to time.Time)
- func (c *TimeChart) SetOnSelectionChanged(f func())
- func (c *TimeChart) SetOnTimeRangeChanged(f func())
- func (c *TimeChart) SetSelection(from, to time.Time)
- func (c *TimeChart) SetTimeRange(from, to time.Time)
- func (c *TimeChart) TimeRange() (from, to time.Time)
- func (c *TimeChart) ZoomBack()
- func (c *TimeChart) ZoomDepth() int
- type TimeChartAggregator
- type TimeChartArea
- func (c *TimeChartArea) AddMarker(m TimeChartMarker)
- func (c *TimeChartArea) AddSeries(name string, source TimeChartDataSource) *TimeChartSeries
- func (c *TimeChartArea) ClearMarkers()
- func (c *TimeChartArea) Markers() []TimeChartMarker
- func (c *TimeChartArea) ResetYRange()
- func (c *TimeChartArea) Series() []*TimeChartSeries
- func (c *TimeChartArea) SetMarkers(markers []TimeChartMarker)
- func (c *TimeChartArea) SetYRange(yMin, yMax float64)
- func (c *TimeChartArea) YRange() (yMin, yMax float64, ok bool)
- type TimeChartDataSource
- type TimeChartMarker
- type TimeChartMemorySource
- type TimeChartPoint
- type TimeChartSeries
- type TimeChartSeriesType
- type TimePicker
- func (c *TimePicker) Duration() time.Duration
- func (c *TimePicker) Hour() int
- func (c *TimePicker) Minute() int
- func (c *TimePicker) ProcessKeyDown(key Key, mods KeyModifiers) bool
- func (c *TimePicker) Second() int
- func (c *TimePicker) SetDuration(d time.Duration)
- func (c *TimePicker) SetOnTimeChanged(f func())
- func (c *TimePicker) SetShowSeconds(show bool)
- func (c *TimePicker) SetTime(hour, minute, second int)
- func (c *TimePicker) Text() string
- type ToastKind
- type ToggleSwitch
- func (c *ToggleSwitch) Checked() bool
- func (c *ToggleSwitch) ProcessKeyDown(key Key, mods KeyModifiers) bool
- func (c *ToggleSwitch) SetChecked(checked bool)
- func (c *ToggleSwitch) SetOnStateChanged(f func())
- func (c *ToggleSwitch) SetText(text string)
- func (c *ToggleSwitch) SetTextFunc(f func() string)
- func (c *ToggleSwitch) Text() string
- type ToolButton
- func (c *ToolButton) IsChecked() bool
- func (c *ToolButton) IsFlat() bool
- func (c *ToolButton) SetButtonSize(width, height int)
- func (c *ToolButton) SetChecked(checked bool)
- func (c *ToolButton) SetEnabled(enabled bool)
- func (c *ToolButton) SetFlat(flat bool)
- func (c *ToolButton) SetHighlight(col color.Color)
- func (c *ToolButton) SetImage(img image.Image)
- func (c *ToolButton) SetOnClick(onClick func())
- type TrayIcon
- type TrayMenuItem
- type TreeNode
- func (n *TreeNode) AddChild(text string) *TreeNode
- func (n *TreeNode) ChildCount() int
- func (n *TreeNode) Children() []*TreeNode
- func (n *TreeNode) Collapse()
- func (n *TreeNode) Data() any
- func (n *TreeNode) Expand()
- func (n *TreeNode) ExpandAll()
- func (n *TreeNode) HasChildren() bool
- func (n *TreeNode) Image() image.Image
- func (n *TreeNode) Index() int
- func (n *TreeNode) InsertChild(index int, text string) *TreeNode
- func (n *TreeNode) IsExpanded() bool
- func (n *TreeNode) IsReadOnly(col int) bool
- func (n *TreeNode) Level() int
- func (n *TreeNode) Parent() *TreeNode
- func (n *TreeNode) Remove()
- func (n *TreeNode) RemoveChildren()
- func (n *TreeNode) SetColor(col color.Color)
- func (n *TreeNode) SetData(data any)
- func (n *TreeNode) SetExpanded(expanded bool)
- func (n *TreeNode) SetHasChildren(hasChildren bool)
- func (n *TreeNode) SetImage(img image.Image) *TreeNode
- func (n *TreeNode) SetReadOnly(col int, readOnly bool)
- func (n *TreeNode) SetText(col int, text string)
- func (n *TreeNode) SetTextFunc(col int, f func() string)
- func (n *TreeNode) Text(col int) string
- func (n *TreeNode) Toggle()
- func (n *TreeNode) Tree() *TreeView
- type TreeView
- func (c *TreeView) AddNode(parent *TreeNode, text string) *TreeNode
- func (c *TreeView) CancelEdit()
- func (c *TreeView) Clear()
- func (c *TreeView) CollapseAll()
- func (c *TreeView) ColumnCount() int
- func (c *TreeView) ColumnName(col int) string
- func (c *TreeView) ColumnWidth(col int) int
- func (c *TreeView) CommitEdit()
- func (c *TreeView) CopySelectionToClipboard()
- func (c *TreeView) CurrentColumn() int
- func (c *TreeView) CurrentNode() *TreeNode
- func (c *TreeView) EditCell(node *TreeNode, col int, enteredText string)
- func (c *TreeView) EditCurrentCell(enteredText string)
- func (c *TreeView) ExpandAll()
- func (c *TreeView) HeaderVisible() bool
- func (c *TreeView) Indent() int
- func (c *TreeView) InnerHeight() int
- func (c *TreeView) InsertNode(parent *TreeNode, index int, text string) *TreeNode
- func (c *TreeView) IsCellEditable(node *TreeNode, col int) bool
- func (c *TreeView) IsEditing() bool
- func (c *TreeView) IsNodeSelected(node *TreeNode) bool
- func (c *TreeView) Multiselect() bool
- func (c *TreeView) Nodes() []*TreeNode
- func (c *TreeView) ProcessKeyDown(key Key, mods KeyModifiers) bool
- func (c *TreeView) ProcessMouseDown(button MouseButton, x int, y int, mods KeyModifiers) bool
- func (c *TreeView) ProcessMouseWheel(deltaX, deltaY int) bool
- func (c *TreeView) ProcessPaint(cnv *Canvas)
- func (c *TreeView) RemoveNode(node *TreeNode)
- func (c *TreeView) RowHeight() int
- func (c *TreeView) ScrollToNode(node *TreeNode)
- func (c *TreeView) SelectAll()
- func (c *TreeView) SelectedNodes() []*TreeNode
- func (c *TreeView) SetColumnCount(count int)
- func (c *TreeView) SetColumnName(col int, name string)
- func (c *TreeView) SetColumnNameFunc(col int, f func() string)
- func (c *TreeView) SetColumnReadOnly(col int, readOnly bool)
- func (c *TreeView) SetColumnWidth(col int, width int)
- func (c *TreeView) SetCurrentColumn(col int)
- func (c *TreeView) SetCurrentNode(node *TreeNode)
- func (c *TreeView) SetEditTriggerDoubleClick(enabled bool)
- func (c *TreeView) SetEditTriggerEnter(enabled bool)
- func (c *TreeView) SetEditTriggerF2(enabled bool)
- func (c *TreeView) SetEditTriggerKeyDown(enabled bool)
- func (c *TreeView) SetGridLines(gridLines bool)
- func (c *TreeView) SetHeaderVisible(visible bool)
- func (c *TreeView) SetIndent(indent int)
- func (c *TreeView) SetMultiselect(enabled bool)
- func (c *TreeView) SetOnCellChanged(f func(node *TreeNode, col int, text string) bool)
- func (c *TreeView) SetOnCollapse(f func(node *TreeNode))
- func (c *TreeView) SetOnColumnClick(callback func(col int))
- func (c *TreeView) SetOnColumnResize(callback func(col int, newWidth int))
- func (c *TreeView) SetOnExpand(f func(node *TreeNode))
- func (c *TreeView) SetOnNodeActivated(f func(node *TreeNode))
- func (c *TreeView) SetOnSelectionChanged(f func(node *TreeNode))
- func (c *TreeView) SetRowHeight(height int)
- func (c *TreeView) SetScrollX(scrollX int)
- func (c *TreeView) SetScrollY(scrollY int)
- func (c *TreeView) SetSelectedNodes(nodes []*TreeNode)
- func (c *TreeView) SetSize(w, h int)
- func (c *TreeView) SetStretchLastColumn(stretch bool)
- type UIStrings
- type VAlign
- type VSpacer
- type Widget
- func (c *Widget) AddButton(row int, col int, text string, onPush func()) *Button
- func (c *Widget) AddHSpacer(row int, col int) *HSpacer
- func (c *Widget) AddLabel(row int, col int, text string) *Label
- func (c *Widget) AddPanel(row int, col int) *Panel
- func (c *Widget) AddTimer(intervalMs int, callback func())
- func (c *Widget) AddVSpacer(row int, col int) *VSpacer
- func (c *Widget) AddWidget(gridRow int, gridColumn int, w Widgeter)
- func (c *Widget) AllChildren() []Widgeter
- func (c *Widget) AppendPopupWidget(w Widgeter)
- func (c *Widget) BackgroundColor() color.Color
- func (c *Widget) BackgroundColorForRole(role string) color.Color
- func (c *Widget) BackgroundColorWithAddElevation(elevation int) color.Color
- func (c *Widget) ClearFocus()
- func (c *Widget) ClearLayoutCache()
- func (c *Widget) CloseAfterPopupWidget(w Widgeter)
- func (c *Widget) CloseAllPopup()
- func (c *Widget) CloseByClickOutside() bool
- func (c *Widget) CloseTopPopup()
- func (c *Widget) ContextMenu() *ContextMenu
- func (c *Widget) CurrentElevation() int
- func (c *Widget) Elevation() int
- func (c *Widget) Enabled() bool
- func (c *Widget) FindWidgetByName(name string) Widgeter
- func (c *Widget) Focus()
- func (c *Widget) FontFamily() string
- func (c *Widget) FontSize() float64
- func (c *Widget) ForegroundColor() color.Color
- func (c *Widget) ForegroundColorDisabled() color.Color
- func (c *Widget) Form() *Form
- func (c *Widget) FullPath() []string
- func (c *Widget) GetHAlign(key string, defaultValue HAlign) HAlign
- func (c *Widget) GetProp(key string) any
- func (c *Widget) GetPropBool(key string, defaultValue bool) bool
- func (c *Widget) GetPropColor(key string, defaultValue string) color.Color
- func (c *Widget) GetPropFloat64(key string, defaultValue float64) float64
- func (c *Widget) GetPropFunction(key string) func()
- func (c *Widget) GetPropInt(key string, defaultValue int) int
- func (c *Widget) GetPropString(key string, defaultValue string) string
- func (c *Widget) GetVAlign(key string, defaultValue VAlign) VAlign
- func (c *Widget) GridX() int
- func (c *Widget) GridY() int
- func (c *Widget) Height() int
- func (c *Widget) Id() string
- func (c *Widget) InitWidget()
- func (c *Widget) InnerHeight() int
- func (c *Widget) InnerWidth() int
- func (c *Widget) IsCanBeFocused() bool
- func (c *Widget) IsFocused() bool
- func (c *Widget) IsHovered() bool
- func (c *Widget) IsRolePrimary() bool
- func (c *Widget) IsRoleSecondary() bool
- func (c *Widget) IsRoleSurface() bool
- func (c *Widget) IsVisible() bool
- func (c *Widget) MaxHeight() int
- func (c *Widget) MaxWidth() int
- func (c *Widget) MinHeight() int
- func (c *Widget) MinWidth() int
- func (c *Widget) MouseCursor() MouseCursor
- func (c *Widget) Name() string
- func (c *Widget) NextGridColumn() int
- func (c *Widget) NextGridRow() int
- func (c *Widget) ParentWidget() Widgeter
- func (c *Widget) ParentWidgetId() string
- func (c *Widget) ProcessChar(char rune, mods KeyModifiers) bool
- func (c *Widget) ProcessClosePopup()
- func (c *Widget) ProcessFocusLost()
- func (c *Widget) ProcessFocused()
- func (c *Widget) ProcessKeyDown(key Key, mods KeyModifiers) bool
- func (c *Widget) ProcessKeyUp(key Key, mods KeyModifiers) bool
- func (c *Widget) ProcessMouseDblClick(button MouseButton, x int, y int, mods KeyModifiers) bool
- func (c *Widget) ProcessMouseDown(button MouseButton, x int, y int, mods KeyModifiers) bool
- func (c *Widget) ProcessMouseEnter() bool
- func (c *Widget) ProcessMouseLeave() bool
- func (c *Widget) ProcessMouseMove(x int, y int, mods KeyModifiers) bool
- func (c *Widget) ProcessMouseUp(button MouseButton, x int, y int, mods KeyModifiers, onlyForWidgetId string) bool
- func (c *Widget) ProcessMouseWheel(deltaX, deltaY int) bool
- func (c *Widget) ProcessPaint(cnv *Canvas)
- func (c *Widget) ProcessPropChange(key string, value interface{})
- func (c *Widget) ProcessTimer()
- func (c *Widget) RectClientAreaOnWindow() (x, y int)
- func (c *Widget) RemoveAllWidgets()
- func (c *Widget) RemoveWidget(w Widgeter)
- func (c *Widget) Role() string
- func (c *Widget) ScrollEnsureVisible(x1, y1 int)
- func (c *Widget) ScrollX() int
- func (c *Widget) ScrollY() int
- func (c *Widget) SetAbsolutePositioning(absolute bool)
- func (c *Widget) SetAllowScroll(allowX bool, allowY bool)
- func (c *Widget) SetAnchors(left, top, right, bottom bool)
- func (c *Widget) SetAutoFillBackground(autoFill bool)
- func (c *Widget) SetBackgroundColor(col color.Color)
- func (c *Widget) SetCanBeFocused(canBeFocused bool)
- func (c *Widget) SetCellPadding(padding int)
- func (c *Widget) SetCloseByClickOutside(close bool)
- func (c *Widget) SetContextMenu(menu *ContextMenu)
- func (c *Widget) SetDragSource(f func(x, y int) *DragData)
- func (c *Widget) SetDropTarget(accept func(data *DragData, x, y int) bool, ...)
- func (c *Widget) SetElevation(elevation int)
- func (c *Widget) SetEnabled(enabled bool)
- func (c *Widget) SetFontFamily(family string)
- func (c *Widget) SetFontSize(fontSize float64)
- func (c *Widget) SetForegroundColor(col color.Color)
- func (c *Widget) SetGridPosition(row, column int)
- func (c *Widget) SetInnerSize(width, height int)
- func (c *Widget) SetLayout(layoutAsXml string, eventProcessor interface{}, widgets map[string]Widgeter) error
- func (c *Widget) SetMaxHeight(maxHeight int)
- func (c *Widget) SetMaxSize(maxWidth, maxHeight int)
- func (c *Widget) SetMaxWidth(maxWidth int)
- func (c *Widget) SetMinHeight(minHeight int)
- func (c *Widget) SetMinSize(minWidth, minHeight int)
- func (c *Widget) SetMinWidth(minWidth int)
- func (c *Widget) SetMouseCursor(cursor MouseCursor)
- func (c *Widget) SetName(name string)
- func (c *Widget) SetOnChar(f func(char rune, mods KeyModifiers) bool)
- func (c *Widget) SetOnClick(f func())
- func (c *Widget) SetOnFocusLost(onFocusLost func())
- func (c *Widget) SetOnFocused(onFocused func())
- func (c *Widget) SetOnKeyDown(f func(key Key, mods KeyModifiers) bool)
- func (c *Widget) SetOnKeyUp(f func(key Key, mods KeyModifiers) bool)
- func (c *Widget) SetOnMouseDblClick(f func(button MouseButton, x int, y int, mods KeyModifiers) bool)
- func (c *Widget) SetOnMouseDown(f func(button MouseButton, x int, y int, mods KeyModifiers) bool)
- func (c *Widget) SetOnMouseEnter(f func())
- func (c *Widget) SetOnMouseLeave(f func())
- func (c *Widget) SetOnMouseMove(f func(x int, y int, mods KeyModifiers) bool)
- func (c *Widget) SetOnMouseUp(f func(button MouseButton, x int, y int, mods KeyModifiers) bool)
- func (c *Widget) SetOnMouseWheel(f func(deltaX, deltaY int) bool)
- func (c *Widget) SetOnPaint(f func(cnv *Canvas))
- func (c *Widget) SetOnPostPaint(f func(cnv *Canvas))
- func (c *Widget) SetOnScrollChanged(f func(scrollX, scrollY int))
- func (c *Widget) SetPanelPadding(padding int)
- func (c *Widget) SetParentWidgetId(id string)
- func (c *Widget) SetPosition(x, y int)
- func (c *Widget) SetProp(key string, value any)
- func (c *Widget) SetPropFunction(key string, f func())
- func (c *Widget) SetRole(role string)
- func (c *Widget) SetScrollX(scrollX int)
- func (c *Widget) SetScrollY(scrollY int)
- func (c *Widget) SetSize(w, h int)
- func (c *Widget) SetTooltip(text string)
- func (c *Widget) SetTooltipFunc(f func() string)
- func (c *Widget) SetTypeName(typeName string)
- func (c *Widget) SetVisible(visible bool)
- func (c *Widget) SetXExpandable(expandable bool)
- func (c *Widget) SetYExpandable(expandable bool)
- func (c *Widget) ShowDialog(centralWidget Widgeter)
- func (c *Widget) Tooltip() string
- func (c *Widget) TypeName() string
- func (c *Widget) ViewportHeight() int
- func (c *Widget) ViewportWidth() int
- func (c *Widget) Widgets() []Widgeter
- func (c *Widget) Width() int
- func (c *Widget) X() int
- func (c *Widget) XExpandable() bool
- func (c *Widget) Y() int
- func (c *Widget) YExpandable() bool
- type Widgeter
Constants ¶
const ( KeyEsc = platforms.KeyEsc KeyF1 = platforms.KeyF1 KeyF2 = platforms.KeyF2 KeyF3 = platforms.KeyF3 KeyF4 = platforms.KeyF4 KeyF5 = platforms.KeyF5 KeyF6 = platforms.KeyF6 KeyF7 = platforms.KeyF7 KeyF8 = platforms.KeyF8 KeyF9 = platforms.KeyF9 KeyF10 = platforms.KeyF10 KeyF11 = platforms.KeyF11 KeyF12 = platforms.KeyF12 KeyF13 = platforms.KeyF13 KeyF14 = platforms.KeyF14 KeyF15 = platforms.KeyF15 KeyF16 = platforms.KeyF16 KeyF17 = platforms.KeyF17 KeyF18 = platforms.KeyF18 KeyF19 = platforms.KeyF19 KeyF20 = platforms.KeyF20 KeyF21 = platforms.KeyF21 KeyF22 = platforms.KeyF22 KeyF23 = platforms.KeyF23 KeyF24 = platforms.KeyF24 KeyGrave = platforms.KeyGrave Key1 = platforms.Key1 Key2 = platforms.Key2 Key3 = platforms.Key3 Key4 = platforms.Key4 Key5 = platforms.Key5 Key6 = platforms.Key6 Key7 = platforms.Key7 Key8 = platforms.Key8 Key9 = platforms.Key9 Key0 = platforms.Key0 KeyMinus = platforms.KeyMinus KeyEqual = platforms.KeyEqual KeyBackspace = platforms.KeyBackspace KeyTab = platforms.KeyTab KeyQ = platforms.KeyQ KeyW = platforms.KeyW KeyE = platforms.KeyE KeyR = platforms.KeyR KeyT = platforms.KeyT KeyY = platforms.KeyY KeyU = platforms.KeyU KeyI = platforms.KeyI KeyO = platforms.KeyO KeyP = platforms.KeyP KeyLeftBracket = platforms.KeyLeftBracket KeyRightBracket = platforms.KeyRightBracket KeyBackslash = platforms.KeyBackslash KeyCapsLock = platforms.KeyCapsLock KeyA = platforms.KeyA KeyS = platforms.KeyS KeyD = platforms.KeyD KeyF = platforms.KeyF KeyG = platforms.KeyG KeyH = platforms.KeyH KeyJ = platforms.KeyJ KeyK = platforms.KeyK KeyL = platforms.KeyL KeySemicolon = platforms.KeySemicolon KeyApostrophe = platforms.KeyApostrophe KeyEnter = platforms.KeyEnter KeyShift = platforms.KeyShift KeyZ = platforms.KeyZ KeyX = platforms.KeyX KeyC = platforms.KeyC KeyV = platforms.KeyV KeyB = platforms.KeyB KeyN = platforms.KeyN KeyM = platforms.KeyM KeyComma = platforms.KeyComma KeyDot = platforms.KeyDot KeySlash = platforms.KeySlash KeyCtrl = platforms.KeyCtrl KeyWin = platforms.KeyWin KeyAlt = platforms.KeyAlt KeySpace = platforms.KeySpace KeyContextMenu = platforms.KeyContextMenu KeyPrintScreen = platforms.KeyPrintScreen KeyScrollLock = platforms.KeyScrollLock KeyPauseBreak = platforms.KeyPauseBreak KeyInsert = platforms.KeyInsert KeyHome = platforms.KeyHome KeyPageUp = platforms.KeyPageUp KeyDelete = platforms.KeyDelete KeyEnd = platforms.KeyEnd KeyPageDown = platforms.KeyPageDown KeyArrowUp = platforms.KeyArrowUp KeyArrowLeft = platforms.KeyArrowLeft KeyArrowDown = platforms.KeyArrowDown KeyArrowRight = platforms.KeyArrowRight KeyNumLock = platforms.KeyNumLock KeyNumpadSlash = platforms.KeyNumpadSlash KeyNumpadAsterisk = platforms.KeyNumpadAsterisk KeyNumpadMinus = platforms.KeyNumpadMinus KeyNumpadPlus = platforms.KeyNumpadPlus KeyNumpad1 = platforms.KeyNumpad1 KeyNumpad2 = platforms.KeyNumpad2 KeyNumpad3 = platforms.KeyNumpad3 KeyNumpad4 = platforms.KeyNumpad4 KeyNumpad5 = platforms.KeyNumpad5 KeyNumpad6 = platforms.KeyNumpad6 KeyNumpad7 = platforms.KeyNumpad7 KeyNumpad8 = platforms.KeyNumpad8 KeyNumpad9 = platforms.KeyNumpad9 KeyNumpad0 = platforms.KeyNumpad0 KeyNumpadDot = platforms.KeyNumpadDot KeyCommand = platforms.KeyCommand KeyFunction = platforms.KeyFunction MouseCursorNotDefined = platforms.MouseCursorNotDefined MouseCursorArrow = platforms.MouseCursorArrow MouseCursorPointer = platforms.MouseCursorPointer MouseCursorResizeHor = platforms.MouseCursorResizeHor MouseCursorResizeVer = platforms.MouseCursorResizeVer MouseCursorIBeam = platforms.MouseCursorIBeam MouseButtonLeft = platforms.MouseButtonLeft MouseButtonMiddle = platforms.MouseButtonMiddle MouseButtonRight = platforms.MouseButtonRight )
const ( // FontFamilySans is the font of the interface: Noto Sans FontFamilySans = "notosans" // FontFamilyMono is a monospaced font for code, logs and aligned // columns of numbers: JetBrains Mono (see Widget.SetFontFamily) FontFamilyMono = "jetbrainsmono" )
Font families registered by default
const ContextMenuItemIconSize = 16
ContextMenuItemIconSize is the size of the item icons
const ContextMenuSeparatorHeight = 9
ContextMenuSeparatorHeight is the height of a separator line between groups of items
const (
DefaultButtonMinWidth = 100
)
const DefaultComboBoxMinWidth = 150
DefaultComboBoxMinWidth keeps a bare ComboBox (no width ever set by the caller) from collapsing to an unusably thin trigger.
const DefaultFontSize = 14.0
const DefaultPrintDPI = 300
DefaultPrintDPI is the resolution the pages are drawn at
const FontFamilyCJK = "system-cjk"
FontFamilyCJK is the family the system CJK font is registered as, when found.
const MAX_HEIGHT = 100000
const MAX_WIDTH = 100000
const MaxInt = int(^uint(0) >> 1)
const MaxUint = ^uint(0)
const MinInt = -MaxInt - 1
const MinUint = 0
const ToastDefaultDuration = 3 * time.Second
ToastDefaultDuration is how long ShowToast keeps a toast on the screen
const (
// ToolButtonDefaultSize is the default width and height of a ToolButton
ToolButtonDefaultSize = 48
)
const TreeViewIconSize = 16
TreeViewIconSize is the size node icons are scaled down to.
Variables ¶
var ( PaperA4 = PaperSize{"A4", 210, 297} PaperA5 = PaperSize{"A5", 148, 210} PaperA3 = PaperSize{"A3", 297, 420} PaperLetter = PaperSize{"Letter", 215.9, 279.4} PaperLegal = PaperSize{"Legal", 215.9, 355.6} )
var DarkPalette = ThemePalette{ Window: ColorFromHex("#2B2B2B"), WindowText: ColorFromHex("#E3E3E3"), Base: ColorFromHex("#1F1F1F"), Text: ColorFromHex("#E3E3E3"), Button: ColorFromHex("#383838"), ButtonText: ColorFromHex("#E3E3E3"), Border: ColorFromHex("#505050"), Divider: ColorFromHex("#3A3A3A"), Highlight: ColorFromHex("#3584C8"), HighlightedText: ColorFromHex("#FFFFFF"), Selection: ColorFromHex("#264F78"), DisabledText: ColorFromHex("#7A7A7A"), PlaceholderText: ColorFromHex("#8A8A8A"), PopupBase: ColorFromHex("#333333"), ToolTipBase: ColorFromHex("#3A3A3A"), ToolTipText: ColorFromHex("#E3E3E3"), Link: ColorFromHex("#5AA9E6"), Error: ColorFromHex("#EF5350"), Warning: ColorFromHex("#FFB74D"), Success: ColorFromHex("#66BB6A"), }
DarkPalette is the dark theme: the same structure as the light one, with depth shown by the lightness of the surfaces instead of shadows. Inputs are darker than the window, buttons and popups lighter.
var DefaultColorPickerPalette = []color.RGBA{
{0x00, 0x00, 0x00, 0xFF}, {0x42, 0x42, 0x42, 0xFF}, {0x75, 0x75, 0x75, 0xFF}, {0xBD, 0xBD, 0xBD, 0xFF}, {0xFF, 0xFF, 0xFF, 0xFF},
{0x79, 0x55, 0x48, 0xFF}, {0xF4, 0x43, 0x36, 0xFF}, {0xE9, 0x1E, 0x63, 0xFF}, {0x9C, 0x27, 0xB0, 0xFF}, {0x67, 0x3A, 0xB7, 0xFF},
{0x3F, 0x51, 0xB5, 0xFF}, {0x21, 0x96, 0xF3, 0xFF}, {0x03, 0xA9, 0xF4, 0xFF}, {0x00, 0xBC, 0xD4, 0xFF}, {0x00, 0x96, 0x88, 0xFF},
{0x4C, 0xAF, 0x50, 0xFF}, {0x8B, 0xC3, 0x4A, 0xFF}, {0xCD, 0xDC, 0x39, 0xFF}, {0xFF, 0xEB, 0x3B, 0xFF}, {0xFF, 0x98, 0x00, 0xFF},
}
DefaultColorPickerPalette is the palette a new ColorPicker offers.
var DefaultUiLineHeight = 30
DefaultUiLineHeight is the height of a single-line control at the theme font size (see ThemeControlHeight); ApplyBaseFontSize updates it.
var ErrNoFileDialog = platforms.ErrNoFileDialog
ErrNoFileDialog is returned when the system has no file dialog to show, e.g. Linux without zenity or kdialog
var ErrNoPrinting = platforms.ErrNoPrinting
ErrNoPrinting: no printer can be used (no CUPS on Linux or macOS)
var ErrNotificationsNotSupported = platforms.ErrNotificationsNotSupported
ErrNotificationsNotSupported is returned by ShowNotification where system notifications aren't available (macOS)
var ErrPrintCanceled = platforms.ErrPrintCanceled
ErrPrintCanceled is given to Form.Print's callback when the user cancels
var ErrSystemFontNotFound = platforms.ErrSystemFontNotFound
ErrSystemFontNotFound is returned when the system has no font of the name
var ErrTrayNotSupported = platforms.ErrTrayNotSupported
ErrTrayNotSupported is returned by NewTrayIcon when the system has no tray, e.g. a Linux desktop without StatusNotifierItem support
var IsDarkTheme = true
var LightPalette = ThemePalette{ Window: ColorFromHex("#EFEFEF"), WindowText: ColorFromHex("#1F1F1F"), Base: ColorFromHex("#FFFFFF"), Text: ColorFromHex("#1F1F1F"), Button: ColorFromHex("#FAFAFA"), ButtonText: ColorFromHex("#1F1F1F"), Border: ColorFromHex("#B5B5B5"), Divider: ColorFromHex("#DCDCDC"), Highlight: ColorFromHex("#2A7DC1"), HighlightedText: ColorFromHex("#FFFFFF"), Selection: ColorFromHex("#BFD9EE"), DisabledText: ColorFromHex("#A0A0A0"), PlaceholderText: ColorFromHex("#8C8C8C"), PopupBase: ColorFromHex("#FFFFFF"), ToolTipBase: ColorFromHex("#FFFFFF"), ToolTipText: ColorFromHex("#1F1F1F"), Link: ColorFromHex("#1D6FB5"), Error: ColorFromHex("#C62828"), Warning: ColorFromHex("#B26A00"), Success: ColorFromHex("#2E7D32"), }
LightPalette is the light theme: flat, in the spirit of Qt's Fusion style.
var NativeFontRendering = true
NativeFontRendering draws the fonts built into nui and those of RegisterFont with the system's text engine where it can take a font file: on Windows with GDI and ClearType, using the hinting of the file, as the system fonts are drawn. Text with characters the font lacks (e.g. Chinese, drawn with a fallback font) is drawn by nui's rasterizer. Set it to false before the first form is shown to draw everything with nui's rasterizer.
var PaperSizes = []PaperSize{PaperA4, PaperA5, PaperA3, PaperLetter, PaperLegal}
PaperSizes are the sizes offered in nui's print dialog
var SystemFallbackFonts = true
SystemFallbackFonts enables the system CJK font. Set it to false before any CJK text is shown to use only the fonts registered by the application.
var Theme map[string]interface{}
Functions ¶
func AddFallbackFont ¶
func AddFallbackFont(family string)
AddFallbackFont adds the registered family to the end of the fallback chain: the fonts tried, in order, for characters the requested font doesn't have.
func ApplyBaseFontSize ¶
func ApplyBaseFontSize(fontSize float64)
ApplyBaseFontSize sets the size of the theme font and lays out the open forms again: the heights of controls follow the font (see ThemeControlHeight).
func ApplyDarkTheme ¶
func ApplyDarkTheme()
func ApplyLightTheme ¶
func ApplyLightTheme()
func ApplyPalette ¶
func ApplyPalette(palette ThemePalette, dark bool)
ApplyPalette switches to the palette, e.g. a copy of LightPalette with another Highlight, and repaints the open forms. dark tells whether it's a dark theme, for the window title bars and for the charts.
func ClipboardGetText ¶
func ClipboardSetText ¶
func ClipboardSetText(text string)
func CohenSutherland ¶
func ColorFromHex ¶
func ColorToHex ¶
func DefaultDateLayout ¶
func DefaultDateLayout() string
DefaultDateLayout returns the time.Format layout of a date in the language of the application, e.g. "02.01.2006" for Russian.
func FirstDayOfWeek ¶
FirstDayOfWeek returns the day weeks start with in the language of the application: Sunday in the US, Japan, Korea and a few other places, Monday elsewhere.
func GetCharPositions ¶
GetCharPositions returns the x of each character of text and, last, the width of the whole text. Advances and kerning are added up the same way as in MeasureText and in drawing, so the cursor stays on the characters.
func GetThemeFloat ¶
func GetThemeInt ¶
func GetThemeString ¶
func Invoke ¶
func Invoke(f func())
Invoke runs f on the UI thread and returns at once. Safe to call from any goroutine; called on the UI thread, f runs after the current handler.
func InvokeSync ¶
func InvokeSync(f func())
InvokeSync runs f on the UI thread and waits for it to return; on the UI thread it just calls f. Don't call it from a goroutine the UI thread is waiting for: that would deadlock.
func IsUIThread ¶
func IsUIThread() bool
IsUIThread reports whether the caller runs on the UI thread
func Language ¶
func Language() string
Language returns the language of the application as a tag like "ru" or "zh-TW": the one set by SetLanguage, else the system's.
func MeasureText ¶
func MouseCursorToString ¶
func MouseCursorToString(c MouseCursor) string
func NewComboBoxPopup ¶
func NewComboBoxPopup() *comboBoxPopup
func NewTabWidgetButton ¶
func NewTabWidgetButton(text string) *tabWidgetButton
func OpenURL ¶
OpenURL opens the address (a web page, a file, "mailto:...") with the system's default application.
func ParseHexColor ¶
ParseHexColor parses "#RGB", "#RRGGBB" or "#RRGGBBAA", with or without the "#", in any case.
func PrintAllWidgets ¶
func PrintAllWidgets()
func RecentColors ¶
RecentColors returns the colors chosen recently in the application's color pickers, newest first.
func RegisterFont ¶
RegisterFont adds a font family from a TrueType or OpenType file. The family name is case-insensitive; registering it again replaces the font.
func RegisterSystemFont ¶
RegisterSystemFont makes the font family drawn with the system font of the name (e.g. "Segoe UI", "Consolas", "DejaVu Sans"), for Widget.SetFontFamily or the theme. ErrSystemFontNotFound if the system has no such font.
func RegisterUIStrings ¶
RegisterUIStrings adds or replaces the library's texts for a language.
func SetAppIcon ¶
SetAppIcon sets the default icon for all windows of the application. Call it at startup, before showing any form - forms that are already shown keep their current icon. A nil image is ignored.
func SetLanguage ¶
func SetLanguage(lang string)
SetLanguage switches the application to the language: the open forms update their texts (see SetTextFunc and Form.SetOnLanguageChanged) and are laid out again. Chinese, Japanese and Korean also pick their variant of the system CJK font.
func ShowMessageBox ¶
func SystemLanguage ¶
func SystemLanguage() string
SystemLanguage returns the language of the system's user interface, "en" if unknown.
func SystemUIFontName ¶
func SystemUIFontName() string
SystemUIFontName returns the name of the font the system uses for its interface: "Segoe UI" on Windows, the desktop's sans-serif font on Linux, the system font on macOS
func ThemeBackgroundColor ¶
ThemeBackgroundColor returns the background of a widget with the role and the elevation (summed over its parents, see Widget.SetElevation).
Roles: "" or "surface" - the window; "base" - input fields and lists; "popup" - menus and dropdowns; "primary" and "secondary" - the accent. A positive elevation shades the surface towards the text color, a negative one sinks it towards the input field background.
func ThemeBackgroundColorDarkTheme ¶
ThemeBackgroundColorDarkTheme is ThemeBackgroundColor for the dark palette.
func ThemeBackgroundColorLightTheme ¶
ThemeBackgroundColorLightTheme is ThemeBackgroundColor for the light palette.
func ThemeControlHeight ¶
func ThemeControlHeight() int
ThemeControlHeight returns the height of buttons, input fields, combo boxes, check boxes and other single-line controls.
func ThemeFontFamily ¶
func ThemeFontFamily() string
func ThemeFontSize ¶
func ThemeFontSize() float64
func ThemeForegroundColor ¶
func ThemeIndicatorSize ¶
func ThemeIndicatorSize() int
ThemeIndicatorSize returns the size of a check box or radio button indicator.
func ThemeLineHeight ¶
func ThemeLineHeight() int
ThemeLineHeight returns the height of a line of text in the theme font.
func ThemeRowHeight ¶
func ThemeRowHeight() int
ThemeRowHeight returns the height of table rows and of menu and dropdown items.
func UseBuiltinFont ¶
func UseBuiltinFont()
UseBuiltinFont draws the interface with the font built into nui (Noto Sans) again, after UseSystemFont
func UseSystemFont ¶
UseSystemFont draws the whole interface with the system font of the name: it becomes the theme font, and the open forms are laid out again for it. ErrSystemFontNotFound if the system has no such font.
Types ¶
type Accordion ¶
type Accordion struct {
Widget
// contains filtered or unexported fields
}
Accordion is a column of expanders (sections). By default only one section is expanded at a time: expanding one collapses the others.
acc := ui.NewAccordion()
general := acc.AddSection("General")
general.Content().AddLabel(0, 0, "Name")
acc.AddSection("Network")
func NewAccordion ¶
func NewAccordion() *Accordion
func (*Accordion) AddSection ¶
AddSection adds a collapsed section at the bottom and returns it. In an exclusive accordion the first section is expanded.
func (*Accordion) Expand ¶
Expand expands the section at index; in an exclusive accordion it collapses the others. A negative index collapses all the sections.
func (*Accordion) ExpandedIndex ¶
ExpandedIndex returns the index of the first expanded section, -1 if none
func (*Accordion) SetExclusive ¶
SetExclusive sets whether only one section may be expanded at a time.
func (*Accordion) SetOnSectionChanged ¶
SetOnSectionChanged sets the function called when the user expands or collapses a section; index is the section the user clicked.
type Button ¶
type Button struct {
Widget
// contains filtered or unexported fields
}
func (*Button) ProcessKeyDown ¶
func (c *Button) ProcessKeyDown(key Key, mods KeyModifiers) bool
func (*Button) ProcessPropChange ¶
func (*Button) Push ¶
func (c *Button) Push()
Push simulates a click on the button, triggering the "onclick" handler programmatically (used e.g. by Form's accept/cancel buttons on Enter/Esc).
func (*Button) SetTextFunc ¶
type ButtonImage ¶
type ButtonImage struct {
Widget
// contains filtered or unexported fields
}
func NewButtonImage ¶
func NewButtonImage(img image.Image) *ButtonImage
func (*ButtonImage) Image ¶
func (c *ButtonImage) Image() image.Image
func (*ButtonImage) ImageHAlign ¶
func (c *ButtonImage) ImageHAlign() HAlign
ImageHAlign returns the horizontal alignment of the image within the button.
func (*ButtonImage) ImageVAlign ¶
func (c *ButtonImage) ImageVAlign() VAlign
ImageVAlign returns the vertical alignment of the image within the button.
func (*ButtonImage) Press ¶
func (c *ButtonImage) Press()
func (*ButtonImage) ProcessPropChange ¶
func (c *ButtonImage) ProcessPropChange(key string, value interface{})
ProcessPropChange repaints when an alignment prop (or any other prop) changes.
func (*ButtonImage) SetImage ¶
func (c *ButtonImage) SetImage(img image.Image)
func (*ButtonImage) SetImageHAlign ¶
func (c *ButtonImage) SetImageHAlign(align HAlign)
SetImageHAlign sets the horizontal alignment of the image within the button.
func (*ButtonImage) SetImageVAlign ¶
func (c *ButtonImage) SetImageVAlign(align VAlign)
SetImageVAlign sets the vertical alignment of the image within the button.
func (*ButtonImage) SetOnButtonClick ¶
func (c *ButtonImage) SetOnButtonClick(fn func(btn *ButtonImage))
type Calendar ¶
type Calendar struct {
Widget
// contains filtered or unexported fields
}
Calendar shows a month as a grid of days to choose a date. The arrows in the header (and PageUp/PageDown, the mouse wheel) change the month; the arrow keys move the selection by a day or a week, Ctrl+PageUp/PageDown by a year, Home/End to the month's first/last day. Month and day names, and the first day of the week, follow the language (UIText, FirstDayOfWeek).
cal := ui.NewCalendar()
cal.SetOnDateChanged(func(d time.Time) { status.SetText(d.Format("2006-01-02")) })
func NewCalendar ¶
func NewCalendar() *Calendar
func (*Calendar) ProcessKeyDown ¶
func (c *Calendar) ProcessKeyDown(key Key, mods KeyModifiers) bool
func (*Calendar) SetDate ¶
SetDate selects the date (kept within SetMinDate/SetMaxDate) and shows its month, without calling SetOnDateChanged's function.
func (*Calendar) SetFirstDayOfWeek ¶
SetFirstDayOfWeek overrides the language's first day of the week.
func (*Calendar) SetMaxDate ¶
func (*Calendar) SetMinDate ¶
SetMinDate and SetMaxDate limit the dates that can be chosen; a zero time removes the limit.
func (*Calendar) SetOnDateActivated ¶
SetOnDateActivated sets the function called on a double click on a day or Enter.
func (*Calendar) SetOnDateChanged ¶
SetOnDateChanged sets the function called when the user selects another date: by a click, the keyboard or the Today button.
func (*Calendar) ShowMonth ¶
ShowMonth shows the month without changing the selection; the month may be out of 1..12 (it's normalized, as by time.Date).
func (*Calendar) ShownMonth ¶
ShownMonth returns the first day of the month shown.
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
func NewCanvasScaled ¶
NewCanvasScaled makes a canvas that draws on rgba with the scale: the coordinates and sizes given to it are logical, and every logical pixel takes scale pixels of rgba, so the drawing is sharp on a HiDPI screen
func (*Canvas) ClipX ¶
ClipX, ClipY, ClipW and ClipH return the clip rectangle in pixels of the image
func (*Canvas) DrawLineF ¶
DrawLineF draws an antialiased line one pixel wide between points with fractional coordinates, both ends included. Integer coordinates are the centers of the pixels, so a line between them is as sharp as DrawLine's; a line between fractional ones is spread over the neighbor pixels, e.g. for a chart that scrolls smoothly.
func (*Canvas) DrawRoundedRect ¶
func (*Canvas) FillFrame ¶
FillFrame draws a control's frame: a rounded rectangle filled with fill and outlined with a 1px border. fill must be opaque.
func (*Canvas) FillRoundedRect ¶
func (*Canvas) FillRoundedRectAA ¶
FillRoundedRectAA fills a rounded rectangle with antialiased corners. Unlike FillRoundedRect it doesn't go through gg, which builds a clip mask of the whole canvas on every call, so it's cheap enough for every control.
func (*Canvas) FillTriangle ¶
FillTriangle fills the triangle with corners (x1,y1), (x2,y2), (x3,y3).
func (*Canvas) MakeScriptLine ¶
func (c *Canvas) MakeScriptLine(x1, y1, x2, y2, width float64) *DrawScript
func (*Canvas) MakeScriptLineBresenham ¶
func (*Canvas) MakeScriptLineWu ¶
func (c *Canvas) MakeScriptLineWu(x1, y1, x2, y2 float64) *DrawScript
func (*Canvas) MixPixel ¶
MixPixel blends the color over the pixel (x, y) of the image: in pixels, with no translation, unlike the other methods
func (*Canvas) Scale ¶
Scale returns how many pixels of the image a logical pixel takes: 1 on an ordinary screen, e.g. 2 on a Retina one
func (*Canvas) SetDirectTranslateAndClip ¶
func (*Canvas) SetFontFamily ¶
func (*Canvas) SetFontSize ¶
func (*Canvas) SetUnderline ¶
func (*Canvas) TranslateAndClip ¶
func (*Canvas) TranslatedX ¶
TranslatedX returns the logical x of the current origin
func (*Canvas) TranslatedY ¶
TranslatedY returns the logical y of the current origin
type Chart ¶
type Chart struct {
Widget
// contains filtered or unexported fields
}
func (*Chart) Data ¶
func (c *Chart) Data() []ChartPoint
func (*Chart) SetData ¶
func (c *Chart) SetData(points []ChartPoint)
type ChartPoint ¶
type Checkbox ¶
type Checkbox struct {
Widget
}
func NewCheckbox ¶
func (*Checkbox) Indeterminate ¶
func (*Checkbox) SetChecked ¶
func (*Checkbox) SetIndeterminate ¶
SetIndeterminate puts the checkbox into the third state (drawn with a dash); Checked is false then. SetChecked leaves it
func (*Checkbox) SetOnStateChanged ¶
func (c *Checkbox) SetOnStateChanged(fn func())
func (*Checkbox) SetTextFunc ¶
func (*Checkbox) SetTristate ¶
SetTristate lets a click put the checkbox into the third, indeterminate state ("leave as it is", "mixed"): unchecked -> checked -> indeterminate
type ColorPicker ¶
type ColorPicker struct {
Widget
// contains filtered or unexported fields
}
ColorPicker is a field showing a color; a click (or Enter, Space, Down, F4) opens a panel to choose another one: a saturation/brightness square, a hue bar, an optional opacity bar, a hex code, a palette and the colors chosen recently.
picker := ui.NewColorPicker()
picker.SetColor(ui.ColorFromHex("#1E88E5"))
picker.SetOnColorChanged(func(col color.RGBA) { preview.SetBackgroundColor(col) })
The color changes live while it's being chosen; Escape in the panel returns to the color it was opened with, a click outside keeps the new one.
Colors are color.RGBA with a straight (not premultiplied) alpha, as ColorFromHex returns them.
func NewColorPicker ¶
func NewColorPicker() *ColorPicker
func (*ColorPicker) AlphaEnabled ¶
func (c *ColorPicker) AlphaEnabled() bool
func (*ColorPicker) ClosePopup ¶
func (c *ColorPicker) ClosePopup()
ClosePopup closes the panel keeping the chosen color.
func (*ColorPicker) Color ¶
func (c *ColorPicker) Color() color.RGBA
Color returns the chosen color.
func (*ColorPicker) IsPopupOpen ¶
func (c *ColorPicker) IsPopupOpen() bool
IsPopupOpen reports whether the panel is open.
func (*ColorPicker) OpenPopup ¶
func (c *ColorPicker) OpenPopup()
OpenPopup opens the panel below the field (above it when it doesn't fit).
func (*ColorPicker) Palette ¶
func (c *ColorPicker) Palette() []color.RGBA
func (*ColorPicker) ProcessKeyDown ¶
func (c *ColorPicker) ProcessKeyDown(key Key, mods KeyModifiers) bool
func (*ColorPicker) SetAlphaEnabled ¶
func (c *ColorPicker) SetAlphaEnabled(enabled bool)
SetAlphaEnabled lets the user choose the opacity too; the hex code then has 8 digits.
func (*ColorPicker) SetColor ¶
func (c *ColorPicker) SetColor(col color.Color)
SetColor sets the color without calling SetOnColorChanged's function. A color.RGBA is taken as it is (straight alpha); other colors are converted. Without SetAlphaEnabled the color is made opaque.
func (*ColorPicker) SetOnColorChanged ¶
func (c *ColorPicker) SetOnColorChanged(f func(col color.RGBA))
SetOnColorChanged sets the function called whenever the user changes the color, also while dragging in the panel.
func (*ColorPicker) SetPalette ¶
func (c *ColorPicker) SetPalette(colors []color.RGBA)
SetPalette sets the colors offered in the panel; nil hides the palette.
type ComboBox ¶
type ComboBox struct {
Widget
// contains filtered or unexported fields
}
func NewComboBox ¶
func NewComboBox() *ComboBox
func (*ComboBox) SelectedIndex ¶
func (*ComboBox) SelectedItemData ¶
func (c *ComboBox) SelectedItemData() interface{}
func (*ComboBox) SelectedItemText ¶
func (*ComboBox) SetItemText ¶
SetItemText changes the text of the item, e.g. for another language; the item keeps its data and the selection doesn't change.
func (*ComboBox) SetOnSelectedIndexChanged ¶
func (c *ComboBox) SetOnSelectedIndexChanged(f func())
SetOnSelectedIndexChanged sets the function called when the user picks another item.
func (*ComboBox) SetSelectedIndex ¶
SetSelectedIndex selects the item without calling the SetOnSelectedIndexChanged function.
type ComboBoxItem ¶
type ComboBoxItem struct {
// contains filtered or unexported fields
}
type ContainerGridColumnInfo ¶
type ContainerGridColumnInfo struct {
// contains filtered or unexported fields
}
type ContainerGridRowInfo ¶
type ContainerGridRowInfo struct {
// contains filtered or unexported fields
}
type ContextMenu ¶
type ContextMenu struct {
Widget
CloseEvent func()
// contains filtered or unexported fields
}
func NewContextMenu ¶
func NewContextMenu(parent Widgeter) *ContextMenu
func (*ContextMenu) AddItem ¶
func (c *ContextMenu) AddItem(text string, onClick func()) *ContextMenuItem
func (*ContextMenu) AddItemWithSubmenu ¶
func (c *ContextMenu) AddItemWithSubmenu(text string, innerMenu *ContextMenu) *ContextMenuItem
func (*ContextMenu) AddSeparator ¶
func (c *ContextMenu) AddSeparator() *ContextMenuItem
AddSeparator adds a line that separates groups of items
func (*ContextMenu) ClosePopup ¶
func (c *ContextMenu) ClosePopup()
func (*ContextMenu) OnInit ¶
func (c *ContextMenu) OnInit()
func (*ContextMenu) PopupFlipped ¶
func (c *ContextMenu) PopupFlipped() (int, int)
PopupFlipped opens a menu that doesn't fit on the screen to the left of (or above) the point it was opened at, a submenu to the left of its parent menu, and a drop-down menu above its title.
func (*ContextMenu) RemoveAllItems ¶
func (c *ContextMenu) RemoveAllItems()
func (*ContextMenu) SetOnShow ¶
func (c *ContextMenu) SetOnShow(f func())
SetOnShow sets the function called every time before the menu is shown, e.g. to hide the items that don't apply to what is selected now (ContextMenuItem.SetVisible).
func (*ContextMenu) ShowMenu ¶
func (c *ContextMenu) ShowMenu(x int, y int)
type ContextMenuItem ¶
type ContextMenuItem struct {
Widget
OnClick func()
// contains filtered or unexported fields
}
func NewContextMenuItem ¶
func NewContextMenuItem() *ContextMenuItem
func (*ContextMenuItem) ControlType ¶
func (c *ContextMenuItem) ControlType() string
func (*ContextMenuItem) Draw ¶
func (c *ContextMenuItem) Draw(ctx *Canvas)
Draw: the hovered item in the accent color, like in the combo box dropdown
func (*ContextMenuItem) Image ¶
func (c *ContextMenuItem) Image() image.Image
func (*ContextMenuItem) IsSeparator ¶
func (c *ContextMenuItem) IsSeparator() bool
IsSeparator reports whether the item is a separator line
func (*ContextMenuItem) MouseEnter ¶
func (c *ContextMenuItem) MouseEnter()
func (*ContextMenuItem) MouseLeave ¶
func (c *ContextMenuItem) MouseLeave()
func (*ContextMenuItem) MouseMove ¶
func (c *ContextMenuItem) MouseMove(x int, y int, mods KeyModifiers) bool
func (*ContextMenuItem) SetImage ¶
func (c *ContextMenuItem) SetImage(img image.Image) *ContextMenuItem
SetImage sets the icon shown left of the text; a larger image is scaled down to ContextMenuItemIconSize. nil removes the icon. Returns the item for chaining:
menu.AddItem("Edit", onEdit).SetImage(editIcon)
func (*ContextMenuItem) SetInnerMenu ¶
func (c *ContextMenuItem) SetInnerMenu(menu *ContextMenu)
func (*ContextMenuItem) SetShortcut ¶
func (c *ContextMenuItem) SetShortcut(shortcut string) *ContextMenuItem
SetShortcut sets the keys that run the item without opening the menu, shown on the item's right: "Ctrl+S", "Ctrl+Shift+Z", "F5", "Mod+S" (Cmd on macOS, Ctrl elsewhere). Works for the items of the form's main menu. Panics on a wrong shortcut (see ParseShortcut); "" removes it. Returns the item for chaining:
file.AddItem("&Save", onSave).SetShortcut("Mod+S")
func (*ContextMenuItem) SetText ¶
func (c *ContextMenuItem) SetText(text string)
SetText sets the text; "&" marks the mnemonic letter: "&Open" shows "Open" with O underlined, and O chooses the item in the open menu.
func (*ContextMenuItem) SetTextFunc ¶
func (c *ContextMenuItem) SetTextFunc(f func() string)
func (*ContextMenuItem) Shortcut ¶
func (c *ContextMenuItem) Shortcut() Shortcut
Shortcut returns the item's shortcut, zero if none
func (*ContextMenuItem) Text ¶
func (c *ContextMenuItem) Text() string
Text returns the text as shown, without the mnemonic mark
type DatePicker ¶
type DatePicker struct {
Widget
// contains filtered or unexported fields
}
DatePicker is a field showing a date; a click (or Enter, Space, F4) drops a Calendar down to choose another one. With the dropdown closed Up/Down change the date by a day, PageUp/PageDown by a month.
due := ui.NewDatePicker()
due.SetDate(time.Now().AddDate(0, 0, 7))
due.SetOnDateChanged(func(d time.Time) { task.Due = d })
func NewDatePicker ¶
func NewDatePicker() *DatePicker
func (*DatePicker) ClosePopup ¶
func (c *DatePicker) ClosePopup()
ClosePopup closes the dropdown without changing the date.
func (*DatePicker) Date ¶
func (c *DatePicker) Date() time.Time
Date returns the chosen date, at midnight local time.
func (*DatePicker) IsPopupOpen ¶
func (c *DatePicker) IsPopupOpen() bool
func (*DatePicker) OpenPopup ¶
func (c *DatePicker) OpenPopup()
OpenPopup drops the calendar down, with the keyboard focus in it.
func (*DatePicker) ProcessKeyDown ¶
func (c *DatePicker) ProcessKeyDown(key Key, mods KeyModifiers) bool
func (*DatePicker) SetDate ¶
func (c *DatePicker) SetDate(date time.Time)
SetDate sets the date (kept within the limits) without calling SetOnDateChanged's function.
func (*DatePicker) SetFormat ¶
func (c *DatePicker) SetFormat(layout string)
SetFormat sets the time.Format layout of the date shown; "" (the default) follows the language, see DefaultDateLayout.
func (*DatePicker) SetMaxDate ¶
func (c *DatePicker) SetMaxDate(date time.Time)
func (*DatePicker) SetMinDate ¶
func (c *DatePicker) SetMinDate(date time.Time)
SetMinDate and SetMaxDate limit the dates; a zero time removes the limit.
func (*DatePicker) SetOnDateChanged ¶
func (c *DatePicker) SetOnDateChanged(f func(date time.Time))
SetOnDateChanged sets the function called when the user chooses another date.
type DialogContent ¶
func (*DialogContent) InitWidget ¶
func (c *DialogContent) InitWidget()
func (*DialogContent) RunInParent ¶
func (c *DialogContent) RunInParent(f func())
RunInParent runs f after the current handler of the dialog returns, then updates the window the dialog was shown over. Use it for the dialog's result callbacks: they run once the dialog is closed, and the parent is repainted with the changes they made (see Form.Invoke). Read what f needs from the dialog's widgets before calling RunInParent.
type DragData ¶
type DragData struct {
// Text is shown next to the mouse while dragging, and may be the data
// itself
Text string
// Files are paths
Files []string
// Value is any data of the application
Value any
// Source is the widget the drag started from, nil for system files
Source Widgeter
}
DragData is what is dragged: set the fields that apply. Files are set for files dragged from the system (e.g. from the file manager).
type DrawScript ¶
func NewDrawScript ¶
func NewDrawScript() *DrawScript
func (*DrawScript) DrawToRGBA ¶
func (c *DrawScript) DrawToRGBA(img *image.RGBA, col color.Color)
type DrawScriptPoint ¶
type EditableComboBox ¶
type EditableComboBox struct {
Widget
// contains filtered or unexported fields
}
EditableComboBox is a text field with a list of suggestions: typing shows the items that contain the typed text (the ones that start with it first, the match highlighted); the arrow button or Alt+Down / F4 shows all of them. Up/Down move in the list, Enter or a click takes the item, Escape closes the list. Any text can be entered, not only an item.
city := ui.NewEditableComboBox()
city.SetItems([]string{"Amsterdam", "Berlin", "London", "Paris"})
city.SetOnItemSelected(func(index int, text string) { ... })
func NewEditableComboBox ¶
func NewEditableComboBox() *EditableComboBox
func (*EditableComboBox) AddItem ¶
func (c *EditableComboBox) AddItem(text string)
func (*EditableComboBox) Focus ¶
func (c *EditableComboBox) Focus()
func (*EditableComboBox) IsPopupOpen ¶
func (c *EditableComboBox) IsPopupOpen() bool
func (*EditableComboBox) Items ¶
func (c *EditableComboBox) Items() []string
func (*EditableComboBox) SetAutoComplete ¶
func (c *EditableComboBox) SetAutoComplete(enabled bool)
SetAutoComplete turns the suggestions while typing on (the default) or off; the arrow button still shows the list.
func (*EditableComboBox) SetEnabled ¶
func (c *EditableComboBox) SetEnabled(enabled bool)
func (*EditableComboBox) SetHint ¶
func (c *EditableComboBox) SetHint(hint string)
SetHint sets the gray text shown while the field is empty.
func (*EditableComboBox) SetItems ¶
func (c *EditableComboBox) SetItems(items []string)
SetItems sets the suggestions.
func (*EditableComboBox) SetOnAccept ¶
func (c *EditableComboBox) SetOnAccept(f func(text string))
SetOnAccept sets the function called on Enter while no suggestion is chosen.
func (*EditableComboBox) SetOnItemSelected ¶
func (c *EditableComboBox) SetOnItemSelected(f func(index int, text string))
SetOnItemSelected sets the function called when the user takes an item from the list; index is its position in Items.
func (*EditableComboBox) SetOnTextChanged ¶
func (c *EditableComboBox) SetOnTextChanged(f func())
SetOnTextChanged sets the function called when the user changes the text.
func (*EditableComboBox) SetSize ¶
func (c *EditableComboBox) SetSize(w, h int)
SetSize lays the field out next to the arrow button.
func (*EditableComboBox) SetText ¶
func (c *EditableComboBox) SetText(text string)
SetText sets the text without showing suggestions or calling SetOnTextChanged's function.
func (*EditableComboBox) Text ¶
func (c *EditableComboBox) Text() string
func (*EditableComboBox) TextBox ¶
func (c *EditableComboBox) TextBox() *TextBox
TextBox returns the field, e.g. to make it read-only or focus it.
type EventNumBoxValueChanged ¶
type EventTextboxKeyDown ¶
type EventTextboxKeyDown struct {
Key Key
Mods KeyModifiers
Processed bool
}
type Expander ¶
type Expander struct {
Widget
// contains filtered or unexported fields
}
Expander is a section with a clickable header that shows or hides its content. The content is a Panel: add the widgets to Content(), laid out on its grid as usual.
adv := ui.NewExpander("Advanced")
adv.Content().AddLabel(0, 0, "Timeout")
adv.Content().AddWidget(0, 1, timeoutBox)
A click on the header, Space or Enter toggles it; Left collapses and Right expands it.
func NewExpander ¶
func (*Expander) Content ¶
Content is the panel holding the widgets shown when the expander is expanded
func (*Expander) MaxHeight ¶
MaxHeight keeps a collapsed expander at its header's height, and an expanded one at the height of its content unless the content stretches - so extra space in the parent goes to the widgets that can use it.
func (*Expander) ProcessKeyDown ¶
func (c *Expander) ProcessKeyDown(key Key, mods KeyModifiers) bool
func (*Expander) SetExpanded ¶
SetExpanded expands or collapses the expander without calling the SetOnExpandedChanged function.
func (*Expander) SetOnExpandedChanged ¶
func (c *Expander) SetOnExpandedChanged(f func())
SetOnExpandedChanged sets the function called when the user expands or collapses the expander.
func (*Expander) SetTitleFunc ¶
type FileDialogFilter ¶
type FileDialogFilter = platforms.FileDialogFilter
type Form ¶
type Form struct {
OnClose func() bool
// contains filtered or unexported fields
}
func (*Form) AddShortcut ¶
AddShortcut runs f when the shortcut is pressed in the form, whatever widget has the focus (except the keys a focused text field uses itself, like Ctrl+C). Panics on a wrong shortcut, see ParseShortcut.
form.AddShortcut("F5", refresh)
form.AddShortcut("Mod+F", func() { search.Focus() })
func (*Form) Close ¶
func (c *Form) Close()
Close closes the window at once, without calling OnClose - the same on every platform. It may be called from any goroutine (off the UI thread it is handed over to it, see Invoke). A window that has a modal dialog open closes as soon as the dialog does. To close the window as if the user clicked its close button, so OnClose can veto it, use RequestClose.
func (*Form) CloseTopPopup ¶
func (c *Form) CloseTopPopup()
func (*Form) DrawWidgetDebugInfo ¶
func (*Form) Exec ¶
func (c *Form) Exec()
Exec waits until the form is closed. Called from the main goroutine (the UI thread), it runs the event loop of all the forms meanwhile - this is how a program runs its main form:
form.Show() form.Exec()
Called from a handler, it runs a nested event loop, so the other forms keep working. Called from another goroutine, it just waits.
func (*Form) FocusedWidget ¶
func (*Form) Hide ¶
func (c *Form) Hide()
Hide hides the form's window, taskbar button and all, until the next Show. The form stays open: Exec keeps waiting, the timers keep running. Useful with a TrayIcon, to keep the application in the tray.
func (*Form) Invoke ¶
func (c *Form) Invoke(f func())
Invoke runs f on the UI thread, then updates the form, and returns at once. Safe to call from any goroutine: it is how a background goroutine changes the widgets of the form. Called on the UI thread, f runs after the current handler. See also the package-level Invoke.
func (*Form) IsMaximized ¶
func (*Form) KeyModifiers ¶
func (c *Form) KeyModifiers() KeyModifiers
KeyModifiers returns which of Shift, Ctrl, Alt (and Cmd on macOS) are held right now - not only inside a key event. A program can show what the keys do with them, like the function key bar of a file manager that changes while Shift is held: read it in a timer. While another window or application is active nothing is held for this window. Call it on the UI thread. Before the window is shown it returns the state of the last key event.
func (*Form) LayoutingBlockPop ¶
func (c *Form) LayoutingBlockPop()
func (*Form) LayoutingBlockPush ¶
func (c *Form) LayoutingBlockPush()
func (*Form) MinSize ¶
layoutMenuBar places the menu bar at the top of the client area and the top widget in the rest of it. MinSize returns the smallest size of the client area the widgets fit in: each of them gets at least its minimum size
func (*Form) MoveToCenterOfParent ¶
func (c *Form) MoveToCenterOfParent()
MoveToCenterOfParent re-centers the window over the form it was shown modally over (see ShowModal). Useful when a dialog only knows its real size once it's building itself (e.g. from OnDialogShow, after SetSize), i.e. too late for ShowModal's own initial centering to use it. Does nothing if the form was not shown via ShowModal.
func (*Form) OpenPopup ¶
OpenPopup shows w above the form's widgets, e.g. a dropdown of your own widget. Before calling it, give w its size and its position in the form's client coordinates - RectClientAreaOnWindow tells where a widget is:
x, y := field.RectClientAreaOnWindow() picker.SetSize(200, 150) picker.SetPosition(x, y+field.Height()) form.OpenPopup(picker)
The popup is shown in its own window, so it can extend beyond the form, and is kept on the screen. Implement PopupPlacer to choose where it goes when it doesn't fit. Its children are laid out on the grid like in any panel.
The popup closes on a click outside it (see SetCloseByClickOutside), on Escape, when the form loses activation or is moved, and by CloseTopPopup.
func (*Form) ParentForm ¶
ParentForm returns the form this one was shown modally over, nil if none
func (*Form) Print ¶
Print prints the job: it shows the print dialog - the system's on Windows, nui's elsewhere, with the printers of CUPS and "Save as PDF" - and prints on the printer the user chose. onDone is called on the UI thread with nil when the job went to the printer (or the PDF is saved), ErrPrintCanceled when the user canceled, or the error.
func (*Form) RemoveShortcut ¶
RemoveShortcut removes a shortcut added by AddShortcut
func (*Form) RequestAttention ¶
func (c *Form) RequestAttention()
RequestAttention marks the window in the taskbar/dock until the user looks at it
func (*Form) RequestClose ¶
RequestClose closes the window as if the user clicked its close button: OnClose is called first and may keep the window open. Returns true if the window is closed. Call it on the UI thread (e.g. from a handler or via Invoke), like OnClose itself runs.
func (*Form) Restore ¶
func (c *Form) Restore()
Restore returns a maximized window to its normal size
func (*Form) SetAcceptButton ¶
func (*Form) SetAllowMaximize ¶
func (*Form) SetAllowMinimize ¶
func (*Form) SetAlwaysOnTop ¶
SetAlwaysOnTop keeps the window above the other windows; call it once the form is shown
func (*Form) SetCancelButton ¶
func (*Form) SetIcon ¶
SetIcon overrides the application icon (see SetAppIcon) for this form. Can be called before or after the window is shown. A nil image is ignored.
func (*Form) SetMainWidget ¶
func (*Form) SetMenuBar ¶
SetMenuBar shows the main menu at the top of the form, above Panel(). nil removes it.
func (*Form) SetOnActivated ¶
func (c *Form) SetOnActivated(f func())
SetOnActivated sets the function called when the window becomes active: shown, or the user came back to it from another window or application
func (*Form) SetOnDeactivated ¶
func (c *Form) SetOnDeactivated(f func())
SetOnDeactivated sets the function called when the window stops being active: the user switched to another window or application
func (*Form) SetOnFilesDropped ¶
SetOnFilesDropped sets the function called when files dragged from the system are dropped on the form outside every drop target that accepts them. x, y is the point in the form's client coordinates.
func (*Form) SetOnGlobalKeyDown ¶
func (c *Form) SetOnGlobalKeyDown(onGlobalKeyDown func(keyCode Key, mods KeyModifiers) bool)
func (*Form) SetOnLanguageChanged ¶
func (c *Form) SetOnLanguageChanged(f func())
SetOnLanguageChanged sets the function that updates the texts SetTextFunc doesn't cover (table headers, combo box items, texts put together...) when the language changes.
func (*Form) SetSize ¶
SetSize sets the size of the client area; it doesn't get smaller than the widgets need, see MinSize
func (*Form) SetTitleFunc ¶
SetTitleFunc makes the form's title come from f, now and on every language change.
func (*Form) Show ¶
func (c *Form) Show()
Show opens the form as a non-modal window and returns at once; a hidden form (see Hide) comes back. The window lives on the UI thread: called from another goroutine, Show opens it there and waits for it (see InvokeSync).
func (*Form) ShowContextMenu ¶
func (c *Form) ShowContextMenu(menu *ContextMenu, x int, y int)
ShowContextMenu opens a menu at (x, y) of the form's client area, from code: e.g. a list of the recent directories on a hotkey. The menu doesn't have to belong to a widget (see Widget.SetContextMenu)
func (*Form) ShowMaximized ¶
func (c *Form) ShowMaximized()
func (*Form) ShowModal ¶
ShowModal opens the form as a modal dialog over parent, which gets no input until the dialog is closed. It returns at once (on macOS, once the dialog is closed). Like Show, it opens the window on the UI thread.
func (*Form) ShowOpenFileDialog ¶
func (c *Form) ShowOpenFileDialog(opts OpenFileDialogOptions, onResult func(paths []string, err error))
ShowOpenFileDialog shows the system "Open File" dialog without blocking the form and calls onResult on the UI thread: paths is empty when the user cancelled. opts.AllowMultiple lets the user pick several files.
func (*Form) ShowSaveFileDialog ¶
func (c *Form) ShowSaveFileDialog(opts SaveFileDialogOptions, onResult func(path string, err error))
ShowSaveFileDialog shows the system "Save File" dialog without blocking the form and calls onResult on the UI thread: path is "" when the user cancelled.
func (*Form) ShowSelectDirectoryDialog ¶
func (c *Form) ShowSelectDirectoryDialog(opts SelectDirectoryDialogOptions, onResult func(path string, err error))
ShowSelectDirectoryDialog shows the system "Select Folder" dialog without blocking the form and calls onResult on the UI thread: path is "" when the user cancelled.
func (*Form) ShowToast ¶
ShowToast shows a short message in the bottom-right corner of the form for ToastDefaultDuration. A click on it closes it at once. The newest toast is at the bottom; the oldest ones go away when there are too many.
func (*Form) ShowToastFor ¶
ShowToastFor is ShowToast with the time the toast stays on the screen
func (*Form) SystemHandle ¶
func (*Form) TopPopupWidget ¶
func (*Form) UpdateBlockPop ¶
func (c *Form) UpdateBlockPop()
func (*Form) UpdateBlockPush ¶
func (c *Form) UpdateBlockPush()
func (*Form) UpdateLayout ¶
func (c *Form) UpdateLayout()
func (*Form) WidgetById ¶
type GroupBox ¶
type GroupBox struct {
Widget
// contains filtered or unexported fields
}
GroupBox is a panel framed with a title, grouping related controls. Its children are laid out on the grid like in a Panel:
group := ui.NewGroupBox("Connection")
group.AddLabel(0, 0, "Host")
group.AddWidget(0, 1, hostBox)
func NewGroupBox ¶
func (*GroupBox) SetTitleFunc ¶
type HAlign ¶
type HAlign int
const HAlignCenter HAlign = 1
const HAlignLeft HAlign = 0
const HAlignRight HAlign = 2
type ImageBox ¶
type ImageBox struct {
Widget
// contains filtered or unexported fields
}
func NewImageBox ¶
func NewImageBox() *ImageBox
func (*ImageBox) Scaling ¶
func (c *ImageBox) Scaling() ImageBoxScale
func (*ImageBox) SetScaling ¶
func (c *ImageBox) SetScaling(scaling ImageBoxScale)
type ImageBoxScale ¶
type ImageBoxScale int
const ( ImageBoxScaleNoScaleAdjustBox ImageBoxScale = 0 ImageBoxScaleNoScaleImageInLeftTop ImageBoxScale = 1 ImageBoxScaleNoScaleImageInCenter ImageBoxScale = 2 ImageBoxScaleStretchImage ImageBoxScale = 3 ImageBoxScaleAdjustImageKeepAspectRatio ImageBoxScale = 4 )
type KeyModifiers ¶
type KeyModifiers = platforms.KeyModifiers
type Label ¶
type Label struct {
Widget
}
func NewLabel ¶
////////////////////////////////////////////////////////////////////////////////// NewLabel creates a new Label widget with the specified text.
func (*Label) IsUnderline ¶
IsUnderline returns whether the Label's text is underlined.
func (*Label) ProcessPropChange ¶
/////////////////////////////////////////////////////////////////////////////// Props
func (*Label) SetTextAlign ¶
SetTextAlign sets the horizontal alignment of the Label's text.
func (*Label) SetTextFunc ¶
func (*Label) SetUnderline ¶
SetUnderline sets whether the Label's text is underlined.
type Link ¶
type Link struct {
Widget
// contains filtered or unexported fields
}
Link is a clickable text, like a hyperlink: underlined under the mouse, activated by a click, Enter or Space. It calls its function, or opens its URL in the browser when it has no function.
help := ui.NewLink("Documentation", nil)
help.SetURL("https://example.com/docs")
func (*Link) ProcessKeyDown ¶
func (c *Link) ProcessKeyDown(key Key, mods KeyModifiers) bool
func (*Link) SetOnClick ¶
func (c *Link) SetOnClick(f func())
SetOnClick sets the function called when the link is activated.
func (*Link) SetTextFunc ¶
type MenuBar ¶
type MenuBar struct {
Widget
// contains filtered or unexported fields
}
MenuBar is the main menu of a form: a row of titles at the top of the window, each opening a ContextMenu that drops down below it. Install it with Form.SetMenuBar:
bar := ui.NewMenuBar()
file := bar.AddMenu("File")
file.AddItem("Open", onOpen)
file.AddSeparator()
file.AddItem("Exit", func() { form.Close() })
form.SetMenuBar(bar)
While one of its menus is open, moving the mouse to another title opens that title's menu instead, as in the usual desktop menus.
func NewMenuBar ¶
func NewMenuBar() *MenuBar
func (*MenuBar) AddMenu ¶
func (c *MenuBar) AddMenu(text string) *ContextMenu
AddMenu adds a title and returns its menu, to be filled like any ContextMenu (items, separators, submenus, icons).
func (*MenuBar) AddMenuItem ¶
func (c *MenuBar) AddMenuItem(text string, menu *ContextMenu) *MenuBarItem
AddMenuItem adds a title that opens an existing menu. Returns the title, e.g. to give it a text that follows the language (SetTextFunc).
func (*MenuBar) Items ¶
func (c *MenuBar) Items() []*MenuBarItem
Items returns the titles of the bar.
type MenuBarItem ¶
type MenuBarItem struct {
Widget
// contains filtered or unexported fields
}
MenuBarItem is a title in a MenuBar. "&" in its text marks the mnemonic letter: "&File" opens with Alt+F, F underlined while Alt is held.
func (*MenuBarItem) Menu ¶
func (c *MenuBarItem) Menu() *ContextMenu
Menu returns the menu the title opens.
func (*MenuBarItem) SetText ¶
func (c *MenuBarItem) SetText(text string)
func (*MenuBarItem) SetTextFunc ¶
func (c *MenuBarItem) SetTextFunc(f func() string)
func (*MenuBarItem) SetVisible ¶
func (c *MenuBarItem) SetVisible(visible bool)
SetVisible hides or shows the title; the titles after it move over.
func (*MenuBarItem) Text ¶
func (c *MenuBarItem) Text() string
type MouseButton ¶
type MouseButton = platforms.MouseButton
type MouseCursor ¶
type MouseCursor = platforms.MouseCursor
func MouseCursorFromString ¶
func MouseCursorFromString(s string) MouseCursor
type NumBox ¶
type NumBox struct {
Widget
// contains filtered or unexported fields
}
NumBox is a single-line numeric input for float64 with min/max clamp, fixed decimals formatting and spin buttons (up/down).
func (*NumBox) IsCanBeFocused ¶
IsCanBeFocused: a disabled box is skipped, e.g. by Tab
func (*NumBox) MouseCursor ¶
func (c *NumBox) MouseCursor() MouseCursor
MouseCursor: no text cursor over a disabled box
func (*NumBox) ProcessPropChange ¶
func (*NumBox) SetDecimals ¶
func (*NumBox) SetOnChanged ¶
func (c *NumBox) SetOnChanged(f func())
SetOnChanged is an alias for SetOnValueChanged, kept for consistency with other controls.
func (*NumBox) SetOnValueChanged ¶
func (c *NumBox) SetOnValueChanged(f func())
type OpenFileDialogOptions ¶
type OpenFileDialogOptions = platforms.OpenFileDialogOptions
type PopupCanceler ¶
type PopupCanceler interface {
CancelPopup()
}
PopupCanceler is implemented by popup widgets that undo what was done in them when Escape closes them (a click outside keeps it), e.g. a color picker's panel returning to the color it was opened with.
type PopupPlacer ¶
type PopupPlacer interface {
// PopupFlipped returns, in the form's client coordinates, the X to use
// when the popup doesn't fit to the right and the Y to use when it
// doesn't fit below
PopupFlipped() (x, y int)
}
PopupPlacer is implemented by popup widgets (see Form.OpenPopup) that know a better position than being pushed back onto the screen when they don't fit on it.
type PrintJob ¶
type PrintJob struct {
Title string
// Pages is the number of pages; or set Paginate when it depends on the
// page size
Pages int
// Paginate returns the number of pages for the page size (e.g. how many
// pages a text takes); called before drawing them
Paginate func(width, height int, dpi float64) int
// DrawPage draws one page on the white page canvas
DrawPage func(p *PrintPage)
// Paper and Landscape are the page for SavePDF and nui's print dialog;
// with the Windows print dialog the printer's settings apply. A4 if not set.
Paper PaperSize
Landscape bool
// DPI is the resolution the pages are drawn at, DefaultPrintDPI if 0
DPI float64
}
PrintJob is a document to print or to save as PDF
func NewTextPrintJob ¶
func NewTextPrintJob(title, text string, opts *TextPrintOptions) *PrintJob
NewTextPrintJob makes a job that prints plain text: the lines are wrapped to the page width (keeping their indentation) and split into pages, with page numbers at the bottom.
form.Print(ui.NewTextPrintJob("notes.txt", text, nil), nil)
ui.NewTextPrintJob("log", logText, &ui.TextPrintOptions{FontFamily: ui.FontFamilyMono}).SavePDF("log.pdf")
type PrintPage ¶
type PrintPage struct {
Canvas *Canvas
// Index is the page's number, from 0; Count is the number of pages
Index, Count int
// Width and Height are the page size in pixels at DPI: the whole paper
// in a PDF, the printable area on a printer
Width, Height int
DPI float64
}
PrintPage is the page being drawn
type ProgressBar ¶
type ProgressBar struct {
Widget
// contains filtered or unexported fields
}
func NewProgressBar ¶
func NewProgressBar(minValue, maxValue, initValue float64) *ProgressBar
func (*ProgressBar) SetMaxValue ¶
func (c *ProgressBar) SetMaxValue(maxValue float64)
func (*ProgressBar) SetMinValue ¶
func (c *ProgressBar) SetMinValue(minValue float64)
func (*ProgressBar) SetText ¶
func (c *ProgressBar) SetText(text string)
func (*ProgressBar) SetValue ¶
func (c *ProgressBar) SetValue(value float64)
func (*ProgressBar) Text ¶
func (c *ProgressBar) Text() string
func (*ProgressBar) Value ¶
func (c *ProgressBar) Value() float64
type Property ¶
type Property struct {
// contains filtered or unexported fields
}
Property is one row of a PropertyGrid: a name and the editor of its value.
func (*Property) NotifyChanged ¶
func (p *Property) NotifyChanged()
NotifyChanged reports a change made by the user in a custom editor (see AddCustom)
func (*Property) SetDescription ¶
SetDescription sets the text shown when the mouse rests on the property
func (*Property) SetOnChanged ¶
func (p *Property) SetOnChanged(f func())
SetOnChanged sets the function called when the user changes this property
func (*Property) SetReadOnly ¶
SetReadOnly shows the value without letting the user change it
type PropertyGrid ¶
type PropertyGrid struct {
Widget
// contains filtered or unexported fields
}
PropertyGrid is a list of named values - properties - edited in place, grouped in collapsible categories. Each property has an editor for its type: a text box, a number box, a checkbox, a combo box, a color picker or a date picker, or any widget (AddCustom).
grid := ui.NewPropertyGrid()
grid.AddString("General", "Name", "Server 1")
grid.AddInt("Network", "Port", 8080, 1, 65535)
grid.AddBool("Network", "Use TLS", true)
grid.SetOnChanged(func(p *ui.Property) { fmt.Println(p.Name(), p.Value()) })
SetObject fills the grid from the exported fields of a struct and writes the edits back into it (see SetObject for the field tags).
func NewPropertyGrid ¶
func NewPropertyGrid() *PropertyGrid
func (*PropertyGrid) AddBool ¶
func (c *PropertyGrid) AddBool(category, name string, value bool) *Property
AddBool adds a yes/no property edited in a checkbox
func (*PropertyGrid) AddChoice ¶
func (c *PropertyGrid) AddChoice(category, name string, options []string, index int) *Property
AddChoice adds a property chosen from the options in a combo box. Its value is the index of the chosen option; SetValue also takes the option's text.
func (*PropertyGrid) AddColor ¶
func (c *PropertyGrid) AddColor(category, name string, value color.RGBA) *Property
AddColor adds a color property edited in a color picker
func (*PropertyGrid) AddCustom ¶
func (c *PropertyGrid) AddCustom(category, name string, editor Widgeter) *Property
AddCustom adds a property edited in any widget. Its Value is nil: read the widget itself, and call the property's NotifyChanged when it changes.
func (*PropertyGrid) AddDate ¶
func (c *PropertyGrid) AddDate(category, name string, value time.Time) *Property
AddDate adds a date property edited in a date picker
func (*PropertyGrid) AddFloat ¶
func (c *PropertyGrid) AddFloat(category, name string, value float64, decimals int) *Property
AddFloat adds a number property edited in a number box with the decimals
func (*PropertyGrid) AddInt ¶
func (c *PropertyGrid) AddInt(category, name string, value, min, max int) *Property
AddInt adds a whole number property edited in a number box, from min to max
func (*PropertyGrid) AddString ¶
func (c *PropertyGrid) AddString(category, name, value string) *Property
AddString adds a property edited in a text box
func (*PropertyGrid) Category ¶
func (c *PropertyGrid) Category(name string) *Expander
Category returns the expander of the category, nil if there is none, e.g. to collapse it
func (*PropertyGrid) Properties ¶
func (c *PropertyGrid) Properties() []*Property
Properties returns the properties in the order they were added
func (*PropertyGrid) Property ¶
func (c *PropertyGrid) Property(name string) *Property
Property returns the property with the name, nil if there is none
func (*PropertyGrid) Refresh ¶
func (c *PropertyGrid) Refresh()
Refresh shows the current values of the struct given to SetObject, after the code changed them
func (*PropertyGrid) SetObject ¶
func (c *PropertyGrid) SetObject(obj any) error
SetObject fills the grid with the exported fields of the struct obj points to, and writes the user's changes back into those fields. Supported field types: string, bool, the integer and float types, color.RGBA and time.Time. Field tags:
prop:"Display name" the name shown ("-" skips the field)
category:"Network" the category
desc:"..." the tooltip
min:"0" max:"100" the range of a number
decimals:"2" the decimals of a float
options:"Low,High" a string (or int index) chosen from the options
readonly:"true" shown but not editable
Call Refresh after changing the struct from the code.
func (*PropertyGrid) SetOnChanged ¶
func (c *PropertyGrid) SetOnChanged(f func(p *Property))
SetOnChanged sets the function called when the user changes a property
type RadioButton ¶
type RadioButton struct {
Widget
// contains filtered or unexported fields
}
func NewRadioButton ¶
func NewRadioButton(text string) *RadioButton
func (*RadioButton) Checked ¶
func (c *RadioButton) Checked() bool
func (*RadioButton) SetChecked ¶
func (c *RadioButton) SetChecked(checked bool)
func (*RadioButton) SetOnStateChanged ¶
func (c *RadioButton) SetOnStateChanged(fn func(btn *RadioButton, checked bool))
func (*RadioButton) SetText ¶
func (c *RadioButton) SetText(text string)
func (*RadioButton) SetTextFunc ¶
func (c *RadioButton) SetTextFunc(f func() string)
func (*RadioButton) Text ¶
func (c *RadioButton) Text() string
type SaveFileDialogOptions ¶
type SaveFileDialogOptions = platforms.SaveFileDialogOptions
type ScrollArea ¶
type ScrollArea struct {
Widget
}
func NewScrollArea ¶
func NewScrollArea() *ScrollArea
type SelectDirectoryDialogOptions ¶
type SelectDirectoryDialogOptions = platforms.SelectDirectoryDialogOptions
type Shortcut ¶
Shortcut is a key with modifiers, e.g. Ctrl+S. It is matched by the key's place on the keyboard, so Ctrl+S works in any keyboard layout.
func MustParseShortcut ¶
MustParseShortcut is ParseShortcut that panics on a wrong shortcut
func ParseShortcut ¶
ParseShortcut parses a shortcut like "Ctrl+S", "Ctrl+Shift+Z", "Alt+F4", "F5" or "Delete". "Mod" is Cmd on macOS and Ctrl elsewhere: "Mod+S" saves with the usual key of each system.
type Slider ¶
type Slider struct {
Widget
// contains filtered or unexported fields
}
Slider chooses a number in a range by dragging a thumb along a track. A click on the track moves the thumb there; the arrows move it by a step, PageUp/PageDown by a page, Home/End to the ends; so does the mouse wheel.
volume := ui.NewSlider()
volume.SetRange(0, 100)
volume.SetStep(1)
volume.SetOnValueChanged(func() { player.SetVolume(volume.Value()) })
func (*Slider) IsVertical ¶
func (*Slider) ProcessKeyDown ¶
func (c *Slider) ProcessKeyDown(key Key, mods KeyModifiers) bool
func (*Slider) SetOnValueChanged ¶
func (c *Slider) SetOnValueChanged(f func())
SetOnValueChanged sets the function called when the user changes the value, also while dragging.
func (*Slider) SetPageStep ¶
SetPageStep sets how far PageUp/PageDown move; 0 (the default) is 1/10 of the range.
func (*Slider) SetStep ¶
SetStep makes the value a multiple of step from the minimum; 0 (the default) allows any value, and the keys move by 1/100 of the range.
func (*Slider) SetTickInterval ¶
SetTickInterval draws a tick every interval along the track; 0 draws none.
func (*Slider) SetValue ¶
SetValue sets the value, kept in the range and on the step, without calling SetOnValueChanged's function.
func (*Slider) SetVertical ¶
SetVertical puts the track upright, the minimum at the bottom.
type Splitter ¶
type Splitter struct {
Widget
// contains filtered or unexported fields
}
Splitter shows two widgets side by side (or one above the other) with a handle between them that can be dragged to resize them.
One of the panes is "fixed": it keeps its size when the splitter is resized, the other one takes the rest. SetFirstSize makes the first pane fixed, SetSecondSize makes the second pane fixed. If one of the panes is hidden, the other one takes the whole area.
func NewHSplitter ¶
func NewHSplitter() *Splitter
NewHSplitter creates a splitter with the panes on the left and on the right
func NewVSplitter ¶
func NewVSplitter() *Splitter
NewVSplitter creates a splitter with the panes on the top and on the bottom
func (*Splitter) HandleSize ¶
func (*Splitter) IsVertical ¶
func (*Splitter) SecondSize ¶
SecondSize returns the current size of the second pane
func (*Splitter) SetFirstSize ¶
SetFirstSize sets the size of the first pane and keeps it when the splitter is resized
func (*Splitter) SetHandleSize ¶
SetHandleSize sets the thickness of the handle between the panes
func (*Splitter) SetOnSplitChanged ¶
func (c *Splitter) SetOnSplitChanged(fn func())
SetOnSplitChanged sets the callback called when the user has dragged the handle
func (*Splitter) SetSecondSize ¶
SetSecondSize sets the size of the second pane and keeps it when the splitter is resized
func (*Splitter) SetWidgets ¶
SetWidgets sets the panes: left/top and right/bottom. nil leaves the pane empty.
func (*Splitter) XExpandable ¶
The splitter always fills the space given to it
func (*Splitter) YExpandable ¶
type TabWidget ¶
type TabWidget struct {
Widget
// contains filtered or unexported fields
}
func NewTabWidget ¶
func NewTabWidget() *TabWidget
func (*TabWidget) SetLayoutXml ¶
func (*TabWidget) SetPageNameFunc ¶
SetPageNameFunc makes the name of the page come from f, now and on every language change.
type Table ¶
type Table struct {
Widget
// contains filtered or unexported fields
}
func (*Table) AddWidgetOnTable ¶
func (*Table) CancelCellEditor ¶
func (c *Table) CancelCellEditor()
CancelCellEditor closes the editor of EditCell, if one is open, as Esc does
func (*Table) CellBorderColor ¶
func (*Table) CellBorderWidth ¶
func (*Table) CellPadding ¶
func (*Table) ClearRows ¶
func (c *Table) ClearRows()
ClearRows removes all the rows, as in a new table: the cells with their text, data, images and colors, the selection and the current cell. RowCount becomes 0. An open cell editor is closed without applying it.
SetRowCount only changes how many rows are shown: the cells of the rows beyond the count are kept, and come back when the count grows again. To load other data, call ClearRows first, then fill the cells and set the count.
func (*Table) ClearSelection ¶
func (c *Table) ClearSelection()
ClearSelection removes the selection entirely: nothing is selected and CurrentRow() returns -1 until a row is clicked or navigated to again (Arrow Down / Home then start from the first row).
func (*Table) ClearSelectionOnEmptyClick ¶
func (*Table) ColumnCount ¶
func (*Table) ColumnName ¶
func (*Table) ColumnWidth ¶
func (*Table) CopySelectionToClipboard ¶
func (c *Table) CopySelectionToClipboard()
func (*Table) CurrentColumn ¶
func (*Table) CurrentRow ¶
func (*Table) EditCell ¶
func (c *Table) EditCell(row, col, colSpan int, text string, onDone func(text string, accepted bool)) *TextBox
EditCell opens a one-line editor over the cells [col, col+colSpan) of the row, with the text in it (in-place renaming of file managers). onDone gets the text: accepted is true on Enter and when the editor loses the focus, false on Esc; the cell itself is not changed. Returns the editor (to select a part of the text, for example), nil if the cell is out of the table.
func (*Table) EditCurrentCell ¶
func (*Table) GetCellData2 ¶
func (*Table) IsCellSelected ¶
IsCellSelected reports whether the given cell is selected. Only meaningful when SelectingRows() is false.
func (*Table) IsEditingCell ¶
IsEditingCell tells whether the editor of EditCell is open
func (*Table) IsRowSelected ¶
IsRowSelected reports whether the given row is selected. Only meaningful when SelectingRows() is true.
func (*Table) Multiselect ¶
func (*Table) PreviousCurrentCellX ¶
func (*Table) PreviousCurrentCellY ¶
func (*Table) ProcessKeyDown ¶
func (c *Table) ProcessKeyDown(key Key, mods KeyModifiers) bool
func (*Table) ProcessMouseDown ¶
func (c *Table) ProcessMouseDown(button MouseButton, x int, y int, mods KeyModifiers) bool
ProcessMouseDown selects the row (cell) under a right click before the context menu is shown, so the menu acts on what was clicked. An already selected row keeps the selection, so a menu over a multi-selection acts on all of it.
func (*Table) ScrollToCell2 ¶
func (*Table) SelectAll ¶
func (c *Table) SelectAll()
SelectAll selects every row (in row-selection mode) or every cell (in cell-selection mode). No-op unless multiselect is enabled.
func (*Table) SelectedCells ¶
func (c *Table) SelectedCells() []TableCellPos
SelectedCells returns the sorted list of currently selected cells. Meaningful when SelectingRows() is false.
func (*Table) SelectedRows ¶
SelectedRows returns the sorted list of currently selected row indices. Meaningful when SelectingRows() is true.
func (*Table) SelectingRows ¶
func (*Table) SetCellBorderColor ¶
func (*Table) SetCellBorderWidth ¶
func (*Table) SetCellContraction ¶
func (*Table) SetCellData2 ¶
func (*Table) SetCellDisplayText ¶
func (*Table) SetCellEditTriggerDoubleClick ¶
func (*Table) SetCellEditTriggerEnter ¶
func (*Table) SetCellEditTriggerF2 ¶
func (*Table) SetCellEditTriggerKeyDown ¶
func (*Table) SetCellImage ¶
func (*Table) SetCellOnDraw ¶
func (*Table) SetCellPadding ¶
SetCellPadding sets the space between the text of the cells (and of the header) and their edges
func (*Table) SetCellSelectionDisabled ¶
func (*Table) SetClearSelectionOnEmptyClick ¶
SetClearSelectionOnEmptyClick controls whether a plain left click on the empty area of the table (outside any cell) clears the selection (default true).
func (*Table) SetColumnCellName2 ¶
func (*Table) SetColumnCount ¶
func (*Table) SetColumnHAlign ¶
SetColumnHAlign aligns the column's header text, e.g. to the right over numbers aligned with SetCellHAlign
func (*Table) SetColumnImage ¶
func (*Table) SetColumnName ¶
func (*Table) SetColumnWidth ¶
func (*Table) SetCurrentCell2 ¶
func (*Table) SetEditTriggerDoubleClick ¶
func (*Table) SetEditTriggerEnter ¶
func (*Table) SetEditTriggerF2 ¶
func (*Table) SetEditTriggerKeyDown ¶
func (*Table) SetHeaderCellSpan2 ¶
func (*Table) SetHeaderRowCount ¶
func (*Table) SetHotTracking ¶
SetHotTracking makes the current cell follow the mouse, as in a drop-down list: the cell under the mouse is lit and the mouse is a hand over it (cells with the selection disabled are skipped)
func (*Table) SetModeLoading ¶
func (*Table) SetMultiselect ¶
SetMultiselect enables or disables selecting more than one row/cell at a time (drag, Shift+click, Ctrl+click, Ctrl+A). Disabling it collapses any existing multi-selection down to the current cell/row.
func (*Table) SetOnCellChanged ¶
func (*Table) SetOnCellMouseDblClick ¶
func (c *Table) SetOnCellMouseDblClick(callback func())
func (*Table) SetOnCellMouseDown ¶
func (c *Table) SetOnCellMouseDown(callback func(button MouseButton, row int, col int, x int, y int, mods KeyModifiers))
func (*Table) SetOnCellMouseUp ¶
func (c *Table) SetOnCellMouseUp(callback func(button MouseButton, row int, col int, x int, y int, mods KeyModifiers))
SetOnCellMouseUp is called when a mouse button is released over the table; row and col are -1 outside the cells
func (*Table) SetOnColumnClick ¶
func (*Table) SetOnColumnResize ¶
func (*Table) SetOnSelectionChanged ¶
func (*Table) SetRowCount ¶
func (*Table) SetRowHeight ¶
func (*Table) SetSelectedRows ¶
SetSelectedRows selects the rows (in row-selection mode), e.g. to keep a selection after the rows were reloaded; the first one becomes the current row. Rows out of range are skipped. Without multiselect only the first row is selected.
func (*Table) SetSelectingRows ¶
SetSelectingRows chooses the selection unit: true selects whole rows, false selects individual cells.
func (*Table) SetShowSelection ¶
func (*Table) SetStretchLastColumn ¶
SetStretchLastColumn makes the last column fill the table up to its right edge, so there is no empty strip after the columns. Its width set with SetColumnWidth stays the minimum; the table doesn't scroll to show the rest.
func (*Table) ShowSelection ¶
func (*Table) TableSetLayoutXml ¶
func (c *Table) TableSetLayoutXml(n *uiNode)
type TableCellPos ¶
TableCellPos identifies a single cell by row and column index.
type TextBox ¶
type TextBox struct {
Widget
// contains filtered or unexported fields
}
func NewTextBox ¶
func NewTextBox() *TextBox
func (*TextBox) AcceptsReturn ¶
func (*TextBox) AssemblyText ¶
func (*TextBox) KeyChar ¶
func (c *TextBox) KeyChar(ch rune, mods KeyModifiers)
func (*TextBox) KeyUp ¶
func (c *TextBox) KeyUp(key Key, mods KeyModifiers)
func (*TextBox) MouseDown ¶
func (c *TextBox) MouseDown(button MouseButton, x int, y int, mods KeyModifiers)
func (*TextBox) MouseUp ¶
func (c *TextBox) MouseUp(button MouseButton, x int, y int, mods KeyModifiers)
func (*TextBox) MoveCursorToEnd ¶
func (c *TextBox) MoveCursorToEnd()
func (*TextBox) OneLineHeight ¶
func (*TextBox) ProcessPaint ¶
ProcessPaint draws the frame on the whole widget, under the text and the scroll bars: the text is drawn in the view only and the frame doesn't scroll with it
func (*TextBox) ProcessPropChange ¶
/////////////////////////////////////////////////////////////////////////////// Props
func (*TextBox) Redo ¶
func (c *TextBox) Redo()
Redo makes the edit taken back by Undo again (Ctrl+Y, Ctrl+Shift+Z)
func (*TextBox) ScrollToBegin ¶
func (c *TextBox) ScrollToBegin()
func (*TextBox) SelectAllText ¶
func (c *TextBox) SelectAllText()
func (*TextBox) SelectRange ¶
SelectRange selects the runes [from, to) of the first line and puts the cursor at the end of the selection (as file managers select a name without its extension)
func (*TextBox) SelectedText ¶
func (*TextBox) SetHintFunc ¶
SetHintFunc makes the hint come from f, now and on every language change.
func (*TextBox) SetIsPassword ¶
func (*TextBox) SetMultiline ¶
func (*TextBox) SetOnTextBoxKeyDown ¶
func (c *TextBox) SetOnTextBoxKeyDown(onKeyDown func())
func (*TextBox) SetOnTextChanged ¶
func (c *TextBox) SetOnTextChanged(onTextChanged func())
func (*TextBox) SetReadOnly ¶
type TextBoxSelection ¶
type TextPrintOptions ¶
type TextPrintOptions struct {
FontFamily string
// FontSize in points
FontSize float64
// Margin on all the sides, in millimeters
Margin float64
// NoPageNumbers leaves out the "page / pages" line at the bottom
NoPageNumbers bool
}
TextPrintOptions set up NewTextPrintJob; the zero values give the theme font at 10 pt, 20 mm margins and page numbers
type ThemePalette ¶
type ThemePalette struct {
// Window is the background of forms and panels, WindowText the text on it
Window color.RGBA
WindowText color.RGBA
// Base is the background of input fields, lists and tables, Text the
// text in them
Base color.RGBA
Text color.RGBA
// Button is the background of buttons, combo boxes and table headers
Button color.RGBA
ButtonText color.RGBA
// Border frames the controls; Divider is a softer line inside them:
// table grid, menu separators
Border color.RGBA
Divider color.RGBA
// Highlight is the accent: focus, checked boxes, chosen items, primary
// buttons; HighlightedText is the text on it
Highlight color.RGBA
HighlightedText color.RGBA
// Selection is the background of selected text, softer than Highlight
// so the text keeps its own color
Selection color.RGBA
DisabledText color.RGBA
PlaceholderText color.RGBA
// PopupBase is the background of menus and dropdowns
PopupBase color.RGBA
ToolTipBase color.RGBA
ToolTipText color.RGBA
Link color.RGBA
Error color.RGBA
Warning color.RGBA
Success color.RGBA
}
ThemePalette is the set of colors every widget is drawn with. Each color has a role, like QPalette in Qt: widgets ask for "the background of an input field" or "the border of a control", not for a particular gray, so the light and the dark themes are just two palettes.
Hover and pressed states aren't in the palette: they are mixed from the background and the text color (see hoverColor), which works in both themes.
func CurrentPalette ¶
func CurrentPalette() *ThemePalette
CurrentPalette returns the colors of the current theme.
type TimeChart ¶
type TimeChart struct {
Widget
// contains filtered or unexported fields
}
TimeChart draws time series in one or more stacked areas.
Mouse: left drag pans horizontally, right drag to the right zooms into the dragged time range, Ctrl + right drag to the right zooms into the dragged rectangle (time and the Y range of that area). Zooms stack: each one saves the current view and right drag to the left (with or without Ctrl) goes back one level, or to the default view when there is nothing to go back to (see ZoomBack, SetDefaultTimeRange and ResetZoom). A double click also goes back one level, Esc resets the zoom and clears the stack. Shift + left drag selects a range; dragging its header moves it, dragging its edges resizes it and the close button in the header clears it. The wheel zooms time around the pointer.
func NewTimeChart ¶
func NewTimeChart() *TimeChart
func (*TimeChart) AddArea ¶
func (c *TimeChart) AddArea() *TimeChartArea
func (*TimeChart) Areas ¶
func (c *TimeChart) Areas() []*TimeChartArea
func (*TimeChart) ClearSelection ¶
func (c *TimeChart) ClearSelection()
func (*TimeChart) DefaultTimeRange ¶
func (*TimeChart) IsDefaultView ¶
IsDefaultView reports whether the chart shows the default range and follows SetDefaultTimeRange.
func (*TimeChart) ProcessMouseUp ¶
func (c *TimeChart) ProcessMouseUp(button MouseButton, x int, y int, mods KeyModifiers, onlyForWidgetId string) bool
ProcessMouseUp is overridden because the form routes onMouseUp only to the widget pressed with the left button; a right-button zoom must end here too. Every widget receives ProcessMouseUp, so the release is seen even when it happens outside the chart.
func (*TimeChart) RemoveAllAreas ¶
func (c *TimeChart) RemoveAllAreas()
func (*TimeChart) ResetTimeRange ¶
func (c *TimeChart) ResetTimeRange()
ResetTimeRange switches to the default view.
func (*TimeChart) ResetZoom ¶
func (c *TimeChart) ResetZoom()
ResetZoom returns to the default time range, auto-scales Y in every area and clears the zoom stack.
func (*TimeChart) SetDefaultTimeRange ¶
SetDefaultTimeRange sets the default range. The application owns it and may call this as often as it likes (for example on every new sample of a live feed): while the chart is in the default view the new range is shown at once; after the user has panned or zoomed it is only remembered, and returning to the default view (ResetZoom, ResetTimeRange or zooming all the way back) shows the default range as it is at that moment.
func (*TimeChart) SetOnSelectionChanged ¶
func (c *TimeChart) SetOnSelectionChanged(f func())
func (*TimeChart) SetOnTimeRangeChanged ¶
func (c *TimeChart) SetOnTimeRangeChanged(f func())
func (*TimeChart) SetSelection ¶
func (*TimeChart) SetTimeRange ¶
SetTimeRange shows the given range. The chart leaves the default view until ResetTimeRange, ResetZoom or zooming back to a level that was the default view.
type TimeChartAggregator ¶
type TimeChartAggregator struct {
// contains filtered or unexported fields
}
TimeChartAggregator merges sorted points into buckets of groupDuration one by one, the same way as TimeChartDownsample. A source with many points can feed them straight from its storage without building a slice of all of them first.
func NewTimeChartAggregator ¶
func NewTimeChartAggregator(groupDuration time.Duration, capacity int) *TimeChartAggregator
NewTimeChartAggregator creates an aggregator; capacity is a hint for the number of result points
func (*TimeChartAggregator) Add ¶
func (c *TimeChartAggregator) Add(p TimeChartPoint)
Add adds the next point; points must come sorted by DT
func (*TimeChartAggregator) Points ¶
func (c *TimeChartAggregator) Points() []TimeChartPoint
Points returns the aggregated points
type TimeChartArea ¶
type TimeChartArea struct {
// contains filtered or unexported fields
}
TimeChartArea is one horizontal band of the chart with its own Y axis. All areas share the time axis.
func (*TimeChartArea) AddMarker ¶
func (c *TimeChartArea) AddMarker(m TimeChartMarker)
AddMarker adds a marker to the area. Markers may be added in any order.
func (*TimeChartArea) AddSeries ¶
func (c *TimeChartArea) AddSeries(name string, source TimeChartDataSource) *TimeChartSeries
func (*TimeChartArea) ClearMarkers ¶
func (c *TimeChartArea) ClearMarkers()
func (*TimeChartArea) Markers ¶
func (c *TimeChartArea) Markers() []TimeChartMarker
func (*TimeChartArea) ResetYRange ¶
func (c *TimeChartArea) ResetYRange()
ResetYRange returns the area to auto-scaling over the visible data.
func (*TimeChartArea) Series ¶
func (c *TimeChartArea) Series() []*TimeChartSeries
func (*TimeChartArea) SetMarkers ¶
func (c *TimeChartArea) SetMarkers(markers []TimeChartMarker)
SetMarkers replaces all markers of the area.
func (*TimeChartArea) SetYRange ¶
func (c *TimeChartArea) SetYRange(yMin, yMax float64)
func (*TimeChartArea) YRange ¶
func (c *TimeChartArea) YRange() (yMin, yMax float64, ok bool)
YRange returns the manual Y range; ok is false while the area auto-scales.
type TimeChartDataSource ¶
type TimeChartDataSource interface {
GetData(from, to time.Time, groupDuration time.Duration) []TimeChartPoint
}
TimeChartDataSource supplies the points of a series.
GetData is called on every paint for the visible range [from, to]. groupDuration is the time covered by one screen pixel: the source should aggregate its data into buckets of that size (see TimeChartDownsample) so that no more than about one point per pixel is returned. Points must be sorted by DT. Returning the nearest point on each side outside the range lets the line continue to the edges of the plot.
A source that loads data asynchronously should return what it has now and call Form().Update() on the chart when more data arrives.
type TimeChartMarker ¶
TimeChartMarker is a text note pinned to a point of an area: DT on the time axis and Value on the area's Y axis (for example the top of a peak). A nil Color uses the theme's marker color.
type TimeChartMemorySource ¶
type TimeChartMemorySource struct {
// contains filtered or unexported fields
}
TimeChartMemorySource is a TimeChartDataSource over an in-memory slice of points sorted by DT. It is safe to add points from another goroutine.
func NewTimeChartMemorySource ¶
func NewTimeChartMemorySource() *TimeChartMemorySource
func (*TimeChartMemorySource) AddPoint ¶
func (c *TimeChartMemorySource) AddPoint(p TimeChartPoint)
AddPoint appends a point. Its DT must not be earlier than the last one.
func (*TimeChartMemorySource) GetData ¶
func (c *TimeChartMemorySource) GetData(from, to time.Time, groupDuration time.Duration) []TimeChartPoint
func (*TimeChartMemorySource) SetPoints ¶
func (c *TimeChartMemorySource) SetPoints(points []TimeChartPoint)
SetPoints replaces the data. The points must be sorted by DT.
type TimeChartPoint ¶
type TimeChartPoint struct {
DT time.Time
First float64
Last float64
High float64
Low float64
HasGood bool
HasBad bool
}
TimeChartPoint is one sample (or one aggregated bucket) of a time series. For a raw sample all four values are equal. For a downsampled bucket First/Last are the first and last values in the bucket and High/Low are its extremes, so a signal that jitters inside a bucket is still drawn as a vertical band instead of collapsing into a flat average. The same shape is an OHLC bar, so trading charts use it directly.
HasGood and HasBad describe data quality: HasBad means the point (or some sample in the bucket) is bad - e.g. the sensor was disconnected - and HasGood means at least one sample carries a valid value. First/Last/High/ Low only describe the good samples. A point without HasGood has no value: the line breaks there. Bad spans are drawn as a light reddish hatch. A point with neither flag is a gap - no data at all, e.g. the acquisition was stopped: the line breaks without the hatch.
func NewTimeChartBad ¶
func NewTimeChartBad(dt time.Time) TimeChartPoint
NewTimeChartBad returns a point with no value, marking bad quality at dt.
func NewTimeChartGap ¶
func NewTimeChartGap(dt time.Time) TimeChartPoint
NewTimeChartGap returns a point that breaks the line at dt without marking bad quality - e.g. where data acquisition was stopped or started.
func NewTimeChartValue ¶
func NewTimeChartValue(dt time.Time, value float64) TimeChartPoint
func TimeChartDownsample ¶
func TimeChartDownsample(points []TimeChartPoint, from, to time.Time, groupDuration time.Duration) []TimeChartPoint
TimeChartDownsample returns the points of the sorted slice that fall into [from, to], plus the nearest point on each side, merged into buckets of groupDuration: First/Last of a bucket come from its first and last good point, High/Low are the extremes of the good points, HasGood is set when the bucket has any good point and HasBad when it has any bad one - so a short outage stays visible however far the chart is zoomed out. Gap points (neither flag) are never merged: each one is kept as a separate point and closes the current bucket, so a break stays visible at any zoom. Buckets are aligned to multiples of groupDuration since the Unix epoch, so panning does not change how points are grouped. It is the same aggregation a server should do before sending data to the chart.
func (TimeChartPoint) HasValue ¶
func (p TimeChartPoint) HasValue() bool
HasValue reports whether First/Last/High/Low are meaningful.
func (TimeChartPoint) IsGap ¶
func (p TimeChartPoint) IsGap() bool
IsGap reports whether the point marks a break in the data.
type TimeChartSeries ¶
type TimeChartSeries struct {
// contains filtered or unexported fields
}
func (*TimeChartSeries) Name ¶
func (c *TimeChartSeries) Name() string
func (*TimeChartSeries) SetColor ¶
func (c *TimeChartSeries) SetColor(col color.Color)
SetColor fixes the series color regardless of the theme.
func (*TimeChartSeries) SetPaletteColor ¶
func (c *TimeChartSeries) SetPaletteColor(index int)
SetPaletteColor uses color number index of the chart palette, which has a dark and a light variant, so the series stays readable in both themes.
func (*TimeChartSeries) SetType ¶
func (c *TimeChartSeries) SetType(seriesType TimeChartSeriesType)
func (*TimeChartSeries) Source ¶
func (c *TimeChartSeries) Source() TimeChartDataSource
type TimeChartSeriesType ¶
type TimeChartSeriesType int
const ( TimeChartSeriesLine TimeChartSeriesType = iota TimeChartSeriesCandles )
type TimePicker ¶
type TimePicker struct {
Widget
// contains filtered or unexported fields
}
TimePicker edits a time of day, 24-hour, in segments: HH:MM or HH:MM:SS. Left/Right (or a click) choose the segment, Up/Down and the mouse wheel change it, digits type it (two digits, or one that can't start a two-digit value, move to the next segment); the arrows at the right change the segment too.
start := ui.NewTimePicker()
start.SetTime(9, 30, 0)
start.SetOnTimeChanged(func() { meeting.Start = start.Duration() })
func NewTimePicker ¶
func NewTimePicker() *TimePicker
func (*TimePicker) Duration ¶
func (c *TimePicker) Duration() time.Duration
Duration returns the time as the time since midnight.
func (*TimePicker) Hour ¶
func (c *TimePicker) Hour() int
func (*TimePicker) Minute ¶
func (c *TimePicker) Minute() int
func (*TimePicker) ProcessKeyDown ¶
func (c *TimePicker) ProcessKeyDown(key Key, mods KeyModifiers) bool
func (*TimePicker) Second ¶
func (c *TimePicker) Second() int
func (*TimePicker) SetDuration ¶
func (c *TimePicker) SetDuration(d time.Duration)
SetDuration sets the time from the time since midnight.
func (*TimePicker) SetOnTimeChanged ¶
func (c *TimePicker) SetOnTimeChanged(f func())
SetOnTimeChanged sets the function called when the user changes the time.
func (*TimePicker) SetShowSeconds ¶
func (c *TimePicker) SetShowSeconds(show bool)
SetShowSeconds adds the seconds segment.
func (*TimePicker) SetTime ¶
func (c *TimePicker) SetTime(hour, minute, second int)
SetTime sets the time without calling SetOnTimeChanged's function; the values are kept in their ranges.
func (*TimePicker) Text ¶
func (c *TimePicker) Text() string
Text returns the time as shown: "09:30" or "09:30:00".
type ToggleSwitch ¶
type ToggleSwitch struct {
Widget
// contains filtered or unexported fields
}
ToggleSwitch is an on/off switch with a text, for settings that apply at once: a click, Space or Enter flips it. The knob slides to its new side.
wifi := ui.NewToggleSwitch("Wi-Fi")
wifi.SetOnStateChanged(func() { network.SetWifi(wifi.Checked()) })
func NewToggleSwitch ¶
func NewToggleSwitch(text string) *ToggleSwitch
func (*ToggleSwitch) Checked ¶
func (c *ToggleSwitch) Checked() bool
func (*ToggleSwitch) ProcessKeyDown ¶
func (c *ToggleSwitch) ProcessKeyDown(key Key, mods KeyModifiers) bool
func (*ToggleSwitch) SetChecked ¶
func (c *ToggleSwitch) SetChecked(checked bool)
SetChecked sets the state without calling SetOnStateChanged's function and without the animation.
func (*ToggleSwitch) SetOnStateChanged ¶
func (c *ToggleSwitch) SetOnStateChanged(f func())
SetOnStateChanged sets the function called when the user flips the switch.
func (*ToggleSwitch) SetText ¶
func (c *ToggleSwitch) SetText(text string)
func (*ToggleSwitch) SetTextFunc ¶
func (c *ToggleSwitch) SetTextFunc(f func() string)
func (*ToggleSwitch) Text ¶
func (c *ToggleSwitch) Text() string
type ToolButton ¶
type ToolButton struct {
ButtonImage
// contains filtered or unexported fields
}
ToolButton is a fixed-size image button for toolbars.
On top of ButtonImage it has:
- a disabled state: a grayed-out copy of the image is shown and clicks are ignored;
- a checked state for toggles: a lighter background and a bright bar along the bottom;
- a lighter bottom edge, so the buttons stand out from the toolbar;
- a flat look (SetFlat): just the image, without the box.
func NewToolButton ¶
func NewToolButton(img image.Image, tooltip string, onClick func()) *ToolButton
NewToolButton creates a ToolButtonDefaultSize square button with the image (drawn centered, as is) and the tooltip. onClick may be nil.
func (*ToolButton) IsChecked ¶
func (c *ToolButton) IsChecked() bool
func (*ToolButton) IsFlat ¶
func (c *ToolButton) IsFlat() bool
func (*ToolButton) SetButtonSize ¶
func (c *ToolButton) SetButtonSize(width, height int)
SetButtonSize fixes the size of the button, e.g. to make the main action wider
func (*ToolButton) SetChecked ¶
func (c *ToolButton) SetChecked(checked bool)
SetChecked shows the button as toggled on: a lighter background and a bar along the bottom edge. The button does not toggle itself on click.
func (*ToolButton) SetEnabled ¶
func (c *ToolButton) SetEnabled(enabled bool)
func (*ToolButton) SetFlat ¶
func (c *ToolButton) SetFlat(flat bool)
SetFlat draws the button without its box: just the image, on a soft rounded background while the mouse is over it, it is pressed or checked. A row of flat buttons makes a light toolbar.
func (*ToolButton) SetHighlight ¶
func (c *ToolButton) SetHighlight(col color.Color)
SetHighlight draws the bottom bar in the color to draw attention to the button, e.g. the action to start with. nil returns the usual look.
func (*ToolButton) SetImage ¶
func (c *ToolButton) SetImage(img image.Image)
SetImage sets the image; the disabled look is derived from it
func (*ToolButton) SetOnClick ¶
func (c *ToolButton) SetOnClick(onClick func())
SetOnClick sets the function called when the enabled button is clicked
type TrayIcon ¶
type TrayIcon struct {
// contains filtered or unexported fields
}
TrayIcon is an icon in the system tray: the notification area on Windows and Linux, the menu bar on macOS. It has a tooltip, a menu (a right click; on macOS any click) and a left-click action, and can show system notifications. Its callbacks run on the UI thread, like all the handlers; the application must be running a form's Exec.
tray, err := ui.NewTrayIcon()
if err == nil {
tray.SetIcon(icon)
tray.SetTooltip("My app")
tray.SetOnClick(func() { form.Show() })
tray.SetMenu(
ui.TrayMenuItem{Text: "Open", OnClick: func() { form.Show() }},
ui.TrayMenuItem{Separator: true},
ui.TrayMenuItem{Text: "Quit", OnClick: func() { form.Close() }},
)
}
To keep the application in the tray when its window is closed, hide the form instead: form.OnClose = func() bool { form.Hide(); return false }
func NewTrayIcon ¶
NewTrayIcon puts an icon in the system tray. Set its image with SetIcon: until then, it shows the application icon (see SetAppIcon) if there is one.
func (*TrayIcon) SetMenu ¶
func (t *TrayIcon) SetMenu(items ...TrayMenuItem)
SetMenu sets the menu of the icon; call it again to change the items, e.g. the state of a checkable one
func (*TrayIcon) SetOnClick ¶
func (t *TrayIcon) SetOnClick(f func())
SetOnClick sets the function called on a left click on the icon (on macOS, only when the icon has no menu)
func (*TrayIcon) SetTooltip ¶
func (*TrayIcon) ShowNotification ¶
ShowNotification shows a system notification (a balloon on Windows, a desktop notification on Linux)
type TrayMenuItem ¶
type TrayMenuItem = platforms.TrayMenuItem
TrayMenuItem is an item of the tray icon's menu: a text with OnClick, a Separator, a Checkable item, or a submenu (Items).
type TreeNode ¶
type TreeNode struct {
// contains filtered or unexported fields
}
TreeNode is a row of a TreeView: texts per column, an icon, children.
func (*TreeNode) ChildCount ¶
func (*TreeNode) Expand ¶
func (n *TreeNode) Expand()
Expand shows the children, calling the tree's SetOnExpand function first.
func (*TreeNode) ExpandAll ¶
func (n *TreeNode) ExpandAll()
ExpandAll expands the node (loading its children, see TreeView.SetOnExpand) and the nodes below it that have children; nodes below whose children aren't loaded yet stay collapsed.
func (*TreeNode) HasChildren ¶
HasChildren reports whether the node has children or is marked with SetHasChildren.
func (*TreeNode) InsertChild ¶
InsertChild adds a child at the index among the children.
func (*TreeNode) IsExpanded ¶
func (*TreeNode) IsReadOnly ¶
func (*TreeNode) Remove ¶
func (n *TreeNode) Remove()
Remove removes the node with its children from the tree.
func (*TreeNode) RemoveChildren ¶
func (n *TreeNode) RemoveChildren()
RemoveChildren removes all the children.
func (*TreeNode) SetColor ¶
SetColor sets the color of the node's texts; nil returns to the default.
func (*TreeNode) SetExpanded ¶
SetExpanded expands or collapses the node.
func (*TreeNode) SetHasChildren ¶
SetHasChildren shows the expand arrow before the children are added, for children loaded in TreeView.SetOnExpand.
func (*TreeNode) SetImage ¶
SetImage sets the icon shown before the text; a larger image is scaled down to TreeViewIconSize. nil removes it. Returns the node for chaining.
func (*TreeNode) SetReadOnly ¶
SetReadOnly excludes the node's cell in the column from editing.
func (*TreeNode) SetTextFunc ¶
SetTextFunc makes the column's text come from f, now and on every language change.
type TreeView ¶
type TreeView struct {
Widget
// contains filtered or unexported fields
}
TreeView shows a hierarchy of nodes in rows, with columns: the first column holds the tree (indentation, expand arrow, icon, text), the other columns hold more texts of the node - like a file manager's detail view.
tree := ui.NewTreeView()
tree.SetColumnCount(2)
tree.SetColumnName(0, "Name")
tree.SetColumnName(1, "Size")
docs := tree.AddNode(nil, "Documents")
docs.AddChild("report.txt").SetText(1, "12 KB")
docs.Expand()
Selection, keyboard navigation and editing work like in Table: see SetMultiselect, SetEditTriggerF2 and SetOnCellChanged.
func NewTreeView ¶
func NewTreeView() *TreeView
func (*TreeView) AddNode ¶
AddNode adds a node with the text in the first column at the end of parent's children, or of the top-level nodes when parent is nil.
func (*TreeView) CancelEdit ¶
func (c *TreeView) CancelEdit()
CancelEdit closes the editor keeping the cell's text.
func (*TreeView) ColumnCount ¶
func (*TreeView) ColumnName ¶
func (*TreeView) ColumnWidth ¶
ColumnWidth returns the width set for the column; the last column may be shown wider, see SetStretchLastColumn.
func (*TreeView) CommitEdit ¶
func (c *TreeView) CommitEdit()
CommitEdit applies the editor's text (unless SetOnCellChanged rejects it) and closes the editor.
func (*TreeView) CopySelectionToClipboard ¶
func (c *TreeView) CopySelectionToClipboard()
CopySelectionToClipboard copies the selected nodes, one per line, their columns separated by tabs (Ctrl+C).
func (*TreeView) CurrentColumn ¶
CurrentColumn returns the column that editing starts in: the one clicked last, or moved to with Ctrl+Left/Right.
func (*TreeView) CurrentNode ¶
CurrentNode returns the node with the keyboard focus, nil if none.
func (*TreeView) EditCell ¶
EditCell opens the editor on the cell, see EditCurrentCell. Does nothing for a cell that isn't editable (IsCellEditable).
func (*TreeView) EditCurrentCell ¶
EditCurrentCell opens the editor on the current node's current column. With enteredText empty the editor starts from the cell's text, all selected; otherwise it starts from enteredText.
func (*TreeView) ExpandAll ¶
func (c *TreeView) ExpandAll()
ExpandAll expands every node that has children. Nodes whose children aren't loaded yet (SetHasChildren) stay collapsed: loading them could never end, e.g. for a tree of folders.
func (*TreeView) HeaderVisible ¶
func (*TreeView) InnerHeight ¶
func (*TreeView) InsertNode ¶
InsertNode adds a node at the index among parent's children (the top-level nodes when parent is nil).
func (*TreeView) IsCellEditable ¶
IsCellEditable reports whether the cell can be edited: its column and node aren't read-only.
func (*TreeView) IsNodeSelected ¶
func (*TreeView) Multiselect ¶
func (*TreeView) ProcessKeyDown ¶
func (c *TreeView) ProcessKeyDown(key Key, mods KeyModifiers) bool
func (*TreeView) ProcessMouseDown ¶
func (c *TreeView) ProcessMouseDown(button MouseButton, x int, y int, mods KeyModifiers) bool
ProcessMouseDown handles the right click before a context menu opens, so the menu acts on the node under the mouse.
func (*TreeView) ProcessMouseWheel ¶
func (*TreeView) ProcessPaint ¶
ProcessPaint brings the rows up to date before the content and the scroll bars are drawn.
func (*TreeView) RemoveNode ¶
RemoveNode removes the node with all its children.
func (*TreeView) ScrollToNode ¶
ScrollToNode expands the node's parents and scrolls the node into view.
func (*TreeView) SelectAll ¶
func (c *TreeView) SelectAll()
SelectAll selects all the shown nodes; only with multiselect.
func (*TreeView) SelectedNodes ¶
SelectedNodes returns the selected nodes, top to bottom.
func (*TreeView) SetColumnCount ¶
func (*TreeView) SetColumnName ¶
SetColumnName sets the header text of the column.
func (*TreeView) SetColumnNameFunc ¶
SetColumnNameFunc makes the header text come from f, now and on every language change.
func (*TreeView) SetColumnReadOnly ¶
SetColumnReadOnly excludes the column from editing, whatever the edit triggers are; see also TreeNode.SetReadOnly.
func (*TreeView) SetColumnWidth ¶
func (*TreeView) SetCurrentColumn ¶
SetCurrentColumn sets the column editing starts in.
func (*TreeView) SetCurrentNode ¶
SetCurrentNode makes the node current and the only selected one, expanding its parents and scrolling it into view. nil clears the selection.
func (*TreeView) SetEditTriggerDoubleClick ¶
func (*TreeView) SetEditTriggerEnter ¶
func (*TreeView) SetEditTriggerF2 ¶
func (*TreeView) SetEditTriggerKeyDown ¶
SetEditTriggerKeyDown starts editing when a letter is typed, replacing the text; without it typing jumps to the next node starting with the typed letters.
func (*TreeView) SetGridLines ¶
SetGridLines draws lines between the rows and columns.
func (*TreeView) SetHeaderVisible ¶
SetHeaderVisible shows or hides the row of column names.
func (*TreeView) SetIndent ¶
SetIndent sets how far each level is shifted to the right; 0 (the default) follows the row height.
func (*TreeView) SetMultiselect ¶
SetMultiselect allows selecting several nodes: Shift+click and Shift+arrows select a range, Ctrl+click and Ctrl+Space toggle a node, Ctrl+A selects all shown nodes. Turning it off keeps only the current node.
func (*TreeView) SetOnCellChanged ¶
SetOnCellChanged sets the function called when an edit is committed, with the new text; returning false rejects it.
func (*TreeView) SetOnCollapse ¶
SetOnCollapse sets the function called after a node collapses.
func (*TreeView) SetOnColumnClick ¶
func (*TreeView) SetOnColumnResize ¶
func (*TreeView) SetOnExpand ¶
SetOnExpand sets the function called before a node expands. Children can be added there, e.g. to load a folder only when it's opened; mark such nodes with SetHasChildren so they show the expand arrow.
func (*TreeView) SetOnNodeActivated ¶
SetOnNodeActivated sets the function called on a double click on a node or Enter, when they don't start editing.
func (*TreeView) SetOnSelectionChanged ¶
SetOnSelectionChanged sets the function called when the current node or the set of selected nodes changes.
func (*TreeView) SetRowHeight ¶
func (*TreeView) SetScrollX ¶
func (*TreeView) SetScrollY ¶
func (*TreeView) SetSelectedNodes ¶
SetSelectedNodes selects the nodes (all of them with multiselect, else the first); the first one becomes current.
func (*TreeView) SetStretchLastColumn ¶
SetStretchLastColumn makes the last column fill the width left by the other columns (the default).
type UIStrings ¶
type UIStrings struct {
OK string
Cancel string
Yes string
No string
// Calendar, DatePicker
Today string
// MonthNames in the nominative case: January...December
MonthNames [12]string
// WeekdaysShort are two- or three-letter names, Sunday first (as time.Weekday)
WeekdaysShort [7]string
// The print dialog (Form.Print on Linux and macOS)
Print, Printer, Copies, Pages, PagesHint, Paper string
Portrait, Landscape, SaveAsPDF string
}
UIStrings are the texts of the library's own widgets, e.g. the buttons of message boxes. English, Russian and Chinese are built in; an application adds other languages with RegisterUIStrings.
type VAlign ¶
type VAlign int
const VAlignBottom VAlign = 2
const VAlignCenter VAlign = 1
const VAlignTop VAlign = 0
type Widget ¶
type Widget struct {
PopupWidgets []Widgeter
// contains filtered or unexported fields
}
func (*Widget) AllChildren ¶
func (*Widget) AppendPopupWidget ¶
func (*Widget) BackgroundColor ¶
func (*Widget) BackgroundColorForRole ¶
func (*Widget) BackgroundColorWithAddElevation ¶
func (*Widget) ClearFocus ¶
func (c *Widget) ClearFocus()
func (*Widget) ClearLayoutCache ¶
func (c *Widget) ClearLayoutCache()
func (*Widget) CloseAfterPopupWidget ¶
func (*Widget) CloseAllPopup ¶
func (c *Widget) CloseAllPopup()
func (*Widget) CloseByClickOutside ¶
func (*Widget) CloseTopPopup ¶
func (c *Widget) CloseTopPopup()
func (*Widget) ContextMenu ¶
func (c *Widget) ContextMenu() *ContextMenu
func (*Widget) CurrentElevation ¶
func (*Widget) FindWidgetByName ¶
func (*Widget) FontFamily ¶
func (*Widget) ForegroundColor ¶
func (*Widget) ForegroundColorDisabled ¶
func (*Widget) GetPropColor ¶
func (*Widget) GetPropFloat64 ¶
func (*Widget) GetPropFunction ¶
func (*Widget) GetPropString ¶
func (*Widget) InitWidget ¶
func (c *Widget) InitWidget()
func (*Widget) InnerHeight ¶
func (*Widget) InnerWidth ¶
func (*Widget) IsCanBeFocused ¶
func (*Widget) IsRolePrimary ¶
func (*Widget) IsRoleSecondary ¶
func (*Widget) IsRoleSurface ¶
func (*Widget) MouseCursor ¶
func (c *Widget) MouseCursor() MouseCursor
func (*Widget) NextGridColumn ¶
func (*Widget) NextGridRow ¶
func (*Widget) ParentWidget ¶
func (*Widget) ParentWidgetId ¶
func (*Widget) ProcessChar ¶
func (c *Widget) ProcessChar(char rune, mods KeyModifiers) bool
func (*Widget) ProcessClosePopup ¶
func (c *Widget) ProcessClosePopup()
func (*Widget) ProcessFocusLost ¶
func (c *Widget) ProcessFocusLost()
func (*Widget) ProcessFocused ¶
func (c *Widget) ProcessFocused()
func (*Widget) ProcessKeyDown ¶
func (c *Widget) ProcessKeyDown(key Key, mods KeyModifiers) bool
func (*Widget) ProcessKeyUp ¶
func (c *Widget) ProcessKeyUp(key Key, mods KeyModifiers) bool
func (*Widget) ProcessMouseDblClick ¶
func (c *Widget) ProcessMouseDblClick(button MouseButton, x int, y int, mods KeyModifiers) bool
func (*Widget) ProcessMouseDown ¶
func (c *Widget) ProcessMouseDown(button MouseButton, x int, y int, mods KeyModifiers) bool
func (*Widget) ProcessMouseEnter ¶
func (*Widget) ProcessMouseLeave ¶
func (*Widget) ProcessMouseMove ¶
func (c *Widget) ProcessMouseMove(x int, y int, mods KeyModifiers) bool
func (*Widget) ProcessMouseUp ¶
func (c *Widget) ProcessMouseUp(button MouseButton, x int, y int, mods KeyModifiers, onlyForWidgetId string) bool
func (*Widget) ProcessMouseWheel ¶
func (*Widget) ProcessPaint ¶
func (*Widget) ProcessPropChange ¶
func (*Widget) ProcessTimer ¶
func (c *Widget) ProcessTimer()
func (*Widget) RectClientAreaOnWindow ¶
func (*Widget) RemoveAllWidgets ¶
func (c *Widget) RemoveAllWidgets()
func (*Widget) RemoveWidget ¶
func (*Widget) ScrollEnsureVisible ¶
ScrollEnsureVisible scrolls the content so the point (x1, y1) of it is in the view
func (*Widget) SetAbsolutePositioning ¶
func (*Widget) SetAllowScroll ¶
func (*Widget) SetAnchors ¶
func (*Widget) SetAutoFillBackground ¶
func (*Widget) SetBackgroundColor ¶
func (*Widget) SetCanBeFocused ¶
func (*Widget) SetCellPadding ¶
func (*Widget) SetCloseByClickOutside ¶
func (*Widget) SetContextMenu ¶
func (c *Widget) SetContextMenu(menu *ContextMenu)
func (*Widget) SetDragSource ¶
SetDragSource makes the widget a place to drag data from. When the user presses the left button on it and moves the mouse, f is called with the point the drag started at, in the widget's coordinates; it returns what is dragged, or nil for no drag there (e.g. outside the selected rows).
func (*Widget) SetDropTarget ¶
func (c *Widget) SetDropTarget(accept func(data *DragData, x, y int) bool, drop func(data *DragData, x, y int))
SetDropTarget makes the widget a place to drop data on. While data is dragged over the widget, accept tells whether it can be dropped at (x, y), in the widget's coordinates; the widget is highlighted when it can. drop is called when the data is dropped there. A nil accept accepts everything. Files dragged from the system come to drop targets too (DragData.Files).
func (*Widget) SetElevation ¶
func (*Widget) SetEnabled ¶
func (*Widget) SetFontFamily ¶
SetFontFamily sets the font of the widget, e.g. FontFamilyMono; an empty family returns the theme font.
func (*Widget) SetFontSize ¶
func (*Widget) SetForegroundColor ¶
func (*Widget) SetGridPosition ¶
func (*Widget) SetInnerSize ¶
func (*Widget) SetMaxHeight ¶
func (*Widget) SetMaxSize ¶
func (*Widget) SetMaxWidth ¶
func (*Widget) SetMinHeight ¶
func (*Widget) SetMinSize ¶
func (*Widget) SetMinWidth ¶
func (*Widget) SetMouseCursor ¶
func (c *Widget) SetMouseCursor(cursor MouseCursor)
func (*Widget) SetOnClick ¶
func (c *Widget) SetOnClick(f func())
func (*Widget) SetOnFocusLost ¶
func (c *Widget) SetOnFocusLost(onFocusLost func())
func (*Widget) SetOnFocused ¶
func (c *Widget) SetOnFocused(onFocused func())
func (*Widget) SetOnKeyDown ¶
func (c *Widget) SetOnKeyDown(f func(key Key, mods KeyModifiers) bool)
func (*Widget) SetOnKeyUp ¶
func (c *Widget) SetOnKeyUp(f func(key Key, mods KeyModifiers) bool)
func (*Widget) SetOnMouseDblClick ¶
func (c *Widget) SetOnMouseDblClick(f func(button MouseButton, x int, y int, mods KeyModifiers) bool)
func (*Widget) SetOnMouseDown ¶
func (c *Widget) SetOnMouseDown(f func(button MouseButton, x int, y int, mods KeyModifiers) bool)
func (*Widget) SetOnMouseEnter ¶
func (c *Widget) SetOnMouseEnter(f func())
func (*Widget) SetOnMouseLeave ¶
func (c *Widget) SetOnMouseLeave(f func())
func (*Widget) SetOnMouseMove ¶
func (c *Widget) SetOnMouseMove(f func(x int, y int, mods KeyModifiers) bool)
func (*Widget) SetOnMouseUp ¶
func (c *Widget) SetOnMouseUp(f func(button MouseButton, x int, y int, mods KeyModifiers) bool)
func (*Widget) SetOnMouseWheel ¶
func (*Widget) SetOnPaint ¶
func (*Widget) SetOnPostPaint ¶
func (*Widget) SetOnScrollChanged ¶
func (*Widget) SetPanelPadding ¶
func (*Widget) SetParentWidgetId ¶
func (*Widget) SetPosition ¶
func (*Widget) SetPropFunction ¶
func (*Widget) SetScrollX ¶
SetScrollX scrolls the content horizontally to scrollX, kept within the content
func (*Widget) SetScrollY ¶
SetScrollY scrolls the content vertically to scrollY, kept within the content
func (*Widget) SetTooltip ¶
SetTooltip sets the text shown when the mouse rests on the widget. An empty string disables the tooltip.
func (*Widget) SetTooltipFunc ¶
SetTooltipFunc makes the tooltip come from f, now and on every language change.
func (*Widget) SetTypeName ¶
func (*Widget) SetVisible ¶
func (*Widget) SetXExpandable ¶
func (*Widget) SetYExpandable ¶
func (*Widget) ShowDialog ¶
func (*Widget) ViewportHeight ¶
ViewportHeight is the height of the visible content area: the widget's height without the horizontal scroll bar
func (*Widget) ViewportWidth ¶
ViewportWidth is the width of the visible content area: the widget's width without the vertical scroll bar
func (*Widget) XExpandable ¶
func (*Widget) YExpandable ¶
type Widgeter ¶
type Widgeter interface {
Id() string
ParentWidgetId() string
SetParentWidgetId(id string)
FullPath() []string
TypeName() string
Name() string
X() int
Y() int
Width() int
Height() int
InnerWidth() int
InnerHeight() int
Form() *Form
SetProp(key string, value interface{})
SetPropFunction(key string, f func())
GetProp(key string) interface{}
GetPropString(key string, defaultValue string) string
GetPropInt(key string, defaultValue int) int
GetPropBool(key string, defaultValue bool) bool
GetPropFloat64(key string, defaultValue float64) float64
SetCloseByClickOutside(close bool)
CloseByClickOutside() bool
Widgets() []Widgeter
Elevation() int
SetRole(role string)
Role() string
FindWidgetByName(name string) Widgeter
Enabled() bool
SetEnabled(enabled bool)
AddTimer(duration int, callback func())
SetName(name string)
SetPosition(x, y int)
SetSize(width, height int)
Focus()
ClearFocus()
ProcessPaint(cnv *Canvas)
ProcessMouseDown(button MouseButton, x int, y int, mods KeyModifiers) bool
ProcessMouseUp(button MouseButton, x int, y int, mods KeyModifiers, onlyForWidgetId string) bool
ProcessMouseMove(x int, y int, mods KeyModifiers) bool
ProcessMouseLeave() bool
ProcessMouseEnter() bool
ProcessKeyDown(keyCode Key, mods KeyModifiers) bool
ProcessKeyUp(keyCode Key, mods KeyModifiers) bool
ProcessMouseDblClick(button MouseButton, x int, y int, mods KeyModifiers) bool
ProcessChar(char rune, mods KeyModifiers) bool
ProcessMouseWheel(deltaX int, deltaY int) bool
ProcessTimer()
ProcessFocused()
ProcessFocusLost()
ProcessPropChange(key string, value interface{})
ProcessClosePopup()
RectClientAreaOnWindow() (x, y int)
ScrollX() int
ScrollY() int
SetMouseCursor(cursor MouseCursor)
MouseCursor() MouseCursor
AddWidget(gridX, gridY int, widget Widgeter)
RemoveWidget(widget Widgeter)
AllChildren() []Widgeter
IsCanBeFocused() bool
IsVisible() bool
GridX() int
GridY() int
SetGridPosition(row, column int)
XExpandable() bool
YExpandable() bool
MinWidth() int
MinHeight() int
MaxWidth() int
MaxHeight() int
SetAbsolutePositioning(absolute bool)
SetXExpandable(expandable bool)
SetYExpandable(expandable bool)
ClearLayoutCache()
// contains filtered or unexported methods
}
Source Files
¶
- button.go
- button_image.go
- calendar.go
- canvas.go
- canvas_frame.go
- chart.go
- checkbox.go
- clipboard.go
- colorpicker.go
- combobox.go
- combobox_editable.go
- context_menu.go
- context_menu_item.go
- datepicker.go
- dialog.go
- dragdrop.go
- drawscript.go
- expander.go
- filedialog.go
- font_registry.go
- font_system.go
- form.go
- form_popup.go
- frame.go
- groupbox.go
- hspacer.go
- imagebox.go
- input.go
- label.go
- language.go
- link.go
- menu_bar.go
- messagebox.go
- numbox.go
- panel.go
- print.go
- print_dialog.go
- print_text.go
- progressbar.go
- propertygrid.go
- radiobutton.go
- scrollarea.go
- shortcut.go
- slider.go
- space.go
- splitter.go
- strings.go
- systemfont.go
- table.go
- tabwidget.go
- tabwidget_button.go
- text_renderer.go
- text_utils.go
- textbox.go
- theme.go
- theme_draw.go
- theme_metrics.go
- timechart.go
- timechart_marker.go
- timechart_source.go
- timechart_theme.go
- timepicker.go
- timer.go
- toast.go
- toggleswitch.go
- tool_button.go
- tooltip.go
- trayicon.go
- treeview.go
- uithread.go
- vspacer.go
- widget.go
- widget_add_widgets.go
- widgeter.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package i18n holds the translations of an application as Go code: the strings are the fields of a struct, and each language is a value of it.
|
Package i18n holds the translations of an application as Go code: the strings are the fields of a struct, and each language is a value of it. |