mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-27 16:29:02 +08:00
Tables: Added TableSetColumnWidth() api variant aimed at becoming public facing.
This commit is contained in:
parent
ae6fc48f60
commit
f130db51ae
@ -2185,6 +2185,7 @@ namespace ImGui
|
||||
IMGUI_API void TableUpdateDrawChannels(ImGuiTable* table);
|
||||
IMGUI_API void TableUpdateLayout(ImGuiTable* table);
|
||||
IMGUI_API void TableUpdateBorders(ImGuiTable* table);
|
||||
IMGUI_API void TableSetColumnWidth(int column_n, float width);
|
||||
IMGUI_API void TableSetColumnWidth(ImGuiTable* table, ImGuiTableColumn* column, float width);
|
||||
IMGUI_API void TableDrawBorders(ImGuiTable* table);
|
||||
IMGUI_API void TableDrawMergeChannels(ImGuiTable* table);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user