mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Added ActivateItem(), GetItemID() functions.
This commit is contained in:
17
imgui.cpp
17
imgui.cpp
@ -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
|
||||
|
Reference in New Issue
Block a user