feat: add message box dialogs
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user