Documentation ¶
Index ¶
- Constants
- func AddHelpToInfoPop(target unison.Paneler, text string)
- func AddKeyBindingInfoToInfoPop(target unison.Paneler, keyBinding unison.KeyBinding, text string)
- func AddScalingHelpToInfoPop(target unison.Paneler)
- func ClearInfoPop(target unison.Paneler)
- func DeepSync(panel unison.Paneler)
- func FocusFirstContent(toolbar, content unison.Paneler)
- func MarkForLayoutWithinDockable(panel unison.Paneler)
- func MarkModified(panel unison.Paneler)
- func NewDefaultInfoPop() *unison.Button
- func NewFieldInteriorLeadingLabel(text string) *unison.Label
- func NewFieldLeadingLabel(text string) *unison.Label
- func NewFieldTrailingLabel(text string) *unison.Label
- func NewInfoPop() *unison.Button
- func NewInteriorSeparator() *unison.Separator
- func NewPageHeader(title string, hSpan int) *unison.Label
- func NewPageInternalHeader(title string, span int) unison.Paneler
- func NewPageLabel(title string) *unison.Label
- func NewPageLabelCenter(title string) *unison.Label
- func NewPageLabelEnd(title string) *unison.Label
- func NewPageLabelWithRandomizer(title, tooltip string, clickCallback func()) *unison.Panel
- func NewSearchField() *unison.Field
- func NewToolbarSeparator() *unison.Separator
- func SetCheckBoxState(checkbox *CheckBox, checked bool)
- func SetFieldValue(field *unison.Field, value string)
- func WrapWithSpan(span int, children ...unison.Paneler) *unison.Panel
- type CheckBox
- type DecimalField
- type DockableKind
- type DragHandle
- type DrawableSVGPair
- type EntityPanel
- type FocusRef
- type GroupedCloser
- type IntegerField
- type LengthField
- type Markdown
- type ModifiableRoot
- type NonEditableField
- type NonEditablePageField
- type NumericField
- type PercentageField
- type Popup
- type Rebuildable
- type Selectable
- type StringField
- func NewMultiLineStringField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() string, ...) *StringField
- func NewStringField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() string, ...) *StringField
- func NewStringPageField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() string, ...) *StringField
- func NewStringPageFieldNoGrab(targetMgr *TargetMgr, targetKey, undoTitle string, get func() string, ...) *StringField
- type Syncer
- type TargetMgr
- type TargetUndo
- type TitledBorder
- type WeightField
Constants ¶
const ( SheetDockableKind = "sheet" TemplateDockableKind = "template" ListDockableKind = "list" )
Known dockable kinds
const DefaultMarkdownWidth = 8 * 100
DefaultMarkdownWidth is the default maximum width to use, roughly equivalent to a page at 100dpi.
Variables ¶
This section is empty.
Functions ¶
func AddHelpToInfoPop ¶ added in v5.3.0
AddHelpToInfoPop adds one or more lines of help text to an InfoPop.
func AddKeyBindingInfoToInfoPop ¶ added in v5.3.0
func AddKeyBindingInfoToInfoPop(target unison.Paneler, keyBinding unison.KeyBinding, text string)
AddKeyBindingInfoToInfoPop adds information about a key binding to an InfoPop.
func AddScalingHelpToInfoPop ¶ added in v5.3.0
AddScalingHelpToInfoPop adds the help info about scaling to an InfoPop.
func ClearInfoPop ¶ added in v5.3.0
ClearInfoPop clears the InfoPop data.
func DeepSync ¶
DeepSync does a depth-first traversal of the panel and all of its descendents and calls Sync() on any Syncer objects it finds.
func FocusFirstContent ¶
FocusFirstContent attempts to focus the first non-button widget in the content. Failing that, tries to focus the first focusable widget in the content. Failing that, tries to focus the first focusable widget in the toolbar.
func MarkForLayoutWithinDockable ¶
MarkForLayoutWithinDockable sets the NeedsLayout flag on the provided panel and all of its parents up to the first Dockable.
func MarkModified ¶
MarkModified looks for a ModifiableRoot, starting at the panel. If found, it then called MarkModified() on it.
func NewDefaultInfoPop ¶ added in v5.3.0
NewDefaultInfoPop creates a new InfoPop with the message about mouse wheel scaling.
func NewFieldInteriorLeadingLabel ¶
NewFieldInteriorLeadingLabel creates a new label appropriate for the label in the interior of a row before a field.
func NewFieldLeadingLabel ¶
NewFieldLeadingLabel creates a new label appropriate for the first label in a row before a field.
func NewFieldTrailingLabel ¶
NewFieldTrailingLabel creates a new label appropriate for after a field.
func NewInfoPop ¶ added in v5.3.0
NewInfoPop creates a new InfoPop.
func NewInteriorSeparator ¶ added in v5.3.0
NewInteriorSeparator creates a new interior vertical separator.
func NewPageHeader ¶
NewPageHeader creates a new center-aligned header for a sheet page.
func NewPageInternalHeader ¶
NewPageInternalHeader creates a new center-aligned internal header for a sheet page.
func NewPageLabel ¶
NewPageLabel creates a new start-aligned field label for a sheet page.
func NewPageLabelCenter ¶
NewPageLabelCenter creates a new center-aligned field label for a sheet page.
func NewPageLabelEnd ¶
NewPageLabelEnd creates a new end-aligned field label for a sheet page.
func NewPageLabelWithRandomizer ¶
NewPageLabelWithRandomizer creates a new end-aligned field label for a sheet page that includes a randomization button.
func NewSearchField ¶
NewSearchField creates a new search widget.
func NewToolbarSeparator ¶
NewToolbarSeparator creates a new vertical separator for the toolbar.
func SetCheckBoxState ¶
SetCheckBoxState sets the checkbox state based on the value of checked.
func SetFieldValue ¶
SetFieldValue sets the value of this field, marking the field and all of its parents as needing to be laid out again if the value is not what is currently in the field.
Types ¶
type CheckBox ¶
CheckBox provides a checkbox that works with undo.
func NewCheckBox ¶
func NewCheckBox(targetMgr *TargetMgr, targetKey, title string, get func() unison.CheckState, set func(unison.CheckState)) *CheckBox
NewCheckBox creates a new check box.
type DecimalField ¶
type DecimalField = NumericField[fxp.Int]
DecimalField is field that holds a decimal (fixed-point) number.
type DockableKind ¶
type DockableKind interface {
DockableKind() string
}
DockableKind defines the method required DockableKinds.
type DragHandle ¶
DragHandle provides a simple draggable handle.
func NewDragHandle ¶
func NewDragHandle(data map[string]any) *DragHandle
NewDragHandle creates a new draggable handle widget.
type DrawableSVGPair ¶
DrawableSVGPair draws two SVG's side-by-side.
func (*DrawableSVGPair) DrawInRect ¶
func (s *DrawableSVGPair) DrawInRect(canvas *unison.Canvas, rect unison.Rect, _ *unison.SamplingOptions, paint *unison.Paint)
DrawInRect implements the Drawable interface.
func (*DrawableSVGPair) LogicalSize ¶
func (s *DrawableSVGPair) LogicalSize() unison.Size
LogicalSize implements the Drawable interface.
type EntityPanel ¶
EntityPanel defines methods for a panel that can hold an entity.
type GroupedCloser ¶
GroupedCloser defines the methods required of a tab that wishes to be closed when another tab is closed.
type IntegerField ¶
type IntegerField = NumericField[int]
IntegerField is field that holds an integer.
func NewIntegerField ¶
func NewIntegerField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() int, set func(int), min, max int, forceSign, noMinWidth bool) *IntegerField
NewIntegerField creates a new field that holds an int.
func NewIntegerPageField ¶
func NewIntegerPageField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() int, set func(int), min, max int, showSign bool) *IntegerField
NewIntegerPageField creates a new integer entry field for a sheet page.
type LengthField ¶
type LengthField = NumericField[measure.Length]
LengthField is field that holds a length value.
func NewHeightPageField ¶
func NewHeightPageField(targetMgr *TargetMgr, targetKey, undoTitle string, entity *gurps.Entity, get func() measure.Length, set func(measure.Length), min, max measure.Length, noMinWidth bool) *LengthField
NewHeightPageField creates a new height entry field for a sheet page.
type Markdown ¶
Markdown provides a simple markdown display widget. It is currently *very* limited in what it can display.
func (*Markdown) SetContent ¶
SetContent replaces the current markdown content.
type ModifiableRoot ¶
ModifiableRoot marks the root of a modifable tree of components, typically a Dockable.
type NonEditableField ¶
NonEditableField holds the data for a non-editable field.
func NewNonEditableField ¶
func NewNonEditableField(syncer func(*NonEditableField)) *NonEditableField
NewNonEditableField creates a new start-aligned non-editable field that uses the same font and size as the field.
func NewNonEditableFieldCenter ¶
func NewNonEditableFieldCenter(syncer func(*NonEditableField)) *NonEditableField
NewNonEditableFieldCenter creates a new center-aligned non-editable field that uses the same font and size as the field.
func NewNonEditableFieldEnd ¶
func NewNonEditableFieldEnd(syncer func(*NonEditableField)) *NonEditableField
NewNonEditableFieldEnd creates a new end-aligned non-editable field that uses the same font and size as the field.
func (*NonEditableField) Sync ¶
func (f *NonEditableField) Sync()
Sync the field to the current value.
type NonEditablePageField ¶
NonEditablePageField holds the data for a non-editable page field.
func NewNonEditablePageField ¶
func NewNonEditablePageField(syncer func(*NonEditablePageField)) *NonEditablePageField
NewNonEditablePageField creates a new start-aligned non-editable field that uses the same font and size as the page field.
func NewNonEditablePageFieldCenter ¶
func NewNonEditablePageFieldCenter(syncer func(*NonEditablePageField)) *NonEditablePageField
NewNonEditablePageFieldCenter creates a new center-aligned non-editable field that uses the same font and size as the page field.
func NewNonEditablePageFieldEnd ¶
func NewNonEditablePageFieldEnd(syncer func(*NonEditablePageField)) *NonEditablePageField
NewNonEditablePageFieldEnd creates a new end-aligned non-editable field that uses the same font and size as the page field.
func (*NonEditablePageField) Sync ¶
func (f *NonEditablePageField) Sync()
Sync the field to the current value.
type NumericField ¶
type NumericField[T xmath.Numeric] struct { *unison.Field Format func(T) string // contains filtered or unexported fields }
NumericField holds a numeric value that can be edited.
func NewNumericField ¶
func NewNumericField[T xmath.Numeric](targetMgr *TargetMgr, targetKey, undoTitle string, getPrototypes func(min, max T) []T, get func() T, set func(T), format func(T) string, extract func(s string) (T, error), min, max T) *NumericField[T]
NewNumericField creates a new field that formats its content.
func (*NumericField[T]) Max ¶
func (f *NumericField[T]) Max() T
Max returns the maximum value allowed.
func (*NumericField[T]) Min ¶
func (f *NumericField[T]) Min() T
Min returns the minimum value allowed.
func (*NumericField[T]) SetMarksModified ¶
func (f *NumericField[T]) SetMarksModified(marksModified bool)
SetMarksModified sets whether this field will attempt to mark its ModifiableRoot as modified. Default is true.
func (*NumericField[T]) SetMinMax ¶
func (f *NumericField[T]) SetMinMax(min, max T)
SetMinMax sets the minimum and maximum values and then adjusts the minimum text width, if a prototype function has been set.
func (*NumericField[T]) Sync ¶
func (f *NumericField[T]) Sync()
Sync the field to the current value.
type PercentageField ¶
type PercentageField = NumericField[int]
PercentageField is field that holds a percentage.
func NewPercentageField ¶
func NewPercentageField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() int, set func(int), min, max int, forceSign, noMinWidth bool) *PercentageField
NewPercentageField creates a new field that holds a percentage.
func NewScaleField ¶ added in v5.3.0
func NewScaleField(min, max int, def, get func() int, set func(int), scroller *unison.ScrollPanel, afterApply func(), attemptCenter bool) *PercentageField
NewScaleField creates a new scale field and hooks it into the target.
type Popup ¶
type Popup[T comparable] struct { *unison.PopupMenu[T] // contains filtered or unexported fields }
Popup provides a popup menu that works with undo.
type Rebuildable ¶
Rebuildable defines the methods a rebuildable panel should provide.
type Selectable ¶
Selectable panels can have their selection queried and set.
type StringField ¶
StringField holds the value for a string field.
func NewMultiLineStringField ¶
func NewMultiLineStringField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() string, set func(string)) *StringField
NewMultiLineStringField creates a new field for editing a string.
func NewStringField ¶
func NewStringField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() string, set func(string)) *StringField
NewStringField creates a new field for editing a string.
func NewStringPageField ¶
func NewStringPageField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() string, set func(string)) *StringField
NewStringPageField creates a new text entry field for a sheet page.
func NewStringPageFieldNoGrab ¶
func NewStringPageFieldNoGrab(targetMgr *TargetMgr, targetKey, undoTitle string, get func() string, set func(string)) *StringField
NewStringPageFieldNoGrab creates a new text entry field for a sheet page, but with HGrab set to false.
type Syncer ¶
type Syncer interface {
Sync()
}
Syncer should be called to sync an object's UI state to its model.
type TargetMgr ¶
type TargetMgr struct {
// contains filtered or unexported fields
}
TargetMgr provides management of target panels.
func NewTargetMgr ¶
NewTargetMgr creates a new TargetMgr with the given root.
func (*TargetMgr) CurrentFocusRef ¶
CurrentFocusRef returns the current FocusRef, if any.
func (*TargetMgr) Find ¶
Find searches the tree of panels starting at the root, looking for a specific refKey.
func (*TargetMgr) NextPrefix ¶
NextPrefix returns the next unique prefix to use.
type TargetUndo ¶
TargetUndo provides undo support for fields that may be swapped out during updates by using a TargetMgr to locate the real target.
func NewTargetUndo ¶
func NewTargetUndo[T any](targetMgr *TargetMgr, targetKey, title string, undoID int64, applyCallback func(target *unison.Panel, data T), beforeData T) *TargetUndo[T]
NewTargetUndo creates a new undo that supports having a revisable target.
type TitledBorder ¶
TitledBorder provides a titled line border.
func (*TitledBorder) Draw ¶
func (t *TitledBorder) Draw(gc *unison.Canvas, rect unison.Rect)
Draw implements unison.Border
func (*TitledBorder) Insets ¶
func (t *TitledBorder) Insets() unison.Insets
Insets implements unison.Border
type WeightField ¶
type WeightField = NumericField[measure.Weight]
WeightField is field that holds a weight value.
func NewWeightField ¶
func NewWeightField(targetMgr *TargetMgr, targetKey, undoTitle string, entity *gurps.Entity, get func() measure.Weight, set func(measure.Weight), min, max measure.Weight, noMinWidth bool) *WeightField
NewWeightField creates a new field that holds a fixed-point number.
func NewWeightPageField ¶
func NewWeightPageField(targetMgr *TargetMgr, targetKey, undoTitle string, entity *gurps.Entity, get func() measure.Weight, set func(measure.Weight), min, max measure.Weight, noMinWidth bool) *WeightField
NewWeightPageField creates a new weight entry field for a sheet page.
Source Files ¶
- checkbox.go
- decimal_field.go
- dockable_kind.go
- drag_handle.go
- drawable_svg_pair.go
- entity_panel.go
- field_label.go
- grouped_closer.go
- helpers.go
- infopop.go
- integer_field.go
- length_field.go
- markdown.go
- modifiable_root.go
- non_editable_field.go
- numeric_field.go
- page.go
- page_non_editable_field.go
- percentage_field.go
- popup.go
- rebuildable.go
- scale.go
- search_field.go
- separator.go
- string_field.go
- sync.go
- target_manager.go
- target_undo.go
- titled_border.go
- weight_field.go
- wrapper.go