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 enum DragType { 00039 Move = 1, 00040 LeftResize = 2, 00041 RightResize = 3 00042 }; 00043 00044 PanelAppletOverlay(Plasma::Applet *applet, QWidget *parent); 00045 ~PanelAppletOverlay(); 00046 00047 void syncOrientation(); 00048 void syncIndex(); 00049 Plasma::Applet *applet() const; 00050 00051 signals: 00052 void removedWithApplet(PanelAppletOverlay*); 00053 void moved(PanelAppletOverlay*); 00054 00055 protected: 00056 void paintEvent(QPaintEvent *event); 00057 void mousePressEvent(QMouseEvent *event); 00058 void mouseMoveEvent(QMouseEvent *event); 00059 void mouseReleaseEvent(QMouseEvent *event); 00060 void enterEvent(QEvent *event); 00061 void leaveEvent(QEvent *event); 00062 00063 protected slots: 00064 void appletDestroyed(); 00065 void delaySyncGeometry(); 00066 void syncGeometry(); 00067 00068 private: 00069 void swapWithPrevious(); 00070 void swapWithNext(); 00071 00072 Plasma::Applet *m_applet; 00073 QGraphicsWidget *m_spacer; 00074 Qt::Orientation m_orientation; 00075 QGraphicsLinearLayout *m_layout; 00076 QRect m_menuButtonRect; 00077 QRectF m_prevGeom; 00078 QRectF m_nextGeom; 00079 QPoint m_origin; 00080 QPoint m_lastGlobalPos; 00081 DragType m_dragAction; 00082 int m_offset; 00083 int m_index; 00084 bool m_clickDrag; 00085 }; 00086 00087 #endif 00088
KDE 4.5 API Reference