Commit Graph

141 Commits

Author SHA1 Message Date
ocornut 76964a27ce Tables: moved TableNextRow(), TableBeginRow(), TableEndRow(), TableNextColumn(), TableBeginCell(), TableEndCell() to their own section. 2020-12-10 18:39:37 +01:00
ocornut e6b875c09b Tables: Ditch old columns flags/setting if not called again. Displaying right-most border when using _SameWidths. Moving Width-related functions to their own section.
Effectively removed the TableFixColumnFlags() in first loop of TableUpdateLayout() to replace it with similar one but only when column not declared. I think this should be the right thing.
2020-12-10 18:33:33 +01:00
ocornut 17536f9add Tables: more consistent use of CellPadding.x*2 and clip-rect on right-most side of non-bordered column + fix cellbg for standalone TableHeader call.
Using CellPadding.x on both sides when BorderV is off, generally most consistent and with default value (4,2) promotes at-glance visible spacing between non-bordered columns. Effectively double horizontal padding on non-bordered columns.
Made ClipRect.Max.x matches WorkMaxX which is where we'd like to go for windows themselves.
TableHeader() submit single cell bg color if not already submitted as a full header row.
Misc comments/docs updates.
2020-12-09 15:13:09 +01:00
ocornut 0b14dd9e55 Tables: fixed propagation of line height from outside the table. Added outer-width demo. 2020-12-04 19:15:27 +01:00
ocornut 6e38026627 Tables: changelog. removed TableGetHoveredColumn() from public API in favor of using TableGetColumnFlags(). renamed ImGuiTableSortSpecsColumn to ImGuiTableColumnSortSpecs. 2020-12-04 19:15:27 +01:00
ocornut 7a61f3407b Tables: support internal TableResetSettings(), clarify lifetime, fixed missing auto-fit on column unhidden after first run, fixed resize assert when changing column sizing policy to stretch mid-frame (before of -1.0f weight) 2020-12-04 19:15:27 +01:00
ocornut b194df413c Tables: exposed status flags via TableGetColumnFlags(), removed TableGetColumnIsSorted()
Scoped width auto calc.
2020-12-04 19:15:27 +01:00
ocornut 984c4cb5f8 Tables: distinguishing per-column IsVisible from IsRequestOutput which is returned to user. Clarified clipping rules/requirements. Comments. 2020-12-04 19:15:27 +01:00
ocornut f70bf69e3b Tables: comments and tweaks on TableUpdateLayout(). changed "apply final width" loop to use natural column order. 2020-12-04 19:15:26 +01:00
ocornut 155b8bb816 Tables: Shared menu item id for "Size all" variations. Avoid allocation on single sort specs. Fix TableGetColumnIsEnabled(). Massage TableHeaderRows(). 2020-12-04 19:15:26 +01:00
ocornut e126a64782 Tables: using a typedef in internal code to specify column/draw channel index storage. 2020-12-04 19:15:26 +01:00
ocornut 6aa8388e9f Tables: index tweaks, fixed some inconsistent spacings. 2020-12-04 19:15:26 +01:00
ocornut 5877b9d722 Tables: moved TablePushBackgroundChannel(), TablePopBackgroundChannel(), TableDrawBorders() to their own section. 2020-12-04 19:15:26 +01:00
ocornut 5180025de5 Tables: moved + renamed TableSetupDrawChannels(), TableMergeDrawChannels() to their own section. 2020-12-04 19:15:26 +01:00
ocornut b7c83e4bac Tables: moved TableGetSortSpecs(), TableGetColumnIsSorted(), TableFixColumnSortDirection(), TableSetColumnSortDirection() to their own section. 2020-12-04 19:15:26 +01:00
ocornut d6b1f0d13d Tables: moved TableHeadersRow(), TableHeader() to their own section. 2020-12-04 19:15:26 +01:00
ocornut 592fc69054 Tables: moved TableDrawContextMenu(), TableOpenContextMenu() to their own section. 2020-12-04 19:15:26 +01:00
ocornut 7aed4b152b Tables: improve index, file structure tweaks. 2020-12-04 19:15:26 +01:00
ocornut 082f1d10d0 Tables: renamed TableBeginUpdateColumns to TableBeginApplyRequests, moved code to TableUpdateLayout, in order to ensure that enable state is not inconsistent due to TableSetupColumn column hiding requests.
All the fields moved from TableBeginUpdateColumns to TableUpdateLayout are not used before.
2020-12-04 19:15:26 +01:00
ocornut 79c9eaa78e Tables: Internals: renamed Visible to Enabled to avoid confusion with visibility checks. 2020-12-04 19:15:26 +01:00
ocornut 5ef7b831c2 Tables: removed ImGuiTableSortSpecs::ColumnsMask because it needlessly exposes our 64-columns limitation which we'd eventually would like to lift
+ shuffle declarations in internals
2020-12-04 19:15:26 +01:00
ocornut e09454aec4 Tables: removed TableGetColumnIsVisible from public api, re-specced as TableGetColumnIsHidden() returning same flag as setter, clipper increase CurrentRow. 2020-12-04 19:15:26 +01:00
ocornut a70c6aae9f Tables: demo synced tables + fix resizing indented synced tables. 2020-12-04 19:15:26 +01:00
ocornut 0c9ab0acdd Tables: setup and maintain ItemWidth per column. 2020-12-04 19:15:26 +01:00
ocornut 8f126d5d95 Tables: rename ImGuiTableFlags_SizingPolicyStretchX to ImGuiTableFlags_ColumnsWidthStretch, ImGuiTableFlags_SizingPolicyFixedX to ImGuiTableFlags_ColumnsWidthFixed. 2020-12-04 19:15:26 +01:00
ocornut 41f89e0f59 Tables: added ImGuiTableFlags_SameWidths, used in demo. Reordered columns flags and exposed them all in Columns Flags section. 2020-12-04 19:15:26 +01:00
ocornut 3a2f0bfc04 Tables: demo inner_size + scrollx + stretch, added TableGetRowIndex(), renamed _WidthAlwaysAutoResize to _WidthAutoResize. 2020-12-04 19:15:25 +01:00
ocornut 3b3503e60f Tables: decent support for auto-resize of stretch columns (trickier than it sounds)
Four cases:
1. visible columns are all stretch, resize all : "size all to default" reset to default weight
2. visible columns are all stretch, resize one: "size one to fit" set weight, reapply weight (todo: improve weight redistribution in case of >1 siblings)
3. visible columns are mixed, resize all: "size all to fit/default" reset stretchs to default weight, set fixed to auto width
4. visible columns are mixed, resize one: "size one to fit", redistribute weight the same way as a manual resize
+ TableSetupColumn() more consistently clear AutoFitQueue.
+ zero-clear RowCellData buffer.
2020-12-04 19:15:25 +01:00
ocornut c5dcf2fde1 Tables: rework keep-visible/max-width code to be less incorrect, but right-most column may effectively has few pixels less of visible cliprect width.
See table_width_distrib and table_width_keep_visible tests.
+ fix minor left-side clipping on post-frozen column
+ made TableHeader() use reliable column->MaxX
2020-12-04 19:15:25 +01:00
ocornut 197e9c085b Tables: separate bg0 and bg1 draw channels, selectable above bg color + will facilitate drawing of borders in EndTable().
+ unused code to strip out dummy draw channel calls.
2020-12-04 19:15:25 +01:00
ocornut 52f24df668 Tables: comments, tweaks, added internal TableSetColumnVisible(), merged the two TableSetColumnWidth(). 2020-12-04 19:15:25 +01:00
ocornut bf197c74f6 Tables: storing WorkMaxX, made offset_x == MinX to be clearer, clip rect merge uses ClipRect.max.x directly, removed unused ShrinkWidth code, metrics. 2020-12-04 19:15:25 +01:00
ocornut 5465d30d67 Tables: added ImGuiTableFlags_PreciseStretchWidths. 2020-12-04 19:15:25 +01:00
ocornut 10db896813 Tables: store RawData in a simple void* pointer, rename ContentMinX > WorkMinX, misc tidying up.
Removed unnecessary casts when using CheckboxFlags().
2020-12-04 19:15:25 +01:00
ocornut 82cf41d804 Tables: tooltip on clipped TableHeader() (amended) 2020-12-04 19:15:25 +01:00
ocornut 507db499e4 Tables: work on background draw channel handling (amend "create a separate background draw channel") + Selectable disable spacing when spanning. 2020-12-04 19:15:25 +01:00
ocornut fe6131168a Tables: Additionally commentary about clipper in the demo + minor padding tweak. 2020-12-04 19:15:25 +01:00
ocornut 94d99f9d0b Tables: Fixed crash when increaasing columns count with bound settings. 2020-12-04 19:15:25 +01:00
ocornut 24a7c45b02 Tables: Fix for 64 columns (maximum of 131 temporary draw channels). 2020-12-04 19:15:25 +01:00
ocornut e5a5256971 Tables: Garbage collection to relieve draw splitter buffers + for test engine: compact settings, remove table. 2020-12-04 19:15:25 +01:00
ocornut f80097ca96 Tables: Fix applying WorkRect in non-scrolling tables. Fix inverted BackgroundClipRect being passed to ImDrawCmd. 2020-12-04 19:15:25 +01:00
ocornut 557253e776 Tables: create a separate background draw channel for rows below the frozen line. 2020-12-04 19:15:24 +01:00
ocornut fae362fd0b Tables: fixed auto-fitting columns not marking settings as dirty + fixed CellBg fill not narrow clipping on ScrollX + freeze. 2020-12-04 19:15:24 +01:00
ocornut 9918b2f147 Tables: Shuffled ordering of draw channels merge group so vertically unfrozen ones come, allowing us to split background channels in two. 2020-12-04 19:15:24 +01:00
ocornut d3222086f0 Tables: Moved TableSetupScrollFreeze(), TableUpdateDrawChannels() lower in more adequate spots.
+ rename IsFreezeRowsPassed to IsUnfrozen.
2020-12-04 19:15:24 +01:00
ocornut d9ca3939e1 Tables: Tidy up comments. Replaced some Columns by Tables in demo. Removed ImGuiTableFlags_Scroll (combining ScrollX/ScrollY) because each axis inccur different requirements/constraints. 2020-12-04 19:15:24 +01:00
ocornut 51abdd53e3 Tables: renamed somehow-duplicate ContentWidth members (implicitly == Max - Min), renamed StartX to ContentMinX for consistency. 2020-12-04 19:15:24 +01:00
ocornut 1731ae5a09 Tables: Reworked padding/spacing/width.
All widths are stored without padding.
Decorelate padding from presence of border.
Added ImGuiTableFlags_Pad/NoPad flags.
Added demo.
Merge StartXHeaders and StartXRows into StartX.
Distinguish CellSpacingX1 and CellSpacingX2 for clarity and to avoid loss of width on non-even spacing values.
2020-12-04 19:15:24 +01:00
ocornut 75c5f534e8 Tables: Avoid allocating into ColumnsName for empty strings, changed TableGetColumnName() to return "" on missing name, generally more friendly. 2020-12-04 19:15:24 +01:00
ocornut f4800db178 Tables: Extracted parts of BeginTable() into TableFixFlags() and TableBeginInitMemory(). 2020-12-04 19:15:24 +01:00