You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
937B

  1. #pragma once
  2. #include <common.hpp>
  3. namespace rack {
  4. namespace history {
  5. struct State;
  6. } // namespace history
  7. namespace engine {
  8. struct Engine;
  9. } // namespace engine
  10. struct Window;
  11. struct PatchManager;
  12. namespace widget {
  13. struct EventState;
  14. } // namespace widget
  15. namespace app {
  16. struct Scene;
  17. } // namespace app
  18. /** Rack instance state
  19. */
  20. struct Context {
  21. widget::EventState* event = NULL;
  22. app::Scene* scene = NULL;
  23. engine::Engine* engine = NULL;
  24. Window* window = NULL;
  25. history::State* history = NULL;
  26. PatchManager* patch = NULL;
  27. ~Context();
  28. };
  29. /** Returns the global Context pointer */
  30. Context* contextGet();
  31. /** Sets the context for this thread.
  32. You must set the context when preparing each thread if the code uses the APP macro in that thread.
  33. */
  34. void contextSet(Context* context);
  35. /** Accesses the global Context pointer. Just an alias for contextGet(). */
  36. #define APP rack::contextGet()
  37. } // namespace rack