Plasma
applettitlebar.h
Go to the documentation of this file.00001 /* 00002 * Copyright 2009 Marco Martin <notmart@gmail.com> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License as 00006 * published by the Free Software Foundation; either version 2, or 00007 * (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 APPLETTITLEBAR_H 00021 #define APPLETTITLEBAR_H 00022 00023 00024 #include <QGraphicsWidget> 00025 00026 #include <Plasma/Plasma> 00027 00028 namespace Plasma 00029 { 00030 class Applet; 00031 class FrameSvg; 00032 class IconWidget; 00033 class Svg; 00034 } 00035 00036 class AppletTitleBar : public QGraphicsWidget 00037 { 00038 Q_OBJECT 00039 00040 public: 00041 explicit AppletTitleBar(Plasma::Applet *parent = 0); 00042 ~AppletTitleBar(); 00043 00044 protected: 00045 void syncSize(); 00046 void syncIconRects(); 00047 00048 //reimplementations 00049 bool eventFilter(QObject *watched, QEvent *event); 00050 void mousePressEvent(QGraphicsSceneMouseEvent *event); 00051 void mouseMoveEvent(QGraphicsSceneMouseEvent *event); 00052 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); 00053 void resizeEvent(QGraphicsSceneResizeEvent *event); 00054 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); 00055 /*void hoverEnterEvent(QGraphicsSceneHoverEvent *event); 00056 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);*/ 00057 00058 protected Q_SLOTS: 00059 void syncMargins(); 00060 void appletRemoved(Plasma::Applet *applet); 00061 void themeChanged(); 00062 void animationFinished(int id); 00063 00064 private: 00065 enum PressedButton{ 00066 NoButton, 00067 MaximizeButton, 00068 ConfigureButton, 00069 CloseButton 00070 }; 00071 00072 Plasma::Applet *m_applet; 00073 00074 PressedButton m_pressedButton; 00075 QRectF m_maximizeButtonRect; 00076 QRectF m_configureButtonRect; 00077 QRectF m_closeButtonRect; 00078 00079 int m_maximizeButtonAnimationId; 00080 int m_configureButtonAnimationId; 00081 int m_closeButtonAnimationId; 00082 00083 Plasma::Svg *m_icons; 00084 Plasma::Svg *m_separator; 00085 Plasma::FrameSvg *m_background; 00086 00087 qreal m_savedAppletTopMargin; 00088 bool m_underMouse; 00089 bool m_showButtons; 00090 }; 00091 00092 #endif
KDE 4.4 API Reference