// Mouse (we need a fallback in case the mouse becomes invalid after being used)
if(IsMousePosValid(&g.IO.MousePos))
returng.IO.MousePos;
returng.MouseLastValidPos;
// The +1.0f offset when stored by OpenPopupEx() allows reopening this or another popup (same or another mouse button) while not moving the mouse, it is pretty standard.
// In theory we could move that +1.0f offset in OpenPopupEx()
// - 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 IsWindowAppearing() after BeginPopup() to tell if a window just opened.
// - IMPORTANT: Notice that for OpenPopupOnItemClick() we exceptionally default flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter
IMGUI_APIvoidOpenPopup(constchar*str_id,ImGuiPopupFlagspopup_flags=0);// call to mark popup as open (don't call every frame!).
IMGUI_APIvoidOpenPopup(ImGuiIDid,ImGuiPopupFlagspopup_flags=0);// id overload to facilitate calling from nested stacks
IMGUI_APIvoidOpenPopupOnItemClick(constchar*str_id=NULL,ImGuiPopupFlagspopup_flags=1);// helper to open popup when clicked on last item. Default to ImGuiPopupFlags_MouseButtonRight == 1. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors)
@ -690,7 +691,7 @@ namespace ImGui
// - Helpers to do OpenPopup+BeginPopup where the Open action is triggered by e.g. hovering an item and right-clicking.
// - They are convenient to easily create context menus, hence the name.
// - IMPORTANT: Notice that BeginPopupContextXXX takes ImGuiPopupFlags just like OpenPopup() and unlike BeginPopup(). For full consistency, we may add ImGuiWindowFlags to the BeginPopupContextXXX functions in the future.
// - IMPORTANT: we exceptionally default their flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter, so if you add other flags remember to re-add the ImGuiPopupFlags_MouseButtonRight.
// - IMPORTANT: Notice that we exceptionally default their flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter, so if you add other flags remember to re-add the ImGuiPopupFlags_MouseButtonRight.
IMGUI_APIboolBeginPopupContextItem(constchar*str_id=NULL,ImGuiPopupFlagspopup_flags=1);// open+begin popup when clicked on last item. Use str_id==NULL to associate the popup to previous item. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp!
IMGUI_APIboolBeginPopupContextWindow(constchar*str_id=NULL,ImGuiPopupFlagspopup_flags=1);// open+begin popup when clicked on current window.
IMGUI_APIboolBeginPopupContextVoid(constchar*str_id=NULL,ImGuiPopupFlagspopup_flags=1);// open+begin popup when clicked in void (where there are no windows).