Skip to content

Commit

Permalink
U: demo frameless, mask. Using comments and questions
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangli10 committed Apr 24, 2024
1 parent 44169fa commit e8aa518
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
3 changes: 2 additions & 1 deletion examples/frameless/frameless.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ func main() {

//指定一个URL地址,或本地html文件目录
cef.BrowserWindow.Config.Url = "http://localhost:22022/index.html"
// LCL MacOS 效果不好,不如VF窗口模式, TODO => LCL。 VF:应需要系统菜单
cef.BrowserWindow.Config.EnableHideCaption = true
// LCL macos 隐藏标题栏后,该选项不生效
// LCL MacOS 隐藏标题栏后,该选项不生效
//cef.BrowserWindow.Config.EnableResize = true
cef.BrowserWindow.Config.Title = "Energy Vue + ElementUI 示例"
cef.BrowserWindow.Config.Width = 1366
Expand Down
18 changes: 15 additions & 3 deletions examples/window/masking/mask/mask.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func Create(window *cef.LCLBrowserWindow) *Mask {
mask.maskForm.SetAlign(types.AlClient) //铺满整个主窗口
//mask.maskForm.SetColor(colors.ClSkyblue)
// 这是透明设置,只能form, 但是它的子组件也会跟着半透明
mask.maskForm.SetAlphaBlend(true) //透明
mask.maskForm.SetAlphaBlend(true) //透明 MacOS好像没效果啊
mask.maskForm.SetAlphaBlendValue(200) //透明度
mask.maskForm.BringToFront()
// 创建一个gif播放组件
Expand Down Expand Up @@ -69,6 +69,18 @@ func (m *Mask) Show() {
m.maskForm.Show()
}

func (m *Mask) Mask() *lcl.TForm {
return m.maskForm
func (m *Mask) Hide() {
m.maskForm.Hide()
}

func (m *Mask) IsValid() bool {
return m.maskForm.IsValid()
}

func (m *Mask) Stop() {
m.gifPlay.Stop()
}

func (m *Mask) Start() {
m.gifPlay.Start()
}
7 changes: 4 additions & 3 deletions examples/window/masking/masking.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ func main() {
fmt.Println("OnLoadingProgressChange:", v)
// 更新UI组件或状态必须在UI线程中运行
cef.RunOnMainThread(func() {
if maskForm.Mask().IsValid() {
if maskForm.IsValid() {
maskForm.Progress(v)
if v == 100 {
maskForm.Mask().Close()
maskForm.Mask().Free()
maskForm.Hide()
maskForm.Stop()

if common.IsLinux() {
part.SetWidth(bw.Width())
Expand All @@ -70,6 +70,7 @@ func main() {
bw.Chromium().SetOnBeforeBrowser(func(sender lcl.IObject, browser *cef.ICefBrowser, frame *cef.ICefFrame, request *cef.ICefRequest, userGesture, isRedirect bool) bool {
cef.RunOnMainThread(func() {
maskForm.Show()
maskForm.Start()
})
return false
})
Expand Down

0 comments on commit e8aa518

Please sign in to comment.