Documentation ¶
Overview ¶
Referenced code: https://github.com/golang/exp/blob/master/shiny/widget/flex/flex.go
Index ¶
- Variables
- type AlignContent
- type AlignItem
- type ButtonHandler
- type Direction
- type DrawHandler
- type DrawRectOpts
- type FillRectOpts
- type FlexAlign
- type FlexWrap
- type Justify
- type MouseHandler
- type MouseLeftButtonHandler
- type Position
- type TouchHandler
- type UpdateHandler
- type View
- func (v *View) AddChild(cv *View)
- func (v *View) Draw(screen *ebiten.Image)
- func (ct *View) HandleJustPressedMouseButtonLeft(x, y int) bool
- func (ct *View) HandleJustPressedTouchID(touchID ebiten.TouchID, x, y int) bool
- func (ct *View) HandleJustReleasedMouseButtonLeft(x, y int)
- func (ct *View) HandleJustReleasedTouchID(touchID ebiten.TouchID, x, y int)
- func (ct *View) HandleMouse(x, y int) bool
- func (v *View) PopChild() *View
- func (v *View) RemoveChild(cv *View) bool
- func (v *View) Update()
Constants ¶
This section is empty.
Variables ¶
var Debug = false
var G graphic
Functions ¶
This section is empty.
Types ¶
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 ButtonHandler ¶
type ButtonHandler 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) }
ButtonHandler represents a button component.
type DrawHandler ¶
type DrawHandler interface { // HandleDraw 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). HandleDraw(screen *ebiten.Image, frame image.Rectangle) }
DrawHandler represents a component that can be added to a container.
type DrawRectOpts ¶
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 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 MouseLeftButtonHandler ¶
type MouseLeftButtonHandler 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) }
MouseLeftButtonHandler 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.
type UpdateHandler ¶
type UpdateHandler interface {
// Updater updates the state of the component by one tick.
HandleUpdate()
}
UpdateHandler represents a component that updates by one tick.
type View ¶
type View struct { Left int Top int Width int Height int MarginLeft int MarginTop int MarginRight int MarginBottom int Position Position Handler DrawHandler Direction Direction Wrap FlexWrap Justify Justify AlignItems AlignItem AlignContent AlignContent // contains filtered or unexported fields }
func (*View) HandleJustPressedMouseButtonLeft ¶
func (*View) HandleJustPressedTouchID ¶
func (*View) HandleJustReleasedMouseButtonLeft ¶
func (ct *View) HandleJustReleasedMouseButtonLeft(x, y int)
func (*View) HandleJustReleasedTouchID ¶
func (ct *View) HandleJustReleasedTouchID(touchID ebiten.TouchID, x, y int)