Added ActivateItem(), GetItemID() functions.

This commit is contained in:
omar
2017-10-05 21:25:20 -07:00
parent 80c4e2fe7b
commit 59c6f35bf6
4 changed files with 46 additions and 7 deletions

View File

@ -2837,6 +2837,11 @@ static void NavUpdate()
IM_ASSERT(g.NavActivateDownId == g.NavActivateId);
g.NavMoveRequest = false;
// Process explicit activation request
if (g.NavNextActivateId != 0)
g.NavActivateId = g.NavActivateDownId = g.NavInputId = g.NavNextActivateId;
g.NavNextActivateId = 0;
// Initiate directional inputs request
const int allowed_dir_flags = (g.ActiveId == 0) ? ~0 : g.ActiveIdAllowNavDirFlags;
if (g.NavMoveRequestForwardStep == 0)
@ -6379,6 +6384,18 @@ void ImGui::SetScrollHere(float center_y_ratio)
SetScrollFromPosY(target_y, center_y_ratio);
}
void ImGui::ActivateItem(ImGuiID id)
{
ImGuiContext& g = *GImGui;
g.NavNextActivateId = id;
}
ImGuiID ImGui::GetItemID()
{
ImGuiContext& g = *GImGui;
return g.CurrentWindow->DC.LastItemId;
}
void ImGui::SetKeyboardFocusHere(int offset)
{
IM_ASSERT(offset >= -1); // -1 is allowed but not below