diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-02-25 17:29:29 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-02-25 17:29:29 -0500 |
| commit | 521b9c7b837f6d6a788695ce3ca7d073a917942a (patch) | |
| tree | cb52a7eefc97ff7c3cd9163eda1538f88388160b /win/options.go | |
| parent | 3796d62e48fa61fbc49612bcdc8b3a8c3e558bda (diff) | |
| download | gui-521b9c7b837f6d6a788695ce3ca7d073a917942a.zip | |
win: implement new Env interface
Diffstat (limited to 'win/options.go')
| -rw-r--r-- | win/options.go | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/win/options.go b/win/options.go new file mode 100644 index 0000000..38f94e3 --- /dev/null +++ b/win/options.go @@ -0,0 +1,48 @@ +package win + +// Option is a functional option to the window constructor New. +type Option func(*options) + +type options struct { + title string + width, height int + resizable bool + borderless bool + maximized bool +} + +// Title option sets the title (caption) of the window. +func Title(title string) Option { + return func(o *options) { + o.title = title + } +} + +// Size option sets the width and height of the window. +func Size(width, height int) Option { + return func(o *options) { + o.width = width + o.height = height + } +} + +// Resizable option makes the window resizable by the user. +func Resizable() Option { + return func(o *options) { + o.resizable = true + } +} + +// Borderless option makes the window borderless. +func Borderless() Option { + return func(o *options) { + o.borderless = true + } +} + +// Maximized option makes the window start maximized. +func Maximized() Option { + return func(o *options) { + o.maximized = true + } +} |