LeviLamina
Loading...
Searching...
No Matches
ModalForm.h
1#pragma once
2
3#include "ll/api/form/FormBase.h"
4#include "mc/world/actor/player/Player.h"
5
6
7namespace ll::form {
8
9enum class ModalFormSelectedButton : bool {
10 Upper = true,
11 Lower = false,
12};
13
14using ModalFormResult = std::optional<ModalFormSelectedButton>;
15
16class ModalForm : public Form {
17
18 class ModalFormImpl;
19 std::unique_ptr<ModalFormImpl> impl;
20
21public:
22 using Callback = std::function<void(Player&, ModalFormResult, FormCancelReason)>;
23
24 LLNDAPI ModalForm();
25
26 LLNDAPI ModalForm(std::string title, std::string content, std::string upperButton, std::string lowerButton);
27
28 LLAPI ~ModalForm() override;
29
30 LLAPI ModalForm& setTitle(std::string const& title);
31
32 LLAPI ModalForm& setContent(std::string const& content);
33
34 LLAPI ModalForm& setUpperButton(std::string const& upperButton);
35
36 LLAPI ModalForm& setLowerButton(std::string const& lowerButton);
37
38 LLAPI bool sendTo(Player& player, Callback callback = {});
39
40 LLAPI bool sendUpdate(Player& player, Callback callback = {});
41};
42
43} // namespace ll::form
Definition Player.h:123
Definition FormBase.h:12
Definition ModalForm.h:16