LeviLamina
Loading...
Searching...
No Matches
SimpleForm.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
9class SimpleForm : public Form {
10
11 class SimpleFormImpl;
12 std::unique_ptr<SimpleFormImpl> impl;
13
14public:
15 using Callback = std::function<void(Player&, int, FormCancelReason)>;
16 using ButtonCallback = std::function<void(Player&)>;
17
18 LLNDAPI SimpleForm();
19
20 LLNDAPI explicit SimpleForm(std::string const& title, std::string const& content = {});
21
22 LLAPI ~SimpleForm() override;
23
24 LLAPI SimpleForm& setTitle(std::string const& title);
25
26 LLAPI SimpleForm& setContent(std::string const& content);
27
28 LLAPI SimpleForm& appendHeader(std::string const& text);
29
30 LLAPI SimpleForm& appendLabel(std::string const& text);
31
32 LLAPI SimpleForm& appendDivider();
33
44 std::string const& text,
45 std::string const& imageData,
46 std::string const& imageType,
47 ButtonCallback callback = {}
48 );
49
57 LLAPI SimpleForm& appendButton(std::string const& text, ButtonCallback callback = {});
58
66 LLAPI SimpleForm& sendTo(Player& player, Callback callback = Callback());
67
68 LLAPI SimpleForm& sendUpdate(Player& player, Callback callback = Callback());
69};
70
71} // namespace ll::form
Definition Player.h:123
Definition FormBase.h:12
Definition SimpleForm.h:9
LLAPI SimpleForm & appendButton(std::string const &text, ButtonCallback callback={})
Append a button to the form.
LLAPI SimpleForm & appendButton(std::string const &text, std::string const &imageData, std::string const &imageType, ButtonCallback callback={})
Append a button to the form.
LLAPI SimpleForm & sendTo(Player &player, Callback callback=Callback())
Send the form to the player.