1 /*************************************************************************** 2 * Copyright (c) 2008 Jeff Mitchell <mitchell@kde.org> * 3 * * 4 * This program is free software; you can redistribute it and/or modify * 5 * it under the terms of the GNU General Public License as published by * 6 * the Free Software Foundation; either version 2 of the License, 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 General Public License * 15 * 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 POPUPDROPPER_P_H 21 #define POPUPDROPPER_P_H 22 23 #include <QList> 24 #include <QMap> 25 #include <QObject> 26 #include <QRectF> 27 #include <QTimeLine> 28 #include <QTimer> 29 30 #include "PopupDropper.h" 31 #include "PopupDropperView.h" 32 33 class QSvgRenderer; 34 class QWidget; 35 36 class PopupDropperPrivate : public QObject 37 { 38 Q_OBJECT 39 40 public: 41 PopupDropperPrivate( PopupDropper* parent, bool sa, QWidget* widget ); 42 ~PopupDropperPrivate() override; 43 44 void newSceneView( PopupDropper* pud ); 45 void setParent( QObject* parent ); 46 47 bool standalone; 48 QWidget* widget; 49 QGraphicsScene* scene; 50 PopupDropperView* view; 51 PopupDropper::Fading fade; 52 QTimeLine fadeHideTimer; 53 QTimeLine fadeShowTimer; 54 int fadeInTime; 55 int fadeOutTime; 56 QTimer deleteTimer; 57 int deleteTimeout; 58 int frameMax; 59 QColor windowColor; 60 QBrush windowBackgroundBrush; 61 QColor baseTextColor; 62 QColor hoveredTextColor; 63 QPen hoveredBorderPen; 64 QBrush hoveredFillBrush; 65 QString file; 66 QSvgRenderer* sharedRenderer; 67 int horizontalOffset; 68 QList<PopupDropperItem*> pdiItems; 69 int overlayLevel; 70 bool entered; 71 QMap<QAction*, PopupDropperPrivate*> submenuMap; 72 bool submenu; 73 QList<QGraphicsItem*> allItems; 74 bool quitOnDragLeave; 75 bool onTop; 76 QRectF widgetRect; 77 78 //queuedHide: To prevent multiple hide() from being sent if it's already being hidden 79 bool queuedHide; 80 81 void dragLeft(); 82 void dragEntered(); 83 void startDeleteTimer(); 84 85 void reposItems(); 86 bool amIOnTop( PopupDropperView* pdv ); 87 88 public Q_SLOTS: 89 void fadeHideTimerFrameChanged( int frame ); 90 void fadeShowTimerFrameChanged( int frame ); 91 void fadeShowTimerFinished(); 92 void fadeHideTimerFinished(); 93 void deleteTimerFinished(); 94 95 private: 96 PopupDropper* q; 97 }; 98 99 #endif //POPUPDROPPER_P_H 100