/
textedit.go
52 lines (43 loc) · 1.3 KB
/
textedit.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
// Copyright 2012 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package declarative
import (
"github.com/lxn/walk"
)
type TextEdit struct {
AssignTo **walk.TextEdit
Name string
Disabled bool
Hidden bool
Font Font
MinSize Size
MaxSize Size
StretchFactor int
Row int
RowSpan int
Column int
ColumnSpan int
ContextMenuActions []*walk.Action
Text string
ReadOnly bool
}
func (te TextEdit) Create(parent walk.Container) error {
w, err := walk.NewTextEdit(parent)
if err != nil {
return err
}
return InitWidget(te, w, func() error {
if err := w.SetText(te.Text); err != nil {
return err
}
w.SetReadOnly(te.ReadOnly)
if te.AssignTo != nil {
*te.AssignTo = w
}
return nil
})
}
func (te TextEdit) WidgetInfo() (name string, disabled, hidden bool, font *Font, minSize, maxSize Size, stretchFactor, row, rowSpan, column, columnSpan int, contextMenuActions []*walk.Action) {
return te.Name, te.Disabled, te.Hidden, &te.Font, te.MinSize, te.MaxSize, te.StretchFactor, te.Row, te.RowSpan, te.Column, te.ColumnSpan, te.ContextMenuActions
}