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 void setSelected(bool b) { mIsSelected = b; }
49 bool isSelected() const { return mIsSelected; }
50
51 QString fileName() const { return mAttachedFileName; }
52 void setFileName(QString strFileName) { mAttachedFileName = strFileName; }
53
54 void addEventListener(KeyFrameEventListener*);
55 void removeEventListner(KeyFrameEventListener*);
56
57 virtual KeyFrame* clone() const { return nullptr; }
58 virtual void loadFile() {}
59 virtual void unloadFile() {}
60 virtual bool isLoaded() const { return true; }
61
62 virtual quint64 memoryUsage() { return 0; }
63
64private:
65 int mFrame = -1;
66 int mLength = 1;
67 bool mIsModified = true;
68 bool mIsSelected = false;
69 QString mAttachedFileName;
70
71 std::vector<KeyFrameEventListener*> mEventListeners;
72};
73
74class KeyFrameEventListener
75{
76public:
77 virtual void onKeyFrameDestroy(KeyFrame*) = 0;
78};
79
80#endif // KeyFrame_H
KeyFrameEventListener
Definition: keyframe.h:75
KeyFrame
Definition: keyframe.h:30
QString
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39