Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • core_lib
  • src
  • structure
keyframe.h
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5Copyright (C) 2012-2020 Matthew Chiawen Chang
6
7This program is free software; you can redistribute it and/or
8modify it under the terms of the GNU General Public License
9as published by the Free Software Foundation; version 2 of the License.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU 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"
26class KeyFrameEventListener;
27
28
29class KeyFrame
30{
31public:
32 explicit KeyFrame();
33 explicit KeyFrame(const KeyFrame& k2);
34 virtual ~KeyFrame();
35
36 KeyFrame& operator=(const KeyFrame& k2);
37
38 int pos() const { return mFrame; }
39 void setPos(int position) { mFrame = position; }
40
41 int length() const { return mLength; }
42 void setLength(int len) { mLength = len; }
43
44 void modification() { mIsModified = true; }
45 void setModified(bool b) { mIsModified = b; }
46 bool isModified() const { return mIsModified; }
47
48 QString fileName() const { return mAttachedFileName; }
49 void setFileName(QString strFileName) { mAttachedFileName = strFileName; }
50
51 void addEventListener(KeyFrameEventListener*);
52 void removeEventListner(KeyFrameEventListener*);
53
54 virtual KeyFrame* clone() const { return nullptr; }
55 virtual void loadFile() {}
56 virtual void unloadFile() {}
57 virtual bool isLoaded() const { return true; }
58
59 virtual quint64 memoryUsage() { return 0; }
60
61private:
62 int mFrame = -1;
63 int mLength = 1;
64 bool mIsModified = true;
65 QString mAttachedFileName;
66
67 std::vector<KeyFrameEventListener*> mEventListeners;
68};
69
70class KeyFrameEventListener
71{
72public:
73 virtual void onKeyFrameDestroy(KeyFrame*) = 0;
74};
75
76#endif // KeyFrame_H
KeyFrameEventListener
Definition: keyframe.h:71
KeyFrame
Definition: keyframe.h:30
QString
Generated on Thu Jun 19 2025 04:02:27 for Pencil2D by doxygen 1.9.6 based on revision c1e137dfccefab10d70198bedd9497784189cf49