From 521b9c7b837f6d6a788695ce3ca7d073a917942a Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Wed, 25 Feb 2026 17:29:29 -0500 Subject: win: implement new Env interface --- win/options.go | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 win/options.go (limited to 'win/options.go') 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 + } +} -- cgit v1.2.3