delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / workspace / plasma / shells / desktop / plasmaapp.h
bloba6a3c6a82f360cb7250f1f3ca1ca1de86cea57b7
1 /*
2 * Copyright 2006, 2007 Aaron Seigo <aseigo@kde.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef PLASMA_APP_H
21 #define PLASMA_APP_H
23 #include <QHash>
24 #include <QList>
25 #include <QSize>
26 #include <QPoint>
28 #include <KUniqueApplication>
30 #include <Plasma/Plasma>
32 namespace Plasma
34 class AppletBrowser;
35 class Containment;
36 class Corona;
37 } // namespace Plasma
39 namespace Kephal {
40 class Screen;
41 } // namespace Kephal
43 class DesktopView;
44 class BackgroundDialog;
45 class RootWidget;
46 class PanelView;
47 class DesktopCorona;
49 class PlasmaApp : public KUniqueApplication
51 Q_OBJECT
52 public:
53 ~PlasmaApp();
55 static PlasmaApp* self();
56 static bool hasComposite();
58 void notifyStartup(bool completed);
59 Plasma::Corona* corona();
60 void showAppletBrowser(Plasma::Containment *containment);
62 /**
63 * Creates a view for the given containment
65 void createDesktopView(Plasma::Containment *containment, int id = 0);
67 /**
68 * Should be called when a panel hides or unhides itself
70 void panelHidden(bool hidden);
72 /**
73 * Current desktop zoom level
75 Plasma::ZoomLevel desktopZoomLevel() const;
77 /**
78 * Returns the PanelViews
80 QList<PanelView*> panelViews() const;
82 #ifdef Q_WS_X11
83 Atom m_XdndAwareAtom;
84 Atom m_XdndEnterAtom;
85 Atom m_XdndFinishedAtom;
86 Atom m_XdndPositionAtom;
87 Atom m_XdndStatusAtom;
88 Atom m_XdndVersionAtom;
89 #endif
91 public Q_SLOTS:
92 // DBUS interface. if you change these methods, you MUST run:
93 // qdbuscpp2xml plasmaapp.h -o dbus/org.kde.plasma.App.xml
94 void toggleDashboard();
96 /**
97 * Request a zoom based on the containment
99 void zoom(Plasma::Containment*, Plasma::ZoomDirection);
101 protected:
102 #ifdef Q_WS_X11
103 PanelView *findPanelForTrigger(WId trigger) const;
104 bool x11EventFilter(XEvent *event);
105 #endif
107 private:
108 PlasmaApp(Display* display, Qt::HANDLE visual, Qt::HANDLE colormap);
109 DesktopView* viewForScreen(int screen, int desktop) const;
110 void zoomIn(Plasma::Containment *containment);
111 void zoomOut(Plasma::Containment *containment);
113 private Q_SLOTS:
114 void setupDesktop();
115 void cleanup();
116 void containmentAdded(Plasma::Containment *containment);
117 void syncConfig();
118 void appletBrowserDestroyed();
119 void createView(Plasma::Containment *containment);
120 void panelRemoved(QObject* panel);
121 void configDialogRemoved(QObject* configDialogRemoved);
122 void screenRemoved(int id);
123 void compositingChanged();
124 void showAppletBrowser();
125 void addContainment(Plasma::Containment *fromContainment = 0);
126 void configureContainment(Plasma::Containment*);
128 private:
129 DesktopCorona *m_corona;
130 QList<PanelView*> m_panels;
131 Plasma::AppletBrowser *m_appletBrowser;
132 QList<DesktopView*> m_desktops;
133 QHash<Plasma::Containment *, BackgroundDialog *> m_configDialogs;
134 Plasma::ZoomLevel m_zoomLevel;
135 int m_panelHidden;
138 #endif // multiple inclusion guard