1/*
2 * Copyright 2009 Marco Martin <notmart@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef PLASMA_WINDOWEFFECTS_H
21#define PLASMA_WINDOWEFFECTS_H
22
23#include <QtGui/QWidget>
24
25#include <plasma/plasma.h>
26
27/** @headerfile plasma/windoweffect.h <Plasma/WindowEffect> */
28
29namespace Plasma
30{
31
32/**
33 * Namespace for all window effects for Plasma/KWin interaction
34 * @since 4.4
35 */
36namespace WindowEffects
37{
38 enum Effect {
39 Slide = 1,
40 WindowPreview = 2,
41 PresentWindows = 3,
42 PresentWindowsGroup = 4,
43 HighlightWindows = 5,
44 OverrideShadow = 6,
45 BlurBehind = 7,
46 Dashboard = 8
47 };
48
49 /**
50 * @return if an atom property is available
51 *
52 * @param effect the effect we want to check
53 * @since 4.4
54 */
55 PLASMA_EXPORT bool isEffectAvailable(Effect effect);
56
57 /**
58 * Mark a window as sliding from screen edge
59 *
60 * @param id of the window on which we want to apply the effect
61 * @param location edge of the screen from which we want the sliding effect.
62 * Desktop and Floating won't have effect.
63 * @param offset distance in pixels from the screen edge defined by location
64 * @since 4.4
65 */
66 PLASMA_EXPORT void slideWindow(WId id, Plasma::Location location, int offset);
67
68 /**
69 * Mark a window as sliding from screen edge
70 * This is an overloaded member function provided for convenience
71 *
72 * @param widget QWidget corresponding to the top level window we want to animate
73 * @param location edge of the screen from which we want the sliding effect.
74 * Desktop and Floating won't have effect.
75 * @since 4.4
76 */
77 PLASMA_EXPORT void slideWindow(QWidget *widget, Plasma::Location location);
78
79 /**
80 * @return dimension of all the windows passed as parameter
81 *
82 * @param ids all the windows we want the size
83 * @since 4.4
84 */
85 PLASMA_EXPORT QList<QSize> windowSizes(const QList<WId> &ids);
86
87 /**
88 * Paint inside the window parent the thumbnails of the windows list in
89 * the respective rectangles of the rects list
90 *
91 * @param parent window where we should paint
92 * @param windows windows we want a thumbnail of.
93 * If it is empty any thumbnail will be deleted
94 * @param rects rectangles in parent coordinates where to paint the window thumbnails.
95 * If it is empty any thumbnail will be deleted
96 * @since 4.4
97 */
98 PLASMA_EXPORT void showWindowThumbnails(WId parent, const QList<WId> &windows = QList<WId>(), const QList<QRect> &rects = QList<QRect>());
99
100 /**
101 * Activate the Present Windows effect for the given groups of windows.
102 *
103 * @param controller The window which is the controller of this effect. The property
104 * will be set on this window. It will be removed by the effect
105 * @param ids all the windows which should be presented.
106 * @since 4.4
107 */
108 PLASMA_EXPORT void presentWindows(WId controller, const QList<WId> &ids);
109
110 /**
111 * Activate the Present Windows effect for the windows of the given desktop.
112 *
113 * @param controller The window which is the controller of this effect. The property
114 * will be set on this window. It will be removed by the effect
115 * @param desktop The desktop whose windows should be presented. -1 for all desktops
116 * @since 4.4
117 */
118 PLASMA_EXPORT void presentWindows(WId controller, int desktop = -1);
119
120 /**
121 * Highlight the selected windows, making all the others translucent
122 *
123 * @param controller The window which is the controller of this effect. The property
124 * will be set on this window. It will be removed by the effect
125 * @param ids all the windows which should be highlighted.
126 * @since 4.4
127 */
128 PLASMA_EXPORT void highlightWindows(WId controller, const QList<WId> &ids);
129
130 /**
131 * Forbid te windowmanager to automatically generate a shadow for this window
132 * @param window the window that won't have shadow
133 * @param override true if it won't have shadow, false enables it again
134 *
135 * @since 4.4
136 */
137 PLASMA_EXPORT void overrideShadow(WId window, bool override);
138
139 /**
140 * Instructs the window manager to blur the background in the specified region
141 * behind the given window. Passing a null region will enable the blur effect
142 * for the whole window. The region is relative to the top-left corner of the
143 * client area.
144 *
145 * Note that you will usually want to set the region to the shape of the window,
146 * excluding any shadow or halo.
147 *
148 * @param window The window for which to enable the blur effect
149 * @param enable Enable the effect if @a true, disable it if @false
150 * @param region The region within the window where the background will be blurred
151 * @since 4.5
152 */
153 PLASMA_EXPORT void enableBlurBehind(WId window, bool enable = true, const QRegion &region = QRegion());
154
155 /**
156 * Instructs the window manager to handle the given window as dashboard window as
157 * Dashboard windows should be handled diffrently and may have special effects
158 * applied to them.
159 *
160 * @param window The window for which to enable the blur effect
161 * @since 4.6
162 */
163 PLASMA_EXPORT void markAsDashboard(WId window);
164}
165
166} // namespace Plasma
167
168#endif
169
170