summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/button.go
blob: 59ec51cc6e0281fc2bbfce27a76dc229081b7b58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main

import (
	"github.com/andlabs/ui"
	_ "github.com/andlabs/ui/winmanifest"

	"git.wit.org/wit/gui/toolkit"
)

func newButton(a *toolkit.Action) {
	var t, newt *andlabsT
	var b *ui.Button
	log(debugToolkit, "newButton()", a.Title)

	t = andlabs[a.WhereId]
	if (t == nil) {
		log(debugToolkit, "newButton() toolkit struct == nil. name=", a.Title)
		return
	}

	newt = new(andlabsT)

	b = ui.NewButton(a.Title)
	newt.uiButton = b
	newt.uiControl = b
	newt.tw = a.Widget
	newt.Type = a.WidgetT
	newt.parent = t

	b.OnClicked(func(*ui.Button) {
		newt.commonChange(newt.tw, a.WidgetId)
	})

	place(a, t, newt)
	// mapWidgetsToolkits(a, newt)
}