| | |
| | | // Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) |
| | | // Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) |
| | | // SPDX-License-Identifier: Apache-2.0 |
| | | |
| | | #include "abstractwindowcontext_p.h" |
| | | |
| | | #include <QtGui/QPen> |
| | |
| | | } |
| | | |
| | | #ifdef Q_OS_MAC |
| | | void AbstractWindowContext::setSystemButtonArea(const QRect &rect) { |
| | | m_systemButtonArea = rect; |
| | | void AbstractWindowContext::setSystemButtonAreaCallback(const ScreenRectCallback &callback) { |
| | | m_systemButtonAreaCallback = callback; |
| | | virtual_hook(SystemButtonAreaChangedHook, nullptr); |
| | | } |
| | | #endif |
| | |
| | | if (!m_windowHandle) |
| | | return; |
| | | |
| | | QRect windowGeometry = m_delegate->getGeometry(m_host); |
| | | QRect screenGeometry = m_windowHandle->screen()->geometry(); |
| | | int x = (screenGeometry.width() - m_windowHandle->width()) / 2; |
| | | int y = (screenGeometry.height() - m_windowHandle->height()) / 2; |
| | | int x = (screenGeometry.width() - windowGeometry.width()) / 2; |
| | | int y = (screenGeometry.height() - windowGeometry.height()) / 2; |
| | | QPoint pos(x, y); |
| | | pos += screenGeometry.topLeft(); |
| | | m_windowHandle->setPosition(pos); |
| | |
| | | } |
| | | |
| | | case RaiseWindowHook: { |
| | | if (!m_windowHandle) |
| | | return; |
| | | |
| | | m_delegate->setWindowVisible(m_host, true); |
| | | Qt::WindowStates state = m_delegate->getWindowState(m_host); |
| | | if (state & Qt::WindowMinimized) { |
| | | m_delegate->setWindowState(m_host, state & ~Qt::WindowMinimized); |