Add giowrap.Clickable().

This commit is contained in:
gmp
2019-08-15 17:47:46 -04:00
parent 03740d940b
commit 74951e8ce5
2 changed files with 38 additions and 30 deletions
+7 -7
View File
@@ -25,23 +25,23 @@ func main() {
ctx := giowrap.NewContext(w)
t := time.NewTicker(time.Second/30)
e1 := giowrap.NewEditor(ctx.Faces.For(regular, ui.Sp(24)), true)
e1.SetText("hi there")
e1.SetText("text 1")
e1.Focus()
e2 := giowrap.NewEditor(ctx.Faces.For(regular, ui.Sp(24)), true)
e2.SetText("ok bye")
e2.SetText("text 2")
f := giowrap.NewFlex(layout.Vertical, layout.Start, layout.Start)
OuterInset := giowrap.NewInset(ui.Dp(10),ui.Dp(10),ui.Dp(10),ui.Dp(10))
InnerInset := giowrap.NewInset(ui.Dp(10),ui.Dp(10),ui.Dp(10),ui.Dp(10))
lbl := giowrap.NewButton(
lbl := giowrap.NewLabel(
ctx.Faces.For(regular, ui.Sp(24)),
"centered",
"push",
text.Center,
)
bg := giowrap.NewBackground(giowrap.Rgb(0x3c98c6), ui.Dp(4))
btn := bg(lbl)
btn := giowrap.Clickable(bg(lbl))
for {
select {
@@ -52,7 +52,7 @@ func main() {
case app.DestroyEvent:
return
case app.DrawEvent:
ctx.Reset(e)
ctx = ctx.Reset(e)
ctx = giowrap.LayoutWithContext(ctx,
OuterInset(
f(
@@ -63,7 +63,7 @@ func main() {
btn,
)))
ctx.Draw()
if lbl.Clicked(ctx) {
if btn.Clicked(ctx) {
log.Print("Clicked: " + e2.Text() )
}
}