3#include <imgui_includes.h>
79 MsgBox(
const std::string&
title,
const std::string& message,
int buttons,
99 auto CalculateButtonLayout() -> void;
100 auto DrawIcon() -> void;
101 auto DrawMessage() -> void;
102 auto DrawButtons() -> void;
103 auto UpdateAnimation() -> void;
104 auto GetTypeIcon() const -> const
char*;
105 auto GetTypeColor() const -> ImVec4;
106 auto GetAnimationAlpha() const ->
float;
109 std::
string message_;
117 std::chrono::steady_clock::time_point animation_start_;
118 float animation_progress_;
122 ImVec2 content_size_;
125 const
char* custom_icon_;
127 bool open_requested_{
false};
130 static int next_id_counter_;
142 const std::string&
title,
143 const std::string& message,
146 std::function<void(
ModalResult)> callback =
nullptr) -> std::shared_ptr<MsgBox>;
159 auto CleanupClosedBoxes() -> void;
161 std::vector<std::shared_ptr<MsgBox>> active_boxes_;
167auto ShowInfo(
const std::string&
title,
const std::string& message,
168 std::function<
void(
ModalResult)> callback =
nullptr) -> std::shared_ptr<MsgBox>;
172 std::function<
void(
ModalResult)> callback =
nullptr) -> std::shared_ptr<MsgBox>;
175auto ShowError(
const std::string&
title,
const std::string& message,
176 std::function<
void(
ModalResult)> callback =
nullptr) -> std::shared_ptr<MsgBox>;
180 std::function<
void(
ModalResult)> callback =
nullptr) -> std::shared_ptr<MsgBox>;
184 std::function<
void(
ModalResult)> callback =
nullptr) -> std::shared_ptr<MsgBox>;
192 std::function<
void(
ModalResult)> callback =
nullptr) -> std::shared_ptr<MsgBox>;
196 std::function<
void(
ModalResult)> callback =
nullptr) -> std::shared_ptr<MsgBox>;
Individual message box instance.
auto SetCustomIcon(const char *icon) -> void
Set custom icon (overrides type-based icon)
auto IsOpen() const -> bool
Check if the message box is open.
auto OpenPopup(std::function< void(ModalResult)> callback) -> void
Open the popup with callback.
MsgBox(const std::string &title, const std::string &message, int buttons, const MsgBoxConfig &config=MsgBoxConfig{})
Constructor with configuration.
auto Draw() -> bool
Draw the message box (returns true if still open)
Message box manager for handling multiple popups.
auto RenderAll() -> void
Render all active message boxes.
auto ShowMessageBox(const std::string &title, const std::string &message, int buttons=ModalResult::Ok, const MsgBoxConfig &config=MsgBoxConfig{}, std::function< void(ModalResult)> callback=nullptr) -> std::shared_ptr< MsgBox >
Create and show a message box.
static auto GetInstance() -> MsgBoxManager &
Get the singleton instance.
auto GetActiveCount() const -> size_t
Get count of active message boxes.
auto CloseAll() -> void
Close all message boxes.
ModalResult
Modal result flags for message box buttons.
auto ShowDeleteConfirmation(const std::string &title, const std::string &message, std::function< void(ModalResult)> callback) -> std::shared_ptr< MsgBox >
Show a delete confirmation dialog with Delete/Cancel buttons.
MessageType
Message box types that determine appearance and icon.
auto ShowInfo(const std::string &title, const std::string &message, std::function< void(ModalResult)> callback) -> std::shared_ptr< MsgBox >
Show an information message box.
auto ShowConfirmation(const std::string &title, const std::string &message, std::function< void(ModalResult)> callback, MessageType type) -> std::shared_ptr< MsgBox >
Show a confirmation dialog with OK/Cancel buttons.
auto ShowSaveConfirmation(const std::string &title, const std::string &message, std::function< void(ModalResult)> callback) -> std::shared_ptr< MsgBox >
Show a save confirmation dialog with Save/Don't Save/Cancel buttons.
auto ShowSuccess(const std::string &title, const std::string &message, std::function< void(ModalResult)> callback) -> std::shared_ptr< MsgBox >
Show a success message box.
auto IsConfirmation(ModalResult result) -> bool
auto ShowWarning(const std::string &title, const std::string &message, std::function< void(ModalResult)> callback) -> std::shared_ptr< MsgBox >
Show a warning message box.
auto ShowQuestion(const std::string &title, const std::string &message, std::function< void(ModalResult)> callback) -> std::shared_ptr< MsgBox >
Show a question message box with Yes/No buttons.
auto ShowError(const std::string &title, const std::string &message, std::function< void(ModalResult)> callback) -> std::shared_ptr< MsgBox >
Show an error message box.
AnimationState
Animation state for smooth transitions.
auto RenderMessageBoxes() -> void
Render all message boxes (call this in your main render loop)
Hash specialization for batch_key to enable use in std::unordered_map.
Configuration for message box appearance and behavior.