From fd8aca4a20f52f696aa239ead1baa20cea5879f6 Mon Sep 17 00:00:00 2001 From: SineStriker <55847490+SineStriker@users.noreply.github.com> Date: 周一, 11 12月 2023 14:58:25 +0800 Subject: [PATCH] Merge pull request #2 from stdware/refactor --- src/core/contexts/abstractwindowcontext_p.h | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/core/contexts/abstractwindowcontext_p.h b/src/core/contexts/abstractwindowcontext_p.h index 30ea3c1..fde76b0 100644 --- a/src/core/contexts/abstractwindowcontext_p.h +++ b/src/core/contexts/abstractwindowcontext_p.h @@ -8,8 +8,8 @@ #include <QtGui/QWindow> #include <QtGui/QPolygon> -#include <QWKCore/corewindowagent.h> -#include <QWKCore/windowitemdelegate.h> +#include <QWKCore/windowagentbase.h> +#include <QWKCore/private/windowitemdelegate_p.h> namespace QWK { @@ -29,8 +29,8 @@ bool setHitTestVisible(const QObject *obj, bool visible); bool setHitTestVisible(const QRect &rect, bool visible); - inline const QObject *systemButton(CoreWindowAgent::SystemButton button) const; - bool setSystemButton(CoreWindowAgent::SystemButton button, const QObject *obj); + inline const QObject *systemButton(WindowAgentBase::SystemButton button) const; + bool setSystemButton(WindowAgentBase::SystemButton button, const QObject *obj); inline const QObject *titleBar() const; bool setTitleBar(const QObject *obj); @@ -38,12 +38,19 @@ void showSystemMenu(const QPoint &pos); QRegion hitTestShape() const; - bool isInSystemButtons(const QPoint &pos, CoreWindowAgent::SystemButton *button) const; + bool isInSystemButtons(const QPoint &pos, WindowAgentBase::SystemButton *button) const; bool isInTitleBarDraggableArea(const QPoint &pos) const; + + virtual QString key() const; + + enum WindowContextHook { + CentralizeHook = 1, + ShowSystemMenuHook, + }; + virtual void virtual_hook(int id, void *data); protected: virtual bool setupHost() = 0; - virtual bool hostEventFilter(QEvent *event); protected: QObject *m_host; @@ -54,7 +61,7 @@ QList<QRect> m_hitTestVisibleRects; const QObject *m_titleBar{}; - std::array<const QObject *, CoreWindowAgent::NumSystemButton> m_systemButtons{}; + std::array<const QObject *, WindowAgentBase::NumSystemButton> m_systemButtons{}; // Cached shape mutable bool hitTestVisibleShapeDirty{}; @@ -74,7 +81,7 @@ } inline const QObject * - AbstractWindowContext::systemButton(CoreWindowAgent::SystemButton button) const { + AbstractWindowContext::systemButton(WindowAgentBase::SystemButton button) const { return m_systemButtons[button]; } -- Gitblit v1.9.1