summaryrefslogtreecommitdiff
path: root/node.go
blob: 26e2efe501b85b5c4e7011519b37599212e8bae4 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0

package main

import (
	"go.wit.com/widget"
)

func (tk *guiWidget) WidgetType() widget.WidgetType {
	if tk.node == nil {
		return widget.Label
	}
	return tk.node.WidgetType
}

func (tk *guiWidget) WidgetId() int {
	return tk.node.WidgetId
}

func (tk *guiWidget) GetLabel() string {
	return tk.node.GetLabel()
}

func (tk *guiWidget) IsEnabled() bool {
	return tk.node.IsEnabled()
}

func (tk *guiWidget) Checked() bool {
	return tk.node.State.Checked
}

func (tk *guiWidget) Hidden() bool {
	if tk.node == nil {
		return false
	}
	if tk.parent == nil {
		return tk.node.Hidden()
	}
	if tk.parent.WidgetId() == 0 {
		return tk.node.Hidden()
	}
	if tk.parent.Hidden() {
		return true
	}
	return tk.node.Hidden()
}

func (tk *guiWidget) Direction() widget.Orientation {
	return tk.node.State.Direction
}

func (tk *guiWidget) GridW() int {
	return tk.node.State.AtW
}

func (tk *guiWidget) GridH() int {
	return tk.node.State.AtH
}

func (tk *guiWidget) SetChecked(b bool) {
	tk.node.State.Checked = b
}