提交 4fff3856 编写于 作者: yanghye's avatar yanghye

A: view's component events/procs

上级 39814f79
......@@ -2427,4 +2427,17 @@ const (
ButtonDelegateRef_CreateForCustom
ButtonDelegate_SetOnButtonPressed
ButtonDelegate_SetOnButtonStateChanged
// ICefLabelButton
LabelButtonRef_CreateLabelButton
LabelButton_AsMenuButton
LabelButton_SetText
LabelButton_GetText
LabelButton_SetImage
LabelButton_GetImage
LabelButton_SetTextColor
LabelButton_SetEnabledTextColors
LabelButton_SetFontList
LabelButton_SetHorizontalAlignment
LabelButton_SetMinimumSize
LabelButton_SetMaximumSize
) //end
......@@ -2427,6 +2427,19 @@ func init() {
dllimports.NewEnergyImport("ButtonDelegateRef_CreateForCustom", 0),
dllimports.NewEnergyImport("ButtonDelegate_SetOnButtonPressed", 0),
dllimports.NewEnergyImport("ButtonDelegate_SetOnButtonStateChanged", 0),
// ICefLabelButton
dllimports.NewEnergyImport("LabelButtonRef_CreateLabelButton", 0),
dllimports.NewEnergyImport("LabelButton_AsMenuButton", 0),
dllimports.NewEnergyImport("LabelButton_SetText", 0),
dllimports.NewEnergyImport("LabelButton_GetText", 0),
dllimports.NewEnergyImport("LabelButton_SetImage", 0),
dllimports.NewEnergyImport("LabelButton_GetImage", 0),
dllimports.NewEnergyImport("LabelButton_SetTextColor", 0),
dllimports.NewEnergyImport("LabelButton_SetEnabledTextColors", 0),
dllimports.NewEnergyImport("LabelButton_SetFontList", 0),
dllimports.NewEnergyImport("LabelButton_SetHorizontalAlignment", 0),
dllimports.NewEnergyImport("LabelButton_SetMinimumSize", 0),
dllimports.NewEnergyImport("LabelButton_SetMaximumSize", 0),
} //end
imports.SetEnergyImportDefs(energyImportDefs)
}
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under Apache License Version 2.0, January 2004
//
// https//www.apache.org/licenses/LICENSE-2.0
//
//----------------------------------------
package cef
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under Apache License Version 2.0, January 2004
//
// https//www.apache.org/licenses/LICENSE-2.0
//
//----------------------------------------
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"
"github.com/energye/golcl/lcl/api"
"unsafe"
)
// LabelButtonRef -> ICefLabelButton
var LabelButtonRef labelButton
type labelButton uintptr
func (*labelButton) New(delegate *ICefButtonDelegate, text string) *ICefLabelButton {
var result uintptr
imports.Proc(def.LabelButtonRef_CreateLabelButton).Call(delegate.Instance(), api.PascalStr(text), uintptr(unsafe.Pointer(&result)))
if result != 0 {
return &ICefLabelButton{&ICefButton{&ICefView{instance: getInstance(result)}}}
}
return nil
}
func (m *ICefLabelButton) AsMenuButton() *ICefMenuButton {
if !m.IsValid() {
return nil
}
var result uintptr
imports.Proc(def.LabelButton_AsMenuButton).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
if result != 0 {
return &ICefMenuButton{&ICefLabelButton{&ICefButton{&ICefView{instance: getInstance(result)}}}}
}
return nil
}
func (m *ICefLabelButton) SetText(text string) {
if !m.IsValid() {
return
}
imports.Proc(def.LabelButton_SetText).Call(m.Instance(), api.PascalStr(text))
}
func (m *ICefLabelButton) GetText() string {
if !m.IsValid() {
return ""
}
r1, _, _ := imports.Proc(def.LabelButton_GetText).Call(m.Instance())
return api.GoStr(r1)
}
func (m *ICefLabelButton) SetImage(buttonState consts.TCefButtonState, image *ICefImage) {
if !m.IsValid() || !image.IsValid() {
return
}
imports.Proc(def.LabelButton_SetImage).Call(m.Instance(), uintptr(buttonState), image.Instance())
}
func (m *ICefLabelButton) GetImage() *ICefImage {
if !m.IsValid() {
return nil
}
var result uintptr
imports.Proc(def.LabelButton_GetImage).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
if result != 0 {
return &ICefImage{instance: getInstance(result)}
}
return nil
}
func (m *ICefLabelButton) SetTextColor(forState consts.TCefButtonState, color types.TCefColor) {
if !m.IsValid() {
return
}
imports.Proc(def.LabelButton_SetTextColor).Call(m.Instance(), uintptr(forState), uintptr(color))
}
func (m *ICefLabelButton) SetEnabledTextColors(color types.TCefColor) {
if !m.IsValid() {
return
}
imports.Proc(def.LabelButton_SetEnabledTextColors).Call(m.Instance(), uintptr(color))
}
func (m *ICefLabelButton) SetFontList(fontList string) {
if !m.IsValid() {
return
}
imports.Proc(def.LabelButton_SetFontList).Call(m.Instance(), api.PascalStr(fontList))
}
func (m *ICefLabelButton) SetHorizontalAlignment(alignment consts.TCefHorizontalAlignment) {
if !m.IsValid() {
return
}
imports.Proc(def.LabelButton_SetHorizontalAlignment).Call(m.Instance(), uintptr(alignment))
}
func (m *ICefLabelButton) SetMinimumSize(size *TCefSize) {
if !m.IsValid() {
return
}
imports.Proc(def.LabelButton_SetMinimumSize).Call(m.Instance(), uintptr(unsafe.Pointer(size)))
}
func (m *ICefLabelButton) SetMaximumSize(size *TCefSize) {
if !m.IsValid() {
return
}
imports.Proc(def.LabelButton_SetMaximumSize).Call(m.Instance(), uintptr(unsafe.Pointer(size)))
}
......@@ -124,7 +124,7 @@ func (m *ICefWindow) SetFullscreen(fullscreen bool) {
}
// SetBackgroundColor 设置背景色
func (m *ICefWindow) SetBackgroundColor(rect *types.TCefColor) {
func (m *ICefWindow) SetBackgroundColor(rect types.TCefColor) {
imports.Proc(def.ICEFWindow_SetBackgroundColor).Call(uintptr(m.instance), rect.ToPtr())
}
......
......@@ -493,6 +493,12 @@ type ICefLabelButton struct {
*ICefButton
}
// ICefMenuButton
// /include/capi/views/cef_menu_button_capi.h (cef_menu_button_t)
type ICefMenuButton struct {
*ICefLabelButton
}
// ICefPanel
// /include/capi/views/cef_panel_capi.h (cef_panel_t)
type ICefPanel struct {
......
......@@ -159,7 +159,7 @@ func (m *TCEFWindowComponent) SetFullscreen(fullscreen bool) {
}
// SetBackgroundColor 设置背景色
func (m *TCEFWindowComponent) SetBackgroundColor(rect *types.TCefColor) {
func (m *TCEFWindowComponent) SetBackgroundColor(rect types.TCefColor) {
imports.Proc(def.CEFWindowComponent_SetBackgroundColor).Call(m.Instance(), rect.ToPtr())
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册