mirror of
https://github.com/shadps4-emu/ext-imgui.git
synced 2024-11-23 10:19:55 +00:00
BeginPopupContextWindow() in_empty_space_only -> !also_over_items (#126)+ comments
Sorry if you used this parameter already.
This commit is contained in:
parent
bda0269133
commit
374d160234
14
imgui.cpp
14
imgui.cpp
@ -3180,26 +3180,26 @@ void ImGui::EndPopup()
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
bool ImGui::BeginPopupContextItem(const char* str_id, int button)
|
||||
bool ImGui::BeginPopupContextItem(const char* str_id, int mouse_button)
|
||||
{
|
||||
if (ImGui::IsItemHovered() && ImGui::IsMouseClicked(button))
|
||||
if (ImGui::IsItemHovered() && ImGui::IsMouseClicked(mouse_button))
|
||||
ImGui::OpenPopup(str_id);
|
||||
return ImGui::BeginPopup(str_id);
|
||||
}
|
||||
|
||||
bool ImGui::BeginPopupContextWindow(bool in_empty_space_only, const char* str_id, int button)
|
||||
bool ImGui::BeginPopupContextWindow(bool also_over_items, const char* str_id, int mouse_button)
|
||||
{
|
||||
if (!str_id) str_id = "window_context_menu";
|
||||
if (ImGui::IsMouseHoveringWindow() && ImGui::IsMouseClicked(button))
|
||||
if (!in_empty_space_only || !ImGui::IsAnyItemHovered())
|
||||
if (ImGui::IsMouseHoveringWindow() && ImGui::IsMouseClicked(mouse_button))
|
||||
if (also_over_items || !ImGui::IsAnyItemHovered())
|
||||
ImGui::OpenPopup(str_id);
|
||||
return ImGui::BeginPopup(str_id);
|
||||
}
|
||||
|
||||
bool ImGui::BeginPopupContextVoid(const char* str_id, int button)
|
||||
bool ImGui::BeginPopupContextVoid(const char* str_id, int mouse_button)
|
||||
{
|
||||
if (!str_id) str_id = "void_context_menu";
|
||||
if (!ImGui::IsMouseHoveringAnyWindow() && ImGui::IsMouseClicked(button))
|
||||
if (!ImGui::IsMouseHoveringAnyWindow() && ImGui::IsMouseClicked(mouse_button))
|
||||
ImGui::OpenPopup(str_id);
|
||||
return ImGui::BeginPopup(str_id);
|
||||
}
|
||||
|
8
imgui.h
8
imgui.h
@ -170,9 +170,9 @@ namespace ImGui
|
||||
// Popup
|
||||
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 BeginPopupContextItem(const char* str_id, int button = 1); // open popup when clicked on last item
|
||||
IMGUI_API bool BeginPopupContextWindow(bool in_empty_space_only = false, const char* str_id = "window_context_menu", int button = 1); // open popup when clicked on current window
|
||||
IMGUI_API bool BeginPopupContextVoid(const char* str_id = "void_context_menu", int button = 1); // open popup when clicked in void (no window)
|
||||
IMGUI_API bool BeginPopupContextItem(const char* str_id, int mouse_button = 1); // open and begin popup when clicked on last item
|
||||
IMGUI_API bool BeginPopupContextWindow(bool also_over_items = true, const char* str_id = NULL, int mouse_button = 1); // open and begin popup when clicked on current window
|
||||
IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, int mouse_button = 1); // open and begin popup when clicked in void (no window)
|
||||
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.
|
||||
|
||||
@ -315,7 +315,7 @@ namespace ImGui
|
||||
IMGUI_API void EndMenuBar();
|
||||
IMGUI_API bool BeginMenu(const char* label, bool enabled = true); // create a sub-menu entry. only call EndMenu() if this returns true!
|
||||
IMGUI_API void EndMenu();
|
||||
IMGUI_API bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true); // return true when activated. shortcuts are displayed for convenience but not processed by ImGui
|
||||
IMGUI_API bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true); // return true when activated. shortcuts are displayed for convenience but not processed by ImGui at the moment
|
||||
IMGUI_API bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true); // return true when activated + toggle (*p_selected) if p_selected != NULL
|
||||
|
||||
// Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare more in your code to handle your types. you can add functions to the ImGui namespace)
|
||||
|
Loading…
Reference in New Issue
Block a user