mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-05 20:48:46 +02:00
Tables: tooltip on clipped TableHeader() (amended)
This commit is contained in:
@ -56,7 +56,6 @@
|
||||
#pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Widgets: BeginTable, EndTable, etc.
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -2231,7 +2230,6 @@ void ImGui::TableHeadersRow()
|
||||
// Emit a column header (text + optional sort order)
|
||||
// We cpu-clip text here so that all columns headers can be merged into a same draw call.
|
||||
// Note that because of how we cpu-clip and display sorting indicators, you _cannot_ use SameLine() after a TableHeader()
|
||||
// FIXME-TABLE: Could hold a selection state.
|
||||
// FIXME-TABLE: Style confusion between CellPadding.y and FramePadding.y
|
||||
void ImGui::TableHeader(const char* label)
|
||||
{
|
||||
@ -2357,9 +2355,13 @@ void ImGui::TableHeader(const char* label)
|
||||
//window->DrawList->AddCircleFilled(ImVec2(ellipsis_max, label_pos.y), 40, IM_COL32_WHITE);
|
||||
RenderTextEllipsis(window->DrawList, label_pos, ImVec2(ellipsis_max, label_pos.y + label_height + g.Style.FramePadding.y), ellipsis_max, ellipsis_max, label, label_end, &label_size);
|
||||
|
||||
const bool text_clipped = label_size.x > (ellipsis_max - label_pos.x);
|
||||
if (text_clipped && hovered && g.HoveredIdNotActiveTimer > g.TooltipSlowDelay)
|
||||
SetTooltip("%.*s", (int)(label_end - label), label);
|
||||
|
||||
// We feed our unclipped width to the column without writing on CursorMaxPos, so that column is still considering for merging.
|
||||
float max_pos_x = label_pos.x + label_size.x + w_sort_text + w_arrow;
|
||||
column->ContentMaxXHeadersUsed = ImMax(column->ContentMaxXHeadersUsed, cell_r.Max.x);// ImMin(max_pos_x, cell_r.Max.x));
|
||||
column->ContentMaxXHeadersUsed = ImMax(column->ContentMaxXHeadersUsed, cell_r.Max.x);
|
||||
column->ContentMaxXHeadersIdeal = ImMax(column->ContentMaxXHeadersIdeal, max_pos_x);
|
||||
|
||||
// We don't use BeginPopupContextItem() because we want the popup to stay up even after the column is hidden
|
||||
|
Reference in New Issue
Block a user