26 lines
510 B
Go
26 lines
510 B
Go
package primitives
|
|
|
|
import "github.com/gotk3/gotk3/gtk"
|
|
|
|
type StyleContexter interface {
|
|
GetStyleContext() (*gtk.StyleContext, error)
|
|
}
|
|
|
|
func AddClass(styleCtx StyleContexter, classes ...string) {
|
|
var style, _ = styleCtx.GetStyleContext()
|
|
for _, class := range classes {
|
|
style.AddClass(class)
|
|
}
|
|
}
|
|
|
|
type Bin interface {
|
|
GetChild() (gtk.IWidget, error)
|
|
}
|
|
|
|
var _ Bin = (*gtk.Bin)(nil)
|
|
|
|
func BinLeftAlignLabel(bin Bin) {
|
|
widget, _ := bin.GetChild()
|
|
widget.(interface{ SetXAlign(float64) }).SetXAlign(0)
|
|
}
|