mirror of
https://gitee.com/energye/energy.git
synced 2024-11-30 02:37:46 +08:00
U: Window API INC
This commit is contained in:
parent
5c211be252
commit
56aed02f20
90
cef/def-win-api-callback.go
Normal file
90
cef/def-win-api-callback.go
Normal file
@ -0,0 +1,90 @@
|
||||
//----------------------------------------
|
||||
//
|
||||
// Copyright © yanghy. All Rights Reserved.
|
||||
//
|
||||
// Licensed under Apache License Version 2.0, January 2004
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//----------------------------------------
|
||||
|
||||
// energy - lcl window api - callback
|
||||
// TODO : All functions of this API have not been fully tested yet
|
||||
|
||||
package cef
|
||||
|
||||
import (
|
||||
"github.com/energye/energy/v2/common/imports"
|
||||
"github.com/energye/energy/v2/types"
|
||||
"github.com/energye/golcl/lcl/api"
|
||||
)
|
||||
|
||||
type enumDisplayMonitorsProc func(hMonitor types.HMONITOR, hdcMonitor types.HDC, lprcMonitor types.Rect, dwData types.LPARAM) types.LongBool
|
||||
type enumFontFamiliesProc func(ELogFont types.TagEnumLogFontA, Metric types.TNewTextMetric, FontType types.LongInt, Data types.LPARAM) types.LongInt
|
||||
type enumFontFamiliesExProc func(ELogFont types.TagEnumLogFontExA, Metric types.TNewTextMetricEx, FontType types.LongInt, Data types.LPARAM) types.LongInt
|
||||
|
||||
type EnumDisplayMonitorsCallback struct {
|
||||
instance uintptr
|
||||
}
|
||||
|
||||
type EnumFontFamiliesCallback struct {
|
||||
instance uintptr
|
||||
}
|
||||
|
||||
type EnumFontFamiliesExCallback struct {
|
||||
instance uintptr
|
||||
}
|
||||
|
||||
func NewEnumDisplayMonitorsCallback() *EnumDisplayMonitorsCallback {
|
||||
return &EnumDisplayMonitorsCallback{}
|
||||
}
|
||||
|
||||
func (m *EnumDisplayMonitorsCallback) Callback(fn enumDisplayMonitorsProc) {
|
||||
if m.instance == 0 {
|
||||
m.instance = api.MakeEventDataPtr(fn)
|
||||
}
|
||||
}
|
||||
|
||||
// Free 使用完需要将释放掉
|
||||
func (m *EnumDisplayMonitorsCallback) Free() {
|
||||
if m.instance != 0 {
|
||||
api.RemoveEventElement(m.instance)
|
||||
imports.Proc(internale_CEF_Win_EnumDisplayMonitorsCallbackFree).Call()
|
||||
}
|
||||
}
|
||||
|
||||
func NewEnumFontFamiliesCallback() *EnumFontFamiliesCallback {
|
||||
return &EnumFontFamiliesCallback{}
|
||||
}
|
||||
|
||||
func (m *EnumFontFamiliesCallback) Callback(fn enumFontFamiliesProc) {
|
||||
if m.instance == 0 {
|
||||
m.instance = api.MakeEventDataPtr(fn)
|
||||
}
|
||||
}
|
||||
|
||||
// Free 使用完需要将释放掉
|
||||
func (m *EnumFontFamiliesCallback) Free() {
|
||||
if m.instance != 0 {
|
||||
api.RemoveEventElement(m.instance)
|
||||
imports.Proc(internale_CEF_Win_EnumFontFamiliesCallbackFree).Call()
|
||||
}
|
||||
}
|
||||
|
||||
func NewEnumFontFamiliesExCallback() *EnumFontFamiliesExCallback {
|
||||
return &EnumFontFamiliesExCallback{}
|
||||
}
|
||||
|
||||
func (m *EnumFontFamiliesExCallback) Callback(fn enumFontFamiliesExProc) {
|
||||
if m.instance == 0 {
|
||||
m.instance = api.MakeEventDataPtr(fn)
|
||||
imports.Proc(internale_CEF_Win_EnumFontFamiliesExCallbackFree).Call()
|
||||
}
|
||||
}
|
||||
|
||||
// Free 使用完需要将释放掉
|
||||
func (m *EnumFontFamiliesExCallback) Free() {
|
||||
if m.instance != 0 {
|
||||
api.RemoveEventElement(m.instance)
|
||||
}
|
||||
}
|
@ -1,12 +1,204 @@
|
||||
//----------------------------------------
|
||||
//
|
||||
// Copyright © yanghy. All Rights Reserved.
|
||||
//
|
||||
// Licensed under Apache License Version 2.0, January 2004
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//----------------------------------------
|
||||
|
||||
// energy - lcl window api
|
||||
// export in Lazarus winapih.inc
|
||||
// TODO : All functions of this API have not been fully tested yet
|
||||
|
||||
package cef
|
||||
|
||||
import (
|
||||
"github.com/energye/energy/v2/common/imports"
|
||||
"github.com/energye/energy/v2/consts"
|
||||
"github.com/energye/energy/v2/types"
|
||||
"github.com/energye/golcl/lcl/api"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
S_OK = 0x00000000
|
||||
S_FALSE = 0x00000001
|
||||
E_UNEXPECTED = 0x8000FFFF
|
||||
E_NOTIMPL = 0x80004001
|
||||
E_OUTOFMEMORY = 0x8007000E
|
||||
E_INVALIDARG = 0x80070057
|
||||
E_NOINTERFACE = 0x80004002
|
||||
E_POINTER = 0x80004003
|
||||
E_HANDLE = 0x80070006
|
||||
E_ABORT = 0x80004004
|
||||
E_FAIL = 0x80004005
|
||||
E_ACCESSDENIED = 0x80070005
|
||||
E_PENDING = 0x8000000A
|
||||
)
|
||||
|
||||
// Win32 Predefined cursor constants
|
||||
const (
|
||||
IDC_ARROW = 32512
|
||||
IDC_IBEAM = 32513
|
||||
IDC_WAIT = 32514
|
||||
IDC_CROSS = 32515
|
||||
IDC_UPARROW = 32516
|
||||
IDC_SIZENWSE = 32642
|
||||
IDC_SIZENESW = 32643
|
||||
IDC_SIZEWE = 32644
|
||||
IDC_SIZENS = 32645
|
||||
IDC_SIZEALL = 32646
|
||||
IDC_NO = 32648
|
||||
IDC_HAND = 32649
|
||||
IDC_APPSTARTING = 32650
|
||||
IDC_HELP = 32651
|
||||
IDC_ICON = 32641
|
||||
IDC_SIZE = 32640
|
||||
)
|
||||
|
||||
const (
|
||||
FALSE = 0
|
||||
TRUE = 1
|
||||
)
|
||||
|
||||
const (
|
||||
WMSZ_LEFT = 1
|
||||
WMSZ_RIGHT = 2
|
||||
WMSZ_TOP = 3
|
||||
WMSZ_TOPLEFT = 4
|
||||
WMSZ_TOPRIGHT = 5
|
||||
WMSZ_BOTTOM = 6
|
||||
WMSZ_BOTTOMLEFT = 7
|
||||
WMSZ_BOTTOMRIGHT = 8
|
||||
)
|
||||
|
||||
func LOBYTE(w uint16) byte {
|
||||
return byte(w)
|
||||
}
|
||||
|
||||
func HIBYTE(w uint16) byte {
|
||||
return byte(w >> 8 & 0xff)
|
||||
}
|
||||
|
||||
func LOWORD(dw uint32) uint16 {
|
||||
return uint16(dw & 0xFFFF)
|
||||
}
|
||||
|
||||
func HIWORD(dw uint32) uint16 {
|
||||
return uint16(dw >> 16 & 0xffff)
|
||||
}
|
||||
|
||||
func GET_X_LPARAM(lp uintptr) int32 {
|
||||
return int32(int16(LOWORD(uint32(lp))))
|
||||
}
|
||||
|
||||
func GET_Y_LPARAM(lp uintptr) int32 {
|
||||
return int32(int16(HIWORD(uint32(lp))))
|
||||
}
|
||||
|
||||
type HCursor struct {
|
||||
instance unsafe.Pointer
|
||||
}
|
||||
|
||||
func (m *HCursor) Free() {
|
||||
m.instance = nil
|
||||
}
|
||||
|
||||
func WinCreateRectRgn(X1, Y1, X2, Y2 int32) *types.HRGN {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_CreateRectRgn).Call(uintptr(X1), uintptr(Y1), uintptr(X2), uintptr(Y2))
|
||||
return types.NewHRGN(r1)
|
||||
}
|
||||
|
||||
func WinSetRectRgn(aRGN *types.HRGN, X1, Y1, X2, Y2 int32) bool {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_SetRectRgn).Call(aRGN.Instance(), uintptr(X1), uintptr(Y1), uintptr(X2), uintptr(Y2))
|
||||
return api.GoBool(r1)
|
||||
}
|
||||
|
||||
func WinDeleteObject(aRGN *types.HRGN) bool {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_DeleteObject).Call(aRGN.Instance())
|
||||
return api.GoBool(r1)
|
||||
}
|
||||
|
||||
func WinCombineRgn(dest, src1, src2 *types.HRGN, fnCombineMode consts.RNGFnCombineMode) int32 {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_CombineRgn).Call(dest.Instance(), src1.Instance(), src2.Instance(), uintptr(fnCombineMode))
|
||||
return int32(r1)
|
||||
}
|
||||
|
||||
func WinPtInRegion(RGN *types.HRGN, X, Y int32) bool {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_PtInRegion).Call(RGN.Instance(), uintptr(X), uintptr(Y))
|
||||
return api.GoBool(r1)
|
||||
}
|
||||
|
||||
func WinScreenToClient(handle types.HWND, p *types.Point) int32 {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_ScreenToClient).Call(uintptr(handle), uintptr(unsafe.Pointer(p)))
|
||||
return int32(r1)
|
||||
}
|
||||
|
||||
func WinClientToScreen(handle types.HWND, p *types.Point) bool {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_ClientToScreen).Call(uintptr(handle), uintptr(unsafe.Pointer(p)))
|
||||
return api.GoBool(r1)
|
||||
}
|
||||
|
||||
func WinDefWindowProc(handle types.HWND, msg types.UINT, wParam types.WPARAM, lParam types.LPARAM) types.LResult {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_DefWindowProc).Call(uintptr(handle), uintptr(msg), uintptr(wParam), uintptr(lParam))
|
||||
return types.LResult(r1)
|
||||
}
|
||||
|
||||
func WinDefSubclassProc(handle types.HWND, msg types.UINT, wParam types.WPARAM, lParam types.LPARAM) types.LResult {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_DefSubclassProc).Call(uintptr(handle), uintptr(msg), uintptr(wParam), uintptr(lParam))
|
||||
return types.LResult(r1)
|
||||
}
|
||||
|
||||
func WinCreateRoundRectRgn(_para1, _para2, _para3, _para4, _para5, _para6 types.LongInt) *types.HRGN {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_CreateRoundRectRgn).Call(_para1.ToPtr(), _para2.ToPtr(), _para3.ToPtr(), _para4.ToPtr(), _para5.ToPtr(), _para6.ToPtr())
|
||||
return types.NewHRGN(r1)
|
||||
}
|
||||
|
||||
func WinSetWindowRgn(handle types.HWND, hRgn *types.HRGN, bRedraw bool) types.LongInt {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_SetWindowRgn).Call(uintptr(handle), hRgn.Instance(), api.PascalBool(bRedraw))
|
||||
return types.LongInt(r1)
|
||||
}
|
||||
|
||||
func WinSetCursor(hCursor *HCursor) *HCursor {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_SetCursor).Call(uintptr(hCursor.instance))
|
||||
return &HCursor{
|
||||
instance: unsafe.Pointer(r1),
|
||||
}
|
||||
}
|
||||
|
||||
func WinLoadCursor(handle types.HWND, lpCursorName int32) *HCursor {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_LoadCursor).Call(uintptr(handle), uintptr(lpCursorName))
|
||||
return &HCursor{
|
||||
instance: unsafe.Pointer(r1),
|
||||
}
|
||||
}
|
||||
|
||||
func WinOnPaint(handle types.HWND) {
|
||||
imports.Proc(internale_CEF_Win_OnPaint).Call(uintptr(handle))
|
||||
}
|
||||
|
||||
func WinSetDraggableRegions(aRGN *types.HRGN, regions []TCefDraggableRegion) {
|
||||
/*
|
||||
//SetDraggableRegions 代码实现
|
||||
draggableRegion := WinCreateRectRgn(0, 0, 0, 0)
|
||||
WinSetRectRgn(draggableRegion, 0, 0, 0, 0)
|
||||
for i := 0; i < regions.RegionsCount(); i++ {
|
||||
region := regions.Region(i)
|
||||
creRGN := WinCreateRectRgn(region.Bounds.X, region.Bounds.Y, region.Bounds.X+region.Bounds.Width, region.Bounds.Y+region.Bounds.Height)
|
||||
if region.Draggable {
|
||||
WinCombineRgn(draggableRegion, draggableRegion, creRGN, consts.RGN_OR)
|
||||
} else {
|
||||
WinCombineRgn(draggableRegion, draggableRegion, creRGN, consts.RGN_DIFF)
|
||||
}
|
||||
WinDeleteObject(creRGN)
|
||||
}
|
||||
fmt.Println("Check PtInRegion:", WinPtInRegion(draggableRegion, 50, 50))
|
||||
*/
|
||||
imports.Proc(internale_CEF_Win_SetDraggableRegions).Call(aRGN.Instance(), uintptr(int32(len(regions))), uintptr(unsafe.Pointer(®ions[0])), uintptr(int32(len(regions))))
|
||||
}
|
||||
|
||||
func WinEndPaint(Handle types.HWND, PS types.TagPaintStruct) types.Integer {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_EndPaint).Call(uintptr(Handle), uintptr(unsafe.Pointer(&PS)))
|
||||
return types.Integer(r1)
|
||||
@ -180,18 +372,18 @@ func WinEnterCriticalSection(CritSection types.TCriticalSection) {
|
||||
imports.Proc(internale_CEF_Win_EnterCriticalSection).Call(CritSection.ToPtr())
|
||||
}
|
||||
|
||||
func WinEnumDisplayMonitors(hdc types.HDC, lprcClip types.Rect, lpfnEnum types.MonitorEnumProc, dwData types.LPARAM) types.LongBool {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_EnumDisplayMonitors).Call(uintptr(hdc), uintptr(unsafe.Pointer(&lprcClip)), uintptr(lpfnEnum), uintptr(dwData))
|
||||
func WinEnumDisplayMonitors(hdc types.HDC, lprcClip types.Rect, callback *EnumDisplayMonitorsCallback, dwData types.LPARAM) types.LongBool {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_EnumDisplayMonitors).Call(uintptr(hdc), uintptr(unsafe.Pointer(&lprcClip)), callback.instance, uintptr(dwData))
|
||||
return types.LongBool(api.GoBool(r1))
|
||||
}
|
||||
|
||||
func WinEnumFontFamilies(DC types.HDC, Family types.PChar, EnumFontFamProc types.FontEnumProc, LParam types.LPARAM) types.LongInt {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_EnumFontFamilies).Call(uintptr(DC), Family.ToPtr(), uintptr(EnumFontFamProc), uintptr(LParam))
|
||||
func WinEnumFontFamilies(DC types.HDC, Family types.PChar, callback *EnumFontFamiliesCallback, LParam types.LPARAM) types.LongInt {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_EnumFontFamilies).Call(uintptr(DC), Family.ToPtr(), callback.instance, uintptr(LParam))
|
||||
return types.LongInt(r1)
|
||||
}
|
||||
|
||||
func WinEnumFontFamiliesEx(DC types.HDC, lpLogFont types.LogFontA, Callback types.FontEnumExProc, LParam types.LPARAM, Flags types.DWORD) types.LongInt {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_EnumFontFamiliesEx).Call(uintptr(DC), uintptr(unsafe.Pointer(&lpLogFont)), uintptr(Callback), uintptr(LParam), uintptr(Flags))
|
||||
func WinEnumFontFamiliesEx(DC types.HDC, lpLogFont types.LogFontA, callback *EnumFontFamiliesExCallback, LParam types.LPARAM, Flags types.DWORD) types.LongInt {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_EnumFontFamiliesEx).Call(uintptr(DC), uintptr(unsafe.Pointer(&lpLogFont)), callback.instance, uintptr(LParam), uintptr(Flags))
|
||||
return types.LongInt(r1)
|
||||
}
|
||||
|
||||
@ -550,7 +742,7 @@ func WinLoadIcon(hInstance types.THandle, lpIconName types.PChar) types.HICON {
|
||||
}
|
||||
|
||||
func WinMaskBltRop(DestDC types.HDC, X, Y, Width, Height types.Integer, SrcDC types.HDC, XSrc, YSrc types.Integer, Mask types.HBITMAP, XMask, YMask types.Integer, Rop types.DWORD) types.LongBool {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_MaskBlt).Call(uintptr(DestDC), uintptr(X), uintptr(Y), uintptr(Width), uintptr(Height), uintptr(SrcDC), uintptr(XSrc), uintptr(YSrc), uintptr(Mask), uintptr(XMask), uintptr(YMask), uintptr(Rop))
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_MaskBltRop).Call(uintptr(DestDC), uintptr(X), uintptr(Y), uintptr(Width), uintptr(Height), uintptr(SrcDC), uintptr(XSrc), uintptr(YSrc), uintptr(Mask), uintptr(XMask), uintptr(YMask), uintptr(Rop))
|
||||
return types.LongBool(api.GoBool(r1))
|
||||
}
|
||||
|
||||
|
@ -1,198 +0,0 @@
|
||||
//----------------------------------------
|
||||
//
|
||||
// Copyright © yanghy. All Rights Reserved.
|
||||
//
|
||||
// Licensed under Apache License Version 2.0, January 2004
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//----------------------------------------
|
||||
|
||||
// energy - lcl window api
|
||||
|
||||
package cef
|
||||
|
||||
import (
|
||||
"github.com/energye/energy/v2/common/imports"
|
||||
"github.com/energye/energy/v2/consts"
|
||||
"github.com/energye/energy/v2/types"
|
||||
"github.com/energye/golcl/lcl/api"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
S_OK = 0x00000000
|
||||
S_FALSE = 0x00000001
|
||||
E_UNEXPECTED = 0x8000FFFF
|
||||
E_NOTIMPL = 0x80004001
|
||||
E_OUTOFMEMORY = 0x8007000E
|
||||
E_INVALIDARG = 0x80070057
|
||||
E_NOINTERFACE = 0x80004002
|
||||
E_POINTER = 0x80004003
|
||||
E_HANDLE = 0x80070006
|
||||
E_ABORT = 0x80004004
|
||||
E_FAIL = 0x80004005
|
||||
E_ACCESSDENIED = 0x80070005
|
||||
E_PENDING = 0x8000000A
|
||||
)
|
||||
|
||||
// Win32 Predefined cursor constants
|
||||
const (
|
||||
IDC_ARROW = 32512
|
||||
IDC_IBEAM = 32513
|
||||
IDC_WAIT = 32514
|
||||
IDC_CROSS = 32515
|
||||
IDC_UPARROW = 32516
|
||||
IDC_SIZENWSE = 32642
|
||||
IDC_SIZENESW = 32643
|
||||
IDC_SIZEWE = 32644
|
||||
IDC_SIZENS = 32645
|
||||
IDC_SIZEALL = 32646
|
||||
IDC_NO = 32648
|
||||
IDC_HAND = 32649
|
||||
IDC_APPSTARTING = 32650
|
||||
IDC_HELP = 32651
|
||||
IDC_ICON = 32641
|
||||
IDC_SIZE = 32640
|
||||
)
|
||||
|
||||
const (
|
||||
FALSE = 0
|
||||
TRUE = 1
|
||||
)
|
||||
|
||||
const (
|
||||
WMSZ_LEFT = 1
|
||||
WMSZ_RIGHT = 2
|
||||
WMSZ_TOP = 3
|
||||
WMSZ_TOPLEFT = 4
|
||||
WMSZ_TOPRIGHT = 5
|
||||
WMSZ_BOTTOM = 6
|
||||
WMSZ_BOTTOMLEFT = 7
|
||||
WMSZ_BOTTOMRIGHT = 8
|
||||
)
|
||||
|
||||
func LOBYTE(w uint16) byte {
|
||||
return byte(w)
|
||||
}
|
||||
|
||||
func HIBYTE(w uint16) byte {
|
||||
return byte(w >> 8 & 0xff)
|
||||
}
|
||||
|
||||
func LOWORD(dw uint32) uint16 {
|
||||
return uint16(dw & 0xFFFF)
|
||||
}
|
||||
|
||||
func HIWORD(dw uint32) uint16 {
|
||||
return uint16(dw >> 16 & 0xffff)
|
||||
}
|
||||
|
||||
func GET_X_LPARAM(lp uintptr) int32 {
|
||||
return int32(int16(LOWORD(uint32(lp))))
|
||||
}
|
||||
|
||||
func GET_Y_LPARAM(lp uintptr) int32 {
|
||||
return int32(int16(HIWORD(uint32(lp))))
|
||||
}
|
||||
|
||||
type HCursor struct {
|
||||
instance unsafe.Pointer
|
||||
}
|
||||
|
||||
func (m *HCursor) Free() {
|
||||
m.instance = nil
|
||||
}
|
||||
|
||||
func WinCreateRectRgn(X1, Y1, X2, Y2 int32) *types.HRGN {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_CreateRectRgn).Call(uintptr(X1), uintptr(Y1), uintptr(X2), uintptr(Y2))
|
||||
return types.NewHRGN(r1)
|
||||
}
|
||||
|
||||
func WinSetRectRgn(aRGN *types.HRGN, X1, Y1, X2, Y2 int32) bool {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_SetRectRgn).Call(aRGN.Instance(), uintptr(X1), uintptr(Y1), uintptr(X2), uintptr(Y2))
|
||||
return api.GoBool(r1)
|
||||
}
|
||||
|
||||
func WinDeleteObject(aRGN *types.HRGN) bool {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_DeleteObject).Call(aRGN.Instance())
|
||||
return api.GoBool(r1)
|
||||
}
|
||||
|
||||
func WinCombineRgn(dest, src1, src2 *types.HRGN, fnCombineMode consts.RNGFnCombineMode) int32 {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_CombineRgn).Call(dest.Instance(), src1.Instance(), src2.Instance(), uintptr(fnCombineMode))
|
||||
return int32(r1)
|
||||
}
|
||||
|
||||
func WinPtInRegion(RGN *types.HRGN, X, Y int32) bool {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_PtInRegion).Call(RGN.Instance(), uintptr(X), uintptr(Y))
|
||||
return api.GoBool(r1)
|
||||
}
|
||||
|
||||
func WinScreenToClient(handle types.HWND, p *types.Point) int32 {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_ScreenToClient).Call(uintptr(handle), uintptr(unsafe.Pointer(p)))
|
||||
return int32(r1)
|
||||
}
|
||||
|
||||
func WinClientToScreen(handle types.HWND, p *types.Point) bool {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_ClientToScreen).Call(uintptr(handle), uintptr(unsafe.Pointer(p)))
|
||||
return api.GoBool(r1)
|
||||
}
|
||||
|
||||
func WinDefWindowProc(handle types.HWND, msg types.UINT, wParam types.WPARAM, lParam types.LPARAM) types.LResult {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_DefWindowProc).Call(uintptr(handle), uintptr(msg), uintptr(wParam), uintptr(lParam))
|
||||
return types.LResult(r1)
|
||||
}
|
||||
|
||||
func WinDefSubclassProc(handle types.HWND, msg types.UINT, wParam types.WPARAM, lParam types.LPARAM) types.LResult {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_DefSubclassProc).Call(uintptr(handle), uintptr(msg), uintptr(wParam), uintptr(lParam))
|
||||
return types.LResult(r1)
|
||||
}
|
||||
|
||||
func WinCreateRoundRectRgn(_para1, _para2, _para3, _para4, _para5, _para6 types.LongInt) *types.HRGN {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_CreateRoundRectRgn).Call(_para1.ToPtr(), _para2.ToPtr(), _para3.ToPtr(), _para4.ToPtr(), _para5.ToPtr(), _para6.ToPtr())
|
||||
return types.NewHRGN(r1)
|
||||
}
|
||||
|
||||
func WinSetWindowRgn(handle types.HWND, hRgn *types.HRGN, bRedraw bool) types.LongInt {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_SetWindowRgn).Call(uintptr(handle), hRgn.Instance(), api.PascalBool(bRedraw))
|
||||
return types.LongInt(r1)
|
||||
}
|
||||
|
||||
func WinSetCursor(hCursor *HCursor) *HCursor {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_SetCursor).Call(uintptr(hCursor.instance))
|
||||
return &HCursor{
|
||||
instance: unsafe.Pointer(r1),
|
||||
}
|
||||
}
|
||||
|
||||
func WinLoadCursor(handle types.HWND, lpCursorName int32) *HCursor {
|
||||
r1, _, _ := imports.Proc(internale_CEF_Win_LoadCursor).Call(uintptr(handle), uintptr(lpCursorName))
|
||||
return &HCursor{
|
||||
instance: unsafe.Pointer(r1),
|
||||
}
|
||||
}
|
||||
|
||||
func WinOnPaint(handle types.HWND) {
|
||||
imports.Proc(internale_CEF_Win_OnPaint).Call(uintptr(handle))
|
||||
}
|
||||
|
||||
func WinSetDraggableRegions(aRGN *types.HRGN, regions []TCefDraggableRegion) {
|
||||
/*
|
||||
//SetDraggableRegions 代码实现
|
||||
draggableRegion := WinCreateRectRgn(0, 0, 0, 0)
|
||||
WinSetRectRgn(draggableRegion, 0, 0, 0, 0)
|
||||
for i := 0; i < regions.RegionsCount(); i++ {
|
||||
region := regions.Region(i)
|
||||
creRGN := WinCreateRectRgn(region.Bounds.X, region.Bounds.Y, region.Bounds.X+region.Bounds.Width, region.Bounds.Y+region.Bounds.Height)
|
||||
if region.Draggable {
|
||||
WinCombineRgn(draggableRegion, draggableRegion, creRGN, consts.RGN_OR)
|
||||
} else {
|
||||
WinCombineRgn(draggableRegion, draggableRegion, creRGN, consts.RGN_DIFF)
|
||||
}
|
||||
WinDeleteObject(creRGN)
|
||||
}
|
||||
fmt.Println("Check PtInRegion:", WinPtInRegion(draggableRegion, 50, 50))
|
||||
*/
|
||||
imports.Proc(internale_CEF_Win_SetDraggableRegions).Call(aRGN.Instance(), uintptr(int32(len(regions))), uintptr(unsafe.Pointer(®ions[0])), uintptr(int32(len(regions))))
|
||||
}
|
@ -80,6 +80,9 @@ const (
|
||||
internale_CEF_Win_EnumDisplayMonitors
|
||||
internale_CEF_Win_EnumFontFamilies
|
||||
internale_CEF_Win_EnumFontFamiliesEx
|
||||
internale_CEF_Win_EnumDisplayMonitorsCallbackFree
|
||||
internale_CEF_Win_EnumFontFamiliesCallbackFree
|
||||
internale_CEF_Win_EnumFontFamiliesExCallbackFree
|
||||
internale_CEF_Win_Ellipse
|
||||
internale_CEF_Win_EqualRgn
|
||||
internale_CEF_Win_ExcludeClipRect
|
||||
|
@ -79,6 +79,9 @@ func init() {
|
||||
dllimports.NewEnergyImport("CEF_Win_EnumDisplayMonitors", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_EnumFontFamilies", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_EnumFontFamiliesEx", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_EnumDisplayMonitorsCallbackFree", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_EnumFontFamiliesCallbackFree", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_EnumFontFamiliesExCallbackFree", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_Ellipse", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_EqualRgn", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_ExcludeClipRect", 0),
|
||||
|
@ -94,10 +94,6 @@ const (
|
||||
MDT_DEFAULT = MDT_EFFECTIVE_DPI
|
||||
)
|
||||
|
||||
type FontEnumProc func(ELogFont TagEnumLogFontA, Metric TNewTextMetric, FontType LongInt, Data LPARAM) LongInt
|
||||
type FontEnumExProc func(ELogFont TagEnumLogFontExA, Metric TNewTextMetricEx, FontType LongInt, Data LPARAM) LongInt
|
||||
type MonitorEnumProc func(hMonitor HMONITOR, hdcMonitor HDC, lprcMonitor Rect, dwData LPARAM) LongBool
|
||||
|
||||
type HRGN struct {
|
||||
instance unsafe.Pointer
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user