Documentation ¶
Overview ¶
Package layout provides a Layout system for faiface/gui.
The core of the package is the Layout interface, everything else is just implementation.
The Layouts represent a Layout, and the Mux makes them usable. The Mux basically acts as a sort of driver.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Grid ¶
type Grid struct { // Rows represents the number of childs of each row. Rows []int // Background represents the background of the grid as a uniform color. Background color.Color // Gap represents the grid gap, equal on all sides. Gap int // Split represents the way the space is divided among the columns in each row. Split SplitFunc // SplitRows represents the way the space is divided among the rows. SplitRows SplitFunc Margin int Border int BorderColor color.Color // Flip represents the orientation of the grid. // When false, rows are spread in the Y axis and columns in the X axis. // When true, rows are spread in the X axis and columns in the Y axis. Flip bool }
Grid represents a grid with rows and columns in each row. Each row can be a different length.
type Intercepter ¶
Intercepter represents an element that can interact with Envs. An Intercepter can modify Events, stop them or emit arbitrary ones. It can also put itself in the draw pipeline, for throttling very expensive draw calls for example.
type Layout ¶
type Layout interface { Lay(image.Rectangle) []image.Rectangle Intercepter }
Layout represents any graphical layout
Lay represents the way to divide space among your childs. It takes a parameter of how much space is available, and returns where exactly to put its childs.
Intercept transforms an Env channel to another. This way the Layout can emit its own Events, re-emit previous ones, or even stop an event from propagating, think win.MoScroll. It can be a no-op.
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux can be used to multiplex an Env, let's call it a root Env. Mux implements a way to create multiple virtual Envs that all interact with the root Env. They receive the same events apart from gui.Resize, and their draw functions get redirected to the root Env.
All gui.Resize events are instead modified according to the underlying Layout. The master Env gets the original gui.Resize events.
type RedrawIntercepter ¶
RedrawIntercepter is a basic Intercepter, it is meant for use in simple Layouts that only need to redraw themselves.