summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/label.go
blob: c5a6896b9d8125909cdff790b41b9b73fcc60421 (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
37
38
39
40
41
42
package main

import "log"

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

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

func NewLabel(parentW *toolkit.Widget, w *toolkit.Widget) {
	var t, newt *andlabsT
	log.Println("gui.andlabs.NewButton()", w.Name)

	t = mapToolkits[parentW]
	if (t == nil) {
		log.Println("go.andlabs.NewButton() toolkit struct == nil. name=", parentW.Name, w.Name)
		return
	}

	if t.broken() {
		return
	}
	newt = new(andlabsT)

	newt.uiLabel = ui.NewLabel(w.Name)
	newt.uiBox = t.uiBox

	if (DebugToolkit) {
		log.Println("gui.Toolbox.NewButton() about to append to Box parent t:", w.Name)
		t.Dump()
		log.Println("gui.Toolbox.NewButton() about to append to Box new t:", w.Name)
		newt.Dump()
	}
	if (t.uiBox != nil) {
		t.uiBox.Append(newt.uiLabel, false)
	} else {
		log.Println("ERROR: wit/gui andlabs couldn't place this label in a box")
		return
	}

	mapWidgetsToolkits(w, newt)
}