/usr/include/plasma/popupapplet.h is in kdelibs5-dev 4:4.8.4-4+deb7u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | /*
* Copyright 2008 by Montel Laurent <montel@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef PLASMA_POPUPAPPLET_H
#define PLASMA_POPUPAPPLET_H
#include <plasma/applet.h>
#include <plasma/plasma_export.h>
#include <plasma/plasma.h>
class QGraphicsProxyWidget;
class QGraphicsLinearLayout;
namespace Plasma
{
class Dialog;
class IconWidget;
class PopupAppletPrivate;
/**
* Allows applets to automatically 'collapse' into an icon when put in an panel, and is a convenient
* base class for any applet that wishes to use extenders.
*
* Applets that subclass this class should implement either widget() or graphicsWidget() to return a
* widget that will be displayed in the applet if the applet is in a Planar or MediaCenter form
* factor. If the applet is put in a panel, an icon will be displayed instead, which shows the
* widget in a popup when clicked.
*
* If you use this class as a base class for your extender using applet, the extender will
* automatically be used for the popup; reimplementing graphicsWidget() is unnecessary in this case.
* If you need a popup that does not steal window focus when openend or used, set window flag
* Qt::X11BypassWindowManagerHint the widget returned by widget() or graphicsWidget().
*/
class PLASMA_EXPORT PopupApplet : public Plasma::Applet
{
Q_OBJECT
Q_PROPERTY(Qt::AlignmentFlag popupAlignment READ popupAlignment WRITE setPopupAlignment)
public:
PopupApplet(QObject *parent, const QVariantList &args);
~PopupApplet();
/**
* @param icon the icon that has to be displayed when the applet is in a panel.
* Passing in a null icon means that the popup applet itself
* will provide an interface for when the PopupApplet is not showing
* the widget() or graphicsWidget() directly.
*/
void setPopupIcon(const QIcon &icon);
/**
* @param icon the icon that has to be displayed when the applet is in a panel.
* Passing in an empty QString() means that the popup applet itself
* will provide an interface for when the PopupApplet is not showing
* the widget() or graphicsWidget() directly.
* If you set a popup icon you must also set a minimum size of the applet. When the applet
* is smaller than this minimum size, it will be displayed as that icon.
*/
void setPopupIcon(const QString &iconName);
/**
* @return the icon that is displayed when the applet is in a panel.
*/
QIcon popupIcon() const;
/**
* Implement either this function or graphicsWidget().
* @return the widget that will get shown in either a layout, in the applet or in a Dialog,
* depending on the form factor of the applet.
*/
virtual QWidget *widget();
void setWidget(QWidget * widget);
/**
* Implement either this function or widget().
* @return the widget that will get shown in either a layout, in the applet or in a Dialog,
* depending on the form factor of the applet.
* If you set a popup icon you must also set a minimum size of the applet. When the applet
* is smaller than this minimum size, it will be displayed as that icon.
*/
virtual QGraphicsWidget *graphicsWidget();
void setGraphicsWidget(QGraphicsWidget * widget);
/**
* @return the placement of the popup relating to the applet
*/
Plasma::PopupPlacement popupPlacement() const;
/**
* Sets the default alignment of the popup relative to the applet
* @param alignment the alignment to use; Qt::AlignLeft or Qt::AlignRight
* @since 4.6
*/
void setPopupAlignment(Qt::AlignmentFlag alignment);
/**
* @return the default alignment of the popup relative to the applet
* @since 4.6
*/
Qt::AlignmentFlag popupAlignment() const;
/**
* Sets whether or not the dialog popup that gets created should be a "passive" popup
* that does not steal focus from other windows or not.
*
* @param passive true if the dialog should be treated as a passive popup
*/
void setPassivePopup(bool passive);
/**
* @return true if the dialog will be treated as a passive poup
*/
bool isPassivePopup() const;
/**
* @return true if the applet is popped up
*/
bool isPopupShowing() const;
/**
* @return true if the applet is collapsed to an icon
* @since 4.6
*/
bool isIconified() const;
public Q_SLOTS:
/**
* Hides the popup.
*/
void hidePopup();
/**
* Shows the dialog showing the widget if the applet is in a panel.
* @param displayTime the time in ms that the popup should be displayed, defaults to 0 which means
* always (until the user closes it again, that is).
*/
void showPopup(uint displayTime = 0);
/**
* Toggles the popup.
*/
void togglePopup();
protected:
/**
* This event handler can be reimplemented in a subclass to receive an
* event before the popup is shown or hidden.
* @param show true if the popup is going to be shown, false if the popup
* is going to be hidden.
* Note that showing and hiding the popup on click is already done in PopupApplet.
*/
virtual void popupEvent(bool show);
/**
* Reimplemented from QGraphicsLayoutItem
*/
QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
/**
* Reimplemented from QGraphicsLayoutItem
*/
void mousePressEvent(QGraphicsSceneMouseEvent *event);
/**
* Reimplemented from QGraphicsLayoutItem
*/
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
/**
* Reimplemented from QGraphicsLayoutItem
*/
bool eventFilter(QObject *watched, QEvent *event);
/**
* Reimplemented from QGraphicsLayoutItem
*/
void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
/**
* Reimplemented from QGraphicsLayoutItem
*/
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
/**
* Reimplemented from QGraphicsLayoutItem
*/
void dropEvent(QGraphicsSceneDragDropEvent *event);
/**
* Reimplemented from QGraphicsLayoutItem
*/
void timerEvent(QTimerEvent *event);
private:
/**
* @internal This constructor is to be used with the Package loading system.
*
* @param parent a QObject parent; you probably want to pass in 0
* @param args a list of strings containing two entries: the service id
* and the applet id
* @since 4.3
*/
PopupApplet(const QString &packagePath, uint appletId, const QVariantList &args);
Q_PRIVATE_SLOT(d, void internalTogglePopup())
Q_PRIVATE_SLOT(d, void hideTimedPopup())
Q_PRIVATE_SLOT(d, void clearPopupLostFocus())
Q_PRIVATE_SLOT(d, void dialogSizeChanged())
Q_PRIVATE_SLOT(d, void dialogStatusChanged(bool))
Q_PRIVATE_SLOT(d, void updateDialogPosition())
Q_PRIVATE_SLOT(d, void appletActivated())
Q_PRIVATE_SLOT(d, void iconSizeChanged(int))
Q_PRIVATE_SLOT(d, void statusChangeWhileShown(Plasma::ItemStatus status))
friend class Applet;
friend class AppletPrivate;
friend class Extender;
friend class PopupAppletPrivate;
PopupAppletPrivate * const d;
};
} // Plasma namespace
#endif /* POPUPAPPLET_H */
|