switched from fbink to gtk2
This commit is contained in:
48
main.go
Normal file
48
main.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package main
|
||||
|
||||
// #cgo pkg-config: gtk+-2.0
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
)
|
||||
|
||||
func main() {
|
||||
gtk.Init(nil)
|
||||
|
||||
// Main window
|
||||
win := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
|
||||
win.SetTitle("L:A_N:application_PC:TS_ID:com.lab126.store")
|
||||
win.SetDefaultSize(400, 200)
|
||||
win.Connect("destroy", gtk.MainQuit)
|
||||
|
||||
// Vertical layout container
|
||||
vbox := gtk.NewVBox(false, 10)
|
||||
win.Add(vbox)
|
||||
|
||||
// Label
|
||||
label := gtk.NewLabel("Hello Kindle!")
|
||||
vbox.PackStart(label, false, false, 10)
|
||||
|
||||
// Horizontal box for buttons
|
||||
hbox := gtk.NewHBox(true, 5)
|
||||
vbox.PackStart(hbox, false, false, 10)
|
||||
|
||||
// Show button
|
||||
btnShow := gtk.NewButtonWithLabel("Show Text")
|
||||
btnShow.Clicked(func() {
|
||||
label.Show()
|
||||
})
|
||||
|
||||
// Hide button
|
||||
btnHide := gtk.NewButtonWithLabel("Hide Text")
|
||||
btnHide.Clicked(func() {
|
||||
label.Hide()
|
||||
})
|
||||
|
||||
hbox.PackStart(btnShow, true, true, 5)
|
||||
hbox.PackStart(btnHide, true, true, 5)
|
||||
|
||||
win.ShowAll()
|
||||
gtk.Main()
|
||||
}
|
||||
Reference in New Issue
Block a user