A: view's component events/procs

This commit is contained in:
杨红岩 2023-07-04 22:35:28 +08:00
parent 0046a59076
commit 7667847c39
4 changed files with 219 additions and 0 deletions

View File

@ -2520,4 +2520,37 @@ const (
ScrollViewComponent_VerticalScrollbarWidth
ScrollViewComponent_HasHorizontalScrollbar
ScrollViewComponent_HasVerticalScrollbar
// ICefTextfield
TextfieldRef_CreateTextField
Textfield_SetPasswordInput
Textfield_IsPasswordInput
Textfield_SetReadOnly
Textfield_IsReadOnly
Textfield_GetText
Textfield_SetText
Textfield_AppendText
Textfield_InsertOrReplaceText
Textfield_HasSelection
Textfield_GetSelectedText
Textfield_SelectAll
Textfield_ClearSelection
Textfield_GetSelectedRange
Textfield_SelectRange
Textfield_GetCursorPosition
Textfield_SetTextColor
Textfield_GetTextColor
Textfield_SetSelectionTextColor
Textfield_GetSelectionTextColor
Textfield_SetSelectionBackgroundColor
Textfield_GetSelectionBackgroundColor
Textfield_SetFontList
Textfield_ApplyTextColor
Textfield_ApplyTextStyle
Textfield_IsCommandEnabled
Textfield_ExecuteCommand
Textfield_ClearEditHistory
Textfield_SetPlaceholderText
Textfield_GetPlaceholderText
Textfield_SetPlaceholderTextColor
Textfield_SetAccessibleName
) //end

View File

@ -2520,6 +2520,39 @@ func init() {
dllimports.NewEnergyImport("ScrollViewComponent_VerticalScrollbarWidth", 0),
dllimports.NewEnergyImport("ScrollViewComponent_HasHorizontalScrollbar", 0),
dllimports.NewEnergyImport("ScrollViewComponent_HasVerticalScrollbar", 0),
// ICefTextfield
dllimports.NewEnergyImport("TextfieldRef_CreateTextField", 0),
dllimports.NewEnergyImport("Textfield_SetPasswordInput", 0),
dllimports.NewEnergyImport("Textfield_IsPasswordInput", 0),
dllimports.NewEnergyImport("Textfield_SetReadOnly", 0),
dllimports.NewEnergyImport("Textfield_IsReadOnly", 0),
dllimports.NewEnergyImport("Textfield_GetText", 0),
dllimports.NewEnergyImport("Textfield_SetText", 0),
dllimports.NewEnergyImport("Textfield_AppendText", 0),
dllimports.NewEnergyImport("Textfield_InsertOrReplaceText", 0),
dllimports.NewEnergyImport("Textfield_HasSelection", 0),
dllimports.NewEnergyImport("Textfield_GetSelectedText", 0),
dllimports.NewEnergyImport("Textfield_SelectAll", 0),
dllimports.NewEnergyImport("Textfield_ClearSelection", 0),
dllimports.NewEnergyImport("Textfield_GetSelectedRange", 0),
dllimports.NewEnergyImport("Textfield_SelectRange", 0),
dllimports.NewEnergyImport("Textfield_GetCursorPosition", 0),
dllimports.NewEnergyImport("Textfield_SetTextColor", 0),
dllimports.NewEnergyImport("Textfield_GetTextColor", 0),
dllimports.NewEnergyImport("Textfield_SetSelectionTextColor", 0),
dllimports.NewEnergyImport("Textfield_GetSelectionTextColor", 0),
dllimports.NewEnergyImport("Textfield_SetSelectionBackgroundColor", 0),
dllimports.NewEnergyImport("Textfield_GetSelectionBackgroundColor", 0),
dllimports.NewEnergyImport("Textfield_SetFontList", 0),
dllimports.NewEnergyImport("Textfield_ApplyTextColor", 0),
dllimports.NewEnergyImport("Textfield_ApplyTextStyle", 0),
dllimports.NewEnergyImport("Textfield_IsCommandEnabled", 0),
dllimports.NewEnergyImport("Textfield_ExecuteCommand", 0),
dllimports.NewEnergyImport("Textfield_ClearEditHistory", 0),
dllimports.NewEnergyImport("Textfield_SetPlaceholderText", 0),
dllimports.NewEnergyImport("Textfield_GetPlaceholderText", 0),
dllimports.NewEnergyImport("Textfield_SetPlaceholderTextColor", 0),
dllimports.NewEnergyImport("Textfield_SetAccessibleName", 0),
} //end
imports.SetEnergyImportDefs(energyImportDefs)
}

View File

