ui_interface.hpp 1002 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include "lumacs/editor_core.hpp" // For EditorEvent and other core types
  3. namespace lumacs {
  4. // Forward declaration to avoid circular dependency
  5. class EditorCore;
  6. /// Abstract interface for a Lumacs editor UI frontend.
  7. /// All editor UIs (ncurses, GTK, etc.) must implement this interface.
  8. class IEditorView {
  9. public:
  10. virtual ~IEditorView() = default;
  11. /// Initialize the UI system (e.g., ncurses init, GTK window setup).
  12. /// This should be called before run().
  13. virtual void init() = 0;
  14. /// Run the main UI loop. This method should block until the UI exits.
  15. virtual void run() = 0;
  16. /// Handle events emitted by the EditorCore.
  17. /// The EditorCore will register this view as a callback listener.
  18. virtual void handle_editor_event(EditorEvent event) = 0;
  19. /// Set the EditorCore instance for the view to interact with.
  20. /// This is typically called once during setup.
  21. virtual void set_core(EditorCore* core) = 0;
  22. };
  23. } // namespace lumacs