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)
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)
IMGUI_APIboolBeginPopupModal(constchar*name,bool*p_open=NULL,ImGuiWindowFlagsflags=0);// return true if the modal is open, and you can start outputting to it.
IMGUI_APIvoidEndPopup();// only call EndPopup() if BeginPopupXXX() returns true!
// Popups: open/close functions
// - OpenPopup(): set popup state to open.
// - OpenPopup(): set popup state to open. ImGuiPopupFlags are available for opening options.
// - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE.
// - CloseCurrentPopup(): use inside the BeginPopup()/EndPopup() scope to close manually.
// - CloseCurrentPopup() is called by default by Selectable()/MenuItem() when activated (FIXME: need some options).
IMGUI_APIvoidOpenPopup(constchar*str_id);// call to mark popup as open (don't call every frame!).
IMGUI_APIboolOpenPopupContextItem(constchar*str_id=NULL,ImGuiMouseButtonmouse_b=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)
// - 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_APIboolOpenPopupContextItem(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.
// 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.
// - They are convenient to easily create context menus, hence the name.
IMGUI_APIboolBeginPopupContextItem(constchar*str_id=NULL,ImGuiMouseButtonmouse_b=1);// open+begin popup when clicked on last item. if you can pass a NULL str_id only if the previous item had an id. 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,ImGuiMouseButtonmouse_b=1,boolalso_over_items=true);// open+begin popup when clicked on current window.
IMGUI_APIboolBeginPopupContextVoid(constchar*str_id=NULL,ImGuiMouseButtonmouse_b=1);// open+begin popup when clicked in void (where there are no windows).
// - 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.
// - We exceptionally default their flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter. Passing a mouse button to ImGuiPopupFlags is guaranteed to be legal.
IMGUI_APIboolBeginPopupContextItem(constchar*str_id=NULL,ImGuiPopupFlagspopup_flags=1);// open+begin popup when clicked on last item. if you can pass a NULL str_id only if the previous item had an id. 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).
// Popups: test function
// - IsPopupOpen(): return true if the popup is open at the current BeginPopup() level of the popup stack.
// - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId: return true if any popup is open at the current BeginPopup() level of the popup stack.
// Flags for OpenPopup*(), BeginPopupContext*(), IsPopupOpen() functions.
// - To be backward compatible with older API which took an 'int mouse_button = 1' argument, we need to treat
// small flags values as a mouse button index, so we encode the mouse button in the first few bits of the flags.
// It is therefore guaranteed to be legal to pass a mouse button index in ImGuiPopupFlags.
// - For the same reason, we exceptionally default the ImGuiPopupFlags argument of BeginPopupContextXXX functions to 1 instead of 0.
enumImGuiPopupFlags_
{
ImGuiPopupFlags_None=0,
ImGuiPopupFlags_MouseButtonLeft=0,// For BeginPopupContext*(): open on Left Mouse release. Guaranted to always be == 0 (same as ImGuiMouseButton_Left)
ImGuiPopupFlags_MouseButtonRight=1,// For BeginPopupContext*(): open on Right Mouse release. Guaranted to always be == 1 (same as ImGuiMouseButton_Right)
ImGuiPopupFlags_MouseButtonMiddle=2,// For BeginPopupContext*(): open on Middle Mouse release. Guaranted to always be == 2 (same as ImGuiMouseButton_Middle)
ImGuiPopupFlags_MouseButtonMask_=0x1F,
ImGuiPopupFlags_MouseButtonDefault_=1,
ImGuiPopupFlags_NoOpenOverExistingPopup=1<<5,// For OpenPopup*(), BeginPopupContext*(): don't open if there's already a popup at the same level of the popup stack
ImGuiPopupFlags_NoOpenOverItems=1<<6,// For BeginPopupContextWindow(): don't return true when hovering items, only when hovering empty space
ImGuiPopupFlags_AnyPopupId=1<<7,// For IsPopupOpen(): ignore the ImGuiID parameter and test for any popup.
ImGuiPopupFlags_AnyPopupLevel=1<<8,// For IsPopupOpen(): search/test at any level of the popup stack (default test in the current level)
staticinlineboolOpenPopupOnItemClick(constchar*str_id=NULL,ImGuiMouseButtonmb=1){returnOpenPopupContextItem(str_id,mb);}// Passing a mouse button to ImGuiPopupFlags is legal