• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • sources
  • kde-4.12
  • kdelibs
  • plasma
  • extenders
extenderitem.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008, 2009 by Rob Scheepmaker <r.scheepmaker@student.utwente.nl>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library 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 GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef PLASMA_EXTENDERITEM_H
21 #define PLASMA_EXTENDERITEM_H
22 
23 #include <QtGui/QGraphicsWidget>
24 
25 #include <kconfiggroup.h>
26 #include <kicon.h>
27 
28 #include "plasma/plasma_export.h"
29 
30 namespace Plasma
31 {
32 
33 class Applet;
34 class Extender;
35 class ExtenderGroup;
36 class ExtenderItemPrivate;
37 
80 class PLASMA_EXPORT ExtenderItem : public QGraphicsWidget
81 {
82  Q_OBJECT
83  Q_PROPERTY(QGraphicsItem * widget READ widget WRITE setWidget)
84  Q_PROPERTY(QString title READ title WRITE setTitle)
85  Q_PROPERTY(QString name READ name WRITE setName)
86  Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
87  Q_PROPERTY(Extender * extender READ extender WRITE setExtender)
88  Q_PROPERTY(bool collapsed READ isCollapsed WRITE setCollapsed)
89  Q_PROPERTY(bool detached READ isDetached)
90  Q_PROPERTY(uint autoExpireDelay READ autoExpireDelay WRITE setAutoExpireDelay)
91 
92  public:
99  explicit ExtenderItem(Extender *hostExtender, uint extenderItemId = 0);
100 
101  ~ExtenderItem();
102 
107  KConfigGroup config() const;
108 
113  void setWidget(QGraphicsItem *widget);
114 
118  QGraphicsItem *widget() const;
119 
125  void setTitle(const QString &title);
126 
130  QString title() const;
131 
138  void setName(const QString &name);
139 
143  QString name() const;
144 
151  void setIcon(const QString &icon);
152 
157  void setIcon(const QIcon &icon);
158 
162  QIcon icon() const;
163 
169  void setExtender(Extender *extender, const QPointF &pos = QPointF(-1, -1));
170 
174  Extender *extender() const;
175 
181  void setGroup(ExtenderGroup *group);
182 
191  void setGroup(ExtenderGroup *group, const QPointF &pos);
192 
197  ExtenderGroup *group() const;
198 
203  bool isGroup() const;
204 
209  void setAutoExpireDelay(uint time);
210 
214  uint autoExpireDelay() const;
215 
219  bool isDetached() const;
220 
224  bool isCollapsed() const;
225 
231  void addAction(const QString &name, QAction *action);
232 
238  QAction *action(const QString &name) const;
239 
249  void setTransient(const bool transient);
250 
255  bool isTransient() const;
256 
257  public Q_SLOTS:
262  void destroy();
263 
267  void setCollapsed(bool collapsed);
268 
272  void returnToSource();
273 
278  void showCloseButton();
279 
283  void hideCloseButton();
284 
285  Q_SIGNALS:
290  void destroyed(Plasma::ExtenderItem *item);
291 
292  protected:
293  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
294 
295  void moveEvent(QGraphicsSceneMoveEvent *event);
296  void resizeEvent(QGraphicsSceneResizeEvent *event);
297 
298  void mousePressEvent(QGraphicsSceneMouseEvent *event);
299  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
300  void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
301  void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
302 
303  void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
304  void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
305 
306  bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
307 
308  QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
309 
310  private:
311  Q_PRIVATE_SLOT(d, void toggleCollapse())
312  Q_PRIVATE_SLOT(d, void updateToolBox())
313  Q_PRIVATE_SLOT(d, void themeChanged())
314  Q_PRIVATE_SLOT(d, void sourceAppletRemoved())
315  Q_PRIVATE_SLOT(d, void actionDestroyed(QObject*))
316 
317  ExtenderItemPrivate * const d;
318 
319  friend class Applet;
320  friend class Extender;
321  friend class ExtenderPrivate;
322  friend class ExtenderItemPrivate;
323 };
324 } // namespace Plasma
325 #endif // PLASMA_EXTENDERITEM_H
Plasma::Extender
Extends applets to allow detachable parts.
Definition: extender.h:65
QWidget
QObject
Plasma::Applet
The base Applet class.
Definition: applet.h:77
Plasma::ExtenderGroup
Allows for grouping of extender items.
Definition: extendergroup.h:50
Plasma::ExtenderItem
Provides detachable items for an Extender.
Definition: extenderitem.h:80
QStyleOptionGraphicsItem
plasma_export.h
QGraphicsWidget
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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