~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/netbook/shell/plasmaapp.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright 2006-2008 Aaron Seigo <aseigo@kde.org>
 
3
 *   Copyright 2009 Marco Martin <notmart@gmail.com>
 
4
 *
 
5
 *   This program is free software; you can redistribute it and/or modify
 
6
 *   it under the terms of the GNU General Public License as
 
7
 *   published by the Free Software Foundation; either version 2,
 
8
 *   or (at your option) any later version.
 
9
 *
 
10
 *   This program is distributed in the hope that it will be useful,
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *   GNU General Public License for more details
 
14
 *
 
15
 *   You should have received a copy of the GNU Library General Public
 
16
 *   License along with this program; if not, write to the
 
17
 *   Free Software Foundation, Inc.,
 
18
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
19
 */
 
20
 
 
21
#ifndef PLASMA_APP_H
 
22
#define PLASMA_APP_H
 
23
 
 
24
 
 
25
#include <KUniqueApplication>
 
26
 
 
27
#include <plasma/plasma.h>
 
28
 
 
29
#ifdef Q_WS_X11
 
30
#include <X11/Xlib.h>
 
31
#include <fixx11h.h>
 
32
#endif
 
33
 
 
34
namespace Plasma
 
35
{
 
36
    class Containment;
 
37
    class Corona;
 
38
    class Dialog;
 
39
    class View;
 
40
    class WidgetExplorer;
 
41
} // namespace Plasma
 
42
 
 
43
class NetView;
 
44
class NetCorona;
 
45
class QTimer;
 
46
class GlowBar;
 
47
class ShadowWindow;
 
48
 
 
49
namespace Kephal
 
50
{
 
51
    class Screen;
 
52
}
 
53
 
 
54
class PlasmaApp : public KUniqueApplication
 
55
{
 
56
    Q_OBJECT
 
57
public:
 
58
    ~PlasmaApp();
 
59
 
 
60
    static PlasmaApp* self();
 
61
    static bool hasComposite();
 
62
 
 
63
    void suspendStartup(bool suspend);
 
64
    Plasma::Corona* corona();
 
65
 
 
66
    /**
 
67
     * Sets the view to be a desktop window if @p isDesktop is true
 
68
     * or an ordinary window otherwise.
 
69
     *
 
70
     * Desktop windows are displayed beneath all other windows, have
 
71
     * no window decoration and occupy the full size of the screen.
 
72
     *
 
73
     * The default behaviour is not to register the view as the desktop
 
74
     * window.
 
75
     */
 
76
    void setIsDesktop(bool isDesktop);
 
77
 
 
78
    NetView *controlBar() const;
 
79
 
 
80
    NetView *mainView() const;
 
81
 
 
82
    QWidget *widgetExplorer() const;
 
83
 
 
84
    /**
 
85
     * Returns true if this widget is currently a desktop window.
 
86
     * See setIsDesktop()
 
87
     */
 
88
    bool isDesktop() const;
 
89
 
 
90
    void showWidgetExplorer(Plasma::Containment *containment);
 
91
 
 
92
public Q_SLOTS:
 
93
    void setAutoHideControlBar(bool autoHide);
 
94
 
 
95
protected:
 
96
    bool eventFilter(QObject *watched, QEvent *event);
 
97
    bool x11EventFilter(XEvent *event);
 
98
    //true if the application has an active window
 
99
    bool hasForegroundWindows() const;
 
100
    //more strict than hasForegroundWindows, the mainview has to be not only active, but also on top of other windows
 
101
    bool mainViewOnTop() const;
 
102
 
 
103
private:
 
104
    PlasmaApp();
 
105
    void reserveStruts();
 
106
    void createUnhideTrigger();
 
107
    void destroyUnHideTrigger();
 
108
 
 
109
private Q_SLOTS:
 
110
    void cleanup();
 
111
    void syncConfig();
 
112
    void positionPanel();
 
113
    void createView(Plasma::Containment *containment);
 
114
    void adjustSize(Kephal::Screen *);
 
115
    void controlBarMoved(const NetView *controlBar);
 
116
    void showWidgetExplorer();
 
117
    void widgetExplorerDestroyed();
 
118
    void closeWidgetExplorer();
 
119
    void mainContainmentActivated();
 
120
    //TODO: probably those functions can go in netview
 
121
    void controlBarVisibilityUpdate();
 
122
    void showControlBar();
 
123
    void hideControlBar();
 
124
    void setControlBarVisible(bool visible);
 
125
    void toggleControlBarVisibility();
 
126
    void lowerMainView();
 
127
    void configureContainment(Plasma::Containment *containment);
 
128
    void updateToolBoxVisibility(bool visible);
 
129
    void unhideHintMousePoll();
 
130
    void wallpaperCheckedIn();
 
131
    void wallpaperCheckInTimeout();
 
132
    void checkShadow();
 
133
 
 
134
Q_SIGNALS:
 
135
    void controlBarChanged();
 
136
 
 
137
private:
 
138
    NetCorona *m_corona;
 
139
    Plasma::Dialog *m_widgetExplorerView;
 
140
    Plasma::WidgetExplorer *m_widgetExplorer;
 
141
#ifdef Q_WS_X11
 
142
    Window m_unhideTrigger;
 
143
    QRect m_triggerZone;
 
144
    QRect m_unhideTriggerGeom;
 
145
#endif
 
146
    GlowBar *m_glowBar;
 
147
    QTimer *m_mousePollTimer;
 
148
    NetView *m_controlBar;
 
149
    NetView *m_mainView;
 
150
    bool m_isDesktop;
 
151
    bool m_autoHideControlBar;
 
152
    QTimer *m_unHideTimer;
 
153
    ShadowWindow *m_shadowWindow;
 
154
    int m_startupSuspendWaitCount;
 
155
};
 
156
 
 
157
#endif // multiple inclusion guard
 
158