| 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_INPUT_CHAIN_H_INCLUDED |
| 8 | #define APP_INPUT_CHAIN_H_INCLUDED |
| 9 | #pragma once |
| 10 | |
| 11 | #include <vector> |
| 12 | |
| 13 | namespace ui { |
| 14 | class Message; |
| 15 | } |
| 16 | |
| 17 | namespace app { |
| 18 | |
| 19 | class Context; |
| 20 | class InputChainElement; |
| 21 | |
| 22 | // The chain of objects (in order) that want to receive |
| 23 | // input/commands from the user (e.g. ColorBar, Timeline, and |
| 24 | // Workspace/DocView). When each of these elements receive the |
| 25 | // user focus, they call InputChain::prioritize(). |
| 26 | class InputChain { |
| 27 | public: |
| 28 | void prioritize(InputChainElement* element, |
| 29 | const ui::Message* msg); |
| 30 | |
| 31 | bool canCut(Context* ctx); |
| 32 | bool canCopy(Context* ctx); |
| 33 | bool canPaste(Context* ctx); |
| 34 | bool canClear(Context* ctx); |
| 35 | |
| 36 | void cut(Context* ctx); |
| 37 | void copy(Context* ctx); |
| 38 | void paste(Context* ctx); |
| 39 | void clear(Context* ctx); |
| 40 | void cancel(Context* ctx); |
| 41 | |
| 42 | private: |
| 43 | std::vector<InputChainElement*> m_elements; |
| 44 | }; |
| 45 | |
| 46 | } // namespace app |
| 47 | |
| 48 | #endif |
| 49 | |