File: abstractinterface.h

package info (click to toggle)
ukui-panel 4.0.0.6-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,148 kB
  • sloc: cpp: 28,423; xml: 476; sh: 51; makefile: 18
file content (118 lines) | stat: -rw-r--r-- 3,752 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
 * libkysdk-waylandhelper's Library
 *
 * Copyright (C) 2023, KylinSoft Co., Ltd.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this library.  If not, see <https://www.gnu.org/licenses/>.
 *
 * Authors: Zhen Sun <sunzhen1@kylinos.cn>
 *
 */

#ifndef ABSTRACTINTERFACE_H
#define ABSTRACTINTERFACE_H

#include <QObject>
#include <QVariant>
#include <QMap>
#include "windowinfo.h"
#include "netwm.h"

namespace kdk
{
using WindowId = QVariant;
class KWindows;

class AbstractInterface:public QObject
{
    Q_OBJECT

public:
    AbstractInterface(QObject* parent=nullptr);
    virtual ~AbstractInterface();
    virtual WindowInfo requestInfo(WindowId wid) = 0;

    virtual void requestActivate(WindowId wid)  = 0;
    virtual void requestClose(WindowId wid)  = 0;
    virtual void requestToggleKeepAbove(WindowId wid)  = 0;
    virtual void requestToggleMinimized(WindowId wid)  = 0;
    virtual void requestToggleMaximized(WindowId wid)  = 0;
    virtual WindowId activeWindow()  = 0;

    virtual QIcon iconFor(WindowId wid)  = 0;
    virtual QString titleFor(WindowId wid)  = 0;
    virtual QString windowGroupFor(WindowId wid) = 0;

    virtual bool windowCanBeDragged(WindowId wid)  = 0;
    virtual bool windowCanBeMaximized(WindowId wid)  = 0;


    virtual void showCurrentDesktop()  = 0;
    virtual void hideCurrentDesktop()  = 0;
    virtual quint32 pid(WindowId wid) = 0;

    virtual void setGeometry(QWindow *window, const QRect &rect) = 0;
    virtual NET::WindowType windowType(WindowId wid) = 0;

    virtual void setSkipTaskBar(QWindow* window,bool skip) = 0;
    virtual void setSkipSwitcher(QWindow* window,bool skip) = 0;

    virtual bool skipTaskBar(const WindowId &wid) = 0;
    virtual bool skipSwitcher(const WindowId &wid) = 0;

    virtual bool isShowingDesktop() = 0;
    virtual void setOnAllDesktops(const WindowId &wid) = 0;

    bool inCurrentDesktopActivity(const WindowInfo &winfo) ;
    bool isPlasmaDesktop(const QRect &wGeometry);
    QString currentDesktop() ;
    QString currentActivity() ;

    void setPlasmaDesktop(WindowId wid);
    bool isValidFor(const WindowId &wid) ;

    QList<WindowId> windows();
    virtual void setPanelTakefocus(QWindow *window, bool flag) = 0;
    virtual void demandAttention(const WindowId &wid, bool set = true) = 0;

Q_SIGNALS:
    void activeWindowChanged(WindowId wid);
    void windowChanged(WindowId winfo);
    void windowAdded(WindowId wid);
    void windowRemoved(WindowId wid);
    void currentDesktopChanged();
    void isShowingDesktopChanged();

    //since 2.3
    void titleChanged(WindowId wid);
    void iconChanged(WindowId wid);
    void activeChanged(WindowId wid);
    void fullscreenChanged(WindowId wid);
    void keepAboveChanged(WindowId wid);
    void minimizedChanged(WindowId wid);
    void maximizedChanged(WindowId wid);
    void onAllDesktopsChanged(WindowId wid);
    void demandsAttentionChanged(WindowId wid);
    void skipTaskbarChanged(WindowId wid);
    void skipSwitcherChanged(WindowId wid);
    void geometryChanged(WindowId wid);

public:
    QMap<WindowId, WindowInfo> m_windows;
    QString m_currentDesktop;
    QString m_currentActivity;
};
}

#endif // ABSTRACTINTERFACE_H