Fixed up Grid and Space() documentation.
This commit is contained in:
parent
c6cafdd402
commit
d55b2a9d18
2
grid.go
2
grid.go
|
@ -9,7 +9,9 @@ import (
|
||||||
// A Grid arranges Controls in a two-dimensional grid.
|
// A Grid arranges Controls in a two-dimensional grid.
|
||||||
// All Controls in a Grid maintain their preferred sizes.
|
// All Controls in a Grid maintain their preferred sizes.
|
||||||
// The height of each row and the width of each column is the maximum preferred height and width (respectively) of all the controls in that row or column (respectively).
|
// The height of each row and the width of each column is the maximum preferred height and width (respectively) of all the controls in that row or column (respectively).
|
||||||
|
// Controls are aligned to the top left corner of each cell.
|
||||||
// Unlike other UI toolkit Grids, this Grid does not (yet?) allow Controls to span multiple rows or columns.
|
// Unlike other UI toolkit Grids, this Grid does not (yet?) allow Controls to span multiple rows or columns.
|
||||||
|
// TODO differnet row/column control alignment; stretchy controls or other resizing options
|
||||||
type Grid struct {
|
type Grid struct {
|
||||||
lock sync.Mutex
|
lock sync.Mutex
|
||||||
created bool
|
created bool
|
||||||
|
|
8
stack.go
8
stack.go
|
@ -164,8 +164,12 @@ func (s *Stack) preferredSize() (width int, height int, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Space returns a null control intended for padding layouts with blank space where otherwise impossible (for instance, at the beginning or in the middle of a Stack).
|
// Space returns a null control intended for padding layouts with blank space.
|
||||||
// In order for a Space to work, it must be marked as stretchy in its parent layout; otherwise its size is undefined.
|
// It appears to its owner as a control of 0x0 size.
|
||||||
|
//
|
||||||
|
// For a Stack, Space can be used to insert spaces in the beginning or middle of Stacks (Stacks by nature handle spaces at the end themselves). In order for this to work properly, make the Space stretchy.
|
||||||
|
//
|
||||||
|
// For a Grid, Space can be used to have an empty cell. (TODO stretching/sizing rules)
|
||||||
func Space() Control {
|
func Space() Control {
|
||||||
// As above, a Stack with no controls draws nothing and reports no errors; its parent will still size it properly if made stretchy.
|
// As above, a Stack with no controls draws nothing and reports no errors; its parent will still size it properly if made stretchy.
|
||||||
return NewStack(Horizontal)
|
return NewStack(Horizontal)
|
||||||
|
|
Loading…
Reference in New Issue