Browse Source

Selectable() should have an ID even though they are disabled, to be consistent with other widgets. Not sure of the reasoning ~1.41 which made this turn to 0.

omar 6 years ago
parent
commit
c2db7f63bd
2 changed files with 8 additions and 6 deletions
  1. 2 2
      imgui_internal.h
  2. 6 4
      imgui_widgets.cpp

+ 2 - 2
imgui_internal.h

@@ -331,8 +331,8 @@ enum ImGuiItemStatusFlags_
 // FIXME: this is in development, not exposed/functional as a generic feature yet.
 // FIXME: this is in development, not exposed/functional as a generic feature yet.
 enum ImGuiLayoutType_
 enum ImGuiLayoutType_
 {
 {
-    ImGuiLayoutType_Vertical,
-    ImGuiLayoutType_Horizontal
+    ImGuiLayoutType_Vertical = 0,
+    ImGuiLayoutType_Horizontal = 1,
 };
 };
 
 
 enum ImGuiAxis
 enum ImGuiAxis

+ 6 - 4
imgui_widgets.cpp

@@ -282,10 +282,12 @@ void ImGui::TextWrapped(const char* fmt, ...)
 
 
 void ImGui::TextWrappedV(const char* fmt, va_list args)
 void ImGui::TextWrappedV(const char* fmt, va_list args)
 {
 {
-    bool need_wrap = (GImGui->CurrentWindow->DC.TextWrapPos < 0.0f);    // Keep existing wrap position is one ia already set
-    if (need_wrap) PushTextWrapPos(0.0f);
+    bool need_backup = (GImGui->CurrentWindow->DC.TextWrapPos < 0.0f);    // Keep existing wrap position if one is already set
+    if (need_backup)
+        PushTextWrapPos(0.0f);
     TextV(fmt, args);
     TextV(fmt, args);
-    if (need_wrap) PopTextWrapPos();
+    if (need_backup)
+        PopTextWrapPos();
 }
 }
 
 
 void ImGui::LabelText(const char* label, const char* fmt, ...)
 void ImGui::LabelText(const char* label, const char* fmt, ...)
@@ -5030,7 +5032,7 @@ 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, (flags & ImGuiSelectableFlags_Disabled) ? 0 : id))
+    if (!ItemAdd(bb, id))
     {
     {
         if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsSet)
         if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsSet)
             PushColumnClipRect();
             PushColumnClipRect();