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

Plasma

  • plasma
  • extenders
extender.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_EXTENDER_H
21#define PLASMA_EXTENDER_H
22
23#include <QtGui/QGraphicsWidget>
24
25#include "plasma/framesvg.h"
26#include "plasma/plasma_export.h"
27
28namespace Plasma
29{
30
31class ExtenderGroup;
32class ExtenderPrivate;
33class ExtenderItem;
34class Applet;
35
65class PLASMA_EXPORT Extender : public QGraphicsWidget
66{
67 Q_OBJECT
68 Q_PROPERTY(QString emptyExtenderMessage READ emptyExtenderMessage WRITE setEmptyExtenderMessage)
69 Q_PROPERTY(QList<ExtenderItem*> items READ items())
70 Q_PROPERTY(QList<ExtenderItem*> attachedItems READ attachedItems())
71 Q_PROPERTY(QList<ExtenderItem*> detachedItems READ detachedItems())
72 Q_PROPERTY(QList<ExtenderGroup*> groups READ groups())
73 Q_PROPERTY(bool empty READ isEmpty())
74
75 public:
79 enum Appearance {
80 NoBorders = 0,
83 BottomUpStacked = 1,
89 TopDownStacked = 2
95 };
96
107 explicit Extender(Applet *applet);
108
109 ~Extender();
110
114 void setEmptyExtenderMessage(const QString &message);
115
119 QString emptyExtenderMessage() const;
120
125 QList<ExtenderItem*> items() const;
126
130 QList<ExtenderItem*> attachedItems() const;
131
135 QList<ExtenderItem*> detachedItems() const;
136
144 Q_INVOKABLE ExtenderItem *item(const QString &name) const;
145
152 Q_INVOKABLE ExtenderGroup *group(const QString &name) const;
153
162 Q_INVOKABLE bool hasItem(const QString &name) const;
163
168 bool isEmpty() const;
169
176 void setAppearance(Appearance appearance);
177
181 Appearance appearance() const;
182
187 QList<ExtenderGroup*> groups() const;
188
193 Applet *applet() const;
194
195 protected:
204 virtual void itemAddedEvent(ExtenderItem *item, const QPointF &pos = QPointF(-1, -1));
205
211 virtual void itemRemovedEvent(ExtenderItem *item);
212
217 virtual void itemHoverEnterEvent(ExtenderItem *item);
218
228 virtual void itemHoverMoveEvent(ExtenderItem *item, const QPointF &pos);
229
234 virtual void itemHoverLeaveEvent(ExtenderItem *item);
235
242 virtual void saveState();
243
250 virtual FrameSvg::EnabledBorders enabledBordersForItem(ExtenderItem *item) const;
251
255 QVariant itemChange(GraphicsItemChange change, const QVariant &value);
256
260 void resizeEvent(QGraphicsSceneResizeEvent *event);
261
265 void mousePressEvent(QGraphicsSceneMouseEvent *event);
266
270 void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
271
275 void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
276
280 void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
281
285 void dropEvent(QGraphicsSceneDragDropEvent *event);
286
287 Q_SIGNALS:
291 void itemAttached(Plasma::ExtenderItem *);
292
296 void itemDetached(Plasma::ExtenderItem *);
297
301 void geometryChanged();
302
303 private:
304 ExtenderPrivate *const d;
305
306 Q_PRIVATE_SLOT(d, void delayItemAddedEvent())
307 Q_PRIVATE_SLOT(d, void extenderItemDestroyed(Plasma::ExtenderItem *item))
308 Q_PRIVATE_SLOT(d, void viewportGeometryChanged(const QRectF &))
309
310 friend class ExtenderPrivate;
311 friend class ExtenderGroup;
312 friend class ExtenderGroupPrivate;
313 friend class ExtenderItem;
314 friend class ExtenderItemPrivate;
315 //dialog needs access to the extender's applet location.
316 friend class DialogPrivate;
317 //applet should be able to call saveState();
318 friend class Applet;
319
320 };
321} // Plasma namespace
322
323#endif //PLASMA_EXTENDER_H
324
Plasma::Applet
The base Applet class.
Definition: applet.h:78
Plasma::ExtenderGroup
Allows for grouping of extender items.
Definition: extendergroup.h:51
Plasma::ExtenderItem
Provides detachable items for an Extender.
Definition: extenderitem.h:81
Plasma::Extender
Extends applets to allow detachable parts.
Definition: extender.h:66
Plasma::Extender::itemDetached
void itemDetached(Plasma::ExtenderItem *)
Fires when an extender item is removed from this extender.
Plasma::Extender::Appearance
Appearance
Description on how to render the extender's items.
Definition: extender.h:79
Plasma::Extender::geometryChanged
void geometryChanged()
Fires when an extender's preferred size changes.
Plasma::Extender::itemAttached
void itemAttached(Plasma::ExtenderItem *)
Fires when an extender item is added to this extender.
QGraphicsWidget
framesvg.h
Plasma
Namespace for everything in libplasma.
Definition: abstractdialogmanager.cpp:25
plasma_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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