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
|
package main
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
"quickcodesearch/fonts"
"runtime"
)
//中文乱码解决方法: https://github.com/fyne-io/fyne/issues/2660
func main() {
a := app.New()
if runtime.GOOS == "windows" {
//t := &myTheme{}
//t.SetFonts("C:/Windows/Fonts/simhei.ttf", "C:/Windows/Fonts/simkai.ttf")
////solveZhCode()
a.Settings().SetTheme(fonts.Default())
}
//enc := mahonia.NewEncoder("utf-8")
w := a.NewWindow("code search util")
w.Resize(fyne.Size{Width: 500, Height: 300})
statusBar := widget.NewLabel("load status:loading..")
//l2 := widget.NewLabel("aa")
input := widget.NewEntry()
input.SetPlaceHolder("type keyword")
fs := widget.NewEntry()
fs.SetPlaceHolder("code directory")
btn := widget.NewButton("加载代码", func() {
//fmt.Println("hello world---")
})
list := widget.NewList(func() int {
return 10
}, func() fyne.CanvasObject {
return widget.NewLabel("hello world我是你爸爸")
}, func(id widget.ListItemID, object fyne.CanvasObject) {
//update date
//fmt.Printf("%+v, %+v\n", id, object)
})
//size := list.Size()
list.Resize(fyne.NewSize(500, 900))
//list.
panel := container.NewHSplit(
container.NewVSplit(
container.NewVBox(input,
fs,
btn,
statusBar),
container.NewMax(list),
),
//container.NewVBox(
//))
container.NewMax(
widget.NewMultiLineEntry(),
),
)
w.SetContent(panel)
w.ShowAndRun()
}
|