1// Aseprite Document Library
2// Copyright (C) 2019-2020 Igara Studio S.A.
3// Copyright (C) 2001-2016 David Capello
4//
5// This file is released under the terms of the MIT license.
6// Read LICENSE.txt for more information.
7
8#ifndef DOC_TAG_H_INCLUDED
9#define DOC_TAG_H_INCLUDED
10#pragma once
11
12#include "base/disable_copying.h"
13#include "doc/anidir.h"
14#include "doc/frame.h"
15#include "doc/object.h"
16#include "doc/with_user_data.h"
17
18#include <string>
19
20namespace doc {
21 class Sprite;
22 class Tags;
23
24 class Tag : public WithUserData {
25 public:
26 Tag(frame_t from, frame_t to);
27 Tag(const Tag& other);
28 ~Tag();
29
30 Sprite* sprite() const;
31 Tags* owner() const { return m_owner; }
32 frame_t fromFrame() const { return m_from; }
33 frame_t toFrame() const { return m_to; }
34 frame_t frames() const { return m_to - m_from + 1; }
35 const std::string& name() const { return m_name; }
36 color_t color() const { return userData().color(); }
37 AniDir aniDir() const { return m_aniDir; }
38
39 void setFrameRange(frame_t from, frame_t to);
40 void setName(const std::string& name);
41 void setColor(color_t color);
42 void setAniDir(AniDir aniDir);
43
44 void setOwner(Tags* owner);
45
46 public:
47 Tags* m_owner;
48 frame_t m_from, m_to;
49 std::string m_name;
50 AniDir m_aniDir;
51
52 // Disable operator=
53 Tag& operator=(Tag&);
54 };
55
56} // namespace doc
57
58#endif
59