MCPcopy
hub / github.com/g3n/engine / NewWindow

Function NewWindow

gui/window.go:70–91  ·  view source on GitHub ↗

NewWindow creates and returns a pointer to a new window with the specified dimensions

(width, height float32)

Source from the content-addressed store, hash-verified

68// NewWindow creates and returns a pointer to a new window with the
69// specified dimensions
70func NewWindow(width, height float32) *Window {
71
72 w := new(Window)
73 w.styles = &StyleDefault().Window
74
75 w.Panel.Initialize(w, width, height)
76 w.Panel.Subscribe(OnMouseDown, w.onMouse)
77 w.Panel.Subscribe(OnMouseUp, w.onMouse)
78 w.Panel.Subscribe(OnCursor, w.onCursor)
79 w.Panel.Subscribe(OnCursorEnter, w.onCursor)
80 w.Panel.Subscribe(OnCursorLeave, w.onCursor)
81 w.Panel.Subscribe(OnResize, func(evname string, ev interface{}) { w.recalc() })
82
83 w.client.Initialize(&w.client, 0, 0)
84 w.Panel.Add(&w.client)
85
86 w.dragPadding = 5
87
88 w.recalc()
89 w.update()
90 return w
91}
92
93// SetResizable sets whether the window is resizable.
94func (w *Window) SetResizable(state bool) {

Callers 1

buildWindowFunction · 0.85

Calls 6

StyleDefaultFunction · 0.85
SubscribeMethod · 0.65
InitializeMethod · 0.45
recalcMethod · 0.45
AddMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected