/
pushbutton.go
58 lines (50 loc) · 1.9 KB
/
pushbutton.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
// 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 PushButton struct {
AssignTo **walk.PushButton
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
OnClicked walk.EventHandler
}
func (pb PushButton) Create(builder *Builder) error {
w, err := walk.NewPushButton(builder.Parent())
if err != nil {
return err
}
return builder.InitWidget(pb, w, func() error {
if pb.OnClicked != nil {
w.Clicked().Attach(pb.OnClicked)
}
if pb.AssignTo != nil {
*pb.AssignTo = w
}
return nil
})
}
func (w PushButton) 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
}