Plasma
panelappletoverlay.h
Go to the documentation of this file.00001 /* 00002 * Copyright 2008 Aaron Seigo <aseigo@kde.org> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as 00006 * published by the Free Software Foundation; either version 2, 00007 * or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this program; if not, write to the 00016 * Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef APPLETMOVEOVERLAY_H 00021 #define APPLETMOVEOVERLAY_H 00022 00023 #include <QWidget> 00024 00025 class QGraphicsLinearLayout; 00026 class QGraphicsWidget; 00027 00028 namespace Plasma 00029 { 00030 class Applet; 00031 } 00032 00033 class PanelAppletOverlay : public QWidget 00034 { 00035 Q_OBJECT 00036 00037 public: 00038 PanelAppletOverlay(Plasma::Applet *applet, QWidget *parent); 00039 ~PanelAppletOverlay(); 00040 00041 void syncOrientation(); 00042 00043 protected: 00044 void paintEvent(QPaintEvent *event); 00045 void mousePressEvent(QMouseEvent *event); 00046 void mouseMoveEvent(QMouseEvent *event); 00047 void mouseReleaseEvent(QMouseEvent *event); 00048 void enterEvent(QEvent *event); 00049 void leaveEvent(QEvent *event); 00050 00051 protected slots: 00052 void delaySyncGeometry(); 00053 void syncGeometry(); 00054 00055 private: 00056 void swapWithPrevious(); 00057 void swapWithNext(); 00058 00059 Plasma::Applet *m_applet; 00060 QGraphicsWidget *m_spacer; 00061 Qt::Orientation m_orientation; 00062 QGraphicsLinearLayout *m_layout; 00063 QRectF m_prevGeom; 00064 QRectF m_nextGeom; 00065 QPoint m_origin; 00066 int m_offset; 00067 int m_index; 00068 bool m_clickDrag; 00069 }; 00070 00071 #endif 00072