1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #ifndef STUDIO_GENERIC_ACTION_H_EAC1E4D4_361B_5C94_BB73_9EB2953E2613
- #define STUDIO_GENERIC_ACTION_H_EAC1E4D4_361B_5C94_BB73_9EB2953E2613
- #include <core/util/class_init.h>
- #include "context_listener.h"
- class QMenu;
- class QErrorMessage;
- namespace rainynite::studio {
- class ContextListener;
- class UiAction {
- public:
- virtual void process() = 0;
- };
- inline map<string,UiAction*> const& get_all_actions() {
- return class_init::string_registry<UiAction>();
- }
- void add_all_actions_to_menu(ContextListener const& parent, QMenu& menu, QErrorMessage& error_box);
- #define REGISTERED_ACTION(Self) \
- private class_init::StringRegistered<Self, UiAction>
- #define CONTEXT_ACTION(Self) \
- public UiAction, \
- public ContextListener, \
- REGISTERED_ACTION(Self)
- #define ACTION_NAME(name_) \
- public: \
- static string name() { return name_; }
- }
- #endif
|