2023-01-07 21:29:08 +08:00
|
|
|
//----------------------------------------
|
|
|
|
//
|
|
|
|
// Copyright © yanghy. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Licensed under GNU General Public License v3.0
|
|
|
|
//
|
|
|
|
//----------------------------------------
|
|
|
|
|
|
|
|
//go:build !windows
|
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package cef
|
|
|
|
|
2023-01-18 17:21:55 +08:00
|
|
|
import (
|
|
|
|
"github.com/energye/energy/common"
|
|
|
|
"github.com/energye/golcl/lcl/types"
|
|
|
|
)
|
2023-01-07 21:35:32 +08:00
|
|
|
|
2023-01-20 10:17:45 +08:00
|
|
|
type customWindowCaption struct {
|
|
|
|
}
|
|
|
|
|
2023-01-07 21:29:08 +08:00
|
|
|
//显示标题栏
|
|
|
|
func (m *LCLBrowserWindow) ShowTitle() {
|
|
|
|
if m.TForm == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
m.TForm.SetBorderStyle(types.BsSizeable)
|
|
|
|
}
|
|
|
|
|
|
|
|
//隐藏标题栏
|
|
|
|
func (m *LCLBrowserWindow) HideTitle() {
|
|
|
|
if m.TForm == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
m.TForm.SetBorderStyle(types.BsSingle)
|
|
|
|
}
|
2023-01-18 08:37:08 +08:00
|
|
|
|
|
|
|
// 默认事件注册 windows 消息事件
|
|
|
|
func (m *LCLBrowserWindow) registerWindowsCompMsgEvent() {
|
|
|
|
|
|
|
|
}
|
2023-01-18 16:34:04 +08:00
|
|
|
|
|
|
|
func (m *LCLBrowserWindow) setDraggableRegions() {
|
|
|
|
}
|
|
|
|
|
|
|
|
//for other platform maximize and restore
|
|
|
|
func (m *LCLBrowserWindow) Maximize() {
|
|
|
|
if m.TForm == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
QueueAsyncCall(func(id int) {
|
|
|
|
var bs = m.BorderStyle()
|
|
|
|
var monitor = m.Monitor().WorkareaRect()
|
|
|
|
if m.windowProperty == nil {
|
|
|
|
m.windowProperty = &WindowProperty{}
|
|
|
|
}
|
|
|
|
if bs == types.BsNone || bs == types.BsSingle { //不能调整窗口大,所以手动控制窗口大小
|
|
|
|
var ws = m.WindowState()
|
|
|
|
var redWindowState types.TWindowState
|
|
|
|
//默认状态0
|
|
|
|
if m.windowProperty.WindowState == types.WsNormal && m.windowProperty.WindowState == ws {
|
|
|
|
redWindowState = types.WsMaximized
|
|
|
|
} else {
|
|
|
|
if m.windowProperty.WindowState == types.WsNormal {
|
|
|
|
redWindowState = types.WsMaximized
|
|
|
|
} else if m.windowProperty.WindowState == types.WsMaximized {
|
|
|
|
redWindowState = types.WsNormal
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m.windowProperty.WindowState = redWindowState
|
|
|
|
if redWindowState == types.WsMaximized {
|
|
|
|
m.windowProperty.X = m.Left()
|
|
|
|
m.windowProperty.Y = m.Top()
|
|
|
|
m.windowProperty.Width = m.Width()
|
|
|
|
m.windowProperty.Height = m.Height()
|
|
|
|
m.SetBounds(monitor.Left, monitor.Top, monitor.Right-monitor.Left-1, monitor.Bottom-monitor.Top-1)
|
|
|
|
} else if redWindowState == types.WsNormal {
|
|
|
|
m.SetBounds(m.windowProperty.X, m.windowProperty.Y, m.windowProperty.Width, m.windowProperty.Height)
|
|
|
|
}
|
|
|
|
m.SetWindowState(redWindowState)
|
|
|
|
} else {
|
|
|
|
if m.WindowState() == types.WsMaximized {
|
|
|
|
m.SetWindowState(types.WsNormal)
|
2023-01-18 17:21:55 +08:00
|
|
|
if common.IsDarwin() {
|
2023-01-18 16:34:04 +08:00
|
|
|
m.SetWindowState(types.WsMaximized)
|
|
|
|
m.SetWindowState(types.WsNormal)
|
|
|
|
}
|
|
|
|
} else if m.WindowState() == types.WsNormal {
|
|
|
|
m.SetWindowState(types.WsMaximized)
|
|
|
|
}
|
|
|
|
m.windowProperty.WindowState = m.WindowState()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|