1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-02-12 17:58:23 +03:00
latte-dock/app/visibilitymanager.h
Michail Vourlakos d86fdfd2ff fix #810,support smart/dynamic background
the dynamic background feature is enhanced and
becomes smarter. It understands snapped windows, windows
that touch the panel edge etc. The criteria in
order for the background to become solid are:
   - any active window that is touching the panel
edge (that includes krunner)
   - any inactive window that is snapped and touches
the panel edge (concerning its geometry: quarter-snapped or half-snapped)
   - maximized windows
   - an inactive window but keepAbove is touching
the panel edge (this catches also the yakuake case)
   - panel popups
2018-01-02 11:49:38 +02:00

117 lines
3.8 KiB
C++

/*
* Copyright 2016 Smith AR <audoban@openmailbox.org>
* 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 VISIBILITYMANAGER_H
#define VISIBILITYMANAGER_H
#include "plasmaquick/containmentview.h"
#include "../liblattedock/dock.h"
#include <QObject>
#include <QTimer>
#include <Plasma/Containment>
namespace Latte {
class VisibilityManagerPrivate;
class VisibilityManager : public QObject {
Q_OBJECT
Q_PROPERTY(Latte::Dock::Visibility mode READ mode WRITE setMode NOTIFY modeChanged)
Q_PROPERTY(bool raiseOnDesktop READ raiseOnDesktop WRITE setRaiseOnDesktop NOTIFY raiseOnDesktopChanged)
Q_PROPERTY(bool raiseOnActivity READ raiseOnActivity WRITE setRaiseOnActivity NOTIFY raiseOnActivityChanged)
Q_PROPERTY(bool isHidden READ isHidden WRITE setIsHidden NOTIFY isHiddenChanged)
Q_PROPERTY(bool blockHiding READ blockHiding WRITE setBlockHiding NOTIFY blockHidingChanged)
Q_PROPERTY(bool containsMouse READ containsMouse NOTIFY containsMouseChanged)
//! Dynamic Background Feature (needed options)
Q_PROPERTY(bool enabledDynamicBackground READ enabledDynamicBackground WRITE setEnabledDynamicBackground NOTIFY enabledDynamicBackgroundChanged)
Q_PROPERTY(bool existsWindowMaximized READ existsWindowMaximized NOTIFY existsWindowMaximizedChanged)
Q_PROPERTY(bool existsWindowSnapped READ existsWindowSnapped NOTIFY existsWindowSnappedChanged)
Q_PROPERTY(int timerShow READ timerShow WRITE setTimerShow NOTIFY timerShowChanged)
Q_PROPERTY(int timerHide READ timerHide WRITE setTimerHide NOTIFY timerHideChanged)
public:
explicit VisibilityManager(PlasmaQuick::ContainmentView *view);
virtual ~VisibilityManager();
Latte::Dock::Visibility mode() const;
void setMode(Latte::Dock::Visibility mode);
bool raiseOnDesktop() const;
void setRaiseOnDesktop(bool enable);
bool raiseOnActivity() const;
void setRaiseOnActivity(bool enable);
bool isHidden() const;
void setIsHidden(bool isHidden);
bool blockHiding() const;
void setBlockHiding(bool blockHiding);
bool containsMouse() const;
int timerShow() const;
void setTimerShow(int msec);
int timerHide() const;
void setTimerHide(int msec);
//! Dynamic Background functions
bool enabledDynamicBackground() const;
void setEnabledDynamicBackground(bool active);
bool existsWindowMaximized() const;
void setExistsWindowMaximized(bool windowMaximized);
bool existsWindowSnapped() const;
void setExistsWindowSnapped(bool windowSnapped);
signals:
void mustBeShown(QPrivateSignal);
void mustBeHide(QPrivateSignal);
void modeChanged();
void raiseOnDesktopChanged();
void raiseOnActivityChanged();
void isHiddenChanged();
void blockHidingChanged();
void containsMouseChanged();
void timerShowChanged();
void timerHideChanged();
//! Dynamic Background signals (from options)
void enabledDynamicBackgroundChanged();
void existsWindowMaximizedChanged();
void existsWindowSnappedChanged();
private:
VisibilityManagerPrivate *const d;
friend class VisibilityManagerPrivate;
};
}
#endif // VISIBILITYMANAGER_H