forked from lxn/walk
/
lineedit.go
74 lines (65 loc) · 2.32 KB
/
lineedit.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
63
64
65
66
67
68
69
70
71
72
73
74
// 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 LineEdit struct {
AssignTo **walk.LineEdit
Name string
Enabled Property
Visible Property
Font Font
ToolTipText Property
MinSize Size
MaxSize Size
StretchFactor int
Row int
RowSpan int
Column int
ColumnSpan int
ContextMenuItems []MenuItem
OnKeyDown walk.KeyEventHandler
OnKeyPress walk.KeyEventHandler
OnKeyUp walk.KeyEventHandler
OnMouseDown walk.MouseEventHandler
OnMouseMove walk.MouseEventHandler
OnMouseUp walk.MouseEventHandler
OnSizeChanged walk.EventHandler
Text Property
ReadOnly Property
CueBanner string
MaxLength int
PasswordMode bool
OnEditingFinished walk.EventHandler
OnTextChanged walk.EventHandler
}
func (le LineEdit) Create(builder *Builder) error {
w, err := walk.NewLineEdit(builder.Parent())
if err != nil {
return err
}
return builder.InitWidget(le, w, func() error {
if le.CueBanner != "" {
if err := w.SetCueBanner(le.CueBanner); err != nil {
return err
}
}
w.SetMaxLength(le.MaxLength)
w.SetPasswordMode(le.PasswordMode)
if le.OnEditingFinished != nil {
w.EditingFinished().Attach(le.OnEditingFinished)
}
if le.OnTextChanged != nil {
w.TextChanged().Attach(le.OnTextChanged)
}
if le.AssignTo != nil {
*le.AssignTo = w
}
return nil
})
}
func (w LineEdit) WidgetInfo() (name string, disabled, hidden bool, font *Font, toolTipText string, minSize, maxSize Size, stretchFactor, row, rowSpan, column, columnSpan int, contextMenuItems []MenuItem, OnKeyDown walk.KeyEventHandler, OnKeyPress walk.KeyEventHandler, OnKeyUp walk.KeyEventHandler, OnMouseDown walk.MouseEventHandler, OnMouseMove walk.MouseEventHandler, OnMouseUp walk.MouseEventHandler, OnSizeChanged walk.EventHandler) {
return w.Name, false, false, &w.Font, "", w.MinSize, w.MaxSize, w.StretchFactor, w.Row, w.RowSpan, w.Column, w.ColumnSpan, w.ContextMenuItems, w.OnKeyDown, w.OnKeyPress, w.OnKeyUp, w.OnMouseDown, w.OnMouseMove, w.OnMouseUp, w.OnSizeChanged
}