CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
PluginListView.h
Go to the documentation of this file.
1
12
13#pragma once
14
15#include "cdc_ui/IView.h"
16#include "cdc_views/ListView.h"
18
19#include <string>
20#include <vector>
21
22namespace cdc::plugin_manager {
23
25public:
27
28 void onEnter(void* context = nullptr) override;
29 void onExit() override;
30 void onResume() override;
31 void render(bool partial) override;
32 bool needsRender() const override { return list_.needsRender(); }
33 void markDirty() override { list_.markDirty(); }
34 void clearDirty() override { list_.clearDirty(); }
35 cdc::ui::InputResult onKey(char key) override;
36 const char* getName() const override { return "PluginListView"; }
37 const char* getFooterHint() const override;
38
40 [[nodiscard]] static PluginListView* active() noexcept;
41
44 void refresh();
45
46private:
47 void rebuildItems();
48 static void onSelectStatic(uint16_t index, void* userData);
49 static void onMenuStatic(uint16_t index, void* userData);
50 void onSelect(uint16_t index);
51 void onMenu(uint16_t index);
52
53 cdc::ui::ListView list_;
54 std::vector<std::string> ids_;
55 std::vector<std::string> labels_;
56 std::vector<cdc::ui::ListItem> items_;
57};
58
59} // namespace cdc::plugin_manager
In-memory representation of a plugin's meta.json.
static PluginListView * active() noexcept
Currently-mounted PluginListView instance, or nullptr if none.
const char * getFooterHint() const override
void onEnter(void *context=nullptr) override
const char * getName() const override
void render(bool partial) override
cdc::ui::InputResult onKey(char key) override
Centralized key-code constants for cdc_views.
Definition IModule.h:8
InputResult
Definition IView.h:10