diff --git a/imgui.h b/imgui.h index 42229755..83b5747d 100644 --- a/imgui.h +++ b/imgui.h @@ -1052,12 +1052,12 @@ enum ImGuiTableFlags_ ImGuiTableFlags_Borders = ImGuiTableFlags_BordersInner | ImGuiTableFlags_BordersOuter, // Draw all borders. ImGuiTableFlags_BordersFullHeightV = 1 << 11, // Borders covers all rows even when Headers are being used. Allow resizing from any rows. // Padding, Sizing - ImGuiTableFlags_NoClipX = 1 << 14, // Disable pushing clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow) - ImGuiTableFlags_SizingPolicyFixedX = 1 << 15, // Default if ScrollX is on. Columns will default to use _WidthFixed or _WidthAlwaysAutoResize policy. Read description above for more details. - ImGuiTableFlags_SizingPolicyStretchX = 1 << 16, // Default if ScrollX is off. Columns will default to use _WidthStretch policy. Read description above for more details. - ImGuiTableFlags_NoHeadersWidth = 1 << 17, // Disable header width contribution to automatic width calculation. - ImGuiTableFlags_NoHostExtendY = 1 << 18, // (FIXME-TABLE: Reword as SizingPolicy?) Disable extending past the limit set by outer_size.y, only meaningful when neither of ScrollX|ScrollY are set (data below the limit will be clipped and not visible) - ImGuiTableFlags_NoKeepColumnsVisible = 1 << 19, // (FIXME-TABLE) Disable code that keeps column always minimally visible when table width gets too small and horizontal scrolling is off. + ImGuiTableFlags_SizingPolicyFixedX = 1 << 12, // Default if ScrollX is on. Columns will default to use _WidthFixed or _WidthAlwaysAutoResize policy. Read description above for more details. + ImGuiTableFlags_SizingPolicyStretchX = 1 << 13, // Default if ScrollX is off. Columns will default to use _WidthStretch policy. Read description above for more details. + ImGuiTableFlags_NoHeadersWidth = 1 << 14, // Disable header width contribution to automatic width calculation. + ImGuiTableFlags_NoHostExtendY = 1 << 15, // (FIXME-TABLE: Reword as SizingPolicy?) Disable extending past the limit set by outer_size.y, only meaningful when neither of ScrollX|ScrollY are set (data below the limit will be clipped and not visible) + ImGuiTableFlags_NoKeepColumnsVisible = 1 << 16, // (FIXME-TABLE) Disable code that keeps column always minimally visible when table width gets too small and horizontal scrolling is off. + ImGuiTableFlags_NoClip = 1 << 17, // Disable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with ScrollFreeze options. // Scrolling ImGuiTableFlags_ScrollX = 1 << 20, // Enable horizontal scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. Because this create a child window, ScrollY is currently generally recommended when using ScrollX. ImGuiTableFlags_ScrollY = 1 << 21, // Enable vertical scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 54f58586..f26d6349 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -3828,7 +3828,7 @@ static void ShowDemoWindowTables() flags &= ~(ImGuiTableFlags_SizingPolicyMaskX_ ^ ImGuiTableFlags_SizingPolicyFixedX); // Can't specify both sizing polices so we clear the other ImGui::SameLine(); HelpMarker("Default if _ScrollX if enabled. Makes columns use _WidthFixed by default, or _WidthAlwaysAutoResize if _Resizable is not set."); ImGui::CheckboxFlags("ImGuiTableFlags_Resizable", (unsigned int*)&flags, ImGuiTableFlags_Resizable); - ImGui::CheckboxFlags("ImGuiTableFlags_NoClipX", (unsigned int*)&flags, ImGuiTableFlags_NoClipX); + ImGui::CheckboxFlags("ImGuiTableFlags_NoClip", (unsigned int*)&flags, ImGuiTableFlags_NoClip); if (ImGui::BeginTable("##3ways", 3, flags, ImVec2(0, 100))) { @@ -4296,7 +4296,6 @@ static void ShowDemoWindowTables() ImGui::BulletText("Padding, Sizing:"); ImGui::Indent(); - ImGui::CheckboxFlags("ImGuiTableFlags_NoClipX", (unsigned int*)&flags, ImGuiTableFlags_NoClipX); if (ImGui::CheckboxFlags("ImGuiTableFlags_SizingPolicyStretchX", (unsigned int*)&flags, ImGuiTableFlags_SizingPolicyStretchX)) flags &= ~(ImGuiTableFlags_SizingPolicyMaskX_ ^ ImGuiTableFlags_SizingPolicyStretchX); // Can't specify both sizing polices so we clear the other ImGui::SameLine(); HelpMarker("[Default if ScrollX is off]\nFit all columns within available width (or specified inner_width). Fixed and Stretch columns allowed."); @@ -4307,6 +4306,8 @@ static void ShowDemoWindowTables() ImGui::CheckboxFlags("ImGuiTableFlags_NoHostExtendY", (unsigned int*)&flags, ImGuiTableFlags_NoHostExtendY); ImGui::CheckboxFlags("ImGuiTableFlags_NoKeepColumnsVisible", (unsigned int*)&flags, ImGuiTableFlags_NoKeepColumnsVisible); ImGui::SameLine(); HelpMarker("Only available if ScrollX is disabled."); + ImGui::CheckboxFlags("ImGuiTableFlags_NoClip", (unsigned int*)&flags, ImGuiTableFlags_NoClip); + ImGui::SameLine(); HelpMarker("Disable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with ScrollFreeze options."); ImGui::Unindent(); ImGui::BulletText("Scrolling:"); @@ -4424,7 +4425,7 @@ static void ShowDemoWindowTables() for (int row_n = clipper.DisplayStart; row_n < clipper.DisplayEnd; row_n++) #else { - for (int row_n = 0; row_n < items_count; n++) + for (int row_n = 0; row_n < items_count; row_n++) #endif { MyItem* item = &items[row_n]; diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 51249f4b..65701724 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -124,10 +124,10 @@ inline ImGuiTableFlags TableFixFlags(ImGuiTableFlags flags) if ((flags & ImGuiTableFlags_NoHostExtendY) && (flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) != 0) flags &= ~ImGuiTableFlags_NoHostExtendY; - // Adjust flags: we don't support NoClipX with (FreezeColumns > 0) + // Adjust flags: we don't support NoClip with (FreezeColumns > 0) // We could with some work but it doesn't appear to be worth the effort. - if (flags & ImGuiTableFlags_ScrollFreezeColumnsMask_) - flags &= ~ImGuiTableFlags_NoClipX; + //if (flags & ImGuiTableFlags_ScrollFreezeColumnsMask_) + // flags &= ~ImGuiTableFlags_NoClip; return flags; } @@ -503,7 +503,7 @@ void ImGui::TableUpdateDrawChannels(ImGuiTable* table) // - FreezeRows || FreezeColumns --> 1+N*2 (unless scrolling value is zero) // - FreezeRows && FreezeColunns --> 2+N*2 (unless scrolling value is zero) const int freeze_row_multiplier = (table->FreezeRowsCount > 0) ? 2 : 1; - const int channels_for_row = (table->Flags & ImGuiTableFlags_NoClipX) ? 1 : table->ColumnsVisibleCount; + const int channels_for_row = (table->Flags & ImGuiTableFlags_NoClip) ? 1 : table->ColumnsVisibleCount; const int channels_for_background = 1; const int channels_for_dummy = (table->ColumnsVisibleCount < table->ColumnsCount || table->VisibleUnclippedMaskByIndex != table->VisibleMaskByIndex) ? +1 : 0; const int channels_total = channels_for_background + (channels_for_row * freeze_row_multiplier) + channels_for_dummy; @@ -518,7 +518,7 @@ void ImGui::TableUpdateDrawChannels(ImGuiTable* table) { column->DrawChannelRowsBeforeFreeze = (ImS8)(draw_channel_current); column->DrawChannelRowsAfterFreeze = (ImS8)(draw_channel_current + (table->FreezeRowsCount > 0 ? channels_for_row : 0)); - if (!(table->Flags & ImGuiTableFlags_NoClipX)) + if (!(table->Flags & ImGuiTableFlags_NoClip)) draw_channel_current++; } else @@ -910,7 +910,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) // Initial state ImGuiWindow* inner_window = table->InnerWindow; - if (table->Flags & ImGuiTableFlags_NoClipX) + if (table->Flags & ImGuiTableFlags_NoClip) table->DrawSplitter.SetCurrentChannel(inner_window->DrawList, 1); else inner_window->DrawList->PushClipRect(inner_window->ClipRect.Min, inner_window->ClipRect.Max, false); @@ -1017,7 +1017,7 @@ void ImGui::EndTable() table->WorkRect.Max.y = ImMax(table->WorkRect.Max.y, table->OuterRect.Max.y); table->LastOuterHeight = table->OuterRect.GetHeight(); - if (!(flags & ImGuiTableFlags_NoClipX)) + if (!(flags & ImGuiTableFlags_NoClip)) inner_window->DrawList->PopClipRect(); inner_window->ClipRect = inner_window->DrawList->_ClipRectStack.back(); @@ -1050,7 +1050,7 @@ void ImGui::EndTable() // Flatten channels and merge draw calls table->DrawSplitter.SetCurrentChannel(inner_window->DrawList, 0); - if ((table->Flags & ImGuiTableFlags_NoClipX) == 0) + if ((table->Flags & ImGuiTableFlags_NoClip) == 0) TableReorderDrawChannelsForMerge(table); table->DrawSplitter.Merge(inner_window->DrawList); @@ -1808,7 +1808,7 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n) window->DC.CursorPos.y = ImMax(window->DC.CursorPos.y, table->RowPosY2); window->SkipItems = column->SkipItems; - if (table->Flags & ImGuiTableFlags_NoClipX) + if (table->Flags & ImGuiTableFlags_NoClip) { table->DrawSplitter.SetCurrentChannel(window->DrawList, 1); }