Finality Engine
Loading...
Searching...
No Matches
EditorPreferences.h
Go to the documentation of this file.
1
6#pragma once
7#include <imgui.h>
8#include <array>
9#include <filesystem>
10#include <string>
11
12namespace FINALITY
13{
17 struct ShortcutDefinition { const char* Name; const char* Label; const char* Scope; ImGuiKeyChord Default; };
20 {
21 public:
22 static constexpr size_t Count = static_cast<size_t>(EditorAction::Count);
23 static const std::array<ShortcutDefinition,Count>& Definitions();
25 ImGuiKeyChord Get(EditorAction action) const { return m_Keys[static_cast<size_t>(action)]; }
26 void Set(EditorAction action, ImGuiKeyChord key) { m_Keys[static_cast<size_t>(action)] = key; }
27 bool Pressed(EditorAction action) const;
28 std::string Label(EditorAction action) const;
29 static std::string ChordName(ImGuiKeyChord key);
30 static bool ParseChord(const std::string& text, ImGuiKeyChord& key);
31 int Conflict(EditorAction action, ImGuiKeyChord key) const;
32 void Load(const std::filesystem::path& root);
33 void Save(const std::filesystem::path& root) const;
34 private:
35 std::array<ImGuiKeyChord,Count> m_Keys;
36 };
37}
static constexpr size_t Count
int Conflict(EditorAction action, ImGuiKeyChord key) const
static const std::array< ShortcutDefinition, Count > & Definitions()
void Load(const std::filesystem::path &root)
void Save(const std::filesystem::path &root) const
static std::string ChordName(ImGuiKeyChord key)
bool Pressed(EditorAction action) const
std::string Label(EditorAction action) const
void Set(EditorAction action, ImGuiKeyChord key)
static bool ParseChord(const std::string &text, ImGuiKeyChord &key)
ImGuiKeyChord Get(EditorAction action) const