ui,ui/app: convert Config to an interface

To keep the interface slim, remove the helper methods and shorten
the essential method, Pixels, to Px.

Add and use unexported Config implementation in the app package.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-07-10 16:40:53 +02:00
parent 624ef78e1c
commit 32aae18293
14 changed files with 104 additions and 104 deletions
+5 -5
View File
@@ -96,14 +96,14 @@ type Insets struct {
cs Constraints
}
func (in *Insets) Begin(c *ui.Config, ops *ui.Ops, cs Constraints) Constraints {
func (in *Insets) Begin(c ui.Config, ops *ui.Ops, cs Constraints) Constraints {
if in.begun {
panic("must End before Begin")
}
in.top = c.Pixels(in.Top)
in.right = c.Pixels(in.Right)
in.bottom = c.Pixels(in.Bottom)
in.left = c.Pixels(in.Left)
in.top = c.Px(in.Top)
in.right = c.Px(in.Right)
in.bottom = c.Px(in.Bottom)
in.left = c.Px(in.Left)
in.begun = true
in.ops = ops
in.cs = cs
+1 -1
View File
@@ -18,7 +18,7 @@ type scrollChild struct {
}
type List struct {
Config *ui.Config
Config ui.Config
Inputs input.Events
Axis Axis
Invert bool