-
Notifications
You must be signed in to change notification settings - Fork 268
/
sciter_windows.go
57 lines (52 loc) · 2.09 KB
/
sciter_windows.go
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
49
50
51
52
53
54
55
56
57
package sciter
/*
#cgo CFLAGS: -Iinclude
#include "sciter-x.h"
*/
import "C"
import (
"github.com/lxn/win"
"unsafe"
)
// LRESULT SciterProc (HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ;//{ return SAPI()->SciterProc (hwnd,msg,wParam,lParam); }
// LRESULT SciterProcND (HWINDOW hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL* pbHandled) ;//{ return SAPI()->SciterProcND (hwnd,msg,wParam,lParam,pbHandled); }
func ProcND(hwnd win.HWND, msg uint, wParam uintptr, lParam uintptr) (ret int, handled bool) {
var bHandled C.BOOL
// ret = uintptr(syssciterProcND(HWND(hwnd), msg, wParam, lParam, &bHandled))
ret = int(C.SciterProcND(C.HWINDOW(unsafe.Pointer(hwnd)), C.UINT(msg), C.WPARAM(wParam), C.LPARAM(lParam), &bHandled))
if bHandled == 0 {
handled = false
} else {
handled = true
}
return
}
// HWINDOW SciterCreateWindow ( UINT creationFlags,LPRECT frame, SciterWindowDelegate* delegate, LPVOID delegateParam, HWINDOW parent);
// Create sciter window.
// On Windows returns HWND of either top-level or child window created.
// On OS X returns NSView* of either top-level window or child view .
//
// \param[in] creationFlags \b SCITER_CREATE_WINDOW_FLAGS, creation flags.
// \param[in] frame \b LPRECT, window frame position and size.
// \param[in] delegate \b SciterWindowDelegate, either partial WinProc implementation or thing implementing NSWindowDelegate protocol.
// \param[in] delegateParam \b LPVOID, optional param passed to SciterWindowDelegate.
// \param[in] parent \b HWINDOW, optional parent window.
// rect is the display area
func CreateWindow(createFlags WindowCreationFlag, rect *Rect, delegate uintptr, delegateParam uintptr, parent C.HWINDOW) C.HWINDOW {
// set default size
if rect == nil {
rect = DefaultRect
}
// create window
hwnd := C.SciterCreateWindow(
C.UINT(createFlags),
(*C.RECT)(unsafe.Pointer(rect)),
(*C.SciterWindowDelegate)(unsafe.Pointer(delegate)),
(C.LPVOID)(delegateParam),
parent)
// in case of NULL
if int(uintptr(unsafe.Pointer(hwnd))) == 0 {
return BAD_HWINDOW
}
return hwnd
}