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