Define giowrap.Horizontal and giowrap.Vertical as AxisOpts.
This commit is contained in:
parent
83c9d40500
commit
cf56e8c47e
|
@ -112,8 +112,8 @@ func eventloop() {
|
||||||
gio.Color(color.RGBA{A: 0xff, R: 0xf0, G: 0xf0, B: 0xe0}))
|
gio.Color(color.RGBA{A: 0xff, R: 0xf0, G: 0xf0, B: 0xe0}))
|
||||||
|
|
||||||
margin := gio.NewInset(gio.Size(ui.Dp(10)))
|
margin := gio.NewInset(gio.Size(ui.Dp(10)))
|
||||||
f1 := gio.NewFlex(gio.Axis(layout.Vertical))
|
f1 := gio.NewFlex(gio.Vertical)
|
||||||
f2 := gio.NewFlex(gio.Axis(layout.Horizontal))
|
f2 := gio.NewFlex(gio.Horizontal)
|
||||||
sidegrid := gio.NewGrid(1)
|
sidegrid := gio.NewGrid(1)
|
||||||
yrs := make([]gio.Widget, 6)
|
yrs := make([]gio.Widget, 6)
|
||||||
curyr := sm.Year
|
curyr := sm.Year
|
||||||
|
@ -125,7 +125,7 @@ func eventloop() {
|
||||||
|
|
||||||
var cal gio.Widget
|
var cal gio.Widget
|
||||||
|
|
||||||
f3 := gio.NewFlex(gio.Axis(layout.Vertical))
|
f3 := gio.NewFlex(gio.Vertical)
|
||||||
daygrid := gio.NewGrid(7)
|
daygrid := gio.NewGrid(7)
|
||||||
sun := NewSLabel("Sun", &sm.Ws[time.Sunday], gio.Align(text.End))
|
sun := NewSLabel("Sun", &sm.Ws[time.Sunday], gio.Align(text.End))
|
||||||
mon := NewSLabel("Mon", &sm.Ws[time.Monday], gio.Align(text.End))
|
mon := NewSLabel("Mon", &sm.Ws[time.Monday], gio.Align(text.End))
|
||||||
|
|
|
@ -103,11 +103,11 @@ func main1() {
|
||||||
|
|
||||||
e2 := giowrap.NewEditor("text 2", giowrap.Face(ctx.Faces.For(regular, ui.Sp(24))))
|
e2 := giowrap.NewEditor("text 2", giowrap.Face(ctx.Faces.For(regular, ui.Sp(24))))
|
||||||
|
|
||||||
f1 := giowrap.NewFlex(giowrap.Axis(layout.Vertical))
|
f1 := giowrap.NewFlex(giowrap.Vertical)
|
||||||
OuterInset := giowrap.NewInset(giowrap.Size(ui.Dp(10)))
|
OuterInset := giowrap.NewInset(giowrap.Size(ui.Dp(10)))
|
||||||
InnerInset := giowrap.NewInset(giowrap.Size(ui.Dp(10)))
|
InnerInset := giowrap.NewInset(giowrap.Size(ui.Dp(10)))
|
||||||
|
|
||||||
f2 := giowrap.NewFlex(giowrap.Axis(layout.Horizontal))
|
f2 := giowrap.NewFlex(giowrap.Horizontal)
|
||||||
|
|
||||||
btn1 := NewButton(ctx.Faces.For(regular, ui.Sp(24)),
|
btn1 := NewButton(ctx.Faces.For(regular, ui.Sp(24)),
|
||||||
"push1", color.RGBA{A: 0xff, R: 0x3c, G: 0x98, B: 0xc6})
|
"push1", color.RGBA{A: 0xff, R: 0x3c, G: 0x98, B: 0xc6})
|
||||||
|
@ -224,11 +224,11 @@ func main2() {
|
||||||
|
|
||||||
e2 := giowrap.NewEditor("text 2", giowrap.Face(ctx.Faces.For(regular, ui.Sp(24))))
|
e2 := giowrap.NewEditor("text 2", giowrap.Face(ctx.Faces.For(regular, ui.Sp(24))))
|
||||||
|
|
||||||
f1 := giowrap.NewFlex(giowrap.Axis(layout.Vertical))
|
f1 := giowrap.NewFlex(giowrap.Vertical)
|
||||||
OuterInset := giowrap.NewInset(giowrap.Size(ui.Dp(10)))
|
OuterInset := giowrap.NewInset(giowrap.Size(ui.Dp(10)))
|
||||||
InnerInset := giowrap.NewInset(giowrap.Size(ui.Dp(10)))
|
InnerInset := giowrap.NewInset(giowrap.Size(ui.Dp(10)))
|
||||||
|
|
||||||
f2 := giowrap.NewFlex(giowrap.Axis(layout.Horizontal))
|
f2 := giowrap.NewFlex(giowrap.Horizontal)
|
||||||
|
|
||||||
btn1 := NewButton(ctx.Faces.For(regular, ui.Sp(24)),
|
btn1 := NewButton(ctx.Faces.For(regular, ui.Sp(24)),
|
||||||
"push1", color.RGBA{A: 0xff, R: 0x3c, G: 0x98, B: 0xc6})
|
"push1", color.RGBA{A: 0xff, R: 0x3c, G: 0x98, B: 0xc6})
|
||||||
|
@ -366,12 +366,12 @@ func main3() {
|
||||||
}
|
}
|
||||||
ctx.Reset(&e)
|
ctx.Reset(&e)
|
||||||
giowrap.NewInset(giowrap.Size(ui.Dp(10)))(
|
giowrap.NewInset(giowrap.Size(ui.Dp(10)))(
|
||||||
giowrap.NewFlex(giowrap.Axis(layout.Vertical))(
|
giowrap.NewFlex(giowrap.Vertical)(
|
||||||
e1,
|
e1,
|
||||||
//giowrap.Flexible(0.33),
|
//giowrap.Flexible(0.33),
|
||||||
giowrap.NewInset(giowrap.Size(ui.Dp(10)))(e2),
|
giowrap.NewInset(giowrap.Size(ui.Dp(10)))(e2),
|
||||||
//giowrap.Flexible(0.67),
|
//giowrap.Flexible(0.67),
|
||||||
giowrap.NewFlex(giowrap.Axis(layout.Horizontal))(
|
giowrap.NewFlex(giowrap.Horizontal)(
|
||||||
giowrap.NewInset(giowrap.Size(ui.Dp(10)))(btn1),
|
giowrap.NewInset(giowrap.Size(ui.Dp(10)))(btn1),
|
||||||
//giowrap.Flexible(0.50),
|
//giowrap.Flexible(0.50),
|
||||||
giowrap.NewInset(giowrap.Size(ui.Dp(10)))(btn2),
|
giowrap.NewInset(giowrap.Size(ui.Dp(10)))(btn2),
|
||||||
|
|
|
@ -97,15 +97,15 @@ func eventloop() {
|
||||||
bg := gio.NewBackground(gio.Color(gray2))
|
bg := gio.NewBackground(gio.Color(gray2))
|
||||||
|
|
||||||
margin := gio.NewInset(gio.Size(ui.Dp(10)))
|
margin := gio.NewInset(gio.Size(ui.Dp(10)))
|
||||||
f1 := gio.NewFlex(gio.Axis(layout.Horizontal))
|
f1 := gio.NewFlex(gio.Horizontal)
|
||||||
lbar := gio.NewLabel(" ", gio.Face(face))
|
lbar := gio.NewLabel(" ", gio.Face(face))
|
||||||
f2 := gio.NewFlex(gio.Axis(layout.Vertical))
|
f2 := gio.NewFlex(gio.Vertical)
|
||||||
topbar := gio.NewLabel("Scroll X and Y. Click to select", gio.Face(face))
|
topbar := gio.NewLabel("Scroll X and Y. Click to select", gio.Face(face))
|
||||||
f3 := gio.NewFlex(gio.Axis(layout.Horizontal))
|
f3 := gio.NewFlex(gio.Horizontal)
|
||||||
f4 := gio.NewFlex(gio.Axis(layout.Vertical))
|
f4 := gio.NewFlex(gio.Vertical)
|
||||||
|
|
||||||
sh := gio.HScroll(gio.NewFlex(gio.Axis(layout.Horizontal)))
|
sh := gio.HScroll(gio.NewFlex(gio.Horizontal))
|
||||||
sv := gio.VScroll(gio.NewFlex(gio.Axis(layout.Vertical)))
|
sv := gio.VScroll(gio.NewFlex(gio.Vertical))
|
||||||
|
|
||||||
numrows := 16
|
numrows := 16
|
||||||
numcols := 50
|
numcols := 50
|
||||||
|
|
2
main.go
2
main.go
|
@ -204,6 +204,8 @@ type List = WidgetCombinator
|
||||||
type AxisOpt struct{ axis layout.Axis }
|
type AxisOpt struct{ axis layout.Axis }
|
||||||
|
|
||||||
func Axis(x layout.Axis) AxisOpt { return AxisOpt{x} }
|
func Axis(x layout.Axis) AxisOpt { return AxisOpt{x} }
|
||||||
|
var Horizontal = AxisOpt{ layout.Horizontal }
|
||||||
|
var Vertical = AxisOpt{ layout.Vertical }
|
||||||
|
|
||||||
type ListOpts struct {
|
type ListOpts struct {
|
||||||
AxisOpt
|
AxisOpt
|
||||||
|
|
Loading…
Reference in New Issue
Block a user