| | |
| | | #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 { |
| | | |
| | |
| | | ~AbstractWindowContext() override; |
| | | |
| | | public: |
| | | virtual bool setup(QObject *host, WindowItemDelegate *delegate); |
| | | bool setup(QObject *host, WindowItemDelegate *delegate); |
| | | |
| | | inline QObject *host() const; |
| | | inline QWindow *window() const; |
| | |
| | | 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); |
| | |
| | | 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; |
| | | |
| | | protected: |
| | | QObject *m_host; |
| | |
| | | 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{}; |
| | |
| | | } |
| | | |
| | | inline const QObject * |
| | | AbstractWindowContext::systemButton(CoreWindowAgent::SystemButton button) const { |
| | | AbstractWindowContext::systemButton(WindowAgentBase::SystemButton button) const { |
| | | return m_systemButtons[button]; |
| | | } |
| | | |