Internals: Merged some changes to facilitate 1D->2D transition for some elements, and merging the stack layout PR (#846)

This commit is contained in:
omar
2018-08-28 19:03:08 +02:00
parent 220e6a55b7
commit f9634feb66
2 changed files with 63 additions and 55 deletions

View File

@ -211,6 +211,14 @@ static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs)
// Types
//-----------------------------------------------------------------------------
// 1D vector (this odd construct is used to facilitate the transition between 1D and 2D and maintenance of some patches)
struct ImVec1
{
float x;
ImVec1() { x = 0.0f; }
ImVec1(float _x) { x = _x; }
};
enum ImGuiButtonFlags_
{
ImGuiButtonFlags_None = 0,
@ -406,9 +414,9 @@ struct ImGuiGroupData
{
ImVec2 BackupCursorPos;
ImVec2 BackupCursorMaxPos;
float BackupIndentX;
float BackupGroupOffsetX;
float BackupCurrentLineHeight;
ImVec1 BackupIndent;
ImVec1 BackupGroupOffset;
ImVec2 BackupCurrentLineSize;
float BackupCurrentLineTextBaseOffset;
float BackupLogLinePosY;
ImGuiID BackupActiveIdIsAlive;
@ -894,11 +902,11 @@ struct IMGUI_API ImGuiWindowTempData
{
ImVec2 CursorPos;
ImVec2 CursorPosPrevLine;
ImVec2 CursorStartPos;
ImVec2 CursorStartPos; // Initial position in client area with padding
ImVec2 CursorMaxPos; // Used to implicitly calculate the size of our contents, always growing during the frame. Turned into window->SizeContents at the beginning of next frame
float CurrentLineHeight;
ImVec2 CurrentLineSize;
float CurrentLineTextBaseOffset;
float PrevLineHeight;
ImVec2 PrevLineSize;
float PrevLineTextBaseOffset;
float LogLinePosY;
int TreeDepth;
@ -930,15 +938,15 @@ struct IMGUI_API ImGuiWindowTempData
ImVector<ImGuiGroupData>GroupStack;
int StackSizesBackup[6]; // Store size of various stacks for asserting
float IndentX; // Indentation / start position from left of window (increased by TreePush/TreePop, etc.)
float GroupOffsetX;
float ColumnsOffsetX; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API.
ImVec1 Indent; // Indentation / start position from left of window (increased by TreePush/TreePop, etc.)
ImVec1 GroupOffset;
ImVec1 ColumnsOffset; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API.
ImGuiColumnsSet* ColumnsSet; // Current columns set
ImGuiWindowTempData()
{
CursorPos = CursorPosPrevLine = CursorStartPos = CursorMaxPos = ImVec2(0.0f, 0.0f);
CurrentLineHeight = PrevLineHeight = 0.0f;
CurrentLineSize = PrevLineSize = ImVec2(0.0f, 0.0f);
CurrentLineTextBaseOffset = PrevLineTextBaseOffset = 0.0f;
LogLinePosY = -1.0f;
TreeDepth = 0;
@ -960,9 +968,9 @@ struct IMGUI_API ImGuiWindowTempData
TextWrapPos = -1.0f;
memset(StackSizesBackup, 0, sizeof(StackSizesBackup));
IndentX = 0.0f;
GroupOffsetX = 0.0f;
ColumnsOffsetX = 0.0f;
Indent = ImVec1(0.0f);
GroupOffset = ImVec1(0.0f);
ColumnsOffset = ImVec1(0.0f);
ColumnsSet = NULL;
}
};