mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-06 13:08:47 +02:00
Demo: Improved popups demo and comments.
This commit is contained in:
19
imgui.cpp
19
imgui.cpp
@ -8363,10 +8363,21 @@ void ImGui::OpenPopupOnItemClick(const char* str_id, ImGuiPopupFlags popup_flags
|
||||
}
|
||||
|
||||
// This is a helper to handle the simplest case of associating one named popup to one given widget.
|
||||
// - You can pass a NULL str_id to use the identifier of the last item.
|
||||
// - You may want to handle this on user side if you have specific needs (e.g. tweaking IsItemHovered() parameters).
|
||||
// - This is essentially the same as calling OpenPopupOnItemClick() + BeginPopup() but written to avoid
|
||||
// computing the ID twice because BeginPopupContextXXX functions may be called very frequently.
|
||||
// - To create a popup associated to the last item, you generally want to pass a NULL value to str_id.
|
||||
// - To create a popup with a specific identifier, pass it in str_id.
|
||||
// - This is useful when using using BeginPopupContextItem() on an item which doesn't have an identifier, e.g. a Text() call.
|
||||
// - This is useful when multiple code locations may want to manipulate/open the same popup, given an explicit id.
|
||||
// - You may want to handle the whole on user side if you have specific needs (e.g. tweaking IsItemHovered() parameters).
|
||||
// This is essentially the same as:
|
||||
// id = str_id ? GetID(str_id) : GetItemID();
|
||||
// OpenPopupOnItemClick(str_id);
|
||||
// return BeginPopup(id);
|
||||
// Which is essentially the same as:
|
||||
// id = str_id ? GetID(str_id) : GetItemID();
|
||||
// if (IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right))
|
||||
// OpenPopup(id);
|
||||
// return BeginPopup(id);
|
||||
// The main difference being that this is tweaked to avoid computing the ID twice.
|
||||
bool ImGui::BeginPopupContextItem(const char* str_id, ImGuiPopupFlags popup_flags)
|
||||
{
|
||||
ImGuiWindow* window = GImGui->CurrentWindow;
|
||||
|
Reference in New Issue
Block a user