A: view's component events/procs

This commit is contained in:
杨红岩 2023-07-04 18:13:32 +08:00
parent 384319bea1
commit 0b2c231671
3 changed files with 28 additions and 9 deletions

View File

@ -24,7 +24,7 @@ import (
)
type onIMECommitTextEvent func(sender lcl.IObject, text string, replacementRange TCefRange, relativeCursorPos int32)
type onIMESetCompositionEvent func(sender lcl.IObject, text string, underlines []*TCefCompositionUnderline, replacementRange, selectionRange TCefRange)
type onIMESetCompositionEvent func(sender lcl.IObject, text string, underlines *TCefCompositionUnderlineArray, replacementRange, selectionRange TCefRange)
type onHandledMessageEvent func(sender lcl.IObject, message *types.TMessage, lResult *types.LRESULT, handled *bool)
func (m *TBufferPanel) SetOnIMECancelComposition(fn lcl.TNotifyEvent) {
@ -63,14 +63,13 @@ func init() {
case onIMECommitTextEvent:
fn.(onIMECommitTextEvent)(lcl.AsObject(getPtr(0)), api.GoStr(getVal(1)), *(*TCefRange)(getPtr(2)), int32(getVal(3)))
case onIMESetCompositionEvent:
//underlinesPtr := getVal(2)
underlinesLen := int32(getVal(3))
underlines := make([]*TCefCompositionUnderline, underlinesLen)
underlines := &TCefCompositionUnderlineArray{
count: int(int32(getVal(3))),
ptr: *(*uintptr)(getPtr(2)),
sizeOf: unsafe.Sizeof(TCefCompositionUnderline{}),
}
replacementRange := *(*TCefRange)(getPtr(4))
selectionRange := *(*TCefRange)(getPtr(5))
for i := 0; i < int(underlinesLen); i++ {
}
fn.(onIMESetCompositionEvent)(lcl.AsObject(getPtr(0)), api.GoStr(getVal(1)), underlines, replacementRange, selectionRange)
case onHandledMessageEvent:
message := (*types.TMessage)(getPtr(1))

View File

@ -1166,12 +1166,29 @@ type TCefPopupFeatures struct {
// /include/internal/cef_types.h (cef_composition_underline_t)
type TCefCompositionUnderline struct {
Range TCefRange
Color Cardinal
BackgroundColor Cardinal
Color TCefColor
BackgroundColor TCefColor
Thick int32
Style TCefCompositionUnderlineStyle
}
type TCefCompositionUnderlineArray struct {
count int
ptr uintptr
sizeOf uintptr
}
func (m *TCefCompositionUnderlineArray) Count() int {
return m.count
}
func (m *TCefCompositionUnderlineArray) Get(index int) *TCefCompositionUnderline {
if index >= 0 && index < m.count {
return (*TCefCompositionUnderline)(common.GetParamPtr(m.ptr, index*int(m.sizeOf)))
}
return nil
}
// /include/internal/cef_types.h (cef_box_layout_settings_t)
type TCefBoxLayoutSettings struct {
Horizontal Integer

View File

@ -370,6 +370,9 @@ func (m *WindowForm) bufferPanelEvent() {
}
}
})
m.bufferPanel.SetOnIMESetComposition(func(sender lcl.IObject, text string, underlines *cef.TCefCompositionUnderlineArray, replacementRange, selectionRange cef.TCefRange) {
fmt.Println("SetOnIMESetComposition", replacementRange, selectionRange)
})
}
func (m *WindowForm) controlPanelWidget() {