Ejemplo n.º 1
0
func (v *Status) Move() {
	// Position the window in lower right corner
	v.window.SetGravity(gdk.GRAVITY_SOUTH_EAST)
	scr_w := gdk.ScreenWidth()
	scr_h := gdk.ScreenHeight()
	v.window.Move(scr_w-220, scr_h-220)
	return
}
Ejemplo n.º 2
0
func main() {

	FreeConsole()

	gtk.Init(nil)

	screenHeight := gdk.ScreenHeight()
	screenWidth := gdk.ScreenWidth()

	window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
	window.SetTitle("mgc")
	window.SetIconName("gtk-about")
	window.Connect("destroy", func() {
		gtk.MainQuit()
	})

	vbox := gtk.NewVBox(false, 0)

	menubar := gtk.NewMenuBar()
	vbox.PackStart(menubar, false, false, 0)

	menu := gtk.NewMenuItemWithMnemonic("_File")
	menubar.Append(menu)
	submenu := gtk.NewMenu()
	menu.SetSubmenu(submenu)

	menuitem := gtk.NewMenuItemWithMnemonic("E_xit")
	menuitem.Connect("activate", func() {
		gtk.MainQuit()
	})
	submenu.Append(menuitem)

	hpaned := gtk.NewHPaned()

	leftFrame := gtk.NewFrame("")
	rightFrame := gtk.NewFrame("")

	leftLabel := gtk.NewLabel("Left")
	rightLabel := gtk.NewLabel("Right")

	leftFrame.Add(leftLabel)
	rightFrame.Add(rightLabel)

	hpaned.Pack1(leftFrame, true, false)
	hpaned.Pack2(rightFrame, true, false)
	vbox.Add(hpaned)

	window.Add(vbox)

	window.SetSizeRequest(screenWidth/4*3, screenHeight/4*3)
	window.ShowAll()

	gtk.Main()
}