-
Notifications
You must be signed in to change notification settings - Fork 0
/
widget.go
45 lines (37 loc) · 848 Bytes
/
widget.go
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
43
44
package renlite
import (
"fyne.io/fyne/v2/widget"
)
// TextGrid
func TextGrid(id ...string) *widget.TextGrid {
grid := widget.NewTextGrid()
if id[0] != "" {
getSrv().widgets[id[0]] = grid
}
return grid
}
func GetTextGrid(id string) *widget.TextGrid {
return GetWidget(id).(*widget.TextGrid)
}
// Label
func Lable(text string, id ...string) *widget.Label {
label := widget.NewLabel(text)
if id[0] != "" {
getSrv().widgets[id[0]] = label
}
return label
}
func GetLabel(id string) *widget.Label {
return GetWidget(id).(*widget.Label)
}
// Button
func Button(label string, tapped func(), id ...string) *widget.Button {
button := widget.NewButton("Hi Ui OpenGL!", tapped)
if id[0] != "" {
getSrv().widgets[id[0]] = button
}
return button
}
func GetButton(id string) *widget.Button {
return GetWidget(id).(*widget.Button)
}