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