golang-ui / nuklear

This project provides Go bindings for nuklear.h — a small ANSI C GUI library.

Home Page:https://github.com/vurtun/nuklear

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setter and getter for Spacing, Padding and GroupPadding

k-toffel opened this issue · comments

Hey,
I wanted to alter the spacing of my custom widgets in a small application of mine and found out that there are no setter and getter for this. So I simply created my own ones. Is it in your interest to include those into the main project or don't you want any of those as there would be a lot variables that can only be accessed by adding custom setter and getter?

Maybe I also overlooked a function giving me control of the spacing. The code I inserted in etc.go is simply this:

func (w *StyleWindow) Spacing() *Vec2 {
	return (*Vec2)(&w.spacing)
}

func (w *StyleWindow) Padding() *Vec2 {
	return (*Vec2)(&w.padding)
}

func (w *StyleWindow) GroupPadding() *Vec2 {
	return (*Vec2)(&w.group_padding)
}

func SetSpacing(ctx *Context, v Vec2) {
	*ctx.Style().Window().Spacing() = v
}

func SetPadding(ctx *Context, v Vec2) {
	*ctx.Style().Window().Padding() = v
}

func SetGroupPadding(ctx *Context, v Vec2) {
	*ctx.Style().Window().GroupPadding() = v
}

Thanks

Hi, yes etc.go is a good place to add such setters and getters! Actually, this is how the package is being expanded, the Nuklear is organised in such way that we need to have Getters and Setters made by hand.

Please make a simple PR, thanks!