File indexing completed on 2024-12-22 04:39:55
0001 /*************************************************************************** 0002 * Copyright (C) 2005-2008 by Bjoern Erik Nilsen & Fredrik Berg Kjoelstad* 0003 * bjoern.nilsen@bjoernen.com & fredrikbk@hotmail.com * 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 SCENETHUMBVIEW_H 0021 #define SCENETHUMBVIEW_H 0022 0023 #include "src/presentation/frontends/qtfrontend/framebar/thumbview.h" 0024 0025 class SceneArrowButton; 0026 class FrameBar; 0027 0028 class QObject; 0029 class QWidget; 0030 class QMouseEvent; 0031 class QPaintEvent; 0032 class QDropEvent; 0033 0034 /** 0035 * Custom widget representing a scene in the framebar. 0036 * 0037 * @author Bjoern Erik Nilsen & Fredrik Berg Kjoelstad 0038 */ 0039 class SceneThumbView : public ThumbView { 0040 Q_OBJECT 0041 public: 0042 /** 0043 * Initializes the SceneThumbView widgets attributes. 0044 * @param frameBar the frameBar for communication. 0045 * @param parent the parent of this widget. 0046 * @param number the number of the scene this widget represents. 0047 */ 0048 SceneThumbView(FrameBar *frameBar, QWidget *parent = 0, int number = 0, const char * name = 0); 0049 0050 /** 0051 * Clean up after the SceneThumbView. 0052 */ 0053 ~SceneThumbView(); 0054 0055 /** 0056 * Sets if the scene is opened or closed. 0057 * @param isOpened true if the scene is opened. 0058 */ 0059 void setOpened(bool isOpened); 0060 0061 /** 0062 * Returns whether the scene is opened. 0063 * @return true if the scene is currently opened. 0064 */ 0065 bool getIsOpened() const; 0066 0067 public slots: 0068 /** 0069 * Closes the scene. 0070 */ 0071 void closeScene(); 0072 0073 protected: 0074 /** 0075 * Overloaded function to paint the widget. 0076 * @param p information about the paintEvent. 0077 */ 0078 virtual void paintEvent ( QPaintEvent *p ); 0079 0080 /** 0081 * Overloaded event function to receive mousepress-events. 0082 * @param e information about the mousepress-event. 0083 */ 0084 void mousePressEvent( QMouseEvent * e ); 0085 0086 /** 0087 * Overloaded event function to receive mouserelease events. 0088 * @param e information about the event. 0089 */ 0090 void mouseReleaseEvent( QMouseEvent * e ); 0091 0092 /** 0093 * Overloaded event function to receive mouseMoveEvents in the scenethumbview. 0094 * Used for moving scenes. 0095 * @param me information about the mouseMoveEvent. 0096 */ 0097 void mouseMoveEvent(QMouseEvent *me); 0098 0099 /** 0100 * Notifies the scenethumbview that a drop have happened inside its borders. 0101 * @param event information about the event. 0102 */ 0103 virtual void contentsDropped(QDropEvent * event); 0104 0105 private: 0106 /** Coordinate for calculating when a drag should start */ 0107 QPoint dragPos; 0108 0109 /** Whether the scene is opened or not. */ 0110 bool isOpened; 0111 0112 /** The scene arrow button for closing the scene. */ 0113 SceneArrowButton *arrowButton; 0114 0115 /** The image displayed on the widget */ 0116 QPixmap centerIcon; 0117 0118 /** The font of the text on the widget */ 0119 QFont f; 0120 0121 /** 0122 * Starts a drag event with this scene as the drag object. 0123 */ 0124 void startDrag(); 0125 }; 0126 0127 #endif