ImGuiIDid=str_id?window->GetID(str_id):window->DC.LastItemId;// If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!
ImGuiIDid=str_id?window->GetID(str_id):window->DC.LastItemId;// If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!
IM_ASSERT(id!=0);// You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
IM_ASSERT(id!=0);// You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
OpenPopupEx(id,popup_flags);
OpenPopupEx(id,popup_flags);
returntrue;
}
}
returnfalse;
}
}
// This is a helper to handle the simplest case of associating one named popup to one given widget.
// This is a helper to handle the simplest case of associating one named popup to one given widget.
// - CloseCurrentPopup() is called by default by Selectable()/MenuItem() when activated (FIXME: need some options).
// - CloseCurrentPopup() is called by default by Selectable()/MenuItem() when activated (FIXME: need some options).
// - Use ImGuiPopupFlags_NoOpenOverExistingPopup to avoid opening a popup if there's already one at the same level. This is equivalent to e.g. testing for !IsAnyPopupOpen() prior to OpenPopup().
// - Use ImGuiPopupFlags_NoOpenOverExistingPopup to avoid opening a popup if there's already one at the same level. This is equivalent to e.g. testing for !IsAnyPopupOpen() prior to OpenPopup().
IMGUI_APIvoidOpenPopup(constchar*str_id,ImGuiPopupFlagspopup_flags=0);// call to mark popup as open (don't call every frame!).
IMGUI_APIvoidOpenPopup(constchar*str_id,ImGuiPopupFlagspopup_flags=0);// call to mark popup as open (don't call every frame!).
IMGUI_APIboolOpenPopupOnItemClick(constchar*str_id=NULL,ImGuiPopupFlagspopup_flags=1);// helper to open popup when clicked on last item. return true when just opened. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors)
IMGUI_APIvoidOpenPopupOnItemClick(constchar*str_id=NULL,ImGuiPopupFlagspopup_flags=1);// helper to open popup when clicked on last item. return true when just opened. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors)
IMGUI_APIvoidCloseCurrentPopup();// manually close the popup we have begin-ed into.
IMGUI_APIvoidCloseCurrentPopup();// manually close the popup we have begin-ed into.
// Popups: open+begin combined functions helpers
// Popups: open+begin combined functions helpers
// - Helpers to do OpenPopup+BeginPopup where the Open action is triggered by e.g. hovering an item and right-clicking.
// - Helpers to do OpenPopup+BeginPopup where the Open action is triggered by e.g. hovering an item and right-clicking.
@ -1714,7 +1714,7 @@ struct ImGuiPayload
namespaceImGui
namespaceImGui
{
{
// OBSOLETED in 1.79 (from August 2020)
// OBSOLETED in 1.79 (from August 2020)
staticinlineboolOpenPopupContextItem(constchar*str_id=NULL,ImGuiMouseButtonmb=1){returnOpenPopupOnItemClick(str_id,mb);}// Renamed in 1.77, renamed back in 1.79. Sorry!
staticinlinevoidOpenPopupContextItem(constchar*str_id=NULL,ImGuiMouseButtonmb=1){OpenPopupOnItemClick(str_id,mb);}// Bool return value removed. Use IsWindowAppearing() in BeginPopup() instead. Renamed in 1.77, renamed back in 1.79. Sorry!
// OBSOLETED in 1.78 (from June 2020)
// OBSOLETED in 1.78 (from June 2020)
// Old drag/sliders functions that took a 'float power = 1.0' argument instead of flags.
// Old drag/sliders functions that took a 'float power = 1.0' argument instead of flags.
// For shared code, you can version check at compile-time with `#if IMGUI_VERSION_NUM >= 17704`.
// For shared code, you can version check at compile-time with `#if IMGUI_VERSION_NUM >= 17704`.