2009-09-13 11:36:45 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
2013-03-12 12:17:53 +00:00
|
|
|
Copyright (C) 2009 Martin Gräßlin <mgraesslin@kde.org>
|
2009-09-13 11:36:45 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#ifndef TABBOXHANDLER_H
|
|
|
|
#define TABBOXHANDLER_H
|
|
|
|
|
|
|
|
#include "tabboxconfig.h"
|
|
|
|
|
|
|
|
#include <QModelIndex>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @file
|
|
|
|
* This file contains the classes which hide KWin core from tabbox.
|
|
|
|
* It defines the pure virtual classes TabBoxHandler and TabBoxClient.
|
|
|
|
* The classes have to be implemented in KWin Core.
|
|
|
|
*
|
|
|
|
* @author Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
* @since 4.4
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2009-09-13 11:36:45 +00:00
|
|
|
|
|
|
|
class QKeyEvent;
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* The TabBox is a model based view for displaying a list while switching windows or desktops.
|
|
|
|
* This functionality is mostly referred to as Alt+Tab. TabBox itself does not provide support for
|
|
|
|
* switching windows or desktops. This has to be done outside of TabBox inside an independent controller.
|
|
|
|
*
|
|
|
|
* The main entrance point to TabBox is the class TabBoxHandler, which has to be subclassed and implemented.
|
|
|
|
* The class TabBoxClient, which represents a window client inside TabBox, has to be implemented as well.
|
|
|
|
*
|
|
|
|
* The behavior of the TabBox is defined by the TabBoxConfig and has to be set in the TabBoxHandler.
|
|
|
|
* If the TabBox should be used to switch desktops as well as clients it is sufficient to just provide
|
|
|
|
* different TabBoxConfig objects instead of creating an own handler for each mode.
|
|
|
|
*
|
|
|
|
* In order to use the TabBox the TabBoxConfig has to be set. This defines if the model for desktops or for
|
|
|
|
* clients will be used. The model has to be initialized by calling TabBoxHandler::createModel(), as the
|
|
|
|
* model is undefined when the TabBox is not active. The TabBox is activated by TabBoxHandler::show().
|
|
|
|
* Depending on the current set TabBoxConfig it is possible that the
|
|
|
|
* highlight windows effect activated and that the view is not displayed at all. As already mentioned
|
|
|
|
* the TabBox does not handle any updating of the selected item. This has to be done by invoking
|
|
|
|
* TabBoxHandler::setCurrentIndex(). Nevertheless the TabBoxHandler provides methods to query for the
|
|
|
|
* model index or the next or previous item, for a cursor position or for a given item (that is
|
|
|
|
* TabBoxClient or desktop). By invoking TabBoxHandler::hide() the view, the
|
|
|
|
* optional highlight windows effect are removed. The model is invalidated immediately. So if it is
|
|
|
|
* necessary to retrieve the last selected item this has to be done before calling the hide method.
|
|
|
|
*
|
|
|
|
* The layout of the TabBox View and the items is completely customizable. Therefore TabBox provides
|
|
|
|
* a widget LayoutConfig which includes a live preview (in kcmkwin/kwintabbox). The layout of items
|
|
|
|
* can be defined by an xml document. That way the user is able to define own custom layouts. The view
|
|
|
|
* itself is made up of two widgets: one to show the complete list and one to show only the selected
|
|
|
|
* item. This way it is possible to have a view which shows for example a list containing only small
|
|
|
|
* icons and nevertheless show the title of the currently selected client.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2009-09-13 11:36:45 +00:00
|
|
|
namespace TabBox
|
|
|
|
{
|
|
|
|
class DesktopModel;
|
|
|
|
class ClientModel;
|
|
|
|
class TabBoxConfig;
|
|
|
|
class TabBoxClient;
|
|
|
|
class TabBoxHandlerPrivate;
|
2012-05-20 13:52:24 +00:00
|
|
|
typedef QList< QWeakPointer< TabBoxClient > > TabBoxClientList;
|
2009-09-13 11:36:45 +00:00
|
|
|
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* This class is a wrapper around KWin Workspace. It is used for accessing the
|
|
|
|
* required core methods from inside TabBox and has to be implemented in KWin core.
|
|
|
|
*
|
|
|
|
* @author Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
* @since 4.4
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2009-09-13 11:36:45 +00:00
|
|
|
class TabBoxHandler : public QObject
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-09-13 11:36:45 +00:00
|
|
|
Q_OBJECT
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
2014-05-27 08:10:07 +00:00
|
|
|
TabBoxHandler(QObject *parent);
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
~TabBoxHandler() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @return The id of the active screen
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual int activeScreen() const = 0;
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @return The current active TabBoxClient or NULL
|
|
|
|
* if there is no active client.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-05-20 13:52:24 +00:00
|
|
|
virtual QWeakPointer<TabBoxClient> activeClient() const = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @param client The client which is starting point to find the next client
|
|
|
|
* @return The next TabBoxClient in focus chain
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-05-20 13:52:24 +00:00
|
|
|
virtual QWeakPointer<TabBoxClient> nextClientFocusChain(TabBoxClient* client) const = 0;
|
2012-08-19 17:32:56 +00:00
|
|
|
/**
|
|
|
|
* This method is used by the ClientModel to find an entrance into the focus chain in case
|
|
|
|
* there is no active Client.
|
|
|
|
*
|
|
|
|
* @return The first Client of the focus chain
|
|
|
|
* @since 4.9.1
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 17:32:56 +00:00
|
|
|
virtual QWeakPointer<TabBoxClient> firstClientFocusChain() const = 0;
|
2012-09-05 18:55:07 +00:00
|
|
|
/**
|
|
|
|
* Checks whether the given @p client is part of the focus chain at all.
|
|
|
|
* This is useful to figure out whether the currently active Client can be used
|
|
|
|
* as a starting point to construct the recently used list.
|
|
|
|
*
|
|
|
|
* In case the @p client is not in the focus chain it is recommended to use the
|
2019-01-12 10:31:32 +00:00
|
|
|
* Client returned by firstClientFocusChain.
|
2012-09-05 18:55:07 +00:00
|
|
|
*
|
|
|
|
* The method accepts a @c null Client and in that case @c false is returned.
|
|
|
|
* @param client The Client to check whether it is in the Focus Chain
|
|
|
|
* @return @c true in case the Client is part of the focus chain, @c false otherwise.
|
|
|
|
* @since 4.9.2
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-09-05 18:55:07 +00:00
|
|
|
virtual bool isInFocusChain(TabBoxClient* client) const = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @param client The client whose desktop name should be retrieved
|
|
|
|
* @return The desktop name of the given TabBoxClient. If the client is
|
|
|
|
* on all desktops the name of current desktop will be returned.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual QString desktopName(TabBoxClient* client) const = 0;
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @param desktop The desktop whose name should be retrieved
|
|
|
|
* @return The desktop name of given desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual QString desktopName(int desktop) const = 0;
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @return The number of current desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual int currentDesktop() const = 0;
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @return The number of virtual desktops
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual int numberOfDesktops() const = 0;
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @param desktop The desktop which is the starting point to find the next desktop
|
|
|
|
* @return The next desktop in the current focus chain.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual int nextDesktopFocusChain(int desktop) const = 0;
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2013-04-12 18:15:31 +00:00
|
|
|
/**
|
|
|
|
* whether KWin is currently compositing and it's related features (elevating) can be used
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2013-04-12 18:15:31 +00:00
|
|
|
virtual bool isKWinCompositing() const = 0;
|
|
|
|
|
2012-04-10 23:19:15 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* De-/Elevate a client using the compositor (if enabled)
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-03-04 08:44:24 +00:00
|
|
|
virtual void elevateClient(TabBoxClient* c, QWindow *tabbox, bool elevate) const = 0;
|
2012-04-10 23:19:15 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* Raise a client (w/o activating it)
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual void raiseClient(TabBoxClient* c) const = 0;
|
2010-10-17 19:49:07 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
|
|
|
* @param c The client to be restacked
|
|
|
|
* @param under The client the other one will be placed below
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual void restack(TabBoxClient *c, TabBoxClient *under) = 0;
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2015-02-06 22:10:59 +00:00
|
|
|
/**
|
|
|
|
* Toggle between ShadeHover and ShadeNormal - not shaded windows are unaffected
|
|
|
|
* @param c The client to be shaded
|
|
|
|
* @param b Whether to un- or shade
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-02-06 22:10:59 +00:00
|
|
|
virtual void shadeClient(TabBoxClient *c, bool b) const = 0;
|
|
|
|
|
2016-08-30 13:50:31 +00:00
|
|
|
virtual void highlightWindows(TabBoxClient *window = nullptr, QWindow *controller = nullptr) = 0;
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @return The current stacking order of TabBoxClients
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual TabBoxClientList stackingOrder() const = 0;
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* Determines if given client will be added to the list:
|
|
|
|
* <UL>
|
|
|
|
* <LI>Depends on desktop</LI>
|
|
|
|
* <LI>if the client wants to have tab focus.</LI>
|
|
|
|
* <LI>The client won't be added if it has modal dialogs</LI>
|
|
|
|
* <LI>In that case the modal dialog will be returned if it isn't already
|
|
|
|
* included</LI>
|
|
|
|
* <LI>Won't be added if it isn't on active screen when using separate
|
|
|
|
* screen focus</LI>
|
|
|
|
* </UL>
|
|
|
|
* @param client The client to be checked for inclusion
|
|
|
|
* @param desktop The desktop the client should be on. This is irrelevant if allDesktops is set
|
|
|
|
* @param allDesktops Add clients from all desktops or only from current
|
|
|
|
* @return The client to be included in the list or NULL if it isn't to be included
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-05-20 13:52:24 +00:00
|
|
|
virtual QWeakPointer<TabBoxClient> clientToAddToList(TabBoxClient* client, int desktop) const = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @return The first desktop window in the stacking order.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-05-20 13:52:24 +00:00
|
|
|
virtual QWeakPointer<TabBoxClient> desktopClient() const = 0;
|
2011-11-27 16:03:35 +00:00
|
|
|
/**
|
|
|
|
* Activates the currently selected client and closes the TabBox.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-11-27 16:03:35 +00:00
|
|
|
virtual void activateAndClose() = 0;
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @return The currently used TabBoxConfig
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
const TabBoxConfig& config() const;
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* Call this method when you want to change the currently used TabBoxConfig.
|
|
|
|
* It fires the signal configChanged.
|
|
|
|
* @param config Updates the currently used TabBoxConfig to config
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
void setConfig(const TabBoxConfig& config);
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* Call this method to show the TabBoxView. Depending on current
|
|
|
|
* configuration this method might not do anything.
|
|
|
|
* If highlight windows effect is to be used it will be activated.
|
|
|
|
* Highlight windows and outline are not shown if
|
|
|
|
* TabBoxConfig::TabBoxMode is TabBoxConfig::DesktopTabBox.
|
|
|
|
* @see TabBoxConfig::isShowTabBox
|
|
|
|
* @see TabBoxConfig::isHighlightWindows
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
void show();
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* Hides the TabBoxView if shown.
|
|
|
|
* Deactivates highlight windows effect if active.
|
|
|
|
* @see show
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
void hide(bool abort = false);
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* Sets the current model index in the view and updates
|
|
|
|
* highlight windows if active.
|
|
|
|
* @param index The current Model index
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
void setCurrentIndex(const QModelIndex& index);
|
2011-10-31 13:34:37 +00:00
|
|
|
/**
|
|
|
|
* @returns the current index
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-10-31 13:34:37 +00:00
|
|
|
const QModelIndex ¤tIndex() const;
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* Retrieves the next or previous item of the current item.
|
|
|
|
* @param forward next or previous item
|
|
|
|
* @return The next or previous item. If there is no matching item
|
|
|
|
* the current item will be returned.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
QModelIndex nextPrev(bool forward) const;
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* Initializes the model based on the current config.
|
|
|
|
* This method has to be invoked before showing the TabBox.
|
|
|
|
* It can also be invoked when clients are added or removed.
|
|
|
|
* In that case partialReset has to be true.
|
|
|
|
*
|
|
|
|
* @param partialReset Keep the currently selected item or regenerate everything
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
void createModel(bool partialReset = false);
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @param desktop The desktop whose index should be retrieved
|
|
|
|
* @return The model index of given desktop. If TabBoxMode is not
|
|
|
|
* TabBoxConfig::DesktopTabBox an invalid model index will be returned.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
QModelIndex desktopIndex(int desktop) const;
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @return The current list of desktops.
|
|
|
|
* If TabBoxMode is not TabBoxConfig::DesktopTabBox an empty list will
|
|
|
|
* be returned.
|
|
|
|
* @see DesktopModel::desktopList
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
QList< int > desktopList() const;
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @return The desktop for given model index. If the index is not valid
|
|
|
|
* or TabBoxMode is not TabBoxConfig::DesktopTabBox -1 will be returned.
|
|
|
|
* @see DesktopModel::desktopIndex
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
int desktop(const QModelIndex& index) const;
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* Handles additional grabbed key events by the TabBox controller.
|
|
|
|
* @param event The key event which has been grabbed
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-03-20 19:01:46 +00:00
|
|
|
virtual void grabbedKeyEvent(QKeyEvent* event) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @param pos The position to be tested in global coordinates
|
|
|
|
* @return True if the view contains the point, otherwise false.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
bool containsPos(const QPoint& pos) const;
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @param client The TabBoxClient whose index should be returned
|
|
|
|
* @return Returns the ModelIndex of given TabBoxClient or an invalid ModelIndex
|
|
|
|
* if the model does not contain the given TabBoxClient.
|
|
|
|
* @see ClientModel::index
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-05-20 13:52:24 +00:00
|
|
|
QModelIndex index(QWeakPointer<TabBoxClient> client) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @return Returns the current list of TabBoxClients.
|
|
|
|
* If TabBoxMode is not TabBoxConfig::ClientTabBox an empty list will
|
|
|
|
* be returned.
|
|
|
|
* @see ClientModel::clientList
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
TabBoxClientList clientList() const;
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @param index The index of the client to be returned
|
|
|
|
* @return Returns the TabBoxClient at given model index. If
|
|
|
|
* the index is invalid, does not point to a Client or the list
|
|
|
|
* is empty, NULL will be returned.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
TabBoxClient* client(const QModelIndex& index) const;
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @return The first model index. That is the model index at position 0, 0.
|
|
|
|
* It is valid, as desktop has at least one desktop and if there are no
|
|
|
|
* clients an empty item is created.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
QModelIndex first() const;
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2016-10-06 06:06:25 +00:00
|
|
|
bool eventFilter(QObject *watcher, QEvent *event) override;
|
|
|
|
|
2017-04-12 16:14:37 +00:00
|
|
|
/**
|
|
|
|
* @returns whether the TabBox operates in a no modifier grab mode.
|
|
|
|
* In this mode a click on an item should directly accept and close the tabbox.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-04-12 16:14:37 +00:00
|
|
|
virtual bool noModifierGrab() const = 0;
|
|
|
|
|
2013-07-22 14:07:39 +00:00
|
|
|
Q_SIGNALS:
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* This signal is fired when the TabBoxConfig changes
|
|
|
|
* @see setConfig
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
void configChanged();
|
2011-12-02 09:48:04 +00:00
|
|
|
void selectedIndexChanged();
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2013-07-22 14:07:39 +00:00
|
|
|
private Q_SLOTS:
|
2015-02-06 22:10:59 +00:00
|
|
|
void initHighlightWindows();
|
2012-05-03 23:08:28 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
2011-04-28 09:16:27 +00:00
|
|
|
friend class TabBoxHandlerPrivate;
|
2011-01-30 14:34:42 +00:00
|
|
|
TabBoxHandlerPrivate* d;
|
|
|
|
};
|
2009-09-13 11:36:45 +00:00
|
|
|
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* This class is a wrapper around a KWin Client. It is used for accessing the
|
|
|
|
* required client methods from inside TabBox and has to be implemented in KWin core.
|
|
|
|
*
|
|
|
|
* @author Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
* @since 4.4
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2009-09-13 11:36:45 +00:00
|
|
|
class TabBoxClient
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
TabBoxClient();
|
|
|
|
virtual ~TabBoxClient();
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @return The caption of the client
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual QString caption() const = 0;
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @param size Requested size of the icon
|
|
|
|
* @return The icon of the client
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2013-12-06 13:41:23 +00:00
|
|
|
virtual QIcon icon() const = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @return The window Id of the client
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual WId window() const = 0;
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* @return Minimized state of the client
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual bool isMinimized() const = 0;
|
|
|
|
virtual int x() const = 0;
|
|
|
|
virtual int y() const = 0;
|
|
|
|
virtual int width() const = 0;
|
|
|
|
virtual int height() const = 0;
|
2011-11-27 13:15:49 +00:00
|
|
|
virtual bool isCloseable() const = 0;
|
2011-11-27 14:00:09 +00:00
|
|
|
virtual void close() = 0;
|
2011-12-01 12:15:11 +00:00
|
|
|
virtual bool isFirstInTabBox() const = 0;
|
2019-01-20 13:04:13 +00:00
|
|
|
virtual QUuid internalId() const = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2009-09-13 11:36:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Pointer to the global TabBoxHandler object.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2009-09-13 11:36:45 +00:00
|
|
|
extern TabBoxHandler* tabBox;
|
|
|
|
|
|
|
|
} // namespace TabBox
|
|
|
|
} // namespace KWin
|
|
|
|
|
|
|
|
#endif // TABBOXHANDLER_H
|