| 1 | // Aseprite |
| 2 | // Copyright (C) 2020 Igara Studio S.A. |
| 3 | // Copyright (C) 2001-2017 David Capello |
| 4 | // |
| 5 | // This program is distributed under the terms of |
| 6 | // the End-User License Agreement for Aseprite. |
| 7 | |
| 8 | #ifndef APP_COMMANDS_COMMANDS_H_INCLUDED |
| 9 | #define APP_COMMANDS_COMMANDS_H_INCLUDED |
| 10 | #pragma once |
| 11 | |
| 12 | #include "app/commands/command_ids.h" |
| 13 | #include "ui/base.h" |
| 14 | |
| 15 | #include <map> |
| 16 | #include <string> |
| 17 | #include <vector> |
| 18 | |
| 19 | namespace app { |
| 20 | class Command; |
| 21 | |
| 22 | class Commands { |
| 23 | static Commands* m_instance; |
| 24 | |
| 25 | public: |
| 26 | Commands(); |
| 27 | ~Commands(); |
| 28 | |
| 29 | static Commands* instance(); |
| 30 | |
| 31 | Command* byId(const char* id); |
| 32 | Commands* add(Command* command); |
| 33 | |
| 34 | // Remove the command but doesn't delete it |
| 35 | void remove(Command* command); |
| 36 | |
| 37 | void getAllIds(std::vector<std::string>& ids); |
| 38 | |
| 39 | private: |
| 40 | std::map<std::string, Command*> m_commands; |
| 41 | }; |
| 42 | |
| 43 | } // namespace app |
| 44 | |
| 45 | #endif |
| 46 | |