File indexing completed on 2024-04-14 05:24:41

0001 /*
0002     SPDX-FileCopyrightText: 2021 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef WIDGETEXPLORERVIEW_H
0007 #define WIDGETEXPLORERVIEW_H
0008 
0009 // local
0010 #include "subconfigview.h"
0011 
0012 //Qt
0013 #include <QObject>
0014 #include <QQuickView>
0015 #include <QPointer>
0016 #include <QTimer>
0017 
0018 // Plasma
0019 #include <plasma/package.h>
0020 #include <Plasma/FrameSvg>
0021 
0022 
0023 namespace Plasma {
0024 class Applet;
0025 class Containment;
0026 class FrameSvg;
0027 class Types;
0028 }
0029 
0030 namespace KWayland {
0031 namespace Client {
0032 class PlasmaShellSurface;
0033 }
0034 }
0035 
0036 namespace Latte {
0037 class Corona;
0038 class View;
0039 }
0040 
0041 namespace Latte {
0042 namespace ViewPart {
0043 
0044 class WidgetExplorerView : public SubConfigView
0045 {
0046     Q_OBJECT
0047     Q_PROPERTY(bool hideOnWindowDeactivate READ hideOnWindowDeactivate WRITE setHideOnWindowDeactivate NOTIFY hideOnWindowDeactivateChanged)
0048 
0049 public:
0050     WidgetExplorerView(Latte::View *view);
0051 
0052     bool hideOnWindowDeactivate() const;
0053     void setHideOnWindowDeactivate(bool hide);
0054 
0055     QRect geometryWhenVisible() const;
0056 
0057 public slots:
0058     Q_INVOKABLE void hideConfigWindow();
0059     Q_INVOKABLE void syncGeometry() override;
0060     Q_INVOKABLE void updateEffects();
0061 
0062 signals:
0063     void hideOnWindowDeactivateChanged();
0064     void showSignal();
0065 
0066 protected:
0067     void showEvent(QShowEvent *ev) override;
0068     void syncSlideEffect() override;
0069     void focusOutEvent(QFocusEvent *ev) override;
0070 
0071     void init() override;
0072     void initParentView(Latte::View *view) override;
0073     void updateEnabledBorders() override;
0074 
0075     Qt::WindowFlags wFlags() const override;
0076 
0077 private:
0078     QRect availableScreenGeometry() const;
0079 
0080 private:
0081     bool m_hideOnWindowDeactivate{true};
0082     QRect m_geometryWhenVisible;
0083 
0084     //only for the mask on disabled compositing, not to actually paint
0085     Plasma::FrameSvg *m_background{nullptr};
0086 };
0087 
0088 }
0089 }
0090 #endif //WIDGETEXPLORERVIEW_H
0091