2008-04-25 20:44:09 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2007 by Aaron Seigo <aseigo@kde.org>
|
|
|
|
* Copyright 2008 by Ménard Alexis <darktears31@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Library 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 CONTAINMENT_P_H
|
|
|
|
#define CONTAINMENT_P_H
|
|
|
|
|
|
|
|
static const int INTER_CONTAINMENT_MARGIN = 6;
|
|
|
|
static const int VERTICAL_STACKING_OFFSET = 10000;
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
class Containment;
|
2008-05-24 14:25:56 +02:00
|
|
|
class ToolBox;
|
2008-04-25 20:44:09 +02:00
|
|
|
|
2008-07-01 20:56:43 +02:00
|
|
|
class ContainmentPrivate
|
2008-04-25 20:44:09 +02:00
|
|
|
{
|
|
|
|
public:
|
2008-10-12 01:28:20 +02:00
|
|
|
ContainmentPrivate(Containment *c)
|
2008-04-25 20:44:09 +02:00
|
|
|
: q(c),
|
|
|
|
formFactor(Planar),
|
|
|
|
location(Floating),
|
2008-05-17 05:39:24 +02:00
|
|
|
focusedApplet(0),
|
2008-08-05 17:27:48 +02:00
|
|
|
wallpaper(0),
|
2008-04-25 20:44:09 +02:00
|
|
|
screen(-1), // no screen
|
2008-05-24 14:25:56 +02:00
|
|
|
toolBox(0),
|
2008-09-05 02:22:42 +02:00
|
|
|
con(0),
|
2008-04-25 20:44:09 +02:00
|
|
|
type(Containment::NoContainmentType),
|
2008-08-05 17:27:48 +02:00
|
|
|
positioning(false),
|
2008-08-20 10:06:34 +02:00
|
|
|
drawWallpaper(true)
|
2008-04-25 20:44:09 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-07-01 20:56:43 +02:00
|
|
|
~ContainmentPrivate()
|
2008-04-25 20:44:09 +02:00
|
|
|
{
|
|
|
|
qDeleteAll(applets);
|
|
|
|
applets.clear();
|
|
|
|
}
|
|
|
|
|
2008-10-12 01:28:20 +02:00
|
|
|
ToolBox *createToolBox();
|
2008-05-24 14:25:56 +02:00
|
|
|
void positionToolBox();
|
2008-04-25 20:44:09 +02:00
|
|
|
void triggerShowAddWidgets();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when constraints have been updated on this containment to provide
|
|
|
|
* constraint services common to all containments. Containments should still
|
2008-04-27 13:13:43 +02:00
|
|
|
* implement their own constraintsEvent method
|
2008-04-25 20:44:09 +02:00
|
|
|
*/
|
2008-04-27 13:13:43 +02:00
|
|
|
void containmentConstraintsEvent(Plasma::Constraints constraints);
|
2008-04-25 20:44:09 +02:00
|
|
|
|
|
|
|
bool regionIsEmpty(const QRectF ®ion, Applet *ignoredApplet=0) const;
|
|
|
|
void positionPanel(bool force = false);
|
|
|
|
void positionContainment();
|
|
|
|
void setLockToolText();
|
|
|
|
void handleDisappeared(AppletHandle *handle);
|
|
|
|
void appletDestroyed(QObject*);
|
2008-05-24 19:13:19 +02:00
|
|
|
void containmentAppletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim);
|
2008-04-25 21:08:49 +02:00
|
|
|
void zoomIn();
|
|
|
|
void zoomOut();
|
2008-09-05 22:06:30 +02:00
|
|
|
bool showContextMenu(const QPointF &point, const QPoint &screenPos, bool includeApplet);
|
2008-04-25 20:44:09 +02:00
|
|
|
|
2008-04-25 21:15:50 +02:00
|
|
|
/**
|
|
|
|
* Locks or unlocks plasma's applets.
|
|
|
|
* When plasma is locked, applets cannot be transformed, added or deleted
|
|
|
|
* but they can still be configured.
|
|
|
|
*/
|
|
|
|
void toggleDesktopImmutability();
|
|
|
|
|
2008-10-12 01:28:20 +02:00
|
|
|
Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(),
|
2008-04-25 20:44:09 +02:00
|
|
|
const QRectF &geometry = QRectF(-1, -1, -1, -1), uint id = 0,
|
|
|
|
bool delayedInit = false);
|
|
|
|
|
2008-10-12 01:28:20 +02:00
|
|
|
KActionCollection &actions();
|
2008-05-17 05:39:24 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* give keyboard focus to applet within this containment
|
|
|
|
*/
|
|
|
|
void focusApplet(Plasma::Applet *applet);
|
|
|
|
|
2008-09-05 02:22:42 +02:00
|
|
|
/**
|
|
|
|
* returns the Context for this Containment
|
|
|
|
*/
|
2008-10-12 01:28:20 +02:00
|
|
|
Context *context();
|
2008-09-05 02:22:42 +02:00
|
|
|
|
2008-04-25 20:44:09 +02:00
|
|
|
Containment *q;
|
|
|
|
FormFactor formFactor;
|
|
|
|
Location location;
|
|
|
|
Applet::List applets;
|
2008-05-17 05:39:24 +02:00
|
|
|
Applet *focusedApplet;
|
2008-08-05 17:27:48 +02:00
|
|
|
Plasma::Wallpaper *wallpaper;
|
2008-04-25 20:44:09 +02:00
|
|
|
QMap<Applet*, AppletHandle*> handles;
|
|
|
|
int screen;
|
2008-05-24 14:25:56 +02:00
|
|
|
ToolBox *toolBox;
|
2008-09-05 02:22:42 +02:00
|
|
|
Context *con;
|
2008-04-25 20:44:09 +02:00
|
|
|
Containment::Type type;
|
|
|
|
bool positioning;
|
2008-08-05 17:27:48 +02:00
|
|
|
bool drawWallpaper;
|
2008-04-25 20:44:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // Plasma namespace
|
|
|
|
|
|
|
|
#endif
|