NewWindow creates and returns a pointer to a new window with the specified dimensions
(width, height float32)
| 68 | // NewWindow creates and returns a pointer to a new window with the |
| 69 | // specified dimensions |
| 70 | func 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. |
| 94 | func (w *Window) SetResizable(state bool) { |
no test coverage detected