File: plasmaapp.h

package info (click to toggle)
kde-workspace 4:4.11.13-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 67,756 kB
  • ctags: 47,705
  • sloc: cpp: 358,638; ansic: 34,695; xml: 5,231; perl: 1,598; sh: 1,307; ruby: 1,135; python: 651; asm: 566; makefile: 37
file content (166 lines) | stat: -rw-r--r-- 4,396 bytes parent folder | download | duplicates (2)
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*
 *   Copyright 2006-2008 Aaron Seigo <aseigo@kde.org>
 *   Copyright 2009 Marco Martin <notmart@gmail.com>
 *
 *   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,
 *   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 Library General Public
 *   License along with this program; if not, write to the
 *   Free Software Foundation, Inc.,
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#ifndef PLASMA_APP_H
#define PLASMA_APP_H


#include <KUniqueApplication>

#include <plasma/plasma.h>

#ifdef Q_WS_X11
#include <X11/Xlib.h>
#include <fixx11h.h>
#endif

namespace Plasma
{
    class Containment;
    class Corona;
    class Dialog;
    class View;
    class WidgetExplorer;
} // namespace Plasma

class NetView;
class NetCorona;
class QTimer;
class GlowBar;
class ShadowWindow;

namespace Kephal
{
    class Screen;
}

class PlasmaApp : public KUniqueApplication
{
    Q_OBJECT
public:
    ~PlasmaApp();

    static PlasmaApp* self();
    static bool hasComposite();

    void suspendStartup(bool suspend);
    Plasma::Corona* corona();

    /**
     * Sets the view to be a desktop window if @p isDesktop is true
     * or an ordinary window otherwise.
     *
     * Desktop windows are displayed beneath all other windows, have
     * no window decoration and occupy the full size of the screen.
     *
     * The default behaviour is not to register the view as the desktop
     * window.
     */
    void setIsDesktop(bool isDesktop);

    NetView *controlBar() const;

    NetView *mainView() const;

    QWidget *widgetExplorer() const;

    /**
     * Returns true if this widget is currently a desktop window.
     * See setIsDesktop()
     */
    bool isDesktop() const;

    /**
      * Returns false if plasma-netbook should not be started
      *  (e.g. due to enabled autostart of plasma-desktop)
      */
    bool shallBeStarted();

    void showWidgetExplorer(Plasma::Containment *containment);

public Q_SLOTS:
    void setAutoHideControlBar(bool autoHide);

protected:
    bool eventFilter(QObject *watched, QEvent *event);
    bool x11EventFilter(XEvent *event);
    //true if the application has an active window
    bool hasForegroundWindows() const;
    //more strict than hasForegroundWindows, the mainview has to be not only active, but also on top of other windows
    bool mainViewOnTop() const;

private:
    PlasmaApp();
    void reserveStruts();
    void createUnhideTrigger();
    void destroyUnHideTrigger();
    void setupAutostart();

private Q_SLOTS:
    void cleanup();
    void syncConfig();
    void positionPanel();
    void createView(Plasma::Containment *containment);
    void adjustSize(Kephal::Screen *);
    void controlBarMoved(const NetView *controlBar);
    void showWidgetExplorer();
    void widgetExplorerDestroyed();
    void closeWidgetExplorer();
    void mainContainmentActivated();
    //TODO: probably those functions can go in netview
    void controlBarVisibilityUpdate();
    void showControlBar();
    void hideControlBar();
    void setControlBarVisible(bool visible);
    void toggleControlBarVisibility();
    void lowerMainView();
    void configureContainment(Plasma::Containment *containment);
    void updateToolBoxVisibility(bool visible);
    void unhideHintMousePoll();
    void wallpaperCheckedIn();
    void wallpaperCheckInTimeout();
    void checkShadow();

Q_SIGNALS:
    void controlBarChanged();

private:
    NetCorona *m_corona;
    Plasma::Dialog *m_widgetExplorerView;
    Plasma::WidgetExplorer *m_widgetExplorer;
#ifdef Q_WS_X11
    Window m_unhideTrigger;
    QRect m_triggerZone;
    QRect m_unhideTriggerGeom;
#endif
    GlowBar *m_glowBar;
    QTimer *m_mousePollTimer;
    NetView *m_controlBar;
    NetView *m_mainView;
    bool m_isDesktop;
    bool m_autoHideControlBar;
    QTimer *m_unHideTimer;
    ShadowWindow *m_shadowWindow;
    int m_startupSuspendWaitCount;
    bool m_shallBeStarted;
};

#endif // multiple inclusion guard