TAB: code to more correctly handle gtk tabs
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
c670905b74
commit
71a9b13236
45
structs.go
45
structs.go
|
@ -1,5 +1,6 @@
|
||||||
package gui
|
package gui
|
||||||
|
|
||||||
|
import "log"
|
||||||
import "image/color"
|
import "image/color"
|
||||||
import "golang.org/x/image/font"
|
import "golang.org/x/image/font"
|
||||||
|
|
||||||
|
@ -92,6 +93,50 @@ type GuiBox struct {
|
||||||
UiBox *ui.Box
|
UiBox *ui.Box
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s GuiBox) SetTitle(title string) {
|
||||||
|
log.Println("DID IT!", title)
|
||||||
|
if (s.Window == nil) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (s.Window.UiWindow == nil) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.Window.UiWindow.SetTitle(title)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s GuiBox) InitTab(title string) {
|
||||||
|
if (s.Window == nil) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (s.Window.UiWindow == nil) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
window := s.Window.UiWindow
|
||||||
|
tab := ui.NewTab()
|
||||||
|
window.SetChild(tab)
|
||||||
|
window.SetMargined(true)
|
||||||
|
|
||||||
|
tab.Append(title, InitBlankWindow())
|
||||||
|
tab.SetMargined(0, true)
|
||||||
|
|
||||||
|
s.Window.UiTab = tab
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s GuiBox) AddTab(title string) {
|
||||||
|
if (s.Window == nil) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (s.Window.UiTab == nil) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
tab := s.Window.UiTab
|
||||||
|
|
||||||
|
tab.Append(title, InitBlankWindow())
|
||||||
|
}
|
||||||
|
|
||||||
// Note: every mouse click is handled
|
// Note: every mouse click is handled
|
||||||
// as a 'Button' regardless of where
|
// as a 'Button' regardless of where
|
||||||
// the user clicks it. You could probably
|
// the user clicks it. You could probably
|
||||||
|
|
Loading…
Reference in New Issue