| 12345678910111213141516171819202122232425262728293031323334353637 |
- #pragma once
- #include "lumacs/editor_core.hpp" // For EditorEvent and other core types
- namespace lumacs {
- // Forward declaration to avoid circular dependency
- class EditorCore;
- /// @brief Abstract interface for a Lumacs editor UI frontend.
- ///
- /// All editor UIs (ncurses, GTK, etc.) must implement this interface.
- /// This decouples the core logic from the specific display technology.
- class IEditorView {
- public:
- virtual ~IEditorView() = default;
- /// @brief Initialize the UI system (e.g., ncurses init, GTK window setup).
- /// This should be called before run().
- virtual void init() = 0;
- /// @brief Run the main UI loop.
- /// This method should block until the UI exits (e.g., gtk_main()).
- virtual void run() = 0;
- /// @brief Handle events emitted by the EditorCore.
- /// The EditorCore will notify the view of model changes (buffer modified, cursor moved).
- /// @param event The event type.
- virtual void handle_editor_event(EditorEvent event) = 0;
- /// @brief Set the EditorCore instance for the view to interact with.
- /// This is typically called once during setup.
- /// @param core Pointer to the core logic instance.
- virtual void set_core(EditorCore* core) = 0;
- };
- } // namespace lumacs
|