feat: add message box dialogs

This commit is contained in:
2026-04-22 18:44:25 +02:00
parent 6c2796f8bd
commit 15a092d0b4
10 changed files with 695 additions and 17 deletions
+40
View File
@@ -0,0 +1,40 @@
/*
* messagebox.hpp
* Message box dialog declarations
* Copyright (c) 2026 Daniel Hammer
*/
#pragma once
#include <montauk/syscall.h>
#include <gui/gui.hpp>
#include <gui/dialogs.hpp>
struct MessageBoxLayout {
gui::Rect text_rect;
gui::Rect footer_rect;
gui::Rect buttons[3];
int button_count;
};
namespace messagebox {
constexpr int MESSAGE_INIT_W = 460;
constexpr int MESSAGE_INIT_H = 220;
constexpr int FOOTER_H = 56;
constexpr int BUTTON_W = 88;
constexpr int BUTTON_H = 30;
constexpr int BUTTON_GAP = 8;
constexpr int MAX_BUTTONS = 3;
constexpr int MAX_LINES = 7;
constexpr int MAX_LINE_LEN = 128;
void init(const char* message, uint8_t buttons, uint8_t default_choice = 0);
void draw();
void handle_mouse(const Montauk::WinEvent& ev);
void handle_key(const Montauk::KeyEvent& key);
void dismiss();
uint8_t selected_choice();
void cleanup();
} // namespace messagebox