diff options
| author | hachem <im@hachem.wtf> | 2026-08-28 01:01:01 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-28 01:01:01 +0200 |
| commit | 801c6a8916a495162b200fff0d14cfbf89ea854c (patch) | |
| tree | c68fb131e87e3098559643c707142eaeac835baa /src/ui/source_view.h | |
| parent | 705e3914e4e820c3ac92892c32c93479691a09e7 (diff) | |
add: ui view and renderer
Diffstat (limited to 'src/ui/source_view.h')
| -rw-r--r-- | src/ui/source_view.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/ui/source_view.h b/src/ui/source_view.h new file mode 100644 index 0000000..94855e8 --- /dev/null +++ b/src/ui/source_view.h @@ -0,0 +1,39 @@ +#pragma once + +#include "core/result.h" + +#include <cstdint> +#include <filesystem> +#include <string> +#include <vector> + +namespace Hsdbg +{ + class Debugger; + + class SourceView + { + public: + auto open(const std::filesystem::path& path) -> Result<void>; + auto close() -> void; + + auto draw(Debugger& debugger) -> void; + + auto set_highlighted_line(uint32_t line) -> void; + + auto path() const -> const std::filesystem::path& { return m_path; } + auto line_count() const -> size_t { return m_lines.size(); } + auto is_open() const -> bool { return !m_lines.empty(); } + + private: + auto draw_open_bar() -> void; + auto draw_lines(Debugger& debugger) -> void; + + std::filesystem::path m_path; + std::vector<std::string> m_lines; + std::string m_path_input; + std::string m_error; + uint32_t m_highlighted_line = 0; + bool m_scroll_to_highlight = false; + }; +} |
