LeviLamina
Loading...
Searching...
No Matches
MessageBox.h
1#pragma once
2
3#include <cstdint>
4#include <memory>
5#include <optional>
6
7#include "ll/api/Expected.h"
8#include "ll/api/base/Macro.h"
9#include "ll/api/coro/CoroTask.h"
10#include "ll/api/ui/form/CustomForm.h"
11
12#include "mc/platform/brstd/move_only_function.h"
13
14class Player;
15
16namespace ll::ui {
17
19 ScreenCloseReason closeReason;
20 std::optional<std::uint32_t> selection;
21};
22
23class MessageBox {
24 struct Impl;
25 std::shared_ptr<Impl> impl;
26
27public:
28 using Result = Expected<MessageBoxResult>;
29 using Callback = brstd::move_only_function<void(Result)>;
30
31 LLNDAPI MessageBox(Player& player, TextValue title);
32 LLAPI ~MessageBox();
33
34 MessageBox(MessageBox const&) = delete;
35 MessageBox& operator=(MessageBox const&) = delete;
36 LLAPI MessageBox(MessageBox&&) noexcept;
37 LLAPI MessageBox& operator=(MessageBox&&) noexcept;
38
39 LLAPI MessageBox& body(TextValue value);
40 LLAPI MessageBox& button1(TextValue label, std::optional<TextValue> tooltip = {});
41 LLAPI MessageBox& button2(TextValue label, std::optional<TextValue> tooltip = {});
42
43 LLNDAPI Expected<> show(Callback callback = {});
44 LLNDAPI coro::CoroTask<Result> showAsync();
45
46 LLNDAPI Expected<> close();
47 LLNDAPI bool isShowing() const noexcept;
48};
49
50} // namespace ll::ui
Definition Player.h:137
Definition move_only_function.h:9
Definition CoroTask.h:45
Definition MessageBox.h:18