Pencil2D  ff90c0872e88be3bf81c548cd60f01983012ec49
Pencil2D is an animation software for both bitmap and vector graphics. It is free, multi-platform, and open source.
 All Classes Functions
keyframe.h
1 /*
2 
3 Pencil - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2012-2017 Matthew Chiawen Chang
6 
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; version 2 of the License.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 */
17 
18 #ifndef KeyFrame_H
19 #define KeyFrame_H
20 
21 #include <cstdint>
22 #include <vector>
23 #include <memory>
24 #include <QString>
25 #include "pencilerror.h"
27 
28 
29 class KeyFrame
30 {
31 public:
32  KeyFrame();
33  virtual ~KeyFrame();
34 
35  int pos() { return mFrame; }
36  void setPos( int position ) { mFrame = position; }
37 
38  int length() { return mLength; }
39  void setLength( int len ) { mLength = len; }
40 
41  void modification() { mIsModified = true; }
42  void setModified( bool b ) { mIsModified = b; }
43  bool isModified() { return mIsModified; };
44 
45  void setSelected( bool b ) { mIsSelected = b; }
46  bool isSelected() { return mIsSelected; }
47 
48  QString fileName() { return mAttachedFileName; }
49  void setFileName( QString strFileName ) { mAttachedFileName = strFileName; }
50 
51  void addEventListener( KeyFrameEventListener* );
52  void removeEventListner( KeyFrameEventListener* );
53 
54  virtual bool isNull() { return false; }
55 
56 private:
57  int mFrame = -1;
58  int mLength = 1;
59  bool mIsModified = false;
60  bool mIsSelected = false;
61  QString mAttachedFileName;
62 
63  std::vector< KeyFrameEventListener* > mEventListeners;
64 };
65 
66 typedef std::shared_ptr< KeyFrame > KeyFramePtr;
67 
69 {
70 public:
71  virtual void onKeyFrameDestroy( KeyFrame* ) = 0;
72 };
73 
74 #endif // KeyFrame_H