elseif(rect_type==TRT_ColumnsContentHeadersUsed){ImGuiTableColumn*c=&table->Columns[n];returnImRect(c->MinX,table->InnerClipRect.Min.y,c->MinX+c->ContentWidthHeadersUsed,table->InnerClipRect.Min.y+table->LastFirstRowHeight);}// Note: y1/y2 not always accurate
ImGui::CheckboxFlags("_IndentEnable",(unsignedint*)&column_flags[column],ImGuiTableColumnFlags_IndentEnable);ImGui::SameLine();HelpMarker("Default for column 0");
ImGui::CheckboxFlags("_IndentDisable",(unsignedint*)&column_flags[column],ImGuiTableColumnFlags_IndentDisable);ImGui::SameLine();HelpMarker("Default for column >0");
floatContentMaxPosRowsFrozen;// Submitted contents absolute maximum position, from which we can infer width.
floatContentMaxPosRowsUnfrozen;// (kept as float because we need to manipulate those between each cell change)
floatContentMaxPosHeadersUsed;
floatContentMaxPosHeadersDesired;
floatContentMaxPosHeadersIdeal;
ImS16ContentWidthRowsFrozen;// Contents width. Because row freezing is not correlated with headers/not-headers we need all 4 variants (ImDrawCmd merging uses different data than alignment code).
ImS16ContentWidthRowsUnfrozen;// (encoded as ImS16 because we actually rarely use those width)
ImS16NameOffset;// Offset into parent ColumnsNames[]
boolIsActive;// Is the column not marked Hidden by the user (regardless of clipping). We're not calling this "Visible" here because visibility also depends on clipping.
boolIsActiveNextFrame;
@ -1982,7 +1982,8 @@ struct ImGuiTable
floatLastOuterHeight;// Outer height from last frame
floatLastFirstRowHeight;// Height of first row from last frame
floatColumnsTotalWidth;
floatInnerWidth;
floatInnerWidth;// User value passed to BeginTable(), see comments at the top of BeginTable() for details.
floatIdealTotalWidth;// Sum of ideal column width for nothing to be clipped
floatResizedColumnNextWidth;
ImRectOuterRect;// Note: OuterRect.Max.y is often FLT_MAX until EndTable(), unless a height has been specified in BeginTable().
// The meaning of outer_size needs to differ slightly depending of if we are using ScrollX/ScrollY flags.
// With ScrollX/ScrollY: using a child window for scrolling:
// (Read carefully because this is subtle but it does make sense!)
// About 'outer_size', its meaning needs to differ slightly depending of if we are using ScrollX/ScrollY flags:
// X:
// - outer_size.x < 0.0f -> right align from window/work-rect maximum x edge.
// - outer_size.x = 0.0f -> auto enlarge, use all available space.
// - outer_size.x > 0.0f -> fixed width
// Y with ScrollX/ScrollY: using a child window for scrolling:
// - outer_size.y < 0.0f -> bottom align
// - outer_size.y = 0.0f -> bottom align: consistent with BeginChild(), best to preserve (0,0) default arg
// - outer_size.y > 0.0f -> fixed child height
// Without scrolling, we output table directly in parent window:
// - outer_size.y = 0.0f -> bottom align, consistent with BeginChild(). not recommended unless table is last item in parent window.
// - outer_size.y > 0.0f -> fixed child height. recommended when using Scrolling on any axis.
// Y without scrolling, we output table directly in parent window:
// - outer_size.y < 0.0f -> bottom align (will auto extend, unless NoHostExtendV is set)
// - outer_size.y = 0.0f -> zero minimum height (will auto extend, unless NoHostExtendV is set)
// - outer_size.y > 0.0f -> minimum height (will auto extend, unless NoHostExtendV is set)
// About: 'inner_width':
// About 'inner_width':
// With ScrollX:
// - inner_width < 0.0f -> *illegal* fit in known width (right align from outer_size.x) <-- weird
// - inner_width = 0.0f -> auto enlarge: *only* fixed size columns, which will take space they need (proportional columns becomes fixed columns) <-- desired default :(
// - inner_width > 0.0f -> fit in known width: fixed column take space they need if possible (otherwise shrink down), proportional columns share remaining space.
// - inner_width = 0.0f -> fit in outer_width: Fixed size columns will take space they need (if avail, otherwise shrink down), Stretch columns becomes Fixed columns.
// - inner_width > 0.0f -> override scrolling width, generally to be larger than outer_size.x. Fixed column take space they need (if avail, otherwise shrink down), Stretch columns share remaining space!
// Without ScrollX:
// - inner_width < 0.0f -> fit in known width (right align from outer_size.x) <-- desired default
// - inner_width = 0.0f -> auto enlarge: will emit contents size in parent window
// - inner_width > 0.0f -> fit in known width (bypass outer_size.x, permitted but not useful, should instead alter outer_width)
// FIXME-TABLE: This is currently not very useful.
// FIXME-TABLE: Replace enlarge vs fixed width by a flag.
// Evenif not really useful, we allow 'inner_scroll_width < outer_size.x' for consistency and to facilitate understanding of what the value does.
// - inner_width -> *ignored*
// Details:
// - If you want to use Stretch columns with ScrollX, you generally need to specify 'inner_width' otherwise the concept
// of "available space" doesn't make sense.
// - Even if not really useful, we allow 'inner_width < outer_size.x' for consistency and to facilitate understanding
// Ensure no vertical scrollbar appears if we only want horizontal one, to make flag consistent (we have no other way to disable vertical scrollbar of a window while keeping the horizontal one showing)
// Ensure no vertical scrollbar appears if we only want horizontal one, to make flag consistent
// (we have no other way to disable vertical scrollbar of a window while keeping the horizontal one showing)
// - We allocate them following the storage order instead of the display order so reordering columns won't needlessly increase overall dormant memory cost.
// - We isolate headers draw commands in their own channels instead of just altering clip rects. This is in order to facilitate merging of draw commands.
// - After crossing FreezeRowsCount, all columns see their current draw channel changed to a second set of draw channels.
// - We only use the dummy draw channel so we can push a null clipping rectangle into it without affecting other channels, while simplifying per-row/per-cell overhead. It will be empty and discarded when merged.
// - We allocate them following storage order instead of display order so reordering columns won't needlessly
// increase overall dormant memory cost.
// - We isolate headers draw commands in their own channels instead of just altering clip rects.
// This is in order to facilitate merging of draw commands.
// - After crossing FreezeRowsCount, all columns see their current draw channel changed to a second set of channels.
// - We only use the dummy draw channel so we can push a null clipping rectangle into it without affecting other
// channels, while simplifying per-row/per-cell overhead. It will be empty and discarded when merged.
// FIXME-TABLE: Increase minimum size during init frame to avoid biasing auto-fitting widgets (e.g. TextWrapped) too much.
// Otherwise what tends to happen is that TextWrapped would output a very large height (= first frame scrollbar display very off + clipper would skip lots of items)
column->WidthRequested=column_width_ideal;
// FIXME-TABLE: Increase minimum size during init frame to avoid biasing auto-fitting widgets
// (e.g. TextWrapped) too much. Otherwise what tends to happen is that TextWrapped would output a very
// large height (= first frame scrollbar display very off + clipper would skip lots of items).
// This is merely making the side-effect less extreme, but doesn't properly fixes it.
// Redistribute remainder width due to rounding (remainder width is < 1.0f * number of Stretch column)
// Using right-to-left distribution (more likely to match resizing cursor), could be adjusted depending where the mouse cursor is and/or relative weights.
// Redistribute remainder width due to rounding (remainder width is < 1.0f * number of Stretch column).
// Using right-to-left distribution (more likely to match resizing cursor), could be adjusted depending where
// the mouse cursor is and/or relative weights.
// FIXME-TABLE: May be simpler to store floating width and floor final positions only
// FIXME-TABLE: Make it optional? User might prefer to preserve pixel perfect same size?
// FIXME-TABLE: This align based on the whole column width, not per-cell, and therefore isn't useful in many cases.
// (To be able to honor this we might be able to store a log of cells width, per row, for visible rows, but nav/programmatic scroll would have visible artifacts.)
// FIXME-TABLE: This align based on the whole column width, not per-cell, and therefore isn't useful in
// many cases (to be able to honor this we might be able to store a log of cells width, per row, for
// visible rows, but nav/programmatic scroll would have visible artifacts.)
// Clear Resizable flag if none of our column are actually resizable (either via an explicit _NoResize flag, either because of using _WidthAlwaysAutoResize/_WidthStretch)
// Clear Resizable flag if none of our column are actually resizable (either via an explicit _NoResize flag,
// either because of using _WidthAlwaysAutoResize/_WidthStretch).
// This will hide the resizing option from the context menu.
@ -1240,12 +1267,15 @@ void ImGui::TableSetColumnWidth(ImGuiTable* table, ImGuiTableColumn* column_0, f
// Each column itself can use 1 channel (row freeze disabled) or 2 channels (row freeze enabled).
// When the contents of a column didn't stray off its limit, we move its channels into the corresponding group
// based on its position (within frozen rows/columns groups or not).
// At the end of the operation our 1-4 groups will each have a ImDrawCmd using the same ClipRect, and they will be merged by the DrawSplitter.Merge() call.
// At the end of the operation our 1-4 groups will each have a ImDrawCmd using the same ClipRect, and they will be
// merged by the DrawSplitter.Merge() call.
//
// Column channels will not be merged into one of the 1-4 groups in the following cases:
// - The contents stray off its clipping rectangle (we only compare the MaxX value, not the MinX value).
// Direct ImDrawList calls won't be taken into account by default, if you use them make sure the ImGui:: bounds matches, by e.g. calling SetCursorScreenPos().
// - The channel uses more than one draw command itself. We drop all our merging stuff here.. we could do better but it's going to be rare.
// Direct ImDrawList calls won't be taken into account by default, if you use them make sure the ImGui:: bounds
// matches, by e.g. calling SetCursorScreenPos().
// - The channel uses more than one draw command itself. We drop all our merging stuff here.. we could do better
// but it's going to be rare.
//
// This function is particularly tricky to understand.. take a breath.
// If we end with a single group and hosted by the outer window, we'll attempt to merge our draw command with
// the existing outer window command. But we can only do so if our columns all fit within the expected clip rect,
// otherwise clipping will be incorrect when ScrollX is disabled.
// If we end with a single group and hosted by the outer window, we'll attempt to merge our draw command
// with the existing outer window command. But we can only do so if our columns all fit within the expected
// clip rect, otherwise clipping will be incorrect when ScrollX is disabled.
// FIXME-TABLE FIXME-WORKRECT: We are wasting a merge opportunity on tables without scrolling if column don't fit within host clip rect, solely because of the half-padding difference between window->WorkRect and window->InnerClipRect
// 2019/10/22: (1) This is breaking table_2_draw_calls but I cannot seem to repro what it is attempting to fix...
// cf git fce2e8dc "Fixed issue with clipping when outerwindow==innerwindow / support ScrollH without ScrollV."
// 2019/10/22: (1) This is breaking table_2_draw_calls but I cannot seem to repro what it is attempting to
// fix... cf git fce2e8dc "Fixed issue with clipping when outerwindow==innerwindow / support ScrollH without ScrollV."
// 2019/10/22: (2) Clamping code in TableUpdateLayout() seemingly made this not necessary...
// Keep header highlighted when context menu is open. (FIXME-TABLE: however we cannot assume the ID of said popup if it has been created by the user...)
// Keep header highlighted when context menu is open.
// (FIXME-TABLE: however we cannot assume the ID of said popup if it has been created by the user...)