Documentation ¶
Overview ¶
Referenced code: https://github.com/golang/exp/blob/master/shiny/widget/flex/flex.go
Index ¶
- func SetIsDebug(val bool)
- type AbsolutePositionItem
- type AlignContent
- type AlignItem
- type Button
- type Container
- type Direction
- type Drawable
- type FixedSizeItem
- type Flex
- func (cont *Flex) AddChild(child Drawable)
- func (cont *Flex) AddChildContainer(child Container)
- func (cont *Flex) Draw(screen *ebiten.Image)
- func (cont *Flex) HandleJustPressedMouseButtonLeft(x, y int) bool
- func (cont *Flex) HandleJustPressedTouchID(touchID ebiten.TouchID, x, y int) bool
- func (cont *Flex) HandleJustReleasedMouseButtonLeft(x, y int)
- func (cont *Flex) HandleJustReleasedTouchID(touchID ebiten.TouchID, x, y int)
- func (cont *Flex) HandleMouse(x, y int) bool
- func (f *Flex) Margin() []int
- func (cont *Flex) SetFrame(frame image.Rectangle)
- func (cont *Flex) SetFramePosition(x, y int)
- func (f *Flex) SetMargin(m []int)
- func (cont *Flex) SetSize(w, h int)
- func (cont *Flex) Size() (int, int)
- func (f *Flex) Update()
- type FlexAlign
- type FlexWrap
- type Justify
- type MarginedItem
- type MouseHandler
- type MouseLeftClickHandler
- type TouchHandler
- type Updatable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetIsDebug ¶ added in v0.5.9
func SetIsDebug(val bool)
Types ¶
type AbsolutePositionItem ¶ added in v0.5.7
type AbsolutePositionItem interface { // Size returns the size(x,y) of the component. Size() (int, int) // Position returns the position(x,y) relative to it's parent container. Position() (int, int) }
AbsolutePositionItem represents a component with fixed size.
type AlignContent ¶
type AlignContent uint8
AlignContent is the 'align-content' property. It aligns container lines when there is extra space on the cross-axis.
const ( AlignContentStart AlignContent = iota AlignContentEnd AlignContentCenter AlignContentSpaceBetween AlignContentSpaceAround AlignContentStretch )
type Button ¶ added in v0.5.0
type Button interface { // HandlePress handle the event when user just started pressing the button // The parameter (x, y) is the location relative to the window (0,0). // touchID is the unique ID of the touch. // If the button is pressed by a mouse, touchID is -1. HandlePress(x, y int, t ebiten.TouchID) // HandleRelease handle the event when user just released the button. // The parameter (x, y) is the location relative to the window (0,0). // The parameter isCancel is true when the touch/left click is released outside of the button. HandleRelease(x, y int, isCancel bool) }
Button represents a button component.
type Container ¶
type Container interface { // SetFrame sets the location (x,y) and size (width,height) relative to the window (0,0). SetFrame(image.Rectangle) // AddChild adds a child component. AddChild(child Drawable) // AddChild adds a child component. AddChildContainer(child Container) // Draw draws its children component. Draw(screen *ebiten.Image) // Size returns the size(x,y) of the container. Size() (int, int) // Update updates the container. Update() // contains filtered or unexported methods }
Container represents a container that can have child components.
type Drawable ¶ added in v0.5.7
type Drawable interface { // Draw function draws the content of the component inside the frame. // The frame parameter represents the location (x,y) and size (width,height) relative to the window (0,0). Draw(screen *ebiten.Image, frame image.Rectangle) }
Drawable represents a UI component that can be added to a Flex container.
type FixedSizeItem ¶ added in v0.5.7
type FixedSizeItem interface { // Size returns the size(width, height) of the component. Size() (int, int) }
FixedSizeItem represents a component with fixed size.
type Flex ¶
type Flex struct { Direction Direction Wrap FlexWrap Justify Justify AlignItems AlignItem AlignContent AlignContent // contains filtered or unexported fields }
Flex is a container widget that lays out its children following the flexbox algorithm.
func (*Flex) AddChild ¶ added in v0.5.3
func (cont *Flex) AddChild(child Drawable)
AddChild adds child component
func (*Flex) AddChildContainer ¶ added in v0.5.3
func (cont *Flex) AddChildContainer(child Container)
AddChildContainer adds child container
func (*Flex) HandleJustPressedMouseButtonLeft ¶ added in v0.5.3
func (*Flex) HandleJustPressedTouchID ¶ added in v0.5.3
func (*Flex) HandleJustReleasedMouseButtonLeft ¶ added in v0.5.3
func (cont *Flex) HandleJustReleasedMouseButtonLeft(x, y int)
func (*Flex) HandleJustReleasedTouchID ¶ added in v0.5.3
func (cont *Flex) HandleJustReleasedTouchID(touchID ebiten.TouchID, x, y int)
func (*Flex) HandleMouse ¶ added in v0.5.3
func (*Flex) SetFrame ¶ added in v0.5.3
SetFrame sets the location (x,y) and size (width,height) relative to the window (0,0).
func (*Flex) SetFramePosition ¶ added in v0.5.3
func (cont *Flex) SetFramePosition(x, y int)
SetFramePosition sets the location (x,y) relative to the window (0,0).
func (*Flex) SetSize ¶ added in v0.5.0
func (cont *Flex) SetSize(w, h int)
SetSize sets the size of the flex container.
type FlexWrap ¶
type FlexWrap uint8
FlexWrap controls whether the container is single- or multi-line, and the direction in which the lines are laid out.
type MarginedItem ¶ added in v0.5.8
type MarginedItem interface { // Margin returns the size of margin int[]{top, riht, bottom, left} Margin() []int }
MarginedItem represents a component with fixed size.
type MouseHandler ¶
type MouseHandler interface { // HandleMouse handles the mouch move and returns true if it handle the mouse move. // The parameter (x, y) is the location relative to the window (0,0). HandleMouse(x, y int) bool }
MouseHandler represents a component that handle mouse move.
type MouseLeftClickHandler ¶ added in v0.5.0
type MouseLeftClickHandler interface { // HandleJustPressedMouseButtonLeft handle left mouse button click just pressed. // The parameter (x, y) is the location relative to the window (0,0). // It returns true if it handles the mouse move. HandleJustPressedMouseButtonLeft(x, y int) bool // HandleJustReleasedTouchID handles the touchID just released. // The parameter (x, y) is the location relative to the window (0,0). HandleJustReleasedMouseButtonLeft(x, y int) }
MouseLeftClickHandler represents a component that handle mouse button left click.
type TouchHandler ¶
type TouchHandler interface { // HandleJustPressedTouchID handles the touchID just pressed and returns true if it handles the TouchID HandleJustPressedTouchID(touch ebiten.TouchID, x, y int) bool // HandleJustReleasedTouchID handles the touchID just released // Should be called only when it handled the TouchID when pressed HandleJustReleasedTouchID(touch ebiten.TouchID, x, y int) }
TouchHandler represents a component that handle touches.