Created
July 13, 2012 03:46
-
-
Save acsellers/3102587 to your computer and use it in GitHub Desktop.
A gtk interface for Go that feels right
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//go-gtk | |
func on_window_resize(){ | |
window := gtk.WidgetFromObject(builder.GetObject("main_window")) | |
switcher := gtk.WidgetFromObject(builder.GetObject("main_switcher")) | |
vline := gtk.WidgetFromObject(builder.GetObject("vline")) | |
win_alloc := new(gtk.GtkAllocation) | |
window.GetAllocation(win_alloc) | |
sw_alloc := new(gtk.GtkAllocation) | |
switcher.GetAllocation(sw_alloc) | |
if sw_alloc.Width != win_alloc.Width - 74 || sw_alloc.Height != win_alloc.Height { | |
vline.SetSizeRequest(2,win_alloc.Height) | |
switcher.SetSizeRequest(win_alloc.Width - 74, win_alloc.Height) | |
Debug.Println("Resized switcher") | |
} | |
} | |
//gg (Planned) | |
func onMainWindowResize(resize gg.Size){ | |
MainInterface.GetNotebook("main_switcher").SetSize(resize.Width - 74, resize.Height) | |
MainInterface.GetVLine("vline").SetSize(2, resize.Height) | |
} | |
//OR maybe | |
window := gg.NewWindow() | |
window.OnResize = func(window gg.Window, resize gg.Size){ | |
window.GetNotebook("main_switcher").SetSize(resize.Width - 74, resize.Height) | |
window.GetVLine("vline").SetSize(2, resize.Height) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment