20 #ifndef ABSTRACTGROUP_H
21 #define ABSTRACTGROUP_H
23 #include <QtGui/QGraphicsWidget>
24 #include <Plasma/Applet>
27 #include "groupfactory_p.h"
34 class AbstractGroupPrivate;
46 Q_PROPERTY(
bool hasInterface READ hasConfigurationInterface)
47 Q_PROPERTY(uint
id READ
id)
49 Q_PROPERTY(
bool isMainGroup READ isMainGroup)
67 StandardBackground = 1,
70 Q_DECLARE_FLAGS(BackgroundHints, BackgroundHint)
75 explicit
AbstractGroup(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
92 AbstractGroup *parentGroup() const;
103 void addApplet(Plasma::Applet *applet,
bool layoutApplet = true);
114 void addSubGroup(AbstractGroup *group,
bool layoutGroup = true);
126 void removeApplet(Plasma::Applet *applet, AbstractGroup *newGroup = 0);
138 void removeSubGroup(AbstractGroup *group, AbstractGroup *newGroup = 0);
149 virtual
void saveChildGroupInfo(
QGraphicsWidget *child, KConfigGroup config) const = 0;
160 virtual
void restoreChildGroupInfo(
QGraphicsWidget *child, const KConfigGroup &group) = 0;
168 QGraphicsView *view() const;
178 KConfigGroup config() const;
189 virtual
void save(KConfigGroup &group) const;
197 virtual
void saveChildren() const;
208 virtual
void restore(KConfigGroup &group);
217 virtual
void restoreChildren();
228 virtual
bool showDropZone(const QPointF &pos);
236 Plasma::Applet::List applets() const;
244 QList<AbstractGroup *> subGroups() const;
264 Plasma::ImmutabilityType immutability() const;
274 virtual QString pluginName() const = 0;
285 void setIsMainGroup();
293 bool isMainGroup() const;
301 void setBackgroundHints(BackgroundHints hint);
309 BackgroundHints backgroundHints() const;
316 bool useSimplerBackgroundForChildren() const;
321 virtual
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget = 0);
329 virtual int type()
const;
353 GroupType groupType()
const;
362 virtual void createConfigurationInterface(KConfigDialog *parent);
369 bool hasConfigurationInterface()
const;
380 void updateConstraints(Plasma::Constraints constraints = Plasma::AllConstraints);
389 static QString mimeType();
397 static AbstractGroup *load(
const QString &name, QGraphicsItem *parent = 0);
402 static QStringList availableGroups();
404 static GroupInfo groupInfo(
const QString &name);
416 void setImmutability(Plasma::ImmutabilityType immutability);
430 virtual void showConfigurationInterface();
436 virtual QVariant itemChange(GraphicsItemChange change,
const QVariant &value);
441 virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
446 virtual void resizeEvent(QGraphicsSceneResizeEvent *event);
455 virtual void layoutChild(
QGraphicsWidget *child,
const QPointF &pos) = 0;
463 void setGroupType(GroupType type);
476 void setHasConfigurationInterface(
bool hasInterface);
487 void setUseSimplerBackgroundForChildren(
bool use);
494 virtual void constraintsEvent(Plasma::Constraints constraints);
512 void appletAddedInGroup(Plasma::Applet *applet,
AbstractGroup *group);
532 void appletRemovedFromGroup(Plasma::Applet *applet,
AbstractGroup *group);
547 void geometryChanged();
552 void groupTransformedByUser();
559 void configNeedsSaving();
566 void immutabilityChanged(Plasma::ImmutabilityType immutability);
569 Q_PRIVATE_SLOT(d,
void appletDestroyed(Plasma::Applet *applet))
570 Q_PRIVATE_SLOT(d,
void subGroupDestroyed(
AbstractGroup *subGroup))
571 Q_PRIVATE_SLOT(d,
void destroyGroup())
572 Q_PRIVATE_SLOT(d,
void onChildGeometryChanged())
574 AbstractGroupPrivate *const d;
576 friend class AbstractGroupPrivate;
579 friend class GroupingContainmentPrivate;
588 #define REGISTER_GROUP(class) \
589 static const bool g_##class = GroupFactory::instance()->registerGroup<class>();
591 #endif // ABSTRACTGROUP_H
#define PLASMA_GROUPINGCONTAINMENT_EXPORT
BackgroundHint
Description on how draw a background for the group.
GroupType
Defines if the applets inside the group can be freely transformed or not by the user.
The base Containment class.