Documentation
¶
Overview ¶
Package rotheme centralizes the Ragnarok-style gogpu/ui theme values.
Index ¶
- Constants
- Variables
- func Button(label string, onClick func()) *primitives.BoxWidget
- func ButtonDisabled(label string, disabled bool, onClick func()) *primitives.BoxWidget
- func ButtonDisabledFn(label string, disabled func() bool, onClick func()) *primitives.BoxWidget
- func Checkbox(opts ...checkbox.Option) *checkbox.Widget
- func ContextMenuItem(label string, onClick func()) *primitives.BoxWidget
- func DrawIconButton(canvas widget.Canvas, bounds geometry.Rect, kind IconButtonKind, ...)
- func DrawLabel(canvas widget.Canvas, content string, bounds geometry.Rect, ...)
- func DrawRotatedText(canvas widget.Canvas, text string, bounds geometry.Rect, size float32, ...)
- func DrawText(canvas widget.Canvas, text string, bounds geometry.Rect, size float32, ...)
- func DrawVerticalGradient(canvas widget.Canvas, bounds geometry.Rect, top, bottom widget.Color)
- func DrawVerticalGradientWithBottomBorder(canvas widget.Canvas, bounds geometry.Rect, top, bottom, border widget.Color, ...)
- func IconButton(kind IconButtonKind, onClick func()) *primitives.BoxWidget
- func IconButtonDisabled(kind IconButtonKind, disabled bool, onClick func()) *primitives.BoxWidget
- func Label(content string) *primitives.TextWidget
- func LargeButton(label string, onClick func()) *primitives.BoxWidget
- func LargeButtonDisabled(label string, disabled bool, onClick func()) *primitives.BoxWidget
- func MeasureText(canvas widget.Canvas, text string, size float32, bold bool) float32
- func Radio(opts ...radio.GroupOption) *radio.Group
- func SelectListRow(label string, enabled bool, height float32) widget.Widget
- func Slider(opts ...slider.Option) *slider.Widget
- func Table(rows []TableRow, opts ...TableOption) widget.Widget
- func Text(content string) *primitives.TextWidget
- func TextField(value string, inputType textfield.InputType, onChange func(string), ...) *textfield.Widget
- func Title(content string) *primitives.TextWidget
- type ButtonPainter
- type CheckboxPainter
- type Colors
- type ContextMenuItemPainter
- type DropdownPainter
- type IconButtonKind
- type IconButtonPainter
- type RadioPainter
- type SelectListPainter
- func (SelectListPainter) PaintDivider(widget.Canvas, listview.DividerState)
- func (p SelectListPainter) PaintEmptyState(canvas widget.Canvas, bounds geometry.Rect)
- func (SelectListPainter) PaintItemBackground(canvas widget.Canvas, state listview.ItemPaintState)
- func (SelectListPainter) PaintSelection(canvas widget.Canvas, state listview.ItemPaintState)
- type SliderPainter
- type TableCell
- type TableOption
- type TableRow
- type TableViewCellContext
- type TableViewColumn
- type TableViewOption
- func TableViewBuildCell(build func(TableViewCellContext) widget.Widget) TableViewOption
- func TableViewBuildSimpleCell(build func(TableViewCellContext) TableViewSimpleCell) TableViewOption
- func TableViewColumns(columns []TableViewColumn) TableViewOption
- func TableViewDispatchHoverToCells(dispatch bool) TableViewOption
- func TableViewEmptyText(text string) TableViewOption
- func TableViewHeaderHeight(height float32) TableViewOption
- func TableViewInvalidateHover(invalidate bool) TableViewOption
- func TableViewOnRowClick(onClick func(int)) TableViewOption
- func TableViewOnRowEvent(onEvent func(int, event.Event) bool) TableViewOption
- func TableViewOnRowEventWithContext(onEvent func(widget.Context, int, event.Event) bool) TableViewOption
- func TableViewRowCount(count int) TableViewOption
- func TableViewRowHeight(height float32) TableViewOption
- func TableViewScrollYSignal(scrollY state.Signal[float32]) TableViewOption
- func TableViewSelectedRow(selectedRow state.Signal[int]) TableViewOption
- func TableViewShowHeader(show bool) TableViewOption
- type TableViewSimpleCell
- type TableViewWidget
- func (w *TableViewWidget) Children() []widget.Widget
- func (w *TableViewWidget) Draw(ctx widget.Context, canvas widget.Canvas)
- func (w *TableViewWidget) Event(ctx widget.Context, e event.Event) bool
- func (w *TableViewWidget) InvalidateRow(ctx widget.Context, row int)
- func (w *TableViewWidget) IsFocusable() bool
- func (w *TableViewWidget) Layout(ctx widget.Context, constraints geometry.Constraints) geometry.Size
- func (w *TableViewWidget) Mount(ctx widget.Context)
- func (w *TableViewWidget) Unmount()
- type TextAreaWidget
- func (w *TextAreaWidget) Draw(_ widget.Context, canvas widget.Canvas)
- func (w *TextAreaWidget) Event(ctx widget.Context, e event.Event) bool
- func (w *TextAreaWidget) IsFocusable() bool
- func (w *TextAreaWidget) Layout(_ widget.Context, constraints geometry.Constraints) geometry.Size
- func (w *TextAreaWidget) SetReadOnly(readOnly bool)
- func (w *TextAreaWidget) Text() string
- type TextFieldPainter
- type TextRotation
- type Theme
- type Typography
Constants ¶
const ( ButtonRadius float32 = 6 ButtonPaddingX float32 = 8 ButtonPaddingY float32 = 5.5 LargeButtonPaddingY float32 = 8.5 )
const ( CheckboxSize float32 = 17 CheckboxRadius float32 = 6 CheckboxGap float32 = 8 )
const ( RadioSize float32 = 13 RadioGap float32 = 7 )
const ( SliderTrackHeight float32 = 6 SliderThumbSize float32 = 16 )
const ( TableRowHeight = float32(14) TableGap = float32(1) TableCellPadX = float32(4) )
const (
ContextMenuItemHeight = 18
)
const IconButtonSize float32 = 17
const SelectListRowPadX float32 = 6
const TableHeaderPadY = float32(4)
Variables ¶
var Default = Theme{ Colors: Colors{ WindowBody: fromRGBA(color.RGBA{R: 255, G: 255, B: 255, A: 255}), WindowTitleTop: fromRGBA(color.RGBA{R: 214, G: 232, B: 250, A: 255}), WindowTitle: fromRGBA(color.RGBA{R: 184, G: 214, B: 242, A: 255}), WindowBorder: fromRGBA(color.RGBA{R: 118, G: 160, B: 206, A: 255}), WindowFooter: fromRGBA(color.RGBA{R: 244, G: 246, B: 248, A: 255}), FooterLine: fromRGBA(color.RGBA{R: 174, G: 180, B: 188, A: 255}), PanelBody: fromRGBA(color.RGBA{R: 250, G: 252, B: 255, A: 255}), Button: fromRGBA(color.RGBA{R: 236, G: 244, B: 252, A: 255}), ButtonHover: fromRGBA(color.RGBA{R: 218, G: 235, B: 250, A: 255}), ButtonDown: fromRGBA(color.RGBA{R: 198, G: 222, B: 245, A: 255}), ButtonBorder: fromRGBA(color.RGBA{R: 138, G: 174, B: 214, A: 255}), Disabled: fromRGBA(color.RGBA{R: 226, G: 230, B: 235, A: 255}), Text: fromRGBA(color.RGBA{R: 38, G: 48, B: 58, A: 255}), TitleText: fromRGBA(color.RGBA{R: 22, G: 54, B: 88, A: 255}), LabelText: fromRGBA(color.RGBA{R: 58, G: 104, B: 156, A: 255}), MutedText: fromRGBA(color.RGBA{R: 98, G: 112, B: 126, A: 255}), InputBorder: fromRGBA(color.RGBA{R: 138, G: 174, B: 214, A: 255}), InputFocus: fromRGBA(color.RGBA{R: 82, G: 138, B: 200, A: 255}), }, Typography: Typography{ FontFamily: uiFontFamily, TextSize: 11, }, }
Functions ¶
func Button ¶
func Button(label string, onClick func()) *primitives.BoxWidget
func ButtonDisabled ¶
func ButtonDisabled(label string, disabled bool, onClick func()) *primitives.BoxWidget
func ButtonDisabledFn ¶
func ButtonDisabledFn(label string, disabled func() bool, onClick func()) *primitives.BoxWidget
func ContextMenuItem ¶ added in v0.6.0
func ContextMenuItem(label string, onClick func()) *primitives.BoxWidget
ContextMenuItem keeps the standard button interaction behavior while using the flat, compact appearance of an action in a context menu.
func DrawIconButton ¶
func DrawRotatedText ¶ added in v0.6.0
func DrawRotatedText(canvas widget.Canvas, text string, bounds geometry.Rect, size float32, textColor widget.Color, bold bool, rotation TextRotation)
DrawRotatedText draws centered text at a right-angle rotation. Horizontal text continues through DrawText so it retains the canvas's native shaping.
func DrawVerticalGradient ¶ added in v0.6.0
DrawVerticalGradient draws a continuous top-to-bottom gradient as one image. The image rasterizes itself at the display's physical scale, avoiding seams between logical rows at fractional scaling factors.
func DrawVerticalGradientWithBottomBorder ¶ added in v0.6.0
func DrawVerticalGradientWithBottomBorder(canvas widget.Canvas, bounds geometry.Rect, top, bottom, border widget.Color, borderHeight float32)
DrawVerticalGradientWithBottomBorder draws the gradient and its bottom border in one image so fractional scaling cannot introduce a seam between them.
func IconButton ¶
func IconButton(kind IconButtonKind, onClick func()) *primitives.BoxWidget
func IconButtonDisabled ¶
func IconButtonDisabled(kind IconButtonKind, disabled bool, onClick func()) *primitives.BoxWidget
func Label ¶ added in v0.11.0
func Label(content string) *primitives.TextWidget
func LargeButton ¶
func LargeButton(label string, onClick func()) *primitives.BoxWidget
func LargeButtonDisabled ¶
func LargeButtonDisabled(label string, disabled bool, onClick func()) *primitives.BoxWidget
func MeasureText ¶
func Text ¶
func Text(content string) *primitives.TextWidget
func Title ¶
func Title(content string) *primitives.TextWidget
Types ¶
type ButtonPainter ¶
type ButtonPainter struct{}
func (ButtonPainter) PaintButton ¶
func (ButtonPainter) PaintButton(canvas widget.Canvas, state button.PaintState)
type CheckboxPainter ¶
type CheckboxPainter struct{}
func (CheckboxPainter) PaintCheckbox ¶
func (CheckboxPainter) PaintCheckbox(canvas widget.Canvas, state checkbox.PaintState)
type Colors ¶
type Colors struct {
WindowBody widget.Color
WindowTitleTop widget.Color
WindowTitle widget.Color
WindowBorder widget.Color
PanelBody widget.Color
Button widget.Color
ButtonHover widget.Color
ButtonDown widget.Color
ButtonBorder widget.Color
Disabled widget.Color
Text widget.Color
TitleText widget.Color
LabelText widget.Color
MutedText widget.Color
InputBorder widget.Color
InputFocus widget.Color
}
type ContextMenuItemPainter ¶ added in v0.6.0
type ContextMenuItemPainter struct{}
func (ContextMenuItemPainter) PaintButton ¶ added in v0.6.0
func (ContextMenuItemPainter) PaintButton(canvas widget.Canvas, state button.PaintState)
type DropdownPainter ¶
type DropdownPainter struct{}
func (DropdownPainter) PaintMenu ¶
func (DropdownPainter) PaintMenu(canvas widget.Canvas, state *dropdown.MenuPaintState)
func (DropdownPainter) PaintTrigger ¶
func (DropdownPainter) PaintTrigger(canvas widget.Canvas, state *dropdown.TriggerPaintState)
type IconButtonKind ¶
type IconButtonKind int
const ( IconButtonClose IconButtonKind = iota IconButtonPlus IconButtonMinus IconButtonLeft IconButtonRight IconButtonUp IconButtonDown )
type IconButtonPainter ¶
type IconButtonPainter struct {
Kind IconButtonKind
}
func (IconButtonPainter) PaintButton ¶
func (p IconButtonPainter) PaintButton(canvas widget.Canvas, state button.PaintState)
type RadioPainter ¶
type RadioPainter struct{}
func (RadioPainter) PaintRadio ¶
func (RadioPainter) PaintRadio(canvas widget.Canvas, state radio.PaintState)
type SelectListPainter ¶
type SelectListPainter struct {
EmptyText string
}
func (SelectListPainter) PaintDivider ¶
func (SelectListPainter) PaintDivider(widget.Canvas, listview.DividerState)
func (SelectListPainter) PaintEmptyState ¶
func (p SelectListPainter) PaintEmptyState(canvas widget.Canvas, bounds geometry.Rect)
func (SelectListPainter) PaintItemBackground ¶
func (SelectListPainter) PaintItemBackground(canvas widget.Canvas, state listview.ItemPaintState)
func (SelectListPainter) PaintSelection ¶
func (SelectListPainter) PaintSelection(canvas widget.Canvas, state listview.ItemPaintState)
type SliderPainter ¶
type SliderPainter struct{}
func (SliderPainter) PaintSlider ¶
func (SliderPainter) PaintSlider(canvas widget.Canvas, state slider.PaintState)
type TableOption ¶
type TableOption func(*tableWidget)
func TableColors ¶
func TableColors(headBG, cellBG widget.Color) TableOption
func TableRowHeightOpt ¶
func TableRowHeightOpt(height float32) TableOption
type TableViewCellContext ¶
type TableViewCellContext struct {
Row int
ColumnIndex int
Column TableViewColumn
Width float32
Height float32
}
type TableViewColumn ¶
type TableViewOption ¶
type TableViewOption func(*tableViewConfig)
func TableViewBuildCell ¶
func TableViewBuildCell(build func(TableViewCellContext) widget.Widget) TableViewOption
func TableViewBuildSimpleCell ¶
func TableViewBuildSimpleCell(build func(TableViewCellContext) TableViewSimpleCell) TableViewOption
func TableViewColumns ¶
func TableViewColumns(columns []TableViewColumn) TableViewOption
func TableViewDispatchHoverToCells ¶
func TableViewDispatchHoverToCells(dispatch bool) TableViewOption
func TableViewEmptyText ¶
func TableViewEmptyText(text string) TableViewOption
func TableViewHeaderHeight ¶
func TableViewHeaderHeight(height float32) TableViewOption
func TableViewInvalidateHover ¶
func TableViewInvalidateHover(invalidate bool) TableViewOption
func TableViewOnRowClick ¶
func TableViewOnRowClick(onClick func(int)) TableViewOption
func TableViewOnRowEvent ¶
func TableViewOnRowEvent(onEvent func(int, event.Event) bool) TableViewOption
func TableViewRowCount ¶
func TableViewRowCount(count int) TableViewOption
func TableViewRowHeight ¶
func TableViewRowHeight(height float32) TableViewOption
func TableViewScrollYSignal ¶
func TableViewScrollYSignal(scrollY state.Signal[float32]) TableViewOption
func TableViewSelectedRow ¶
func TableViewSelectedRow(selectedRow state.Signal[int]) TableViewOption
func TableViewShowHeader ¶
func TableViewShowHeader(show bool) TableViewOption
type TableViewSimpleCell ¶
type TableViewSimpleCell struct {
Text string
Icon image.Image
Align widget.TextAlign
Color widget.Color
Hidden bool
IconButton IconButtonKind
HasIconButton bool
IconButtonDisabled bool
}
func TableViewIconButtonCell ¶
func TableViewIconButtonCell(kind IconButtonKind, disabled bool) TableViewSimpleCell
type TableViewWidget ¶
type TableViewWidget struct {
widget.WidgetBase
// contains filtered or unexported fields
}
func TableView ¶
func TableView(opts ...TableViewOption) *TableViewWidget
func (*TableViewWidget) Children ¶
func (w *TableViewWidget) Children() []widget.Widget
func (*TableViewWidget) Draw ¶
func (w *TableViewWidget) Draw(ctx widget.Context, canvas widget.Canvas)
func (*TableViewWidget) InvalidateRow ¶ added in v0.6.0
func (w *TableViewWidget) InvalidateRow(ctx widget.Context, row int)
InvalidateRow redraws one materialized row without rebuilding the table.
func (*TableViewWidget) IsFocusable ¶
func (w *TableViewWidget) IsFocusable() bool
func (*TableViewWidget) Layout ¶
func (w *TableViewWidget) Layout(ctx widget.Context, constraints geometry.Constraints) geometry.Size
func (*TableViewWidget) Mount ¶
func (w *TableViewWidget) Mount(ctx widget.Context)
func (*TableViewWidget) Unmount ¶
func (w *TableViewWidget) Unmount()
type TextAreaWidget ¶ added in v0.11.0
type TextAreaWidget struct {
widget.WidgetBase
// contains filtered or unexported fields
}
TextAreaWidget is a small, wrapped multiline editor. It uses the same font, focus, clipboard and pointer capture services as the other UI inputs. Positions are rune offsets; maxBytes bounds the encoded text, not its glyphs.
func TextArea ¶ added in v0.11.0
func TextArea(value string, maxBytes int, onChange func(string)) *TextAreaWidget
func (*TextAreaWidget) Draw ¶ added in v0.11.0
func (w *TextAreaWidget) Draw(_ widget.Context, canvas widget.Canvas)
func (*TextAreaWidget) IsFocusable ¶ added in v0.11.0
func (w *TextAreaWidget) IsFocusable() bool
func (*TextAreaWidget) Layout ¶ added in v0.11.0
func (w *TextAreaWidget) Layout(_ widget.Context, constraints geometry.Constraints) geometry.Size
func (*TextAreaWidget) SetReadOnly ¶ added in v0.11.0
func (w *TextAreaWidget) SetReadOnly(readOnly bool)
func (*TextAreaWidget) Text ¶ added in v0.11.0
func (w *TextAreaWidget) Text() string
type TextFieldPainter ¶
type TextFieldPainter struct{}
func (TextFieldPainter) PaintTextField ¶
func (TextFieldPainter) PaintTextField(canvas widget.Canvas, state *textfield.PaintState)
type TextRotation ¶ added in v0.6.0
type TextRotation uint8
const ( TextRotationNone TextRotation = iota TextRotationCounterClockwise TextRotationClockwise )
type Theme ¶
type Theme struct {
Colors Colors
Typography Typography
}