/
webview.go
49 lines (41 loc) · 1.24 KB
/
webview.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
// 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 WebView struct {
AssignTo **walk.WebView
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
URL string
}
func (wv WebView) Create(parent walk.Container) error {
w, err := walk.NewWebView(parent)
if err != nil {
return err
}
return InitWidget(wv, w, func() error {
if err := w.SetURL(wv.URL); err != nil {
return err
}
if wv.AssignTo != nil {
*wv.AssignTo = w
}
return nil
})
}
func (wv WebView) WidgetInfo() (name string, disabled, hidden bool, font *Font, minSize, maxSize Size, stretchFactor, row, rowSpan, column, columnSpan int, contextMenuActions []*walk.Action) {
return wv.Name, wv.Disabled, wv.Hidden, &wv.Font, wv.MinSize, wv.MaxSize, wv.StretchFactor, wv.Row, wv.RowSpan, wv.Column, wv.ColumnSpan, wv.ContextMenuActions
}