Documentation ¶
Index ¶
- type Anchor
- type Flow
- type GridComponent
- type GridConfig
- type GridEngine
- func (g *GridEngine) Add(b *uik.Block, bd GridComponent)
- func (g *GridEngine) AddName(name string, b *uik.Block)
- func (g *GridEngine) ConfigUnsafe(cfg interface{})
- func (g *GridEngine) GetHint() (hint uik.SizeHint)
- func (g *GridEngine) GetLayout(size geom.Coord) (layout Layout)
- func (g *GridEngine) Remove(b *uik.Block)
- func (g *GridEngine) SetConfig(cfg GridConfig)
- func (g *GridEngine) SetHint(block *uik.Block, hint uik.SizeHint)
- func (g *GridEngine) SetLayouter(layouter *Layouter)
- type Layout
- type LayoutEngine
- type Layouter
- type PadConfig
- type PadLayout
- func (p *PadLayout) ConfigUnsafe(cfg interface{})
- func (p *PadLayout) GetHint() (hint uik.SizeHint)
- func (p *PadLayout) GetLayout(size geom.Coord) (l Layout)
- func (p *PadLayout) SetBlock(block *uik.Block)
- func (p *PadLayout) SetConfig(cfg PadConfig)
- func (p *PadLayout) SetHint(block *uik.Block, hint uik.SizeHint)
- func (p *PadLayout) SetLayouter(layouter *Layouter)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flow ¶
type Flow struct { uik.Foundation Add chan *uik.Block Remove chan *uik.Block // contains filtered or unexported fields }
func (*Flow) HandleEvents ¶
func (f *Flow) HandleEvents()
dispense events to children, as appropriate
func (*Flow) Initialize ¶
func (f *Flow) Initialize()
type GridComponent ¶
type GridComponent struct {
// The coordinates for the top-left of the block's placement
GridX, GridY int
// How many extra columns and rows the block occupies
ExtraX, ExtraY int
// AnchorX and AnchorY get the bit flags from AnchorMin and AnchorMax. The
// zero value means they will float in the center.
AnchorTop, AnchorBottom bool
AnchorLeft, AnchorRight bool
// The zero-values for MinSize, PreferredSize and MaxSize tell the grid to ignore them
MinSize, PreferredSize, MaxSize geom.Coord
}
type GridConfig ¶
type GridConfig struct {
Components map[string]GridComponent
}
func ParseGridConfig ¶
func ParseGridConfig(fmt string) (cfg GridConfig, err error)
func ReadGridConfig ¶
func ReadGridConfig(r io.Reader) (cfg GridConfig, err error)
type GridEngine ¶
type GridEngine struct {
// contains filtered or unexported fields
}
func NewGridEngine ¶
func NewGridEngine(config GridConfig) (g *GridEngine)
func (*GridEngine) Add ¶
func (g *GridEngine) Add(b *uik.Block, bd GridComponent)
func (*GridEngine) AddName ¶
func (g *GridEngine) AddName(name string, b *uik.Block)
func (*GridEngine) ConfigUnsafe ¶
func (g *GridEngine) ConfigUnsafe(cfg interface{})
func (*GridEngine) GetHint ¶
func (g *GridEngine) GetHint() (hint uik.SizeHint)
func (*GridEngine) Remove ¶
func (g *GridEngine) Remove(b *uik.Block)
func (*GridEngine) SetConfig ¶
func (g *GridEngine) SetConfig(cfg GridConfig)
func (*GridEngine) SetHint ¶
func (g *GridEngine) SetHint(block *uik.Block, hint uik.SizeHint)
func (*GridEngine) SetLayouter ¶
func (g *GridEngine) SetLayouter(layouter *Layouter)
type LayoutEngine ¶
type LayoutEngine interface { // The layouter using this engine. The engine should use this // layouter's .AddBlock(), .RemoveBlock(), .Invalidate() // methods, etc. SetLayouter(layouter *Layouter) // Set the hint associated with this block. SetHint(block *uik.Block, hint uik.SizeHint) // Return the hint that the Layouter will report. GetHint() uik.SizeHint // Get the bounds for each of the blocks in this layout. GetLayout(size geom.Coord) Layout // Items sent on the config channel will appear as a parameter // to this function. It is suffixed by "Unsafe" to deter // sites other than the Layouter from calling it, since it // would not be safe for them. ConfigUnsafe(cfg interface{}) }
Implement this interface with your own layout code. All methods listed in this interface will be called from the same goroutine in the Layouter, so no mutual thread-safety is needed. However, if your implementing type has more methods (perhaps to add a new block, or to set configuration data), those methods will need to implement some sort of thread-safety when manipulating the data accessed by the LayoutEngine methods.
type Layouter ¶
type Layouter struct { uik.Foundation // contains filtered or unexported fields }
func HBox ¶
func HBox(config GridConfig, blocks ...*uik.Block) (l *Layouter)
func NewGrid ¶
func NewGrid(cfg GridConfig) (l *Layouter)
func NewLayouter ¶
func NewLayouter(engine LayoutEngine) (l *Layouter)
func VBox ¶
func VBox(config GridConfig, blocks ...*uik.Block) (l *Layouter)
func (*Layouter) HandleEvents ¶
func (l *Layouter) HandleEvents()
dispense events to children, as appropriate
func (*Layouter) Initialize ¶
func (l *Layouter) Initialize()
type PadLayout ¶
type PadLayout struct {
// contains filtered or unexported fields
}
func NewPadLayout ¶
func (*PadLayout) ConfigUnsafe ¶
func (p *PadLayout) ConfigUnsafe(cfg interface{})
Do not call this method except from within the containing Layout's goroutine.
func (*PadLayout) SetLayouter ¶
Click to show internal directories.
Click to hide internal directories.