|
|
|
@ -5264,6 +5264,9 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((flags & (ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick)) == 0)
|
|
|
|
|
flags |= ImGuiButtonFlags_PressedOnClickRelease;
|
|
|
|
|
|
|
|
|
|
bool pressed = false;
|
|
|
|
|
bool hovered = IsHovered(bb, id, (flags & ImGuiButtonFlags_FlattenChilds) != 0);
|
|
|
|
|
if (hovered)
|
|
|
|
@ -5271,32 +5274,29 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|
|
|
|
SetHoveredID(id);
|
|
|
|
|
if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))
|
|
|
|
|
{
|
|
|
|
|
if (g.IO.MouseDoubleClicked[0] && (flags & ImGuiButtonFlags_PressedOnDoubleClick))
|
|
|
|
|
if ((flags & ImGuiButtonFlags_PressedOnClickRelease) && g.IO.MouseClicked[0]) // Most common type
|
|
|
|
|
{
|
|
|
|
|
pressed = true;
|
|
|
|
|
SetActiveID(id, window); // Hold on ID
|
|
|
|
|
FocusWindow(window);
|
|
|
|
|
}
|
|
|
|
|
else if (g.IO.MouseClicked[0])
|
|
|
|
|
if ((flags & ImGuiButtonFlags_PressedOnClick) && g.IO.MouseClicked[0])
|
|
|
|
|
{
|
|
|
|
|
if (flags & ImGuiButtonFlags_PressedOnClick)
|
|
|
|
|
{
|
|
|
|
|
pressed = true;
|
|
|
|
|
SetActiveID(0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SetActiveID(id, window);
|
|
|
|
|
}
|
|
|
|
|
pressed = true;
|
|
|
|
|
SetActiveID(0);
|
|
|
|
|
FocusWindow(window);
|
|
|
|
|
}
|
|
|
|
|
else if (g.IO.MouseReleased[0] && (flags & ImGuiButtonFlags_PressedOnRelease))
|
|
|
|
|
if ((flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDoubleClicked[0])
|
|
|
|
|
{
|
|
|
|
|
pressed = true;
|
|
|
|
|
SetActiveID(0);
|
|
|
|
|
FocusWindow(window);
|
|
|
|
|
}
|
|
|
|
|
else if ((flags & ImGuiButtonFlags_Repeat) && g.ActiveId == id && ImGui::IsMouseClicked(0, true))
|
|
|
|
|
if ((flags & ImGuiButtonFlags_PressedOnRelease) && g.IO.MouseReleased[0])
|
|
|
|
|
{
|
|
|
|
|
pressed = true;
|
|
|
|
|
SetActiveID(0);
|
|
|
|
|
}
|
|
|
|
|
if ((flags & ImGuiButtonFlags_Repeat) && g.ActiveId == id && ImGui::IsMouseClicked(0, true))
|
|
|
|
|
pressed = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -5309,7 +5309,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (hovered)
|
|
|
|
|
if (hovered && (flags & ImGuiButtonFlags_PressedOnClickRelease))
|
|
|
|
|
pressed = true;
|
|
|
|
|
SetActiveID(0);
|
|
|
|
|
}
|
|
|
|
@ -8242,7 +8242,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|
|
|
|
if (flags & ImGuiSelectableFlags_Menu) button_flags |= ImGuiButtonFlags_PressedOnClick;
|
|
|
|
|
if (flags & ImGuiSelectableFlags_MenuItem) button_flags |= ImGuiButtonFlags_PressedOnClick|ImGuiButtonFlags_PressedOnRelease;
|
|
|
|
|
if (flags & ImGuiSelectableFlags_Disabled) button_flags |= ImGuiButtonFlags_Disabled;
|
|
|
|
|
if (flags & ImGuiSelectableFlags_AllowDoubleClick) button_flags |= ImGuiButtonFlags_PressedOnDoubleClick;
|
|
|
|
|
if (flags & ImGuiSelectableFlags_AllowDoubleClick) button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick;
|
|
|
|
|
bool hovered, held;
|
|
|
|
|
bool pressed = ButtonBehavior(bb_with_spacing, id, &hovered, &held, button_flags);
|
|
|
|
|
if (flags & ImGuiSelectableFlags_Disabled)
|
|
|
|
|