Documentation
¶
Index ¶
- Constants
- Variables
- func Shape(s shape) func(*ButtonOption)
- func Type(k kind) func(*ButtonOption)
- type Base
- func (b *Base) Align(ta TextAlign) Widget
- func (b *Base) Attach(a *core.App)
- func (b *Base) BgColor(bg *Color) Widget
- func (b *Base) BorderColor(c *Color) Widget
- func (b *Base) BorderRadius(r int) Widget
- func (b *Base) Build() Widget
- func (b *Base) Detach()
- func (b *Base) FgColor(fg *Color) Widget
- func (b *Base) FixedHeight(height int) Widget
- func (b *Base) FixedRatioHeight(height int) Widget
- func (b *Base) FixedRatioWidth(width int) Widget
- func (b *Base) FixedSize(w, h int) Widget
- func (b *Base) FixedWidth(width int) Widget
- func (b *Base) FontSize(size *FontSize) Widget
- func (b *Base) Height() int
- func (b *Base) ID() core.WidgetID
- func (b *Base) Margin(n int) Widget
- func (b *Base) OnChange(handler func(ev core.Event)) Widget
- func (b *Base) OnClick(handler func(ev core.Event)) Widget
- func (b *Base) OtherStyle() *OtherStyle
- func (b *Base) Padding(n int) Widget
- func (b *Base) SetHeight(height int) Widget
- func (b *Base) SetSize(width, height int) Widget
- func (b *Base) SetSizePolicy(sp SizePolicy) Widget
- func (b *Base) SetSizeStyle(s string)
- func (b *Base) SetTextStyle(style *TextStyle) Widget
- func (b *Base) SetWidget(w Widget)
- func (b *Base) SetWidth(width int) Widget
- func (b *Base) SizePolicy() SizePolicy
- func (b *Base) SizeStyle() string
- func (b *Base) TextStyle() *TextStyle
- func (b *Base) Update()
- func (b *Base) VerticalAlign(va VerticalAlign) Widget
- func (b *Base) View() string
- func (b *Base) Width() int
- type BoolStateModel
- type ButtonModel
- type ButtonOption
- type ButtonWidget
- type Color
- type ColumnLayout
- type Component
- type DataRow
- type DataTableStyle
- type DataTableWidget
- type DividerWidget
- type EventPublisher
- type FontSize
- type HeaderRow
- type InputModel
- type InputType
- type InputWidget
- type IntStateModel
- func (i *IntStateModel) Add(n int)
- func (i *IntStateModel) Decrement()
- func (i *IntStateModel) Div(n int)
- func (i *IntStateModel) Increment()
- func (i *IntStateModel) Mul(n int)
- func (i *IntStateModel) SetString(value string)
- func (i *IntStateModel) SetValue(value int)
- func (i *IntStateModel) String() string
- func (i *IntStateModel) Sub(n int)
- func (i *IntStateModel) Value() int
- type Layout
- type Model
- type OtherStyle
- type RowLayout
- type SizePolicy
- type SpacerWidget
- type StrStateModel
- type StringEventPublisher
- type SwitchModel
- type SwitchWidget
- type TableData
- type TableModel
- type TextAlign
- type TextAreaModel
- type TextAreaWidget
- type TextStyle
- type TextWidget
- type VerticalAlign
- type Widget
Constants ¶
View Source
const ( DefaultKind kind = iota Primary Success Neutral Warning Dangerous )
View Source
const ( DefaultShape shape = iota Outline Pill Circle )
Variables ¶
View Source
var ( PrimaryColor = NewColor("primary", 500) SuccessColor = NewColor("success", 500) WarningColor = NewColor("warning", 500) DangerColor = NewColor("danger", 500) NeutralColor = NewColor("neutral", 500) Black = NewColor("neutral", 0) White = NewColor("neutral", 1000) Gray = NewColor("gray", 500) Red = NewColor("red", 500) Orange = NewColor("orange", 500) Amber = NewColor("amber", 500) Yellow = NewColor("yellow", 500) Lime = NewColor("lime", 500) Green = NewColor("green", 500) Emerald = NewColor("emerald", 500) Teal = NewColor("teal", 500) Cyan = NewColor("cyan", 500) Sky = NewColor("sky", 500) Blue = NewColor("blue", 500) Indigo = NewColor("indigo", 500) Violet = NewColor("violet", 500) Purple = NewColor("purple", 500) Fuchsia = NewColor("fuchsia", 500) Pink = NewColor("pink", 500) Rose = NewColor("rose", 500) )
View Source
var ( TwoXSmall = NewFontSize("2x-small") XSmall = NewFontSize("x-small") Small = NewFontSize("small") Medium = NewFontSize("medium") Large = NewFontSize("large") XLarge = NewFontSize("x-large") TwoXLarge = NewFontSize("2x-large") ThreeXLarge = NewFontSize("3x-large") FourXLarge = NewFontSize("4x-large") )
Functions ¶
func Shape ¶
func Shape(s shape) func(*ButtonOption)
func Type ¶
func Type(k kind) func(*ButtonOption)
Types ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
func (*Base) BorderColor ¶
func (*Base) BorderRadius ¶
func (*Base) FixedHeight ¶
func (*Base) FixedRatioHeight ¶
func (*Base) FixedRatioWidth ¶
func (*Base) FixedWidth ¶
func (*Base) OtherStyle ¶
func (b *Base) OtherStyle() *OtherStyle
func (*Base) SetSizePolicy ¶
func (b *Base) SetSizePolicy(sp SizePolicy) Widget
func (*Base) SetSizeStyle ¶
func (*Base) SetTextStyle ¶
func (*Base) SizePolicy ¶
func (b *Base) SizePolicy() SizePolicy
func (*Base) VerticalAlign ¶
func (b *Base) VerticalAlign(va VerticalAlign) Widget
type BoolStateModel ¶
type BoolStateModel struct { Model // contains filtered or unexported fields }
func BoolState ¶
func BoolState(value bool) *BoolStateModel
func (*BoolStateModel) SetValue ¶
func (b *BoolStateModel) SetValue(value bool)
func (*BoolStateModel) String ¶
func (b *BoolStateModel) String() string
func (*BoolStateModel) Value ¶
func (b *BoolStateModel) Value() bool
type ButtonModel ¶
type ButtonModel struct { Model // contains filtered or unexported fields }
func NewButtonModel ¶
func NewButtonModel(label string) *ButtonModel
func (*ButtonModel) Disable ¶
func (bm *ButtonModel) Disable()
func (*ButtonModel) Enable ¶
func (bm *ButtonModel) Enable()
func (*ButtonModel) Label ¶
func (bm *ButtonModel) Label() string
func (*ButtonModel) Loading ¶
func (bm *ButtonModel) Loading(flag bool)
func (*ButtonModel) SetLabel ¶
func (bm *ButtonModel) SetLabel(label string)
type ButtonOption ¶
type ButtonOption struct {
// contains filtered or unexported fields
}
func (*ButtonOption) String ¶
func (o *ButtonOption) String() string
type ButtonWidget ¶
type ButtonWidget struct { Base // contains filtered or unexported fields }
func Button ¶
func Button(label string, options ...func(*ButtonOption)) *ButtonWidget
func ButtonWithModel ¶
func ButtonWithModel(m *ButtonModel, options ...func(*ButtonOption)) *ButtonWidget
func (*ButtonWidget) Disable ¶
func (b *ButtonWidget) Disable() *ButtonWidget
func (*ButtonWidget) Enable ¶
func (b *ButtonWidget) Enable() *ButtonWidget
func (*ButtonWidget) Label ¶
func (b *ButtonWidget) Label() string
func (*ButtonWidget) SetLabel ¶
func (b *ButtonWidget) SetLabel(label string) *ButtonWidget
func (*ButtonWidget) View ¶
func (b *ButtonWidget) View() string
type ColumnLayout ¶
type ColumnLayout struct {
Layout
}
func Column ¶
func Column(children ...Widget) *ColumnLayout
func (*ColumnLayout) View ¶
func (c *ColumnLayout) View() string
type Component ¶
type Component struct { Base // contains filtered or unexported fields }
func NewComponent ¶
type DataTableStyle ¶
type DataTableStyle struct{}
func (*DataTableStyle) String ¶
func (s *DataTableStyle) String() string
type DataTableWidget ¶
type DataTableWidget struct { Base // contains filtered or unexported fields }
func DataTable ¶
func DataTable(m *TableModel) *DataTableWidget
func (*DataTableWidget) SetStyle ¶
func (dt *DataTableWidget) SetStyle(style *DataTableStyle) *DataTableWidget
func (*DataTableWidget) View ¶
func (dt *DataTableWidget) View() string
type DividerWidget ¶
type DividerWidget struct {
Base
}
func Divider ¶
func Divider() *DividerWidget
func (*DividerWidget) View ¶
func (d *DividerWidget) View() string
type EventPublisher ¶
type EventPublisher interface { AddListener(w Widget) Notify() }
type FontSize ¶
type FontSize struct {
// contains filtered or unexported fields
}
func NewFontSize ¶
type InputModel ¶
type InputModel struct { Model // contains filtered or unexported fields }
func NewInputModel ¶
func NewInputModel(t InputType, placeholder string) *InputModel
func (*InputModel) InputType ¶
func (im *InputModel) InputType() InputType
func (*InputModel) Placeholder ¶
func (im *InputModel) Placeholder() string
func (*InputModel) SetInputType ¶
func (im *InputModel) SetInputType(inputType InputType)
func (*InputModel) SetPlaceholder ¶
func (im *InputModel) SetPlaceholder(placeholder string)
type InputWidget ¶
type InputWidget struct { Base // contains filtered or unexported fields }
func Input ¶
func Input(inputType InputType, placeholder string) *InputWidget
func InputWithModel ¶
func InputWithModel(m *InputModel) *InputWidget
func (*InputWidget) View ¶
func (i *InputWidget) View() string
type IntStateModel ¶
type IntStateModel struct { Model // contains filtered or unexported fields }
func IntState ¶
func IntState(value int) *IntStateModel
func (*IntStateModel) Add ¶
func (i *IntStateModel) Add(n int)
func (*IntStateModel) Decrement ¶
func (i *IntStateModel) Decrement()
func (*IntStateModel) Div ¶
func (i *IntStateModel) Div(n int)
func (*IntStateModel) Increment ¶
func (i *IntStateModel) Increment()
func (*IntStateModel) Mul ¶
func (i *IntStateModel) Mul(n int)
func (*IntStateModel) SetString ¶
func (i *IntStateModel) SetString(value string)
func (*IntStateModel) SetValue ¶
func (i *IntStateModel) SetValue(value int)
func (*IntStateModel) String ¶
func (i *IntStateModel) String() string
func (*IntStateModel) Sub ¶
func (i *IntStateModel) Sub(n int)
func (*IntStateModel) Value ¶
func (i *IntStateModel) Value() int
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func (*Model) AddListener ¶
type OtherStyle ¶
type OtherStyle struct {
// contains filtered or unexported fields
}
func (*OtherStyle) String ¶
func (s *OtherStyle) String() string
type SizePolicy ¶
type SizePolicy int
const ( Fixed SizePolicy = iota FixedWidth FixedRatioWidth FixedHeight FixedRatioHeight Expanding )
type SpacerWidget ¶
type SpacerWidget struct {
Base
}
func Spacer ¶
func Spacer() *SpacerWidget
func (*SpacerWidget) View ¶
func (s *SpacerWidget) View() string
type StrStateModel ¶
type StrStateModel struct { Model // contains filtered or unexported fields }
func StrState ¶
func StrState(value string) *StrStateModel
func (*StrStateModel) SetString ¶
func (s *StrStateModel) SetString(value string)
func (*StrStateModel) SetValue ¶
func (s *StrStateModel) SetValue(value string)
func (*StrStateModel) String ¶
func (s *StrStateModel) String() string
type StringEventPublisher ¶
type StringEventPublisher interface { EventPublisher fmt.Stringer SetString(value string) }
type SwitchModel ¶
type SwitchModel struct { Model // contains filtered or unexported fields }
func NewSwitchModel ¶
func NewSwitchModel(checked bool) *SwitchModel
func (*SwitchModel) Checked ¶
func (sm *SwitchModel) Checked() bool
func (*SwitchModel) SetChecked ¶
func (sm *SwitchModel) SetChecked(checked bool)
type SwitchWidget ¶
type SwitchWidget struct { Base // contains filtered or unexported fields }
func Switch ¶
func Switch(checked bool, label string) *SwitchWidget
func SwitchWithModel ¶
func SwitchWithModel(b *BoolStateModel, label string) *SwitchWidget
func (*SwitchWidget) View ¶
func (s *SwitchWidget) View() string
type TableModel ¶
type TableModel struct { Model // contains filtered or unexported fields }
func NewTableModel ¶
func NewTableModel(header *HeaderRow, rows []*DataRow) *TableModel
func (*TableModel) AddRow ¶
func (m *TableModel) AddRow(row *DataRow)
func (*TableModel) Header ¶
func (m *TableModel) Header() *HeaderRow
func (*TableModel) Rows ¶
func (m *TableModel) Rows() []*DataRow
func (*TableModel) SetHeader ¶
func (m *TableModel) SetHeader(header *HeaderRow)
func (*TableModel) SetRows ¶
func (m *TableModel) SetRows(rows []*DataRow)
type TextAreaModel ¶
type TextAreaModel struct { Model // contains filtered or unexported fields }
func NewTextAreaModel ¶
func NewTextAreaModel(placeholder string) *TextAreaModel
func (*TextAreaModel) Placeholder ¶
func (sm *TextAreaModel) Placeholder() string
func (*TextAreaModel) SetPlaceholder ¶
func (sm *TextAreaModel) SetPlaceholder(placeholder string)
type TextAreaWidget ¶
type TextAreaWidget struct { Base // contains filtered or unexported fields }
func TextArea ¶
func TextArea(placeholder string) *TextAreaWidget
func TextAreaWithModel ¶
func TextAreaWithModel(m *TextAreaModel) *TextAreaWidget
func (*TextAreaWidget) View ¶
func (t *TextAreaWidget) View() string
type TextWidget ¶
type TextWidget struct { Base // contains filtered or unexported fields }
func Text ¶
func Text(s StringEventPublisher) *TextWidget
Go 1.18がリリースされたらstring | State[T] のようになるだろう..
func (*TextWidget) SetLabel ¶
func (t *TextWidget) SetLabel(label string)
func (*TextWidget) View ¶
func (t *TextWidget) View() string
type VerticalAlign ¶
type VerticalAlign int
const ( Middle VerticalAlign = iota Baseline Top Bottom Sub TextTop )
func (VerticalAlign) String ¶
func (va VerticalAlign) String() string
type Widget ¶
type Widget interface { core.Widget Detach() Update() SetSize(w, h int) Widget Width() int SetWidth(w int) Widget Height() int SetHeight(h int) Widget SizePolicy() SizePolicy SetSizePolicy(sp SizePolicy) Widget FixedWidth(n int) Widget FixedRatioWidth(n int) Widget FixedHeight(n int) Widget FixedRatioHeight(n int) Widget FixedSize(w, h int) Widget SizeStyle() string SetSizeStyle(s string) TextStyle() *TextStyle OtherStyle() *OtherStyle SetTextStyle(style *TextStyle) Widget Align(ta TextAlign) Widget VerticalAlign(va VerticalAlign) Widget FgColor(fg *Color) Widget BgColor(bg *Color) Widget BorderColor(c *Color) Widget BorderRadius(r int) Widget FontSize(size *FontSize) Widget Padding(n int) Widget Margin(n int) Widget OnClick(func(ev core.Event)) Widget OnChange(func(ev core.Event)) Widget }
Click to show internal directories.
Click to hide internal directories.