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/ui.h | |
| parent | 705e3914e4e820c3ac92892c32c93479691a09e7 (diff) | |
add: ui view and renderer
Diffstat (limited to 'src/ui/ui.h')
| -rw-r--r-- | src/ui/ui.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/ui/ui.h b/src/ui/ui.h new file mode 100644 index 0000000..20d4e1b --- /dev/null +++ b/src/ui/ui.h @@ -0,0 +1,79 @@ +#pragma once + +#include "core/result.h" +#include "ui/source_view.h" + +#include <cstdint> +#include <filesystem> +#include <string> +#include <string_view> +#include <vector> + +namespace Hsdbg +{ + class Debugger; + class Window; + + class Ui + { + public: + explicit Ui(Window& window); + ~Ui(); + + Ui(const Ui&) = delete; + Ui(Ui&&) = delete; + auto operator=(const Ui&) -> Ui& = delete; + auto operator=(Ui&&) -> Ui& = delete; + + auto begin_frame() -> void; + auto draw(Debugger& debugger) -> void; + auto end_frame() -> void; + + // where the ui will jump when a frame is selected or a breakpoint is hit + auto open_source(const std::filesystem::path& path) -> void; + + private: + struct PanelVisibility + { + bool source = true; + bool breakpoints = true; + bool call_stack = true; + bool threads = true; + bool locals = true; + bool registers = true; + bool console = true; + bool demo = false; + }; + + auto apply_style() -> void; + auto build_default_layout(uint32_t dockspace_id) -> void; + + auto draw_menu_bar(Debugger& debugger) -> void; + auto draw_toolbar(Debugger& debugger) -> void; + auto draw_status_bar(Debugger& debugger) -> void; + auto draw_load_target_popup(Debugger& debugger) -> void; + + auto draw_source_panel(Debugger& debugger) -> void; + auto draw_breakpoints_panel(Debugger& debugger) -> void; + auto draw_call_stack_panel(Debugger& debugger) -> void; + auto draw_threads_panel(Debugger& debugger) -> void; + auto draw_locals_panel(Debugger& debugger) -> void; + auto draw_registers_panel(Debugger& debugger) -> void; + auto draw_console_panel(Debugger& debugger) -> void; + + auto push_console(std::string line) -> void; + auto report(const Result<void>& result, std::string_view action) -> void; + + Window* m_window = nullptr; + SourceView m_source_view; + PanelVisibility m_visible; + + std::vector<std::string> m_console_lines; + std::string m_console_input; + std::string m_target_input; + + bool m_layout_built = false; + bool m_console_scroll_pending = false; + bool m_load_target_pending = false; + }; +} |
