1/*****************************************************************
2This file is part of the KDE project.
3
4Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
5
6Permission is hereby granted, free of charge, to any person obtaining a
7copy of this software and associated documentation files (the "Software"),
8to deal in the Software without restriction, including without limitation
9the rights to use, copy, modify, merge, publish, distribute, sublicense,
10and/or sell copies of the Software, and to permit persons to whom the
11Software is furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22DEALINGS IN THE SOFTWARE.
23******************************************************************/
24
25#ifndef KDECORATIONBRIDGE_H
26#define KDECORATIONBRIDGE_H
27
28#include "kdecoration.h"
29#include <QWidget>
30
31/**
32 * @short Bridge class for communicating between decorations and KWin core.
33 *
34 * This class allows communication between decorations and KWin core while allowing
35 * to keep binary compatibility. Decorations do not need to use it directly at all.
36 */
37class KDecorationBridge : public KDecorationDefines
38{
39public:
40 virtual ~KDecorationBridge() {}
41 virtual bool isActive() const = 0;
42 virtual bool isCloseable() const = 0;
43 virtual bool isMaximizable() const = 0;
44 virtual MaximizeMode maximizeMode() const = 0;
45 virtual QuickTileMode quickTileMode() const = 0;
46 virtual bool isMinimizable() const = 0;
47 virtual bool providesContextHelp() const = 0;
48 virtual int desktop() const = 0;
49 virtual bool isModal() const = 0;
50 virtual bool isShadeable() const = 0;
51 virtual bool isShade() const = 0;
52 virtual bool isSetShade() const = 0;
53 virtual bool keepAbove() const = 0;
54 virtual bool keepBelow() const = 0;
55 virtual bool isMovable() const = 0;
56 virtual bool isResizable() const = 0;
57 virtual NET::WindowType windowType(unsigned long supported_types) const = 0;
58 virtual QIcon icon() const = 0;
59 virtual QString caption() const = 0;
60 virtual void processMousePressEvent(QMouseEvent*) = 0;
61 virtual void showWindowMenu(const QRect &) = 0;
62 virtual void showWindowMenu(const QPoint &) = 0;
63 virtual void showApplicationMenu(const QPoint&) = 0;
64 virtual bool menuAvailable() const = 0;
65 virtual void performWindowOperation(WindowOperation) = 0;
66 virtual void setMask(const QRegion&, int) = 0;
67 virtual bool isPreview() const = 0;
68 virtual QRect geometry() const = 0;
69 virtual QRect iconGeometry() const = 0;
70 virtual QRegion unobscuredRegion(const QRegion& r) const = 0;
71 virtual WId windowId() const = 0;
72 virtual void closeWindow() = 0;
73 virtual void maximize(MaximizeMode mode) = 0;
74 virtual void minimize() = 0;
75 virtual void showContextHelp() = 0;
76 virtual void setDesktop(int desktop) = 0;
77 virtual void titlebarDblClickOperation() = 0;
78 virtual void titlebarMouseWheelOperation(int delta) = 0;
79 virtual void setShade(bool set) = 0;
80 virtual void setKeepAbove(bool) = 0;
81 virtual void setKeepBelow(bool) = 0;
82 // not part of public API
83 virtual int currentDesktop() const = 0;
84 virtual QWidget* initialParentWidget() const = 0;
85 virtual Qt::WFlags initialWFlags() const = 0;
86 virtual void grabXServer(bool grab) = 0;
87};
88
89class KDecorationBridgeUnstable
90 : public KDecorationBridge
91{
92public:
93 virtual bool compositingActive() const = 0;
94 virtual QRect transparentRect() const = 0;
95
96 // Window tabbing
97 using KDecorationBridge::caption;
98 virtual QString caption(int idx) const = 0;
99 virtual void closeTab(long id) = 0;
100 virtual void closeTabGroup() = 0;
101 virtual long currentTabId() const = 0;
102 using KDecorationBridge::icon;
103 virtual QIcon icon(int idx) const = 0;
104 virtual void setCurrentTab(long id) = 0;
105 using KDecorationBridge::showWindowMenu;
106 virtual void showWindowMenu(const QPoint& pos, long id) = 0;
107 virtual void tab_A_before_B(long A, long B) = 0;
108 virtual void tab_A_behind_B(long A, long B) = 0;
109 virtual int tabCount() const = 0;
110 virtual long tabId(int idx) const = 0;
111 virtual void untab(long id, const QRect& newGeom) = 0;
112 virtual WindowOperation buttonToWindowOperation(Qt::MouseButtons button) = 0;
113};
114
115#endif
116