Line data Source code
1 : #pragma once
2 :
3 : #include <array>
4 : #include <functional>
5 : #include <string>
6 :
7 : #include "common.h"
8 : #include "gui/state/snapshot_manager.h"
9 : #include "gui/ui_component.h"
10 :
11 : namespace Amplitron {
12 :
13 : struct SnapshotSlotInfo {
14 : bool is_filled = false;
15 : bool is_active = false;
16 : const char* label = "";
17 : };
18 :
19 10 : struct SnapshotsProps {
20 10 : std::array<SnapshotSlotInfo, SnapshotManager::NUM_SLOTS> slots{};
21 :
22 : std::function<void(int)> on_recall_slot;
23 : std::function<void(int)> on_save_slot;
24 : std::function<void(int)> on_clear_slot;
25 : };
26 :
27 : /**
28 : * @brief Reactive A/B/C/D snapshot toolbar component.
29 : *
30 : * Receives slot state through SnapshotsProps. All mutations go through
31 : * callbacks which are executed in GuiManager (where command history lives).
32 : */
33 6 : class GuiSnapshots : public UIComponent<SnapshotsProps> {
34 : public:
35 30 : GuiSnapshots() = default;
36 :
37 : /** @brief Render the snapshot toolbar row. */
38 : void render() override;
39 :
40 : private:
41 : static constexpr float STATUS_DISPLAY_SECONDS = 2.0f;
42 :
43 6 : char status_msg_[64] = {};
44 6 : float status_timer_ = 0.0f;
45 : };
46 :
47 : } // namespace Amplitron
|