aboutsummaryrefslogtreecommitdiffstats
path: root/win/options.go
diff options
context:
space:
mode:
Diffstat (limited to 'win/options.go')
-rw-r--r--win/options.go48
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
+ }
+}