/******************************************************************************* * @类: Dialog * @摘要: 模态和非模态对话框控件,提供丰富的消息框功能 * @描述: * 实现完整的对话框功能,支持多种按钮组合和异步结果回调。 * 自动处理布局、背景保存恢复和生命周期管理。 * * @特性: * - 支持六种标准消息框类型(OK、YesNo、YesNoCancel等) * - 模态和非模态两种工作模式 * - 自动文本换行和尺寸计算 * - 背景保存和恢复机制 * - 工厂模式下的去重检测 * * @使用场景: 用户提示、确认操作、输入请求等交互场景 * @所属框架: 星垣(StellarX) GUI框架 * @作者: 我在人间做废物 ******************************************************************************/ #pragma once #include"StellarX.h" #define closeButtonWidth 30 //关闭按钮宽度 #define closeButtonHeight 20 //关闭按钮高度 同时作为对话框标题栏高度 #define functionButtonWidth 70 //按钮宽度 #define functionButtonHeight 30 //按钮高度 #define buttonMargin 10 //按钮间距 #define buttonAreaHeight 50 //按钮区域高度 #define titleToTextMargin 10 //标题到文本的距离 #define textToBorderMargin 10 //文本到边框的距离 #define BorderWidth 3 //边框宽度 class Dialog : public Canvas { Window& hWnd; //窗口引用 int textWidth = 0; //文本宽度 int textHeight = 0; //文本高度 int buttonNum = 0; // 按钮数量 StellarX::MessageBoxType type = StellarX::MessageBoxType::OK; //对话框类型 std::string titleText = "提示"; //标题文本 std::unique_ptr