BoundsProperty

Description of the View's bounds like margin or padding

Create from source

func NewBoundsProperty(params Params) BoundsProperty

Creates the new BoundsProperty and return its interface

Create from resource

View {
    padding = _{
        top = 1px,
        right = 2px,
        bottom = 1px,
        left = 2px,
    },
}

Interface description

Inherit methods from Properties, fmt.Stringer

Bounds(session Session) Bounds

Return top, right, bottom and left size of the bounds

Properties

"bottom"

Bottom bound value

Constant: Bottom

Types: SizeUnit, SizeFunc, string, float, int

Internal type is SizeUnit, other types converted to it during assignment

See SizeUnit description for more details

Examples

GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        background-color = lightgreen,
        padding = _{bottom = 1em},
    },
}
view := rui.NewGridLayout(session, rui.Params{
    rui.Width:               rui.Percent(100),
    rui.Height:              rui.Percent(100),
    rui.CellHorizontalAlign: rui.CenterAlign,
    rui.CellVerticalAlign:   rui.CenterAlign,
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text:            "Some text",
        rui.BackgroundColor: rui.LightGreen,
        rui.Padding: rui.NewBoundsProperty(rui.Params{
            rui.Bottom: rui.Em(1),
        }),
    }),
})

"left"

Left bound value

Constant: Left

Types: SizeUnit, SizeFunc, string, float, int

Internal type is SizeUnit, other types converted to it during assignment

See SizeUnit description for more details

Examples

GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        background-color = lightgreen,
        padding = _{left = 1em},
    },
}
view := rui.NewGridLayout(session, rui.Params{
    rui.Width:               rui.Percent(100),
    rui.Height:              rui.Percent(100),
    rui.CellHorizontalAlign: rui.CenterAlign,
    rui.CellVerticalAlign:   rui.CenterAlign,
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text:            "Some text",
        rui.BackgroundColor: rui.LightGreen,
        rui.Padding: rui.NewBoundsProperty(rui.Params{
            rui.Left: rui.Em(1),
        }),
    }),
})

Right bound value

Constant: Right

Types: SizeUnit, SizeFunc, string, float, int

Internal type is SizeUnit, other types converted to it during assignment

See SizeUnit description for more details

Examples

GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        background-color = lightgreen,
        padding = _{right = 1em},
    },
}
view := rui.NewGridLayout(session, rui.Params{
    rui.Width:               rui.Percent(100),
    rui.Height:              rui.Percent(100),
    rui.CellHorizontalAlign: rui.CenterAlign,
    rui.CellVerticalAlign:   rui.CenterAlign,
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text:            "Some text",
        rui.BackgroundColor: rui.LightGreen,
        rui.Padding: rui.NewBoundsProperty(rui.Params{
            rui.Right: rui.Em(1),
        }),
    }),
})

"top"

Top bound value

Constant: Top

Types: SizeUnit, SizeFunc, string, float, int

Internal type is SizeUnit, other types converted to it during assignment

See SizeUnit description for more details

Examples

GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        background-color = lightgreen,
        padding = _{top = 1em},
    },
}
view := rui.NewGridLayout(session, rui.Params{
    rui.Width:               rui.Percent(100),
    rui.Height:              rui.Percent(100),
    rui.CellHorizontalAlign: rui.CenterAlign,
    rui.CellVerticalAlign:   rui.CenterAlign,
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text:            "Some text",
        rui.BackgroundColor: rui.LightGreen,
        rui.Padding: rui.NewBoundsProperty(rui.Params{
            rui.Top: rui.Em(1),
        }),
    }),
})
func DefaultBounds() Bounds

Return bounds with top, right, bottom and left fields set to Auto