@ -9,3 +9,151 @@
//----------------------------------------
package cef
import (
"github.com/energye/energy/v2/cef/internal/def"
"github.com/energye/energy/v2/common/imports"
"github.com/energye/energy/v2/consts"
"github.com/energye/energy/v2/types"
"unsafe"
)
var TextFieldRef textField
type textField uintptr
func (*textField) New(delegate *ICefTextfieldDelegate) *ICefTextfield {
var result uintptr
imports.Proc(def.TextfieldRef_CreateTextField).Call(delegate.Instance(), uintptr(unsafe.Pointer(&result)))
if result != 0 {
return &ICefTextfield{&ICefView{
instance: unsafe.Pointer(result),
}}
}
return nil
}
func (m *ICefTextfield) SetPasswordInput(passwordInput bool) {
AObj.SetPasswordInput(password_input)
}
func (m *ICefTextfield) IsPasswordInput() bool {
Result = AObj.IsPasswordInput
}
func (m *ICefTextfield) SetReadOnly(readOnly bool) {
AObj.SetReadOnly(read_only)
}
func (m *ICefTextfield) IsReadOnly() bool {
Result = AObj.IsReadOnly
}
func (m *ICefTextfield) GetText() string {
Result = string(string(AObj.GetText))
}
func (m *ICefTextfield) SetText(text string) {
AObj.SetText(stringToUStr(text_))
}
func (m *ICefTextfield) AppendText(text string) {
AObj.AppendText(stringToUStr(text_))
}
func (m *ICefTextfield) InsertOrReplaceText(text string) {
AObj.InsertOrReplaceText(stringToUStr(text_))
}
func (m *ICefTextfield) HasSelection() bool {
Result = AObj.HasSelection()
}
func (m *ICefTextfield) GetSelectedText() string {
Result = string(string(AObj.GetSelectedText))
}
func (m *ICefTextfield) SelectAll(reversed bool) {
AObj.SelectAll(reversed)
}
func (m *ICefTextfield) ClearSelection() {
AObj.ClearSelection
}
func (m *ICefTextfield) GetSelectedRange() TCefRange {
Result = AObj.GetSelectedRange
}
func (m *ICefTextfield) SelectRange(range_ TCefRange) {
AObj.SelectRange(range)
}
func (m *ICefTextfield) GetCursorPosition() types.NativeUInt {
Result = AObj.GetCursorPosition
}
func (m *ICefTextfield) SetTextColor(color types.TCefColor) {
AObj.SetTextColor(color)
}
func (m *ICefTextfield) GetTextColor() {
TCefColor
Result = AObj.GetTextColor
}
func (m *ICefTextfield) SetSelectionTextColor(color types.TCefColor) {
AObj.SetSelectionTextColor(color)
}
func (m *ICefTextfield) GetSelectionTextColor() types.TCefColor {
Result = AObj.GetSelectionTextColor
}
func (m *ICefTextfield) SetSelectionBackgroundColor(color types.TCefColor) {
AObj.SetSelectionBackgroundColor(color)
}
func (m *ICefTextfield) GetSelectionBackgroundColor() types.TCefColor {
Result = AObj.GetSelectionBackgroundColor()
}
func (m *ICefTextfield) SetFontList(fontList string) {
AObj.SetFontList(stringToUStr(font_list))
}
func (m *ICefTextfield) ApplyTextColor(color types.TCefColor, range_ TCefRange) {
AObj.ApplyTextColor(color, range)
}
func (m *ICefTextfield) ApplyTextStyle(style consts.TCefTextStyle, add bool, range_ TCefRange) {
AObj.ApplyTextStyle(style, add, range)
}
func (m *ICefTextfield) IsCommandEnabled(commandId consts.TCefTextFieldCommands) bool {
Result = AObj.IsCommandEnabled(command_id)
}
func (m *ICefTextfield) ExecuteCommand(commandId consts.TCefTextFieldCommands) {
AObj.ExecuteCommand(command_id)
}
func (m *ICefTextfield) ClearEditHistory() {
AObj.ClearEditHistory
}
func (m *ICefTextfield) SetPlaceholderText(text string) {
AObj.SetPlaceholderText(stringToUStr(text_))
}
func (m *ICefTextfield) GetPlaceholderText() string {
Result = string(string(AObj.GetPlaceholderText))
}
func (m *ICefTextfield) SetPlaceholderTextColor(color types.TCefColor) {
AObj.SetPlaceholderTextColor(color)
}
func (m *ICefTextfield) SetAccessibleName(name string) {
AObj.SetAccessibleName(stringToUStr(name))
}

View File

@ -578,6 +578,11 @@ type ICefPanelDelegate struct {
*ICefViewDelegate
}
// ICefTextfieldDelegate
type ICefTextfieldDelegate struct {
*ICefViewDelegate
}
// TCEFViewComponent
type TCEFViewComponent struct {
lcl.IComponent