Esempio n. 1
0
func genMouseEventArg(wparam, lparam uintptr) *MouseEventData {
	var data MouseEventData
	data.Button = int(wparam)
	data.X = int(w32.LOWORD(uint(lparam)))
	data.Y = int(w32.HIWORD(uint(lparam)))

	return &data
}
Esempio n. 2
0
func (this *Dialog) WndProc(msg uint, wparam, lparam uintptr) uintptr {
	switch msg {
	case w32.WM_INITDIALOG:
		gDialogWaiting = nil
		this.onLoad.Fire(NewEventArg(this, nil))
	case w32.WM_COMMAND:
		switch w32.LOWORD(uint32(wparam)) {
		case w32.IDOK:
			this.onOK.Fire(NewEventArg(this, nil))
			return w32.TRUE
		case w32.IDCANCEL:
			this.onCancel.Fire(NewEventArg(this, nil))
			return w32.TRUE
		}
	case w32.WM_CLOSE:
		this.Close(w32.IDCANCEL)
	case w32.WM_DESTROY:
		if this.parent == nil {
			Exit()
		}
	}
	return w32.FALSE
}
Esempio n. 3
0
func (app *DemoApp) WndProc(hwnd w32.HWND, msg uint, wParam, lParam uintptr) uintptr {
	if hwnd != app.hwnd {
		return w32.DefWindowProc(hwnd, msg, wParam, lParam)
	}
	switch msg {
	case w32.WM_SIZE:
		width := w32.LOWORD(uint(lParam))
		height := w32.HIWORD(uint(lParam))
		app.OnResize(width, height)
		return 0
	case w32.WM_DISPLAYCHANGE:
		w32.InvalidateRect(app.hwnd, nil, false)
		return 0
	case w32.WM_PAINT:
		app.OnRender()
		w32.ValidateRect(app.hwnd, nil)
		return 0
	case w32.WM_DESTROY:
		w32.PostQuitMessage(0)
		return 1
	}

	return w32.DefWindowProc(hwnd, msg, wParam, lParam)
}
Esempio n. 4
0
func genPoint(p uintptr) (x, y int) {
	x = int(w32.LOWORD(uint32(p)))
	y = int(w32.HIWORD(uint32(p)))
	return
}