mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-13 08:19:55 +02:00
Tables: Added TableSetColumnWidth() api variant aimed at becoming public facing.
This commit is contained in:
@ -886,7 +886,7 @@ void ImGui::EndTable()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiTable* table = g.CurrentTable;
|
||||
IM_ASSERT(table != NULL && "Only call EndTable() is BeginTable() returns true!");
|
||||
IM_ASSERT(table != NULL && "Only call EndTable() if BeginTable() returns true!");
|
||||
|
||||
// This assert would be very useful to catch a common error... unfortunately it would probably trigger in some cases,
|
||||
// and for consistency user may sometimes output empty tables (and still benefit from e.g. outer border)
|
||||
@ -1134,6 +1134,18 @@ static void TableUpdateColumnsWeightFromWidth(ImGuiTable* table)
|
||||
}
|
||||
}
|
||||
|
||||
// Public wrapper
|
||||
void ImGui::TableSetColumnWidth(int column_n, float width)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiTable* table = g.CurrentTable;
|
||||
IM_ASSERT(table != NULL);
|
||||
IM_ASSERT(table->IsLayoutLocked == false);
|
||||
IM_ASSERT(column_n >= 0 && column_n < table->ColumnsCount);
|
||||
TableSetColumnWidth(table, &table->Columns[column_n], width);
|
||||
}
|
||||
|
||||
// [Internal]
|
||||
void ImGui::TableSetColumnWidth(ImGuiTable* table, ImGuiTableColumn* column_0, float column_0_width)
|
||||
{
|
||||
// Constraints
|
||||
|
Reference in New Issue
Block a user