File indexing completed on 2024-12-22 04:39:54
0001 /*************************************************************************** 0002 * Copyright (C) 2005-2008 by fredrik * 0003 * fredrik@Elanor * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0019 ***************************************************************************/ 0020 #ifndef SCENEARROWBUTTON_H 0021 #define SCENEARROWBUTTON_H 0022 0023 #include <QWidget> 0024 #include <QTimer> 0025 //Added by qt3to4: 0026 #include <QMouseEvent> 0027 #include <QEvent> 0028 #include <QPaintEvent> 0029 0030 0031 /** 0032 *@author Bjoern Erik Nilsen & Fredrik Berg Kjoelstad 0033 */ 0034 class SceneArrowButton : public QWidget 0035 { 0036 Q_OBJECT 0037 public: 0038 /** 0039 * Sets up the scenearrowbutton 0040 * @param parent the parent of the widget. 0041 */ 0042 SceneArrowButton( QWidget *parent=0 ); 0043 0044 /** 0045 * Sets if the scene is opened or closed. 0046 * @param isOpened true if the scene is opened. 0047 */ 0048 void setOpened(bool isOpened); 0049 0050 public slots: 0051 /** 0052 * Slot for moving the icon to create an animation-like effect. 0053 */ 0054 void moveIcon(); 0055 0056 protected: 0057 /** Overloaded function to paint the widget. 0058 * @param p information about the paintEvent. 0059 */ 0060 virtual void paintEvent ( QPaintEvent *p); 0061 0062 /** 0063 * Overloaded event function to receive mouserelease-events. 0064 * @param e information about the mouserelease-event. 0065 */ 0066 void mouseReleaseEvent( QMouseEvent * e ); 0067 0068 /** 0069 * Overloaded event function for receiving information when the mouse 0070 * enter the widget 0071 * @param e information about the event 0072 */ 0073 void enterEvent ( QEvent * e); 0074 0075 /** 0076 * Overloaded event function for receiving information when the mouse 0077 * leaves the widget 0078 * @param e information about the event 0079 */ 0080 void leaveEvent ( QEvent * e); 0081 0082 private: 0083 bool isOpened; 0084 int iconX; 0085 0086 QTimer *moveTimer; 0087 0088 signals: 0089 void clicked(); 0090 }; 0091 0092 #endif