ProcessActions.hpp
1 #pragma once
3 namespace Process
4 {
5 template <typename T>
7 }
8 
9 #define SCORE_DECLARE_FOCUSED_PROCESS_CONDITION(Type) \
10  namespace Process \
11  { \
12  template <> \
13  struct EnableWhenFocusedProcessIs<Type> final : public score::FocusActionCondition \
14  { \
15  public: \
16  static score::ActionConditionKey static_key() \
17  { \
18  return score::ActionConditionKey{"FocusedProcessIs" #Type}; \
19  } \
20  \
21  EnableWhenFocusedProcessIs() \
22  : score::FocusActionCondition{static_key()} \
23  { \
24  } \
25  \
26  private: \
27  void action(score::ActionManager& mgr, score::MaybeDocument doc) override \
28  { \
29  if(!doc) \
30  { \
31  setEnabled(mgr, false); \
32  return; \
33  } \
34  \
35  auto obj = doc->focus.get(); \
36  if(!obj) \
37  { \
38  setEnabled(mgr, false); \
39  return; \
40  } \
41  \
42  setEnabled(mgr, bool(dynamic_cast<const Type*>(obj))); \
43  } \
44  }; \
45  }
Base classes and tools to implement processes and layers.
Definition: JSONVisitor.hpp:1324
Definition: ProcessActions.hpp:6