Browse Source

MenuItem, Selectable: Fixed disabled widget interfering with navigation (fix c2db7f63 in 1.67).

pull/2406/head
omar 6 years ago
parent
commit
076be7ec41
  1. 1
      docs/CHANGELOG.txt
  2. 15
      imgui_widgets.cpp

1
docs/CHANGELOG.txt

@ -60,6 +60,7 @@ Other Changes:
when manipulating the scrollbar of a multi-line input text. when manipulating the scrollbar of a multi-line input text.
- ColorPicker: Fixed a bug/assertion when displaying a color picker in a collapsed window - ColorPicker: Fixed a bug/assertion when displaying a color picker in a collapsed window
while dragging its title bar. (#2389) while dragging its title bar. (#2389)
- MenuItem, Selectable: Fixed disabled widget interfering with navigation (fix c2db7f63 in 1.67).
- TabBar: Fixed a crash when using BeginTabBar() recursively (didn't affect docking). (#2371) - TabBar: Fixed a crash when using BeginTabBar() recursively (didn't affect docking). (#2371)
- TabBar: Added extra mis-usage error recovery. Past the assert, common mis-usage don't lead to - TabBar: Added extra mis-usage error recovery. Past the assert, common mis-usage don't lead to
hard crashes any more, facilitating integration with scripting languages. (#1651) hard crashes any more, facilitating integration with scripting languages. (#1651)

15
imgui_widgets.cpp

@ -5179,7 +5179,20 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
bb.Min.y -= spacing_U; bb.Min.y -= spacing_U;
bb.Max.x += spacing_R; bb.Max.x += spacing_R;
bb.Max.y += spacing_D; bb.Max.y += spacing_D;
if (!ItemAdd(bb, id))
bool item_add;
if (flags & ImGuiSelectableFlags_Disabled)
{
ImGuiItemFlags backup_item_flags = window->DC.ItemFlags;
window->DC.ItemFlags |= ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus;
item_add = ItemAdd(bb, id);
window->DC.ItemFlags = backup_item_flags;
}
else
{
item_add = ItemAdd(bb, id);
}
if (!item_add)
{ {
if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsSet) if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsSet)
PushColumnClipRect(); PushColumnClipRect();

Loading…
Cancel
Save