Update docs.
This commit is contained in:
parent
13ffbd4fa3
commit
10b99f3ffb
27
README.md
27
README.md
|
@ -34,3 +34,30 @@ type Enclosure interface {
|
|||
|
||||
func Enclose(e Enclosure, w ...Widget) Widget { ... }
|
||||
```
|
||||
|
||||
The `Context` struct also contains a `map[string]interface{}` allowing arbitrary
|
||||
data to be maintained. This can be used, for example, to define themes, and control
|
||||
the operation of a `WidgetCombinator` during operation. For example>
|
||||
|
||||
```go
|
||||
type fWidget struct { l Layout }
|
||||
func NewfWidget(l layout) fWidget { return fWidget{ l: l } }
|
||||
|
||||
func (f Flex) Flexible(v float32) Widget {
|
||||
return NewfWidget(func(ctx Context) Context {
|
||||
ctx.extra["Flexible"] = v
|
||||
return ctx
|
||||
})
|
||||
}
|
||||
|
||||
...
|
||||
ctx = giowrap.LayoutWithContext(ctx,
|
||||
myFlex(
|
||||
w1,
|
||||
giowrap.Flexible(0.5),
|
||||
w2,
|
||||
giowrap.Flexible(1),
|
||||
w3,
|
||||
))
|
||||
...
|
||||
```
|
||||
|
|
|
@ -57,9 +57,9 @@ func main() {
|
|||
OuterInset(
|
||||
f(
|
||||
e1,
|
||||
f.Flexible(5),
|
||||
giowrap.Flexible(5),
|
||||
InnerInset(e2),
|
||||
f.Flexible(10),
|
||||
giowrap.Flexible(10),
|
||||
btn,
|
||||
)))
|
||||
ctx.Draw()
|
||||
|
|
Loading…
Reference in New Issue
Block a user