File indexing completed on 2024-06-16 04:38:06
0001 /*************************************************************************** 0002 * Copyright (C) 2005-2014 by Linuxstopmotion contributors; * 0003 * see the AUTHORS file for details. * 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 THUMBVIEW_H 0021 #define THUMBVIEW_H 0022 0023 #include <QLabel> 0024 0025 class FrameBar; 0026 0027 class QDropEvent; 0028 class QWidget; 0029 0030 /** 0031 * This abstract class represents the thumbviews in the framebar. It has 0032 * two subclasses: the FrameThumbView and the SceneThumbView. 0033 * 0034 * @author Bjoern Erik Nilsen & Fredrik Berg Kjoelstad 0035 */ 0036 class ThumbView : public QLabel { 0037 Q_OBJECT 0038 public: 0039 0040 /** 0041 * Creates and sets up the thumbview class. 0042 * @param frameBar the framebar for communicating. 0043 * @param parent the parent widget. 0044 * @param number the number of this thumbview in the framebar. 0045 */ 0046 ThumbView(FrameBar *frameBar, QWidget *parent, int number, const char *name = 0); 0047 0048 /** 0049 * Cleans up after the widget. 0050 */ 0051 virtual ~ThumbView(); 0052 0053 /** 0054 * Adds another reference. The reference count starts at 1 on construction. 0055 */ 0056 void addRef(); 0057 0058 /** 0059 * Removes a reference. If the reference count falls to zero this object is 0060 * deleted. 0061 */ 0062 void delRef(); 0063 0064 /** 0065 * Function to set the number of this ThumbView in the framebar 0066 * when the ThumbView change position. 0067 * @param number the new number for the ThumbView in the framebar. 0068 */ 0069 virtual void setNumber(int number); 0070 0071 /** 0072 *Retrieves the number of this ThumbView in the framebar 0073 *@return the number for this ThumbView in the framebar 0074 */ 0075 int getNumber() const; 0076 0077 /** 0078 * Abstract function for telling a framethumbview that it has one or more sounds 0079 * attached to it. 0080 * @param hasSounds true if the frame has one or more sounds attached to it. 0081 */ 0082 virtual void setHasSounds(bool hasSounds); 0083 0084 /** 0085 * Sets whether a framethumbview should be marked as selected. 0086 * @param selected whether this framethumbview should be showed as selected. 0087 */ 0088 virtual void setSelected(bool selected); 0089 0090 /** 0091 * Abstract function for telling a scenethumbview whether the scene is opened or 0092 * closed 0093 * @param isOpened true if the scene is opened. 0094 */ 0095 virtual void setOpened(bool isOpened); 0096 0097 /** 0098 * Notifies the thumbview that a drop have happened inside its borders. 0099 * 0100 * The reason it doesn't accept it itself is that the framebar need the information 0101 * so that it can autoscroll. 0102 * @param event information about the event. 0103 */ 0104 virtual void contentsDropped(QDropEvent * event); 0105 0106 FrameBar* getFrameBar() const { 0107 return frameBar; 0108 } 0109 0110 private: 0111 /** 0112 * Reference count. As a QDrag object might be referring to this object 0113 * after it has been deleted from the frame bar, we need to delay deletion 0114 * until a drag starting here has ended. 0115 */ 0116 int refCount; 0117 0118 /** The framebar for communicating with it */ 0119 FrameBar *frameBar; 0120 0121 /** For a scene, the scene number within the animation. For a frame, the 0122 * frame number within the scene. */ 0123 int number; 0124 }; 0125 0126 #endif