| 1 | // Aseprite Document Library |
| 2 | // Copyright (c) 2001-2018 David Capello |
| 3 | // |
| 4 | // This file is released under the terms of the MIT license. |
| 5 | // Read LICENSE.txt for more information. |
| 6 | |
| 7 | #ifndef DOC_DOCUMENT_H_INCLUDED |
| 8 | #define DOC_DOCUMENT_H_INCLUDED |
| 9 | #pragma once |
| 10 | |
| 11 | #include <string> |
| 12 | |
| 13 | #include "doc/object.h" |
| 14 | #include "doc/sprites.h" |
| 15 | |
| 16 | namespace doc { |
| 17 | |
| 18 | class Document : public Object { |
| 19 | public: |
| 20 | Document(); |
| 21 | ~Document(); |
| 22 | |
| 23 | const Sprites& sprites() const { return m_sprites; } |
| 24 | Sprites& sprites() { return m_sprites; } |
| 25 | |
| 26 | const Sprite* sprite() const { return m_sprites.empty() ? NULL: m_sprites.front(); } |
| 27 | Sprite* sprite() { return m_sprites.empty() ? NULL: m_sprites.front(); } |
| 28 | |
| 29 | int width() const; |
| 30 | int height() const; |
| 31 | ColorMode colorMode() const; |
| 32 | |
| 33 | std::string name() const; |
| 34 | const std::string& filename() const { return m_filename; } |
| 35 | void setFilename(const std::string& filename); |
| 36 | |
| 37 | protected: |
| 38 | virtual void onFileNameChange(); |
| 39 | |
| 40 | private: |
| 41 | std::string m_filename; // Document's file name. From where it was |
| 42 | // loaded, where it is saved. |
| 43 | Sprites m_sprites; |
| 44 | }; |
| 45 | |
| 46 | } // namespace doc |
| 47 | |
| 48 | #endif |
| 49 | |