mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-28 00:39:02 +08:00
BeginPopupContextWindow() rearranged and clarified parameters (#126)
This commit is contained in:
parent
b0a9bbf6f6
commit
1cb6a294b0
@ -3180,10 +3180,11 @@ bool ImGui::BeginPopupContextItem(const char* str_id, int button)
|
|||||||
return ImGui::BeginPopup(str_id);
|
return ImGui::BeginPopup(str_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::BeginPopupContextWindow(const char* str_id, bool void_only, int button)
|
bool ImGui::BeginPopupContextWindow(bool in_empty_space_only, const char* str_id, int button)
|
||||||
{
|
{
|
||||||
|
if (str_id == NULL) str_id = "window_context_menu";
|
||||||
if (ImGui::IsMouseHoveringWindow() && ImGui::IsMouseClicked(button))
|
if (ImGui::IsMouseHoveringWindow() && ImGui::IsMouseClicked(button))
|
||||||
if (!void_only || !ImGui::IsAnyItemHovered())
|
if (!in_empty_space_only || !ImGui::IsAnyItemHovered())
|
||||||
ImGui::OpenPopup(str_id);
|
ImGui::OpenPopup(str_id);
|
||||||
return ImGui::BeginPopup(str_id);
|
return ImGui::BeginPopup(str_id);
|
||||||
}
|
}
|
||||||
|
2
imgui.h
2
imgui.h
@ -170,7 +170,7 @@ namespace ImGui
|
|||||||
IMGUI_API void OpenPopup(const char* str_id); // mark popup as open. popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level). close childs popups if any. will close popup when user click outside, or activate a pressable item, or CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block.
|
IMGUI_API void OpenPopup(const char* str_id); // mark popup as open. popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level). close childs popups if any. will close popup when user click outside, or activate a pressable item, or CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block.
|
||||||
IMGUI_API bool BeginPopup(const char* str_id); // return true if popup if opened and start outputting to it. only call EndPopup() if BeginPopup() returned true!
|
IMGUI_API bool BeginPopup(const char* str_id); // return true if popup if opened and start outputting to it. only call EndPopup() if BeginPopup() returned true!
|
||||||
IMGUI_API bool BeginPopupContextItem(const char* str_id, int button = 1); // open popup when clicked on last item
|
IMGUI_API bool BeginPopupContextItem(const char* str_id, int button = 1); // open popup when clicked on last item
|
||||||
IMGUI_API bool BeginPopupContextWindow(const char* str_id = "window_context_menu", bool void_only = false, int button = 1); // open popup when clicked on current window
|
IMGUI_API bool BeginPopupContextWindow(bool in_void_only = false, const char* str_id = "window_context_menu", int button = 1); // open popup when clicked on current window
|
||||||
IMGUI_API void EndPopup();
|
IMGUI_API void EndPopup();
|
||||||
IMGUI_API void CloseCurrentPopup(); // close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup.
|
IMGUI_API void CloseCurrentPopup(); // close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user