• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeplasma-addons API Reference
  • KDE Home
  • Contact Us
 

GroupingDesktop

  • sources
  • kde-4.14
  • kdeplasma-addons
  • containments
  • groupingdesktop
  • lib
abstractgroup.h
Go to the documentation of this file.
1 /*
2  * Copyright 2009-2010 by Giulio Camuffo <giuliocamuffo@gmail.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Library General Public License as
6  * published by the Free Software Foundation; either version 2, or
7  * (at your option) any later version.
8  *
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
13  *
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.
18  */
19 
20 #ifndef ABSTRACTGROUP_H
21 #define ABSTRACTGROUP_H
22 
23 #include <QtGui/QGraphicsWidget>
24 #include <Plasma/Applet>
25 
26 #include "groupinfo.h"
27 #include "groupfactory_p.h"
28 #include "groupingcontainment_export.h"
29 
30 class KConfigGroup;
31 
32 class GroupingContainment;
33 class Handle;
34 class AbstractGroupPrivate;
35 
43 class PLASMA_GROUPINGCONTAINMENT_EXPORT AbstractGroup : public QGraphicsWidget
44 {
45  Q_OBJECT
46  Q_PROPERTY(bool hasInterface READ hasConfigurationInterface)
47  Q_PROPERTY(uint id READ id)
48  Q_PROPERTY(GroupType groupType READ groupType)
49  Q_PROPERTY(bool isMainGroup READ isMainGroup)
50 
51  public:
55  enum GroupType {
56  ConstrainedGroup = 0,
58  FreeGroup = 1
59  };
60  Q_ENUMS(GroupType)
61 
62 
65  enum BackgroundHint {
66  NoBackground = 0,
67  StandardBackground = 1,
68  PlainBackground = 2
69  };
70  Q_DECLARE_FLAGS(BackgroundHints, BackgroundHint)
71 
72 
75  explicit AbstractGroup(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
76 
80  virtual ~AbstractGroup();
81 
87  virtual void init();
88 
92  AbstractGroup *parentGroup() const;
93 
103  void addApplet(Plasma::Applet *applet, bool layoutApplet = true);
104 
114  void addSubGroup(AbstractGroup *group, bool layoutGroup = true);
115 
126  void removeApplet(Plasma::Applet *applet, AbstractGroup *newGroup = 0);
127 
138  void removeSubGroup(AbstractGroup *group, AbstractGroup *newGroup = 0);
139 
149  virtual void saveChildGroupInfo(QGraphicsWidget *child, KConfigGroup config) const = 0;
150 
160  virtual void restoreChildGroupInfo(QGraphicsWidget *child, const KConfigGroup &group) = 0;
161 
168  QGraphicsView *view() const;
169 
173  void destroy();
174 
178  KConfigGroup config() const;
179 
189  virtual void save(KConfigGroup &group) const;
190 
197  virtual void saveChildren() const;
198 
208  virtual void restore(KConfigGroup &group);
209 
217  virtual void restoreChildren();
218 
228  virtual bool showDropZone(const QPointF &pos);
229 
236  Plasma::Applet::List applets() const;
237 
244  QList<AbstractGroup *> subGroups() const;
245 
252  QList<QGraphicsWidget *> children() const;
253 
257  uint id() const;
258 
264  Plasma::ImmutabilityType immutability() const;
265 
269  GroupingContainment *containment() const;
270 
274  virtual QString pluginName() const = 0;
275 
285  void setIsMainGroup();
286 
293  bool isMainGroup() const;
294 
301  void setBackgroundHints(BackgroundHints hint);
302 
309  BackgroundHints backgroundHints() const;
310 
316  bool useSimplerBackgroundForChildren() const;
317 
321  virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
322 
326  enum {
327  Type = UserType + 2
328  };
329  virtual int type() const;
330 
334  void raise();
335 
345  virtual Handle *createHandleForChild(QGraphicsWidget *child);
346 
353  GroupType groupType() const;
354 
362  virtual void createConfigurationInterface(KConfigDialog *parent);
363 
369  bool hasConfigurationInterface() const;
370 
380  void updateConstraints(Plasma::Constraints constraints = Plasma::AllConstraints);
381 
387  virtual void releaseChild(QGraphicsWidget *child);
388 
389  static QString mimeType();
390 
397  static AbstractGroup *load(const QString &name, QGraphicsItem *parent = 0);
398 
402  static QStringList availableGroups();
403 
404  static GroupInfo groupInfo(const QString &name);
405 
406  public slots:
416  void setImmutability(Plasma::ImmutabilityType immutability);
417 
430  virtual void showConfigurationInterface();
431 
432  protected:
436  virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
437 
441  virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
442 
446  virtual void resizeEvent(QGraphicsSceneResizeEvent *event);
447 
455  virtual void layoutChild(QGraphicsWidget *child, const QPointF &pos) = 0;
456 
463  void setGroupType(GroupType type);
464 
476  void setHasConfigurationInterface(bool hasInterface);
477 
487  void setUseSimplerBackgroundForChildren(bool use);
488 
494  virtual void constraintsEvent(Plasma::Constraints constraints);
495 
496  signals:
502  void groupDestroyed(AbstractGroup *group);
503 
512  void appletAddedInGroup(Plasma::Applet *applet, AbstractGroup *group);
513 
522  void subGroupAddedInGroup(AbstractGroup *subGroup, AbstractGroup *group);
523 
532  void appletRemovedFromGroup(Plasma::Applet *applet, AbstractGroup *group);
533 
542  void subGroupRemovedFromGroup(AbstractGroup *subGroup, AbstractGroup *group);
543 
547  void geometryChanged();
548 
552  void groupTransformedByUser();
553 
559  void configNeedsSaving();
560 
566  void immutabilityChanged(Plasma::ImmutabilityType immutability);
567 
568  private:
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())
573 
574  AbstractGroupPrivate *const d;
575 
576  friend class AbstractGroupPrivate;
577  friend class Handle;
578  friend class GroupingContainment;
579  friend class GroupingContainmentPrivate;
580 
581 };
582 
583 Q_DECLARE_METATYPE(AbstractGroup *)
584 
588 #define REGISTER_GROUP(class) \
589  static const bool g_##class = GroupFactory::instance()->registerGroup<class>();
590 
591 #endif // ABSTRACTGROUP_H
QWidget
QGraphicsItem
Handle
Definition: handle.h:41
QGraphicsWidget::type
virtual int type() const
PLASMA_GROUPINGCONTAINMENT_EXPORT
#define PLASMA_GROUPINGCONTAINMENT_EXPORT
Definition: groupingcontainment_export.h:32
QPointF
QGraphicsWidget::itemChange
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value)
AbstractGroup::BackgroundHint
BackgroundHint
Description on how draw a background for the group.
Definition: abstractgroup.h:65
groupingcontainment_export.h
QPainter
AbstractGroup::GroupType
GroupType
Defines if the applets inside the group can be freely transformed or not by the user.
Definition: abstractgroup.h:55
QGraphicsItem::dragLeaveEvent
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
QGraphicsWidget
QString
QList
QGraphicsSceneResizeEvent
QGraphicsWidget::geometryChanged
void geometryChanged()
QStringList
GroupingContainment
The base Containment class.
Definition: groupingcontainment.h:38
QStyleOptionGraphicsItem
groupinfo.h
QGraphicsSceneDragDropEvent
GroupInfo
Definition: groupinfo.h:30
AbstractGroup
The base Group class.
Definition: abstractgroup.h:43
QGraphicsWidget::resizeEvent
virtual void resizeEvent(QGraphicsSceneResizeEvent *event)
QGraphicsView
QVariant
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:39:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

GroupingDesktop

Skip menu "GroupingDesktop"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeplasma-addons API Reference

Skip menu "kdeplasma-addons API Reference"
  •     GroupingDesktop
  •   liblancelot

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal