Changed margins on large dialog content.

This commit is contained in:
Sander Schobers 2020-05-18 11:22:18 +02:00
parent 90c6531b23
commit 1f6729c037

View File

@ -8,6 +8,8 @@ import (
"opslag.de/schobers/zntg/ui" "opslag.de/schobers/zntg/ui"
) )
const titleBarHeight = 64
type LargeDialog struct { type LargeDialog struct {
ui.StackPanel ui.StackPanel
@ -24,7 +26,7 @@ func NewLargeDialog(title string, content ui.Control) *LargeDialog {
dialog.titleBar = NewLargeDialogTitleBar(title, func(ctx ui.Context, state interface{}) { dialog.titleBar = NewLargeDialogTitleBar(title, func(ctx ui.Context, state interface{}) {
dialog.closeRequested.Notify(ctx, state) dialog.closeRequested.Notify(ctx, state)
}) })
dialog.content.Content = content dialog.content.Content = ui.Margins(content, titleBarHeight, 20, titleBarHeight, 0)
dialog.Children = []ui.Control{dialog.titleBar, &dialog.content} dialog.Children = []ui.Control{dialog.titleBar, &dialog.content}
return dialog return dialog
@ -99,6 +101,5 @@ func (b *LargeDialogTitleBar) Arrange(ctx ui.Context, bounds geom.RectangleF32,
} }
func (b *LargeDialogTitleBar) DesiredSize(ctx ui.Context, size geom.PointF32) geom.PointF32 { func (b *LargeDialogTitleBar) DesiredSize(ctx ui.Context, size geom.PointF32) geom.PointF32 {
const titleHeight = 64 return geom.PtF32(size.X, titleBarHeight)
return geom.PtF32(size.X, titleHeight)
} }