mirror of
https://gitee.com/energye/energy.git
synced 2024-12-02 11:47:37 +08:00
Fix: Chromium & DialogHandler onFileDialog callback args:acceptFiltersList
This commit is contained in:
parent
981751a3b0
commit
b89c3bd57c
@ -61,7 +61,7 @@ type chromiumEventOnExtensionLoaded func(sender lcl.IObject, extension *ICefExte
|
|||||||
type chromiumEventOnExtensionLoadFailed func(sender lcl.IObject, result consts.TCefErrorCode)
|
type chromiumEventOnExtensionLoadFailed func(sender lcl.IObject, result consts.TCefErrorCode)
|
||||||
type chromiumEventOnExtensionUnloaded func(sender lcl.IObject, extension *ICefExtension)
|
type chromiumEventOnExtensionUnloaded func(sender lcl.IObject, extension *ICefExtension)
|
||||||
type chromiumEventOnFavIconUrlChange func(sender lcl.IObject, browser *ICefBrowser, iconUrls []string) // TStrings => []string
|
type chromiumEventOnFavIconUrlChange func(sender lcl.IObject, browser *ICefBrowser, iconUrls []string) // TStrings => []string
|
||||||
type chromiumEventOnFileDialog func(sender lcl.IObject, browser *ICefBrowser, mode consts.TCefFileDialogMode, title, defaultFilePath string, acceptFilters []string, callback *ICefFileDialogCallback) bool
|
type chromiumEventOnFileDialog func(sender lcl.IObject, browser *ICefBrowser, mode consts.FileDialogMode, title, defaultFilePath string, acceptFilters *lcl.TStrings, callback *ICefFileDialogCallback) bool
|
||||||
type chromiumEventOnGetAccessibilityHandler func(sender lcl.IObject, accessibilityHandler *ICefAccessibilityHandler)
|
type chromiumEventOnGetAccessibilityHandler func(sender lcl.IObject, accessibilityHandler *ICefAccessibilityHandler)
|
||||||
type chromiumEventOnGetAudioParameters func(sender lcl.IObject, browser *ICefBrowser, params *TCefAudioParameters) bool
|
type chromiumEventOnGetAudioParameters func(sender lcl.IObject, browser *ICefBrowser, params *TCefAudioParameters) bool
|
||||||
type chromiumEventOnGetResourceHandler func(sender lcl.IObject, browser *ICefBrowser, frame *ICefFrame, request *ICefRequest) (resourceHandler *ICefResourceHandler)
|
type chromiumEventOnGetResourceHandler func(sender lcl.IObject, browser *ICefBrowser, frame *ICefFrame, request *ICefRequest) (resourceHandler *ICefResourceHandler)
|
||||||
|
@ -310,22 +310,22 @@ func init() {
|
|||||||
fn.(chromiumEventOnFavIconUrlChange)(lcl.AsObject(getPtr(0)), browse, iconUrls)
|
fn.(chromiumEventOnFavIconUrlChange)(lcl.AsObject(getPtr(0)), browse, iconUrls)
|
||||||
case chromiumEventOnFileDialog:
|
case chromiumEventOnFileDialog:
|
||||||
browse := &ICefBrowser{instance: getPtr(1)}
|
browse := &ICefBrowser{instance: getPtr(1)}
|
||||||
mode := consts.TCefFileDialogMode(getVal(2))
|
mode := consts.FileDialogMode(getVal(2))
|
||||||
title := api.GoStr(getVal(3))
|
title := api.GoStr(getVal(3))
|
||||||
defaultFilePath := api.GoStr(getVal(4))
|
defaultFilePath := api.GoStr(getVal(4))
|
||||||
acceptFiltersList := lcl.AsStrings(getVal(5))
|
acceptFiltersList := lcl.AsStrings(getVal(5))
|
||||||
callback := &ICefFileDialogCallback{instance: getPtr(6)}
|
callback := &ICefFileDialogCallback{instance: getPtr(6)}
|
||||||
result := (*bool)(getPtr(7))
|
result := (*bool)(getPtr(7))
|
||||||
var acceptFilters []string
|
//var acceptFilters []string
|
||||||
if acceptFiltersList.IsValid() {
|
//if acceptFiltersList.IsValid() {
|
||||||
count := int(acceptFiltersList.Count())
|
// count := int(acceptFiltersList.Count())
|
||||||
acceptFilters = make([]string, count, count)
|
// acceptFilters = make([]string, count, count)
|
||||||
for i := 0; i < count; i++ {
|
// for i := 0; i < count; i++ {
|
||||||
acceptFilters[i] = acceptFiltersList.Strings(int32(i))
|
// acceptFilters[i] = acceptFiltersList.Strings(int32(i))
|
||||||
}
|
// }
|
||||||
acceptFiltersList.Free()
|
// //acceptFiltersList.Free()
|
||||||
}
|
//}
|
||||||
*result = fn.(chromiumEventOnFileDialog)(lcl.AsObject(getPtr(0)), browse, mode, title, defaultFilePath, acceptFilters, callback)
|
*result = fn.(chromiumEventOnFileDialog)(lcl.AsObject(getPtr(0)), browse, mode, title, defaultFilePath, acceptFiltersList, callback)
|
||||||
case chromiumEventOnGetAccessibilityHandler:
|
case chromiumEventOnGetAccessibilityHandler:
|
||||||
accessibilityHandler := &ICefAccessibilityHandler{instance: getPtr(1)}
|
accessibilityHandler := &ICefAccessibilityHandler{instance: getPtr(1)}
|
||||||
fn.(chromiumEventOnGetAccessibilityHandler)(lcl.AsObject(getPtr(0)), accessibilityHandler)
|
fn.(chromiumEventOnGetAccessibilityHandler)(lcl.AsObject(getPtr(0)), accessibilityHandler)
|
||||||
|
@ -68,7 +68,7 @@ func (m *ICefDialogHandler) SetOnFileDialog(fn onFileDialog) {
|
|||||||
|
|
||||||
// ************************** events ************************** //
|
// ************************** events ************************** //
|
||||||
|
|
||||||
type onFileDialog func(browser *ICefBrowser, mode consts.TCefFileDialogMode, title, defaultFilePath string, acceptFilters []string, callback *ICefFileDialogCallback) bool
|
type onFileDialog func(browser *ICefBrowser, mode consts.FileDialogMode, title, defaultFilePath string, acceptFilters *lcl.TStrings, callback *ICefFileDialogCallback) bool
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
lcl.RegisterExtEventCallback(func(fn interface{}, getVal func(idx int) uintptr) bool {
|
lcl.RegisterExtEventCallback(func(fn interface{}, getVal func(idx int) uintptr) bool {
|
||||||
@ -78,22 +78,13 @@ func init() {
|
|||||||
switch fn.(type) {
|
switch fn.(type) {
|
||||||
case onFileDialog:
|
case onFileDialog:
|
||||||
browse := &ICefBrowser{instance: getPtr(0)}
|
browse := &ICefBrowser{instance: getPtr(0)}
|
||||||
mode := consts.TCefFileDialogMode(getVal(1))
|
mode := consts.FileDialogMode(getVal(1))
|
||||||
title := api.GoStr(getVal(2))
|
title := api.GoStr(getVal(2))
|
||||||
defaultFilePath := api.GoStr(getVal(3))
|
defaultFilePath := api.GoStr(getVal(3))
|
||||||
acceptFiltersList := lcl.AsStrings(getVal(4))
|
acceptFiltersList := lcl.AsStrings(getVal(4))
|
||||||
callback := &ICefFileDialogCallback{instance: getPtr(5)}
|
callback := &ICefFileDialogCallback{instance: getPtr(5)}
|
||||||
result := (*bool)(getPtr(6))
|
result := (*bool)(getPtr(6))
|
||||||
var acceptFilters []string
|
*result = fn.(onFileDialog)(browse, mode, title, defaultFilePath, acceptFiltersList, callback)
|
||||||
if acceptFiltersList.IsValid() {
|
|
||||||
count := int(acceptFiltersList.Count())
|
|
||||||
acceptFilters = make([]string, count, count)
|
|
||||||
for i := 0; i < count; i++ {
|
|
||||||
acceptFilters[i] = acceptFiltersList.Strings(int32(i))
|
|
||||||
}
|
|
||||||
acceptFiltersList.Free()
|
|
||||||
}
|
|
||||||
*result = fn.(onFileDialog)(browse, mode, title, defaultFilePath, acceptFilters, callback)
|
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,12 @@ func (m *ICefFileDialogCallback) Cont(filePaths []string) {
|
|||||||
if !m.IsValid() {
|
if !m.IsValid() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fps := lcl.NewStrings()
|
fps := lcl.NewStringList()
|
||||||
|
if filePaths != nil {
|
||||||
for _, fp := range filePaths {
|
for _, fp := range filePaths {
|
||||||
fps.Add(fp)
|
fps.Add(fp)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
imports.Proc(def.FileDialogCallback_Cont).Call(m.Instance(), fps.Instance())
|
imports.Proc(def.FileDialogCallback_Cont).Call(m.Instance(), fps.Instance())
|
||||||
fps.Free()
|
fps.Free()
|
||||||
}
|
}
|
||||||
|
@ -1201,9 +1201,6 @@ const (
|
|||||||
// /include/internal/cef_types.h (cef_quick_menu_edit_state_flags_t)
|
// /include/internal/cef_types.h (cef_quick_menu_edit_state_flags_t)
|
||||||
type TCefQuickMenuEditStateFlags = types.Int32
|
type TCefQuickMenuEditStateFlags = types.Int32
|
||||||
|
|
||||||
// /include/internal/cef_types.h (cef_file_dialog_mode_t)
|
|
||||||
type TCefFileDialogMode = types.Cardinal
|
|
||||||
|
|
||||||
// /include/internal/cef_types.h (cef_log_severity_t)
|
// /include/internal/cef_types.h (cef_log_severity_t)
|
||||||
type TCefLogSeverity = types.Cardinal
|
type TCefLogSeverity = types.Cardinal
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user