aboutsummaryrefslogtreecommitdiffstats
path: root/win/options.go
blob: 38f94e31125e5e9bfe8692c106030dcfe74e4c26 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
	}
}