Columns: Added internal tracking of a few flag temporarily, to facilitate the work of third-parties who have columns patches. (#125)

This commit is contained in:
omar 2017-12-13 19:26:04 +01:00
parent 4ae5c7e227
commit e8e84a6ad6
2 changed files with 7 additions and 0 deletions

View File

@ -10979,6 +10979,7 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlag
window->DC.CursorPos.x = (float)(int)(window->Pos.x + window->DC.IndentX + window->DC.ColumnsOffsetX); window->DC.CursorPos.x = (float)(int)(window->Pos.x + window->DC.IndentX + window->DC.ColumnsOffsetX);
// Initialize defaults // Initialize defaults
columns->IsFirstFrame = (columns->Columns.Size == 0);
if (columns->Columns.Size == 0) if (columns->Columns.Size == 0)
{ {
columns->Columns.reserve(columns_count + 1); columns->Columns.reserve(columns_count + 1);
@ -11032,6 +11033,7 @@ void ImGui::EndColumns()
window->DC.CursorMaxPos.x = ImMax(columns->StartMaxPosX, columns->MaxX); // Restore cursor max pos, as columns don't grow parent window->DC.CursorMaxPos.x = ImMax(columns->StartMaxPosX, columns->MaxX); // Restore cursor max pos, as columns don't grow parent
// Draw columns borders and handle resize // Draw columns borders and handle resize
columns->IsBeingResized = false;
if (!(columns->Flags & ImGuiColumnsFlags_NoBorder) && !window->SkipItems) if (!(columns->Flags & ImGuiColumnsFlags_NoBorder) && !window->SkipItems)
{ {
const float y1 = columns->StartPosY; const float y1 = columns->StartPosY;
@ -11070,6 +11072,7 @@ void ImGui::EndColumns()
{ {
float x = GetDraggedColumnOffset(columns, dragging_column); float x = GetDraggedColumnOffset(columns, dragging_column);
SetColumnOffset(dragging_column, x); SetColumnOffset(dragging_column, x);
columns->IsBeingResized = true;
} }
} }

View File

@ -424,6 +424,8 @@ struct ImGuiColumnsSet
{ {
ImGuiID ID; ImGuiID ID;
ImGuiColumnsFlags Flags; ImGuiColumnsFlags Flags;
bool IsFirstFrame;
bool IsBeingResized;
int Current; int Current;
int Count; int Count;
float MinX, MaxX; float MinX, MaxX;
@ -437,6 +439,8 @@ struct ImGuiColumnsSet
{ {
ID = 0; ID = 0;
Flags = 0; Flags = 0;
IsFirstFrame = false;
IsBeingResized = false;
Current = 0; Current = 0;
Count = 1; Count = 1;
MinX = MaxX = 0.0f; MinX = MaxX = 0.0f;