summaryrefslogtreecommitdiff
path: root/debugger.cpp
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-12-31 13:44:32 +1100
committerquou <quou@disroot.org>2024-12-31 13:44:32 +1100
commita9a0d1ee84397621b6172693330b48e9474b0a91 (patch)
treedadae19cdd20d09903438ee07af69b7694af6fef /debugger.cpp
parent0c7b8be8e7d257f2f584121d97bfb899085aa350 (diff)
UI modal windows
Diffstat (limited to 'debugger.cpp')
-rw-r--r--debugger.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/debugger.cpp b/debugger.cpp
new file mode 100644
index 0000000..6a71e15
--- /dev/null
+++ b/debugger.cpp
@@ -0,0 +1,40 @@
+#include "debugger.hpp"
+extern "C" {
+#include "plat.h"
+}
+
+struct Vram_Debugger : UI::Modal {
+ UI::Element* enable_btn;
+
+ Vram_Debugger(UI* ui, UI::Element* parent):
+ UI::Modal(ui, parent, "VRAM debugger") {
+ }
+};
+
+void create_vram_debugger(
+ UI* ui,
+ UI::Element* parent,
+ UI::Element* button
+) {
+ auto window = ui->create_element<Vram_Debugger>(parent);
+ window->enable_btn = button;
+ window->handler = [](UI::Element* e, const UI::Message& m) {
+ if (m.type == UI::Message::Type::destroy) {
+ auto window = (Vram_Debugger*)e;
+ window->enable_btn->enable();
+ }
+ return 0;
+ };
+ ui->create_element<UI::Label>(window->contents, "Hello, I'm the VRAM debugger!");
+}
+
+void register_debuggers(UI* ui, UI::Toolbar* toolbar) {
+ auto btnvram = ui->create_element<UI::Button>(toolbar, "VRAM Debugger");
+ btnvram->handler = [](UI::Element* e, const UI::Message& m) {
+ if (m.type == UI::Message::Type::click) {
+ e->disable();
+ create_vram_debugger(e->ui, e->ui->root, e);
+ }
+ return 0;
+ };
+}