blob: 1603f4153c46da1ff8d4798841b6cbab89004da7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#pragma once
#include <imgui.h>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <string>
#include <vector>
enum ImCmdTextType {
ImCmdTextType_Regular,
ImCmdTextType_Highlight,
ImCmdTextType_COUNT,
};
namespace ImCmd {
struct Command {
const char* Name;
std::function<void()> InitialCallback;
std::function<void(int selected_option)> SubsequentCallback;
std::function<void()> TerminatingCallback;
};
// Command management
void AddCommand(Command command);
void RemoveCommand(const char* name);
// Styling
void SetStyleFont(ImCmdTextType type, ImFont* font);
void SetStyleColor(ImCmdTextType type, ImU32 color);
void ClearStyleColor(ImCmdTextType type); //< Clear the style color for the given type, defaulting to ImGuiCol_Text
// Command palette widget
void SetNextCommandPaletteSearch(const char* text);
void SetNextCommandPaletteSearchBoxFocused();
void ShowCommandPalette(const char* name);
bool IsAnyItemSelected();
void RemoveCache(const char* name);
void RemoveAllCaches();
// Command palette widget in a window helper
void SetNextWindowAffixedTop(ImGuiCond cond = 0);
void ShowCommandPaletteWindow(const char* name, bool* p_open);
// Command responses, only call these in command callbacks (except TerminatingCallback)
void Prompt(std::vector<std::string> options);
} // namespace ImCmd
|