aboutsummaryrefslogtreecommitdiff
path: root/source/EditorCommandPalette.hpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-04-25 20:22:07 -0700
committerrtk0c <[email protected]>2022-04-25 20:22:07 -0700
commit855da86feae1a5cc14dc2d486ccf115f484dbc2e (patch)
tree8284c6a6bdfb1a919eb1a22f466f4180a329c7f3 /source/EditorCommandPalette.hpp
parentd78a55de5003dbb040f1d1c369409e63a2c806d8 (diff)
Changeset: 16 Initial work on rendering sprites to screen
Diffstat (limited to 'source/EditorCommandPalette.hpp')
-rw-r--r--source/EditorCommandPalette.hpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/source/EditorCommandPalette.hpp b/source/EditorCommandPalette.hpp
new file mode 100644
index 0000000..1603f41
--- /dev/null
+++ b/source/EditorCommandPalette.hpp
@@ -0,0 +1,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