|
@@ -361,6 +361,8 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|
|
table->IsLayoutLocked = false;
|
|
|
table->InnerWidth = inner_width;
|
|
|
temp_data->UserOuterSize = outer_size;
|
|
|
+ if (instance_no > 0 && table->InstanceDataExtra.Size < instance_no)
|
|
|
+ table->InstanceDataExtra.push_back(ImGuiTableInstanceData());
|
|
|
|
|
|
// When not using a child window, WorkRect.Max will grow as we append contents.
|
|
|
if (use_child_window)
|
|
@@ -933,9 +935,10 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
|
|
width_remaining_for_stretched_columns -= 1.0f;
|
|
|
}
|
|
|
|
|
|
+ ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent);
|
|
|
table->HoveredColumnBody = -1;
|
|
|
table->HoveredColumnBorder = -1;
|
|
|
- const ImRect mouse_hit_rect(table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.Max.x, ImMax(table->OuterRect.Max.y, table->OuterRect.Min.y + table->LastOuterHeight));
|
|
|
+ const ImRect mouse_hit_rect(table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.Max.x, ImMax(table->OuterRect.Max.y, table->OuterRect.Min.y + table_instance->LastOuterHeight));
|
|
|
const bool is_hovering_table = ItemHoverable(mouse_hit_rect, 0);
|
|
|
|
|
|
// [Part 6] Setup final position, offset, skip/clip states and clipping rectangles, detect hovered column
|
|
@@ -1096,7 +1099,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
|
|
// [Part 10] Hit testing on borders
|
|
|
if (table->Flags & ImGuiTableFlags_Resizable)
|
|
|
TableUpdateBorders(table);
|
|
|
- table->LastFirstRowHeight = 0.0f;
|
|
|
+ table_instance->LastFirstRowHeight = 0.0f;
|
|
|
table->IsLayoutLocked = true;
|
|
|
table->IsUsingHeaders = false;
|
|
|
|
|
@@ -1141,10 +1144,11 @@ void ImGui::TableUpdateBorders(ImGuiTable* table)
|
|
|
// use the final height from last frame. Because this is only affecting _interaction_ with columns, it is not
|
|
|
// really problematic (whereas the actual visual will be displayed in EndTable() and using the current frame height).
|
|
|
// Actual columns highlight/render will be performed in EndTable() and not be affected.
|
|
|
+ ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent);
|
|
|
const float hit_half_width = TABLE_RESIZE_SEPARATOR_HALF_THICKNESS;
|
|
|
const float hit_y1 = table->OuterRect.Min.y;
|
|
|
- const float hit_y2_body = ImMax(table->OuterRect.Max.y, hit_y1 + table->LastOuterHeight);
|
|
|
- const float hit_y2_head = hit_y1 + table->LastFirstRowHeight;
|
|
|
+ const float hit_y2_body = ImMax(table->OuterRect.Max.y, hit_y1 + table_instance->LastOuterHeight);
|
|
|
+ const float hit_y2_head = hit_y1 + table_instance->LastFirstRowHeight;
|
|
|
|
|
|
for (int order_n = 0; order_n < table->ColumnsCount; order_n++)
|
|
|
{
|
|
@@ -1223,6 +1227,7 @@ void ImGui::EndTable()
|
|
|
TableOpenContextMenu((int)table->HoveredColumnBody);
|
|
|
|
|
|
// Finalize table height
|
|
|
+ ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent);
|
|
|
inner_window->DC.PrevLineSize = temp_data->HostBackupPrevLineSize;
|
|
|
inner_window->DC.CurrLineSize = temp_data->HostBackupCurrLineSize;
|
|
|
inner_window->DC.CursorMaxPos = temp_data->HostBackupCursorMaxPos;
|
|
@@ -1233,7 +1238,7 @@ void ImGui::EndTable()
|
|
|
else if (!(flags & ImGuiTableFlags_NoHostExtendY))
|
|
|
table->OuterRect.Max.y = table->InnerRect.Max.y = ImMax(table->OuterRect.Max.y, inner_content_max_y); // Patch OuterRect/InnerRect height
|
|
|
table->WorkRect.Max.y = ImMax(table->WorkRect.Max.y, table->OuterRect.Max.y);
|
|
|
- table->LastOuterHeight = table->OuterRect.GetHeight();
|
|
|
+ table_instance->LastOuterHeight = table->OuterRect.GetHeight();
|
|
|
|
|
|
// Setup inner scrolling range
|
|
|
// FIXME: This ideally should be done earlier, in BeginTable() SetNextWindowContentSize call, just like writing to inner_window->DC.CursorMaxPos.y,
|
|
@@ -1749,7 +1754,7 @@ void ImGui::TableEndRow(ImGuiTable* table)
|
|
|
const bool unfreeze_rows_actual = (table->CurrentRow + 1 == table->FreezeRowsCount);
|
|
|
const bool unfreeze_rows_request = (table->CurrentRow + 1 == table->FreezeRowsRequest);
|
|
|
if (table->CurrentRow == 0)
|
|
|
- table->LastFirstRowHeight = bg_y2 - bg_y1;
|
|
|
+ TableGetInstanceData(table, table->InstanceCurrent)->LastFirstRowHeight = bg_y2 - bg_y1;
|
|
|
|
|
|
const bool is_visible = (bg_y2 >= table->InnerClipRect.Min.y && bg_y1 <= table->InnerClipRect.Max.y);
|
|
|
if (is_visible)
|
|
@@ -2502,10 +2507,11 @@ void ImGui::TableDrawBorders(ImGuiTable* table)
|
|
|
inner_drawlist->PushClipRect(table->Bg0ClipRectForDrawCmd.Min, table->Bg0ClipRectForDrawCmd.Max, false);
|
|
|
|
|
|
// Draw inner border and resizing feedback
|
|
|
+ ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent);
|
|
|
const float border_size = TABLE_BORDER_SIZE;
|
|
|
const float draw_y1 = table->InnerRect.Min.y;
|
|
|
const float draw_y2_body = table->InnerRect.Max.y;
|
|
|
- const float draw_y2_head = table->IsUsingHeaders ? ImMin(table->InnerRect.Max.y, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table->LastFirstRowHeight) : draw_y1;
|
|
|
+ const float draw_y2_head = table->IsUsingHeaders ? ImMin(table->InnerRect.Max.y, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table_instance->LastFirstRowHeight) : draw_y1;
|
|
|
if (table->Flags & ImGuiTableFlags_BordersInnerV)
|
|
|
{
|
|
|
for (int order_n = 0; order_n < table->ColumnsCount; order_n++)
|
|
@@ -3427,9 +3433,8 @@ static void TableSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandle
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void ImGui::TableSettingsInstallHandler(ImGuiContext* context)
|
|
|
+void ImGui::TableSettingsAddSettingsHandler()
|
|
|
{
|
|
|
- ImGuiContext& g = *context;
|
|
|
ImGuiSettingsHandler ini_handler;
|
|
|
ini_handler.TypeName = "Table";
|
|
|
ini_handler.TypeHash = ImHashStr("Table");
|
|
@@ -3438,7 +3443,7 @@ void ImGui::TableSettingsInstallHandler(ImGuiContext* context)
|
|
|
ini_handler.ReadLineFn = TableSettingsHandler_ReadLine;
|
|
|
ini_handler.ApplyAllFn = TableSettingsHandler_ApplyAll;
|
|
|
ini_handler.WriteAllFn = TableSettingsHandler_WriteAll;
|
|
|
- g.SettingsHandlers.push_back(ini_handler);
|
|
|
+ AddSettingsHandler(&ini_handler);
|
|
|
}
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
@@ -3536,6 +3541,8 @@ void ImGui::DebugNodeTable(ImGuiTable* table)
|
|
|
GetForegroundDrawList()->AddRect(GetItemRectMin(), GetItemRectMax(), IM_COL32(255, 255, 0, 255));
|
|
|
if (!open)
|
|
|
return;
|
|
|
+ if (table->InstanceCurrent > 0)
|
|
|
+ ImGui::Text("** %d instances of same table! Some data below will refer to last instance.", table->InstanceCurrent + 1);
|
|
|
bool clear_settings = SmallButton("Clear settings");
|
|
|
BulletText("OuterRect: Pos: (%.1f,%.1f) Size: (%.1f,%.1f) Sizing: '%s'", table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.GetWidth(), table->OuterRect.GetHeight(), DebugNodeTableGetSizingPolicyDesc(table->Flags));
|
|
|
BulletText("ColumnsGivenWidth: %.1f, ColumnsAutoFitWidth: %.1f, InnerWidth: %.1f%s", table->ColumnsGivenWidth, table->ColumnsAutoFitWidth, table->InnerWidth, table->InnerWidth == 0.0f ? " (auto)" : "");
|