2008-11-04 00:08:39 +01: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
|
|
|
|
|
2008-11-14 01:34:36 +01:00
|
|
|
#include <kmenu.h>
|
2008-11-14 00:08:58 +01:00
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
static const int INTER_CONTAINMENT_MARGIN = 6;
|
2008-12-01 13:40:08 +01:00
|
|
|
static const int TOOLBOX_MARGIN = 150;
|
2008-11-09 20:51:31 +01:00
|
|
|
static const int CONTAINMENT_COLUMNS = 2;
|
2008-11-04 00:08:39 +01:00
|
|
|
static const int VERTICAL_STACKING_OFFSET = 10000;
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
class Containment;
|
|
|
|
class ToolBox;
|
|
|
|
|
|
|
|
class ContainmentPrivate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ContainmentPrivate(Containment *c)
|
|
|
|
: q(c),
|
|
|
|
formFactor(Planar),
|
|
|
|
location(Floating),
|
|
|
|
focusedApplet(0),
|
|
|
|
wallpaper(0),
|
|
|
|
screen(-1), // no screen
|
2008-11-17 05:34:55 +01:00
|
|
|
desktop(-1), // all desktops
|
2008-11-04 00:08:39 +01:00
|
|
|
toolBox(0),
|
|
|
|
con(0),
|
|
|
|
type(Containment::NoContainmentType),
|
|
|
|
drawWallpaper(true)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~ContainmentPrivate()
|
|
|
|
{
|
|
|
|
qDeleteAll(applets);
|
|
|
|
applets.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
ToolBox *createToolBox();
|
|
|
|
void positionToolBox();
|
2009-04-24 21:28:17 +02:00
|
|
|
void updateToolBoxVisibility();
|
2008-11-04 00:08:39 +01:00
|
|
|
void triggerShowAddWidgets();
|
2008-11-10 02:26:27 +01:00
|
|
|
void requestConfiguration();
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when constraints have been updated on this containment to provide
|
|
|
|
* constraint services common to all containments. Containments should still
|
|
|
|
* implement their own constraintsEvent method
|
|
|
|
*/
|
|
|
|
void containmentConstraintsEvent(Plasma::Constraints constraints);
|
|
|
|
|
|
|
|
bool regionIsEmpty(const QRectF ®ion, Applet *ignoredApplet=0) const;
|
|
|
|
void positionPanel(bool force = false);
|
2008-11-25 01:23:43 +01:00
|
|
|
void positionContainments();
|
2008-11-04 00:08:39 +01:00
|
|
|
void setLockToolText();
|
|
|
|
void handleDisappeared(AppletHandle *handle);
|
2009-01-28 08:58:17 +01:00
|
|
|
void appletDestroyed(Plasma::Applet*);
|
2008-11-04 00:08:39 +01:00
|
|
|
void containmentAppletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim);
|
|
|
|
void zoomIn();
|
|
|
|
void zoomOut();
|
2008-11-14 00:08:58 +01:00
|
|
|
void containmentActions(KMenu &desktopMenu);
|
|
|
|
void appletActions(KMenu &desktopMenu, Applet *applet, bool includeApplet);
|
2008-11-04 00:08:39 +01:00
|
|
|
bool showContextMenu(const QPointF &point, const QPoint &screenPos, bool includeApplet);
|
2008-12-15 17:54:09 +01:00
|
|
|
void checkRemoveAction();
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(),
|
|
|
|
const QRectF &geometry = QRectF(-1, -1, -1, -1), uint id = 0,
|
|
|
|
bool delayedInit = false);
|
|
|
|
|
2009-05-03 22:22:14 +02:00
|
|
|
KActionCollection *actions();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* add the regular actions & keyboard shortcuts onto Applet's collection
|
|
|
|
*/
|
|
|
|
static void addDefaultActions(KActionCollection *actions);
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* give keyboard focus to applet within this containment
|
|
|
|
*/
|
|
|
|
void focusApplet(Plasma::Applet *applet);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* returns the Context for this Containment
|
|
|
|
*/
|
|
|
|
Context *context();
|
|
|
|
|
2009-05-05 07:19:35 +02:00
|
|
|
/**
|
|
|
|
* Handles dropped/pasted mimetype data
|
|
|
|
* @param event the drop or mouse event
|
|
|
|
*/
|
|
|
|
void dropData(QGraphicsSceneEvent *event);
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
Containment *q;
|
|
|
|
FormFactor formFactor;
|
|
|
|
Location location;
|
|
|
|
Applet::List applets;
|
|
|
|
Applet *focusedApplet;
|
|
|
|
Plasma::Wallpaper *wallpaper;
|
|
|
|
QMap<Applet*, AppletHandle*> handles;
|
|
|
|
int screen;
|
2008-11-17 05:34:55 +01:00
|
|
|
int desktop;
|
2008-11-04 00:08:39 +01:00
|
|
|
ToolBox *toolBox;
|
|
|
|
Context *con;
|
|
|
|
Containment::Type type;
|
|
|
|
static bool s_positioning;
|
|
|
|
bool drawWallpaper;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // Plasma namespace
|
|
|
|
|
|
|
|
#endif
|