Documentation
¶
Overview ¶
Package std provides a collection of standard components that can be used with the ui framework.
Index ¶
- Constants
- Variables
- type AccordionCallbackData
- type AccordionData
- type BaseButtonComponent
- type ButtonCallbackData
- type ButtonData
- type ButtonState
- type CheckboxCallbackData
- type CheckboxData
- type CodeAreaCallbackData
- type CodeAreaData
- type ContainerData
- type DropZoneCallbackData
- type DropdownCallbackData
- type DropdownData
- type DropdownItem
- type EditBoxCallbackData
- type EditBoxData
- type ElementData
- type ImageMode
- type LabelData
- type ListItemCallbackData
- type ListItemData
- type OnActionFunc
- type PaperData
- type PictureData
- type ScrollPaneData
- type SpacingData
- type SwitchData
- type TabbarTabCallbackData
- type TabbarTabData
- type ToolbarButtonCallbackData
- type ToolbarButtonData
- type ToolbarData
- type ToolbarLogoData
- type ToolbarPositioning
- type ViewportCallbackData
- type ViewportData
Constants ¶
const ( CheckboxContentSpacing = 5 CheckboxIconSize = 24 CheckboxFontSize = float32(20) CheckboxFontFile = "ui:///roboto-regular.ttf" CheckboxCheckedIconFile = "ui:///checked.png" CheckboxUncheckedIconFile = "ui:///unchecked.png" )
Variables ¶
var ( AccordionHeaderPadding = 2 AccordionHeaderContentSpacing = 5 AccordionHeaderIconSize = 24 AccordionHeaderFontSize = float32(20) AccordionHeaderFontFile = "ui:///roboto-regular.ttf" AccordionExpandedIconFile = "ui:///expanded.png" AccordionCollapsedIconFile = "ui:///collapsed.png" )
var ( ButtonSidePadding = 6 ButtonContentSpacing = 5 ButtonIconSize = 24 ButtonHeight = 28 ButtonFontFile = "ui:///roboto-regular.ttf" ButtonFontSize = float32(18) )
var ( DropdownFontSize = float32(18) DropdownFontFile = "ui:///roboto-regular.ttf" DropdownIconSize = 24 DropdownIconFile = "ui:///expanded.png" )
var ( DropdownItemIndicatorSize = 20 DropdownItemIndicatorPadding = 5 )
var ( DropdownListFontSize = float32(18) DropdownListFontFile = "ui:///roboto-regular.ttf" )
var ( LabelFontFile = "ui:///roboto-regular.ttf" LabelFontSize = float32(24.0) )
var ( PaperPadding = 5 PaperBorderSize = float32(1.0) PaperRoundness = float32(10.0) )
var ( TabbarHeight = 40 TabbarItemSpacing = 2 TabbarSidePadding = 5 )
var ( TabbarTabHeight = TabbarHeight TabbarTabTopPadding = 5 TabbarTabSidePadding = 10 TabbarTabContentSpacing = 5 TabbarTabIconSize = 24 TabbarTabFontFile = "ui:///roboto-regular.ttf" TabbarTabFontSize = float32(20) TabbarTabCloseIconFile = "ui:///close.png" TabbarTabRadius = float32(15) )
var ( PrimaryColor ui.Color = ui.RGB(0x40, 0x89, 0xBD) OnPrimaryColor ui.Color = ui.RGB(0x00, 0x00, 0x00) PrimaryLightColor ui.Color = ui.RGB(0x7C, 0xAE, 0xEB) OnPrimaryLightColor ui.Color = ui.RGB(0x00, 0x00, 0x00) PrimaryDarkColor ui.Color = ui.RGB(0x32, 0x59, 0x73) OnPrimaryDarkColor ui.Color = ui.RGB(0xFF, 0xFF, 0xFF) SecondaryColor ui.Color = ui.RGB(0x8B, 0xC3, 0x4A) OnSecondaryColor ui.Color = ui.RGB(0x00, 0x00, 0x00) SecondaryLightColor ui.Color = ui.RGB(0xA9, 0xC2, 0x8A) OnSecondaryLightColor ui.Color = ui.RGB(0x00, 0x00, 0x00) SecondaryDarkColor ui.Color = ui.RGB(0x4B, 0x6B, 0x3A) OnSecondaryDarkColor ui.Color = ui.RGB(0xFF, 0xFF, 0xFF) BackgroundColor ui.Color = ui.RGB(0x3B, 0x3B, 0x3B) OnBackgroundColor ui.Color = ui.RGB(0xFF, 0xFF, 0xFF) SurfaceColor ui.Color = ui.RGB(0xFF, 0xFF, 0xFF) OnSurfaceColor ui.Color = ui.RGB(0x00, 0x00, 0x00) ErrorColor ui.Color = ui.RGB(0xB3, 0x1E, 0x00) OnErrorColor ui.Color = ui.RGB(0xFF, 0xFF, 0xFF) OutlineColor ui.Color = ui.RGB(0xB0, 0xB0, 0xB0) HoverOverlayColor ui.Color = ui.RGBA(0x00, 0x00, 0x00, 0x40) PressOverlayColor ui.Color = ui.RGBA(0x00, 0x00, 0x00, 0x80) ModalOverlayColor ui.Color = ui.RGBA(0x00, 0x00, 0x00, 0xA0) )
var ( ToolbarHeight = 48 ToolbarBorderSize = 1 ToolbarSidePadding = 5 ToolbarItemSpacing = 10 ToolbarItemHeight = ToolbarHeight - 2*ToolbarBorderSize )
var ( ToolbarButtonSidePadding = 4 ToolbarButtonContentSpacing = 5 ToolbarButtonIconSize = 24 ToolbarButtonFontFile = "ui:///roboto-regular.ttf" ToolbarButtonFontSize = float32(20) ToolbarBottonSelectionHeight = float32(5.0) )
var ( ToolbarLogoSidePadding = 4 ToolbarLogoContentSpacing = 5 ToolbarLogoIconSize = 24 ToolbarLogoFontFile = "ui:///roboto-bold.ttf" ToolbarLogoFontSize = float32(20) ToolbarLogoSelectionHeight = float32(5.0) )
var ( ToolbarSeparatorWidth = 3 ToolbarSeparatorLineSize = float32(1.0) ToolbarSeparatorLineLengthRatio = float32(0.7) )
var ( ViewportInitialFBWidth = uint32(400) ViewportInitialFBHeight = uint32(300) )
var Accordion = co.Define(&accordionComponent{})
var Button = co.Define(&buttonComponent{})
Button is a component that allows a user click on it to activate a process.
var Checkbox = co.Define(&checkboxComponent{})
var CodeArea = co.Define(&codeAreaComponent{})
var Container = co.Define(&containerComponent{})
Container represents a component that holds other components and has some sort of visual boundary.
var DropZone = co.Define(&dropZoneComponent{})
DropZone is a transparent component that handles file drop events.
It is intended to be used as a container for a different component that provides a visual aid (e.g. an upload icon or some type of viewport).
var Dropdown = co.Define(&dropdownComponent{})
var EditBox = co.Define(&editboxComponent{})
var Element = co.Element
Element represents the most basic component, which is translated to a UI Element. All higher-order components eventually boil down to an Element.
var Label = co.Define(&labelComponent{})
Label represents a component that visualizes a text string.
var List = co.Define(&listComponent{})
List represents a container that holds a sequence of ListItem components in a vertical orientation.
var ListItem = co.Define(&listItemComponent{})
ListItem represents a component to be displayed in a List.
var (
ListItemPadding = 2
)
var (
ListItemSpacing = 2
)
var Modal = co.Define(&modalComponent{})
var Paper = co.Define(&paperComponent{})
Paper represents an outlined container.
var Picture = co.Define(&pictureComponent{})
var ScrollPane = co.Define(&scrollPaneComponent{})
ScrollPane is a container component that provides scrolling functionality in order to accommodate all children.
var Spacing = co.Define(&spacingComponent{})
Spacing represents an invisible component that requests that a specific amount of visual space be reserved for it.
var Switch = co.Define(&switchComponent{})
Switch is a container that can switch between different views depending on the specified SwitchData.
var Tabbar = co.Define(&tabbarComponent{})
var TabbarTab = co.Define(&tabbarTabComponent{})
var Toolbar = co.Define(&toolbarComponent{})
Toolbar represents a container that holds key controls (mostly buttons) in a horizontal fashion.
var ToolbarButton = co.Define(&toolbarButtonComponent{})
var ToolbarLogo = co.Define(&toolbarLogoComponent{})
ToolbarLogo is used to display a logo on the Toolbar. Usually this would be the first item in a Toolbar.
var ToolbarSeparator = co.Define(&toolbarSeparatorComponent{})
var Viewport = co.Define(&viewportComponent{})
Viewport represents a component that uses low-level API calls to render an external scene, unlike other components that rely on the Canvas API.
Functions ¶
This section is empty.
Types ¶
type AccordionCallbackData ¶
type AccordionCallbackData struct {
OnToggle func(bool)
}
AccordionCallbackData holds the callback data for an Accordion container.
type AccordionData ¶
AccordionData holds the data for an Accordion container.
type BaseButtonComponent ¶
type BaseButtonComponent struct {
// contains filtered or unexported fields
}
BaseButtonComponent provides a basic mouse event handling for a button component.
Users are expected to compose this structure into a component implementation that can do the actual rendering.
func (*BaseButtonComponent) OnClickFunc ¶
func (c *BaseButtonComponent) OnClickFunc() OnActionFunc
func (*BaseButtonComponent) OnMouseEvent ¶
func (c *BaseButtonComponent) OnMouseEvent(element *ui.Element, event ui.MouseEvent) bool
func (*BaseButtonComponent) SetOnClickFunc ¶
func (c *BaseButtonComponent) SetOnClickFunc(onAction OnActionFunc)
func (*BaseButtonComponent) State ¶
func (c *BaseButtonComponent) State() ButtonState
type ButtonCallbackData ¶
type ButtonCallbackData struct {
OnClick OnActionFunc
}
ButtonCallbackData holds the callback data for the Button component.
type ButtonData ¶
ButtonData holds the data for the Button component.
type ButtonState ¶
type ButtonState int
ButtonState indicates the state of a Button control.
const ( // ButtonStateUp indicates that the button is in its default state. ButtonStateUp ButtonState = iota // ButtonStateOver indicates that the cursor is over the button. ButtonStateOver // ButtonStateDown indicates that the cursor is pressing on the button. ButtonStateDown )
type CheckboxCallbackData ¶ added in v0.16.0
type CheckboxCallbackData struct {
OnToggle func(bool)
}
type CheckboxData ¶ added in v0.16.0
type CodeAreaCallbackData ¶ added in v0.16.0
type CodeAreaCallbackData struct {
OnChange func(string)
}
type CodeAreaData ¶ added in v0.16.0
type ContainerData ¶
type ContainerData struct { BackgroundColor opt.T[ui.Color] BorderColor opt.T[ui.Color] BorderSize ui.Spacing Padding ui.Spacing Layout ui.Layout }
ContainerData holds the data for a Container component.
type DropZoneCallbackData ¶
DropZoneCallbackData can be used to specify callback data for a DropZone component.
type DropdownCallbackData ¶
type DropdownCallbackData struct {
OnItemSelected func(key any)
}
DropdownCallbackData holds the callback data for a Dropdown container.
type DropdownData ¶
type DropdownData struct { Items []DropdownItem SelectedKey any }
DropdownData holds the data for a Dropdown container.
type DropdownItem ¶
DropdownItem represents a single dropdown entry.
type EditBoxCallbackData ¶ added in v0.16.0
type EditBoxData ¶ added in v0.16.0
type ElementData ¶
type ElementData = co.ElementData
ElementData is the struct that should be used when configuring an Element component's data.
type ImageMode ¶
type ImageMode int
ImageMode determines how an image is displayed within a Picture control.
const ( // ImageModeStretch will stretch the image to cover the // available draw area in the control. ImageModeStretch ImageMode = iota // ImageModeFit will preserve the aspect ratio of the image // and will scale it up or down so that the image takes as // much space of the draw area as possible, without exiting // the bounds of the area. ImageModeFit // ImageModeCover will preserve the aspect ratio of the image // while also ensuring it covers the entire draw area. This // usually means that part of the image will be outside the // bounds of the control and will not be visible. ImageModeCover )
type LabelData ¶
type LabelData struct { Font *ui.Font FontSize opt.T[float32] FontColor opt.T[ui.Color] Text string }
LabelData holds the data for the Label component.
type ListItemCallbackData ¶
type ListItemCallbackData struct {
OnSelected OnActionFunc
}
ListItemCallbackData holds the callback data for a ListItem component.
type ListItemData ¶
type ListItemData struct {
Selected bool
}
ListItemData holds the data for a ListItem component.
type OnActionFunc ¶
type OnActionFunc func()
OnActionFunc can be used to get notifications about action (click) events.
type PictureData ¶
type PictureData struct { // BackgroundColor specifies the color to be rendered behind the image. BackgroundColor opt.T[ui.Color] // Image specifies the Image to be displayed. Image *ui.Image // ImageColor specifies an optional multiplier color. ImageColor opt.T[ui.Color] // Mode specifies how the image will be scaled and visualized within the // Picture component. Mode ImageMode }
PictureData represents the available data properties for the Picture component.
type ScrollPaneData ¶
type ScrollPaneData struct { // DisableHorizontal stops the pane from scrolling horizontally. DisableHorizontal bool // DisableVertical stops the pane from scrolling vertically. DisableVertical bool // Focused specifies whether this scroll pane should automatically get // the focus. Focused bool }
ScrollPaneData holds the available configuration options for the ScrollPane component.
type SpacingData ¶
SpacingData holds the configuration data for a Spacing component.
type SwitchData ¶
type SwitchData struct { // ChildKey holds the key of the child component to be rendered. // If this does not match any child then nothing is rendered. ChildKey string }
SwitchData holds the data for a Switch component.
type TabbarTabCallbackData ¶
type TabbarTabCallbackData struct { OnClick OnActionFunc OnClose OnActionFunc }
TabbarTabCallbackData holds the callback data for a TabbarTab component.
type TabbarTabData ¶
TabbarTabData holds the data for a TabbarTab component.
type ToolbarButtonCallbackData ¶
type ToolbarButtonCallbackData struct {
OnClick OnActionFunc
}
ToolbarButtonCallbackData holds the callback handlers for a ToolbarButton component.
type ToolbarButtonData ¶
ToolbarButtonData holds the data for a ToolbarButton component.
type ToolbarData ¶
type ToolbarData struct {
Positioning ToolbarPositioning
}
ToolbarData can be used to specify configuration for the Toolbar component.
type ToolbarLogoData ¶ added in v0.12.0
ToolbarLogoData holds the data for a ToolbarLogo component.
type ToolbarPositioning ¶
type ToolbarPositioning int
ToolbarPositioning determines the visual appearance of the toolbar, depending on where it is intended to be placed on the screen.
const ( ToolbarPositioningTop ToolbarPositioning = iota ToolbarPositioningMiddle ToolbarPositioningBottom )
type ViewportCallbackData ¶
type ViewportCallbackData struct { OnKeyboardEvent func(element *ui.Element, event ui.KeyboardEvent) bool OnMouseEvent func(element *ui.Element, event ui.MouseEvent) bool OnRender func(framebuffer render.Framebuffer, fbSize ui.Size) }
ViewportCallbackData holds the callback data for a Viewport component.
type ViewportData ¶
ViewportData holds the data for a Viewport component.
Source Files
¶
- accordion.go
- button.go
- checkbox.go
- codearea.go
- codearea_action.go
- codearea_change.go
- codearea_draw.go
- codearea_navigation.go
- codearea_selection.go
- container.go
- doc.go
- dropdown.go
- dropdown_item.go
- dropdown_list.go
- dropzone.go
- editbox.go
- editbox_action.go
- editbox_change.go
- editbox_draw.go
- editbox_navigation.go
- editbox_selection.go
- element.go
- label.go
- list.go
- list_item.go
- modal.go
- paper.go
- picture.go
- scroll_pane.go
- spacing.go
- switch.go
- tabbar.go
- tabbar_tab.go
- theme.go
- toolbar.go
- toolbar_button.go
- toolbar_logo.go
- toolbar_separator.go
- viewport.go