| 1 | // Aseprite |
| 2 | // Copyright (C) 2019 Igara Studio S.A. |
| 3 | // Copyright (C) 2001-2018 David Capello |
| 4 | // |
| 5 | // This program is distributed under the terms of |
| 6 | // the End-User License Agreement for Aseprite. |
| 7 | |
| 8 | #ifndef APP_CONTEXT_FLAGS_H_INCLUDED |
| 9 | #define APP_CONTEXT_FLAGS_H_INCLUDED |
| 10 | #pragma once |
| 11 | |
| 12 | #include "base/ints.h" |
| 13 | |
| 14 | namespace app { |
| 15 | |
| 16 | class Context; |
| 17 | class Site; |
| 18 | |
| 19 | class ContextFlags { |
| 20 | public: |
| 21 | enum { |
| 22 | HasActiveDocument = 1 << 0, |
| 23 | HasActiveSprite = 1 << 1, |
| 24 | HasVisibleMask = 1 << 2, |
| 25 | HasActiveLayer = 1 << 3, |
| 26 | HasActiveCel = 1 << 4, |
| 27 | HasActiveImage = 1 << 5, |
| 28 | HasBackgroundLayer = 1 << 6, |
| 29 | ActiveDocumentIsReadable = 1 << 7, |
| 30 | ActiveDocumentIsWritable = 1 << 8, |
| 31 | ActiveLayerIsImage = 1 << 9, |
| 32 | ActiveLayerIsBackground = 1 << 10, |
| 33 | ActiveLayerIsVisible = 1 << 11, |
| 34 | ActiveLayerIsEditable = 1 << 12, |
| 35 | ActiveLayerIsReference = 1 << 13, |
| 36 | ActiveLayerIsTilemap = 1 << 14, |
| 37 | HasSelectedColors = 1 << 15, |
| 38 | HasSelectedTiles = 1 << 16, |
| 39 | }; |
| 40 | |
| 41 | ContextFlags(); |
| 42 | |
| 43 | bool check(uint32_t flags) const { return (m_flags & flags) == flags; } |
| 44 | void update(Context* context); |
| 45 | |
| 46 | private: |
| 47 | void updateFlagsFromSite(const Site& site); |
| 48 | |
| 49 | uint32_t m_flags; |
| 50 | }; |
| 51 | |
| 52 | } // namespace app |
| 53 | |
| 54 | #endif |
| 55 | |