You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
latte-dock/app/view/windowstracker.h

101 lines
3.2 KiB
C++

/*
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock 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.
*
* Latte-Dock 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 WINDOWSTRACKER_H
#define WINDOWSTRACKER_H
// local
#include "../wm/abstractwindowinterface.h"
// Qt
#include <QObject>
namespace Latte{
class Corona;
class View;
namespace WindowSystem {
class AbstractWindowInterface;
class SchemeColors;
}
}
namespace Latte {
namespace ViewPart {
class WindowsTracker : public QObject {
Q_OBJECT
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
Q_PROPERTY(bool activeWindowMaximized READ activeWindowMaximized NOTIFY activeWindowMaximizedChanged)
Q_PROPERTY(bool activeWindowTouching READ activeWindowTouching NOTIFY activeWindowTouchingChanged)
Q_PROPERTY(bool existsWindowActive READ existsWindowActive NOTIFY existsWindowActiveChanged)
Q_PROPERTY(bool existsWindowMaximized READ existsWindowMaximized NOTIFY existsWindowMaximizedChanged)
Q_PROPERTY(bool existsWindowTouching READ existsWindowTouching NOTIFY existsWindowTouchingChanged)
Q_PROPERTY(Latte::WindowSystem::SchemeColors *activeWindowScheme READ activeWindowScheme NOTIFY activeWindowSchemeChanged)
Q_PROPERTY(Latte::WindowSystem::SchemeColors *touchingWindowScheme READ touchingWindowScheme NOTIFY touchingWindowSchemeChanged)
public:
explicit WindowsTracker(Latte::View *parent);
virtual ~WindowsTracker();
bool enabled() const;
void setEnabled(bool active);
bool activeWindowMaximized() const;
bool activeWindowTouching() const;
bool existsWindowActive() const;
bool existsWindowMaximized() const;
bool existsWindowTouching() const;
WindowSystem::SchemeColors *activeWindowScheme() const;
WindowSystem::SchemeColors *touchingWindowScheme() const;
void setWindowOnActivities(QWindow &window, const QStringList &activities);
signals:
void enabledChanged();
void activeWindowDraggingStarted();
void activeWindowMaximizedChanged();
void activeWindowTouchingChanged();
void existsWindowActiveChanged();
void existsWindowMaximizedChanged();
void existsWindowTouchingChanged();
void activeWindowSchemeChanged();
void touchingWindowSchemeChanged();
public slots:
Q_INVOKABLE void requestToggleMaximizeForActiveWindow();
Q_INVOKABLE void requestMoveActiveWindow(int localX, int localY);
Q_INVOKABLE bool activeWindowCanBeDragged();
private:
void init();
private:
Latte::Corona *m_corona{nullptr};
Latte::View *m_latteView{nullptr};
WindowSystem::AbstractWindowInterface *m_wm;
};
}
}
#endif