1 /*
2     KWin - the KDE window manager
3     This file is part of the KDE project.
4 
5     SPDX-FileCopyrightText: 2009 Martin Gräßlin <mgraesslin@kde.org>
6 
7     SPDX-License-Identifier: GPL-2.0-or-later
8 */
9 
10 #ifndef TABBOXCONFIG_H
11 #define TABBOXCONFIG_H
12 
13 #include <QString>
14 
15 /**
16  * @file
17  * This file defines the class TabBoxConfig.
18  *
19  * @author Martin Gräßlin <mgraesslin@kde.org>
20  * @since 4.4
21  */
22 
23 namespace KWin
24 {
25 namespace TabBox
26 {
27 class TabBoxConfigPrivate;
28 
29 /**
30  * The TabBoxConfig class holds all configuration options for the TabBox.
31  * The TabBoxHandler contains a pointer to an object of this class and is
32  * used by all classes of TabBox. The config defines what kind of data the
33  * TabBox is displaying and how the layout looks like. There can be different
34  * Config sets and by setting a new config in the TabBoxHandler the behaviour
35  * of the TabBox is changed immediately.
36  *
37  * @author Martin Gräßlin <mgraesslin@kde.org>
38  * @since 4.4
39  */
40 class TabBoxConfig
41 {
42 public:
43     /**
44      * ClientDesktopMode defines whether windows from the current desktop or from all
45      * desktops are included in the TabBoxClient List in the TabBoxClientModel
46      */
47     enum ClientDesktopMode {
48         AllDesktopsClients, ///< TabBoxClients from all desktops are included.
49         OnlyCurrentDesktopClients, ///< Only TabBoxClients on current desktop are included
50         ExcludeCurrentDesktopClients ///< Exclude TabBoxClients on current desktop
51     };
52     /**
53      * ClientActivitiesMode defines whether windows from the current activity or from all
54      * activities are included in the TabBoxClient List in the TabBoxClientModel
55      */
56     enum ClientActivitiesMode {
57         AllActivitiesClients, ///< TabBoxClients from all Activities are included.
58         OnlyCurrentActivityClients, ///< Only TabBoxClients on current activity are included
59         ExcludeCurrentActivityClients ///< Exclude TabBoxClients on current activity
60     };
61     /**
62      * ClientApplicationsMode defines which windows from the current application or from all
63      * applications are included in the TabBoxClient List in the TabBoxClientModel
64      */
65     enum ClientApplicationsMode {
66         AllWindowsAllApplications, ///< TabBoxClients from all applications are included
67         OneWindowPerApplication, ///< Only one TabBoxClient for each application is included
68         AllWindowsCurrentApplication ///< Only TabBoxClients for the current application are included
69     };
70     /**
71      * ClientMinimizedMode defines which windows are included in the TabBoxClient List
72      * in the TabBoxClientModel based on whether they are minimized or not
73      */
74     enum ClientMinimizedMode {
75         IgnoreMinimizedStatus, ///< TabBoxClients are included no matter they are minimized or not
76         ExcludeMinimizedClients, ///< Exclude minimized TabBoxClients
77         OnlyMinimizedClients ///< Only minimized TabBoxClients are included
78     };
79     /**
80      * ShowDesktopMode defines whether a TabBoxClient representing the desktop
81      * is included in the TabBoxClient List in the TabBoxClientModel
82      */
83     enum ShowDesktopMode {
84         DoNotShowDesktopClient, ///< A TabBoxClient representing the desktop is not included
85         ShowDesktopClient ///< A TabBoxClient representing the desktop is included
86     };
87     /**
88      * ClientActivitiesMode defines whether windows from the current activity or from all
89      * activities are included in the TabBoxClient List in the TabBoxClientModel
90      */
91     enum ClientMultiScreenMode {
92         IgnoreMultiScreen, ///< TabBoxClients are included independently of the screen they are on
93         OnlyCurrentScreenClients, ///< Only TabBoxClients on current screen are included
94         ExcludeCurrentScreenClients ///< Exclude TabBoxClients from the current screen
95     };
96     /**
97      * ClientSwitchingMode defines the sorting of the TabBoxClients in the
98      * TabBoxClientModel.
99      */
100     enum ClientSwitchingMode {
101         FocusChainSwitching, ///< Sort by recently used. Most recently used TabBoxClient is the first
102         StackingOrderSwitching ///< Sort by current stacking order
103     };
104     /**
105      * DesktopSwitchingMode defines the sorting of the desktops in the
106      * TabBoxDesktopModel.
107      */
108     enum DesktopSwitchingMode {
109         MostRecentlyUsedDesktopSwitching,///< Sort by recently used. Most recently used desktop is the first
110         StaticDesktopSwitching///< Static sorting in numerical ascending order
111     };
112     /**
113      * TabBoxMode defines what kind of items the TabBox is displaying and which
114      * Model is used
115      */
116     enum TabBoxMode {
117         ClientTabBox,///< TabBox uses TabBoxClientModel
118         DesktopTabBox///< TabBox uses TabBoxDesktopModel
119     };
120     TabBoxConfig();
121     ~TabBoxConfig();
122     TabBoxConfig& operator=(const TabBoxConfig& object);
123 
124     // getters
125     /**
126      * @return If the TabBox should be shown or not
127      * This option does not apply for TabBoxMode DesktopTabBox.
128      * @see setShowTabBox
129      * @see defaultShowTabBox
130      */
131     bool isShowTabBox() const;
132     /**
133      * @return If Highlight Window effect should be used.
134      * This option does not apply for TabBoxMode DesktopTabBox.
135      * @see setHighlightWindows
136      * @see defaultHighlightWindows
137      */
138     bool isHighlightWindows() const;
139     /**
140      * @return The current TabBoxMode
141      * @see setTabBoxMode
142      */
143     TabBoxMode tabBoxMode() const;
144     /**
145      * @return The current ClientDesktopMode
146      * This option only applies for TabBoxMode ClientTabBox.
147      * @see setClientDesktopMode
148      * @see defaultDesktopMode
149      */
150     ClientDesktopMode clientDesktopMode() const;
151     /**
152      * @return The current ClientActivitiesMode
153      * This option only applies for TabBoxMode ClientTabBox.
154      * @see setClientActivitiesMode
155      * @see defaultActivitiesMode
156      */
157     ClientActivitiesMode clientActivitiesMode() const;
158     /**
159      * @return The current ClientApplicationsMode
160      * This option only applies for TabBoxMode ClientTabBox.
161      * @see setClientApplicationsMode
162      * @see defaultApplicationsMode
163      */
164     ClientApplicationsMode clientApplicationsMode() const;
165     /**
166      * @return The current ClientMinimizedMode
167      * This option only applies for TabBoxMode ClientTabBox.
168      * @see setClientMinimizedMode
169      * @see defaultMinimizedMode
170      */
171     ClientMinimizedMode clientMinimizedMode() const;
172     /**
173      * @return The current ShowDesktopMode
174      * This option only applies for TabBoxMode ClientTabBox.
175      * @see setShowDesktopMode
176      * @see defaultShowDesktopMode
177      */
178     ShowDesktopMode showDesktopMode() const;
179     /**
180      * @return The current ClientMultiScreenMode
181      * This option only applies for TabBoxMode ClientTabBox.
182      * @see setClientMultiScreenMode
183      * @see defaultMultiScreenMode
184      */
185     ClientMultiScreenMode clientMultiScreenMode() const;
186     /**
187      * @return The current ClientSwitchingMode.
188      * This option only applies for TabBoxMode ClientTabBox.
189      * @see setClientSwitchingMode
190      * @see defaultSwitchingMode
191      */
192     ClientSwitchingMode clientSwitchingMode() const;
193     /**
194      * @return The current DesktopSwitchingMode
195      * This option only applies for TabBoxMode DesktopTabBox.
196      * @see setDesktopSwitchingMode
197      */
198     DesktopSwitchingMode desktopSwitchingMode() const;
199     /**
200      * @return Then name of the current ItemLayout
201      * @see setlayoutName
202      */
203     QString& layoutName() const;
204 
205     // setters
206     /**
207      * @param show The tabbox should be shown or not.
208      * This option does not apply for TabBoxMode DesktopTabBox.
209      * @see isShowTabBox
210      */
211     void setShowTabBox(bool show);
212     /**
213      * @param highlight Highlight Windows effect should be used or not.
214      * This option does not apply for TabBoxMode DesktopTabBox.
215      * @see isHighlightWindows
216      */
217     void setHighlightWindows(bool highlight);
218     /**
219      * @param mode The new TabBoxMode to be used.
220      * @see tabBoxMode
221      */
222     void setTabBoxMode(TabBoxMode mode);
223     /**
224      * @param desktopMode The new ClientDesktopMode to be used.
225      * This option only applies for TabBoxMode ClientTabBox.
226      * @see clientDesktopMode
227      */
228     void setClientDesktopMode(ClientDesktopMode desktopMode);
229     /**
230      * @param activitiesMode The new ClientActivitiesMode to be used.
231      * This option only applies for TabBoxMode ClientTabBox.
232      * @see clientActivitiesMode
233      */
234     void setClientActivitiesMode(ClientActivitiesMode activitiesMode);
235     /**
236      * @param applicationsMode The new ClientApplicationsMode to be used.
237      * This option only applies for TabBoxMode ClientTabBox.
238      * @see clientApplicationsMode
239      */
240     void setClientApplicationsMode(ClientApplicationsMode applicationsMode);
241     /**
242      * @param minimizedMode The new ClientMinimizedMode to be used.
243      * This option only applies for TabBoxMode ClientTabBox.
244      * @see clientMinimizedMode
245      */
246     void setClientMinimizedMode(ClientMinimizedMode minimizedMode);
247     /**
248      * @param showDesktopMode The new ShowDesktopMode to be used.
249      * This option only applies for TabBoxMode ClientTabBox.
250      * @see showDesktopMode
251      */
252     void setShowDesktopMode(ShowDesktopMode showDesktopMode);
253     /**
254      * @param multiScreenMode The new ClientMultiScreenMode to be used.
255      * This option only applies for TabBoxMode ClientTabBox.
256      * @see clientMultiScreenMode
257      */
258     void setClientMultiScreenMode(ClientMultiScreenMode multiScreenMode);
259     /**
260      * @param switchingMode The new ClientSwitchingMode to be used.
261      * This option only applies for TabBoxMode ClientTabBox.
262      * @see clientSwitchingMode
263      */
264     void setClientSwitchingMode(ClientSwitchingMode switchingMode);
265     /**
266      * @param switchingMode The new DesktopSwitchingMode to be used.
267      * This option only applies for TabBoxMode DesktopTabBox.
268      * @see desktopSwitchingMode
269      */
270     void setDesktopSwitchingMode(DesktopSwitchingMode switchingMode);
271     /**
272      * @param name The new ItemLayout config name
273      * @see layoutName
274      */
275     void setLayoutName(const QString& name);
276 
277     // some static methods to access default values
defaultDesktopMode()278     static ClientDesktopMode defaultDesktopMode() {
279         return OnlyCurrentDesktopClients;
280     }
defaultActivitiesMode()281     static ClientActivitiesMode defaultActivitiesMode() {
282         return OnlyCurrentActivityClients;
283     }
defaultApplicationsMode()284     static ClientApplicationsMode defaultApplicationsMode() {
285         return AllWindowsAllApplications;
286     }
defaultMinimizedMode()287     static ClientMinimizedMode defaultMinimizedMode() {
288         return IgnoreMinimizedStatus;
289     }
defaultShowDesktopMode()290     static ShowDesktopMode defaultShowDesktopMode() {
291         return DoNotShowDesktopClient;
292     }
defaultMultiScreenMode()293     static ClientMultiScreenMode defaultMultiScreenMode() {
294         return IgnoreMultiScreen;
295     }
defaultSwitchingMode()296     static ClientSwitchingMode defaultSwitchingMode() {
297         return FocusChainSwitching;
298     }
defaultShowTabBox()299     static bool defaultShowTabBox() {
300         return true;
301     }
defaultHighlightWindow()302     static bool defaultHighlightWindow() {
303         return true;
304     }
defaultLayoutName()305     static QString defaultLayoutName() {
306         return QStringLiteral("org.kde.breeze.desktop");
307     }
308 private:
309     TabBoxConfigPrivate* d;
310 };
311 
312 } // namespace TabBox
313 } // namespace KWin
314 
315 #endif // TABBOXCONFIG_H
316