-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlabelimpl.go
62 lines (52 loc) · 1.16 KB
/
labelimpl.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//go:build impl
package faithtop
import (
"github.com/therecipe/qt/core"
"github.com/therecipe/qt/widgets"
"strconv"
"strings"
)
type LabelImpl struct {
*WidgetImpl
label *widgets.QLabel
}
func init() {
newLabelImpl = func() ILabel {
v := &LabelImpl{
label: widgets.NewQLabel(nil, 0),
}
v.WidgetImpl = widgetImplFrom(v.label.QWidget_PTR())
return v
}
}
func (l *LabelImpl) Text(s string) ILabel {
l.label.SetText(s)
return l
}
func (l *LabelImpl) Assign(v *ILabel) ILabel {
*v = l
return l
}
func (l *LabelImpl) Interaction(flags TextInteractionFlag) ILabel {
l.label.SetTextInteractionFlags(core.Qt__TextInteractionFlag(flags))
return l
}
func (l *LabelImpl) Image(url string, w, h int) ILabel {
builder := new(strings.Builder)
builder.WriteString("<img src='" + url + "' ")
if w > 0 {
builder.WriteString("width='" + strconv.Itoa(w) + "' ")
}
if h > 0 {
builder.WriteString("height='" + strconv.Itoa(h) + "' ")
}
builder.WriteString(">")
return l.Text(builder.String())
}
func (l *LabelImpl) GetText() string {
return l.label.Text()
}
func (l *LabelImpl) OpenExternalLinks(b bool) ILabel {
l.label.SetOpenExternalLinks(b)
return l
}