yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
panel_palette.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_LAYOUT_LAYOUT_DESIGNER_PANEL_PALETTE_H_
2#define YAZE_APP_EDITOR_LAYOUT_LAYOUT_DESIGNER_PANEL_PALETTE_H_
3
4#include <string>
5#include <vector>
6
7namespace yaze {
8namespace editor {
9namespace layout_designer {
10
11// One row in the palette. Sourced from ContentRegistry::Panels at draw
12// time so the palette reflects exactly what REGISTER_PANEL knows about.
13// The designer works against this snapshot — not the live
14// WorkspaceWindowManager — which means panels that aren't yet registered
15// in the active session still appear (registering is editor-switch-gated;
16// authoring isn't).
18 std::string panel_id;
19 std::string display_name;
20 std::string icon;
21 std::string category;
22};
23
24// Collect palette entries from ContentRegistry::Panels. `exclude_panel_id`
25// filters self-reference so the designer can't be dropped inside itself.
26// Entries are sorted by (category, display_name) for a stable layout.
27std::vector<PanelPaletteEntry> CollectPaletteEntries(
28 const std::string& exclude_panel_id = {});
29
30// Stateless widget. Draws a search box at top and a category-grouped list
31// of entries (each group is a collapsing header). Rows are explicit drag
32// sources for the layout canvas, not clickable commands. The caller owns
33// `*query` (the search string); pass a persistent member.
34void DrawPanelPalette(const std::vector<PanelPaletteEntry>& entries,
35 std::string* query);
36
37namespace panel_palette_internal {
38
39// Case-insensitive substring match over the whitespace-split terms in
40// `query`. Empty query matches everything. Matches when the `entry`'s
41// display_name, panel_id, OR category matches every term.
42bool MatchesQuery(const PanelPaletteEntry& entry, const std::string& query);
43
44} // namespace panel_palette_internal
45
46} // namespace layout_designer
47} // namespace editor
48} // namespace yaze
49
50#endif // YAZE_APP_EDITOR_LAYOUT_LAYOUT_DESIGNER_PANEL_PALETTE_H_
bool MatchesQuery(const PanelPaletteEntry &entry, const std::string &query)
void DrawPanelPalette(const std::vector< PanelPaletteEntry > &entries, std::string *query)
std::vector< PanelPaletteEntry > CollectPaletteEntries(const std::string &exclude_panel_id)