Documentation fix.

This commit is contained in:
Greg 2019-08-16 20:31:50 -04:00
parent bfd6ae49df
commit a463c073ed

View File

@ -32,9 +32,12 @@ type Enclosure interface {
func Enclose(e Enclosure, w ...Widget) Widget { ... } func Enclose(e Enclosure, w ...Widget) Widget { ... }
``` ```
The `Context` struct also contains a `map[string]interface{}` allowing arbitrary The giowrap package also includes a private package-global variable called
data to be maintained. This can be used, for example, to define themes, and control extra that is a []interface{}, allowing arbitrary data to be maintained by
the operation of a `WidgetCombinator` during operation. For example> UI elements. Elements can request access to the structure when they are
allocated and they are returned a unique integer index into the slice. This
can be used, for example, to define themes, and control
the operation of a `WidgetCombinator` during operation. For example:
```go ```go
type fWidget struct { l Layout } type fWidget struct { l Layout }
@ -42,7 +45,7 @@ func NewfWidget(l layout) fWidget { return fWidget{ l: l } }
func Flexible(v float32) Widget { func Flexible(v float32) Widget {
return NewfWidget(func(ctx Context) Context { return NewfWidget(func(ctx Context) Context {
ctx.extra["Flexible"] = v extra.data[extra.cur].(*FlexOpts).flexible = v
return ctx return ctx
}) })
} }