File indexing completed on 2024-05-19 16:34:55

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2009 Martin Gräßlin <mgraesslin@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include <QString>
0013 
0014 /**
0015  * @file
0016  * This file defines the class TabBoxConfig.
0017  *
0018  * @author Martin Gräßlin <mgraesslin@kde.org>
0019  * @since 4.4
0020  */
0021 
0022 namespace KWin
0023 {
0024 namespace TabBox
0025 {
0026 class TabBoxConfigPrivate;
0027 
0028 /**
0029  * The TabBoxConfig class holds all configuration options for the TabBox.
0030  * The TabBoxHandler contains a pointer to an object of this class and is
0031  * used by all classes of TabBox. The config defines what kind of data the
0032  * TabBox is displaying and how the layout looks like. There can be different
0033  * Config sets and by setting a new config in the TabBoxHandler the behaviour
0034  * of the TabBox is changed immediately.
0035  *
0036  * @author Martin Gräßlin <mgraesslin@kde.org>
0037  * @since 4.4
0038  */
0039 class TabBoxConfig
0040 {
0041 public:
0042     /**
0043      * ClientDesktopMode defines whether windows from the current desktop or from all
0044      * desktops are included in the TabBoxClient List in the TabBoxClientModel
0045      */
0046     enum ClientDesktopMode {
0047         AllDesktopsClients, ///< TabBoxClients from all desktops are included.
0048         OnlyCurrentDesktopClients, ///< Only TabBoxClients on current desktop are included
0049         ExcludeCurrentDesktopClients ///< Exclude TabBoxClients on current desktop
0050     };
0051     /**
0052      * ClientActivitiesMode defines whether windows from the current activity or from all
0053      * activities are included in the TabBoxClient List in the TabBoxClientModel
0054      */
0055     enum ClientActivitiesMode {
0056         AllActivitiesClients, ///< TabBoxClients from all Activities are included.
0057         OnlyCurrentActivityClients, ///< Only TabBoxClients on current activity are included
0058         ExcludeCurrentActivityClients ///< Exclude TabBoxClients on current activity
0059     };
0060     /**
0061      * ClientApplicationsMode defines which windows from the current application or from all
0062      * applications are included in the TabBoxClient List in the TabBoxClientModel
0063      */
0064     enum ClientApplicationsMode {
0065         AllWindowsAllApplications, ///< TabBoxClients from all applications are included
0066         OneWindowPerApplication, ///< Only one TabBoxClient for each application is included
0067         AllWindowsCurrentApplication ///< Only TabBoxClients for the current application are included
0068     };
0069     /**
0070      * ClientMinimizedMode defines which windows are included in the TabBoxClient List
0071      * in the TabBoxClientModel based on whether they are minimized or not
0072      */
0073     enum ClientMinimizedMode {
0074         IgnoreMinimizedStatus, ///< TabBoxClients are included no matter they are minimized or not
0075         ExcludeMinimizedClients, ///< Exclude minimized TabBoxClients
0076         OnlyMinimizedClients ///< Only minimized TabBoxClients are included
0077     };
0078     /**
0079      * ShowDesktopMode defines whether a TabBoxClient representing the desktop
0080      * is included in the TabBoxClient List in the TabBoxClientModel
0081      */
0082     enum ShowDesktopMode {
0083         DoNotShowDesktopClient, ///< A TabBoxClient representing the desktop is not included
0084         ShowDesktopClient ///< A TabBoxClient representing the desktop is included
0085     };
0086     /**
0087      * OrderMinimizedMode defines whether the TabBoxClients considered part of the
0088      * TabBoxClient List should be grouped by the minimisation status
0089      */
0090     enum OrderMinimizedMode {
0091         NoGroupByMinimized, ///< TabBoxClients are not grouped by whether they are minimized
0092         GroupByMinimized ///< TabBoxClients are grouped by whether they are minimized or not
0093     };
0094     /**
0095      * ClientActivitiesMode defines whether windows from the current activity or from all
0096      * activities are included in the TabBoxClient List in the TabBoxClientModel
0097      */
0098     enum ClientMultiScreenMode {
0099         IgnoreMultiScreen, ///< TabBoxClients are included independently of the screen they are on
0100         OnlyCurrentScreenClients, ///< Only TabBoxClients on current screen are included
0101         ExcludeCurrentScreenClients ///< Exclude TabBoxClients from the current screen
0102     };
0103     /**
0104      * ClientSwitchingMode defines the sorting of the TabBoxClients in the
0105      * TabBoxClientModel.
0106      */
0107     enum ClientSwitchingMode {
0108         FocusChainSwitching, ///< Sort by recently used. Most recently used TabBoxClient is the first
0109         StackingOrderSwitching ///< Sort by current stacking order
0110     };
0111     /**
0112      * DesktopSwitchingMode defines the sorting of the desktops in the
0113      * TabBoxDesktopModel.
0114      */
0115     enum DesktopSwitchingMode {
0116         MostRecentlyUsedDesktopSwitching, ///< Sort by recently used. Most recently used desktop is the first
0117         StaticDesktopSwitching ///< Static sorting in numerical ascending order
0118     };
0119     /**
0120      * TabBoxMode defines what kind of items the TabBox is displaying and which
0121      * Model is used
0122      */
0123     enum TabBoxMode {
0124         ClientTabBox, ///< TabBox uses TabBoxClientModel
0125         DesktopTabBox ///< TabBox uses TabBoxDesktopModel
0126     };
0127     TabBoxConfig();
0128     ~TabBoxConfig();
0129     TabBoxConfig &operator=(const TabBoxConfig &object);
0130 
0131     // getters
0132     /**
0133      * @return If the TabBox should be shown or not
0134      * This option does not apply for TabBoxMode DesktopTabBox.
0135      * @see setShowTabBox
0136      * @see defaultShowTabBox
0137      */
0138     bool isShowTabBox() const;
0139     /**
0140      * @return If Highlight Window effect should be used.
0141      * This option does not apply for TabBoxMode DesktopTabBox.
0142      * @see setHighlightWindows
0143      * @see defaultHighlightWindows
0144      */
0145     bool isHighlightWindows() const;
0146     /**
0147      * @return The current TabBoxMode
0148      * @see setTabBoxMode
0149      */
0150     TabBoxMode tabBoxMode() const;
0151     /**
0152      * @return The current ClientDesktopMode
0153      * This option only applies for TabBoxMode ClientTabBox.
0154      * @see setClientDesktopMode
0155      * @see defaultDesktopMode
0156      */
0157     ClientDesktopMode clientDesktopMode() const;
0158     /**
0159      * @return The current ClientActivitiesMode
0160      * This option only applies for TabBoxMode ClientTabBox.
0161      * @see setClientActivitiesMode
0162      * @see defaultActivitiesMode
0163      */
0164     ClientActivitiesMode clientActivitiesMode() const;
0165     /**
0166      * @return The current ClientApplicationsMode
0167      * This option only applies for TabBoxMode ClientTabBox.
0168      * @see setClientApplicationsMode
0169      * @see defaultApplicationsMode
0170      */
0171     ClientApplicationsMode clientApplicationsMode() const;
0172     /**
0173      * @return The current OrderMinimizedMode
0174      * This option only applies for TabBoxMode ClientTabBox.
0175      * @see setOrderMinimizedMode
0176      * @see defaultOrderMinimizedMode
0177      */
0178     OrderMinimizedMode orderMinimizedMode() const;
0179     /**
0180      * @return The current ClientMinimizedMode
0181      * This option only applies for TabBoxMode ClientTabBox.
0182      * @see setClientMinimizedMode
0183      * @see defaultMinimizedMode
0184      */
0185     ClientMinimizedMode clientMinimizedMode() const;
0186     /**
0187      * @return The current ShowDesktopMode
0188      * This option only applies for TabBoxMode ClientTabBox.
0189      * @see setShowDesktopMode
0190      * @see defaultShowDesktopMode
0191      */
0192     ShowDesktopMode showDesktopMode() const;
0193     /**
0194      * @return The current ClientMultiScreenMode
0195      * This option only applies for TabBoxMode ClientTabBox.
0196      * @see setClientMultiScreenMode
0197      * @see defaultMultiScreenMode
0198      */
0199     ClientMultiScreenMode clientMultiScreenMode() const;
0200     /**
0201      * @return The current ClientSwitchingMode.
0202      * This option only applies for TabBoxMode ClientTabBox.
0203      * @see setClientSwitchingMode
0204      * @see defaultSwitchingMode
0205      */
0206     ClientSwitchingMode clientSwitchingMode() const;
0207     /**
0208      * @return The current DesktopSwitchingMode
0209      * This option only applies for TabBoxMode DesktopTabBox.
0210      * @see setDesktopSwitchingMode
0211      */
0212     DesktopSwitchingMode desktopSwitchingMode() const;
0213     /**
0214      * @return Then name of the current ItemLayout
0215      * @see setlayoutName
0216      */
0217     QString &layoutName() const;
0218 
0219     // setters
0220     /**
0221      * @param show The tabbox should be shown or not.
0222      * This option does not apply for TabBoxMode DesktopTabBox.
0223      * @see isShowTabBox
0224      */
0225     void setShowTabBox(bool show);
0226     /**
0227      * @param highlight Highlight Windows effect should be used or not.
0228      * This option does not apply for TabBoxMode DesktopTabBox.
0229      * @see isHighlightWindows
0230      */
0231     void setHighlightWindows(bool highlight);
0232     /**
0233      * @param mode The new TabBoxMode to be used.
0234      * @see tabBoxMode
0235      */
0236     void setTabBoxMode(TabBoxMode mode);
0237     /**
0238      * @param desktopMode The new ClientDesktopMode to be used.
0239      * This option only applies for TabBoxMode ClientTabBox.
0240      * @see clientDesktopMode
0241      */
0242     void setClientDesktopMode(ClientDesktopMode desktopMode);
0243     /**
0244      * @param activitiesMode The new ClientActivitiesMode to be used.
0245      * This option only applies for TabBoxMode ClientTabBox.
0246      * @see clientActivitiesMode
0247      */
0248     void setClientActivitiesMode(ClientActivitiesMode activitiesMode);
0249     /**
0250      * @param applicationsMode The new ClientApplicationsMode to be used.
0251      * This option only applies for TabBoxMode ClientTabBox.
0252      * @see clientApplicationsMode
0253      */
0254     void setClientApplicationsMode(ClientApplicationsMode applicationsMode);
0255     /**
0256      * @param orderMinimizedMode The new OrderMinimizedMode to be used.
0257      * This option only applies for TabBoxMode ClientTabBox.
0258      * @see orderMinimizedMode
0259      */
0260     void setOrderMinimizedMode(OrderMinimizedMode orderMinimizedMode);
0261     /**
0262      * @param minimizedMode The new ClientMinimizedMode to be used.
0263      * This option only applies for TabBoxMode ClientTabBox.
0264      * @see clientMinimizedMode
0265      */
0266     void setClientMinimizedMode(ClientMinimizedMode minimizedMode);
0267     /**
0268      * @param showDesktopMode The new ShowDesktopMode to be used.
0269      * This option only applies for TabBoxMode ClientTabBox.
0270      * @see showDesktopMode
0271      */
0272     void setShowDesktopMode(ShowDesktopMode showDesktopMode);
0273     /**
0274      * @param multiScreenMode The new ClientMultiScreenMode to be used.
0275      * This option only applies for TabBoxMode ClientTabBox.
0276      * @see clientMultiScreenMode
0277      */
0278     void setClientMultiScreenMode(ClientMultiScreenMode multiScreenMode);
0279     /**
0280      * @param switchingMode The new ClientSwitchingMode to be used.
0281      * This option only applies for TabBoxMode ClientTabBox.
0282      * @see clientSwitchingMode
0283      */
0284     void setClientSwitchingMode(ClientSwitchingMode switchingMode);
0285     /**
0286      * @param switchingMode The new DesktopSwitchingMode to be used.
0287      * This option only applies for TabBoxMode DesktopTabBox.
0288      * @see desktopSwitchingMode
0289      */
0290     void setDesktopSwitchingMode(DesktopSwitchingMode switchingMode);
0291     /**
0292      * @param name The new ItemLayout config name
0293      * @see layoutName
0294      */
0295     void setLayoutName(const QString &name);
0296 
0297     // some static methods to access default values
0298     static ClientDesktopMode defaultDesktopMode()
0299     {
0300         return OnlyCurrentDesktopClients;
0301     }
0302     static ClientActivitiesMode defaultActivitiesMode()
0303     {
0304         return OnlyCurrentActivityClients;
0305     }
0306     static ClientApplicationsMode defaultApplicationsMode()
0307     {
0308         return AllWindowsAllApplications;
0309     }
0310     static OrderMinimizedMode defaultOrderMinimizedMode()
0311     {
0312         return NoGroupByMinimized;
0313     }
0314     static ClientMinimizedMode defaultMinimizedMode()
0315     {
0316         return IgnoreMinimizedStatus;
0317     }
0318     static ShowDesktopMode defaultShowDesktopMode()
0319     {
0320         return DoNotShowDesktopClient;
0321     }
0322     static ClientMultiScreenMode defaultMultiScreenMode()
0323     {
0324         return IgnoreMultiScreen;
0325     }
0326     static ClientSwitchingMode defaultSwitchingMode()
0327     {
0328         return FocusChainSwitching;
0329     }
0330     static bool defaultShowTabBox()
0331     {
0332         return true;
0333     }
0334     static bool defaultHighlightWindow()
0335     {
0336         return true;
0337     }
0338     static QString defaultLayoutName()
0339     {
0340         return QStringLiteral("org.kde.breeze.desktop");
0341     }
0342 
0343 private:
0344     TabBoxConfigPrivate *d;
0345 };
0346 
0347 } // namespace TabBox
0348 } // namespace KWin