From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/IMGUI/NamedKeyControlList.h | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Runtime/IMGUI/NamedKeyControlList.h (limited to 'Runtime/IMGUI/NamedKeyControlList.h') diff --git a/Runtime/IMGUI/NamedKeyControlList.h b/Runtime/IMGUI/NamedKeyControlList.h new file mode 100644 index 0000000..dc4dff7 --- /dev/null +++ b/Runtime/IMGUI/NamedKeyControlList.h @@ -0,0 +1,40 @@ +#ifndef NAMEDKEYCONTROLLIST_H +#define NAMEDKEYCONTROLLIST_H + +namespace IMGUI +{ + struct NamedControl + { + int ID; + int windowID; + NamedControl () + { + ID = 0; + windowID = -1; + } + NamedControl (int _ID, int _windowID) + { + ID = _ID; + windowID = _windowID; + } + }; + + class NamedKeyControlList + { + public: + void AddNamedControl (const std::string &str, int id, int windowID); + + // Return ptr name of a given control, NULL if none. + std::string GetNameOfControl (int id); + + // Return the ID of a named control. + // Used in GUIState::FocusControl + NamedControl* GetControlNamed (const std::string &name); + + void Clear () { m_NamedControls.clear (); } + private: + std::map m_NamedControls; + }; +}; + +#endif \ No newline at end of file -- cgit v1.1-26-g67d0