00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2007 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 #ifndef ANIMATIONFRAMESUBSETWIDGET_H 00011 #define ANIMATIONFRAMESUBSETWIDGET_H 00012 00013 #include <QtGui/QWidget> 00014 00015 #include "AnimationController.h" 00016 #include "AnimationFrame.h" 00017 #include "TypesFile.h" 00018 00019 class AnimationFrameSpinBox; 00020 class QDateTimeEdit; 00021 class QLabel; 00022 class QSlider; 00023 00024 /** 00025 * A widget used to set a frame subset. 00026 * 00027 * The frame subset widget will allow users to set a subset between two frames 00028 * in an animation. This widget will support both frame-based and time-based animations. 00029 * The widget will be made up of two controls, each with its own slider and custom spin box. 00030 * One control will represent the start frame while the other will handle the stop frame. 00031 */ 00032 class AnimationFrameSubsetWidget : public QWidget 00033 { 00034 Q_OBJECT 00035 00036 public: 00037 /** 00038 * Creates a frame subset widget. 00039 * 00040 * @param pParent 00041 * The parent widget. 00042 */ 00043 AnimationFrameSubsetWidget(QWidget* pParent); 00044 00045 /** 00046 * Destroys the frame subset widget and all child frame subset items. 00047 */ 00048 virtual ~AnimationFrameSubsetWidget(); 00049 00050 /** 00051 * This method will set up the sliders and the spin boxes using the 00052 * data in the animation controller that is given. 00053 * 00054 * @param pController 00055 * The animation controller containing the animation frames. 00056 */ 00057 void setFrames(AnimationController* pController); 00058 00059 /** 00060 * This method will set up the sliders and the spin boxes using the 00061 * data in the animation that is given. 00062 * 00063 * @param pAnimation 00064 * The animation used with the widget. 00065 */ 00066 void setFrames(Animation* pAnimation); 00067 00068 /** 00069 * This method will set up the sliders and the spin boxes using the 00070 * vector of animation frames that is given. 00071 * 00072 * @param frames 00073 * The vector containing the animation frames. 00074 * @param type 00075 * The animation type. 00076 */ 00077 void setFrames(const std::vector<AnimationFrame>& frames, FrameType type); 00078 00079 /** 00080 * Returns the start frame control value. 00081 * 00082 * @return The start frame value for an animation. 00083 */ 00084 double getStartFrame() const; 00085 00086 /** 00087 * Sets the value for the start frame control. 00088 * 00089 * @param start 00090 * The start frame in an animation. 00091 */ 00092 void setStartFrame(double start); 00093 00094 /** 00095 * Returns the stop frame control value. 00096 * 00097 * @return the stop frame value for an animation. 00098 */ 00099 double getStopFrame() const; 00100 00101 /** 00102 * Sets the value for the stop frame control. 00103 * 00104 * @param stop 00105 * The stop frame in an animation. 00106 */ 00107 void setStopFrame(double stop); 00108 00109 /** 00110 * Returns the type of animation. 00111 * 00112 * @return The animation type. 00113 */ 00114 FrameType getFrameType() const; 00115 00116 private slots: 00117 /** 00118 * This method will update the start frame control when 00119 * its slider moved. 00120 * 00121 * @param value 00122 * The new value for the start frame control. 00123 */ 00124 void startSliderMoved(int value); 00125 00126 /** 00127 * This method will update the stop frame control when 00128 * its slider moved. 00129 * 00130 * @param value 00131 * The new value for the stop frame control. 00132 */ 00133 void stopSliderMoved(int value); 00134 00135 /** 00136 * This method will update the start frame control slider when 00137 * the value in its spin box is changed. 00138 * 00139 * @param frame 00140 * The frame containing the new value. 00141 */ 00142 void updateStartSlider(const AnimationFrame& frame); 00143 00144 /** 00145 * This method will update the stop frame control slider when 00146 * the value in its spin box is changed. 00147 * 00148 * @param frame 00149 * The frame containing the new value. 00150 */ 00151 void updateStopSlider(const AnimationFrame& frame); 00152 00153 private: 00154 AnimationFrameSubsetWidget(const AnimationFrameSubsetWidget& rhs); 00155 AnimationFrameSubsetWidget& operator=(const AnimationFrameSubsetWidget& rhs); 00156 00157 /** 00158 * Sets the type of animation. 00159 * 00160 * @param type 00161 * The animation type. 00162 */ 00163 void setFrameType(FrameType type); 00164 00165 QLabel* mpStartLabel; 00166 QSlider* mpStartSlider; 00167 AnimationFrameSpinBox* mpStartSpin; 00168 QLabel* mpStopLabel; 00169 QSlider* mpStopSlider; 00170 AnimationFrameSpinBox* mpStopSpin; 00171 FrameType mType; 00172 }; 00173 00174 #endif