1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-12 02:00:58 +01:00

Internals: Renamed ImGuiSimpleColumns to ImGuiMenuColumns to avoid confusion. Reduced internal buffer size (we only use 3 slots).

This commit is contained in:
omar 2018-01-03 14:35:11 +01:00
parent 79d38e5ade
commit f9b2058d5a
2 changed files with 9 additions and 9 deletions

View File

@ -1693,7 +1693,7 @@ void ImGuiTextBuffer::appendf(const char* fmt, ...)
// ImGuiSimpleColumns (internal use only) // ImGuiSimpleColumns (internal use only)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
ImGuiSimpleColumns::ImGuiSimpleColumns() ImGuiMenuColumns::ImGuiMenuColumns()
{ {
Count = 0; Count = 0;
Spacing = Width = NextWidth = 0.0f; Spacing = Width = NextWidth = 0.0f;
@ -1701,7 +1701,7 @@ ImGuiSimpleColumns::ImGuiSimpleColumns()
memset(NextWidths, 0, sizeof(NextWidths)); memset(NextWidths, 0, sizeof(NextWidths));
} }
void ImGuiSimpleColumns::Update(int count, float spacing, bool clear) void ImGuiMenuColumns::Update(int count, float spacing, bool clear)
{ {
IM_ASSERT(Count <= IM_ARRAYSIZE(Pos)); IM_ASSERT(Count <= IM_ARRAYSIZE(Pos));
Count = count; Count = count;
@ -1718,7 +1718,7 @@ void ImGuiSimpleColumns::Update(int count, float spacing, bool clear)
} }
} }
float ImGuiSimpleColumns::DeclColumns(float w0, float w1, float w2) // not using va_arg because they promote float to double float ImGuiMenuColumns::DeclColumns(float w0, float w1, float w2) // not using va_arg because they promote float to double
{ {
NextWidth = 0.0f; NextWidth = 0.0f;
NextWidths[0] = ImMax(NextWidths[0], w0); NextWidths[0] = ImMax(NextWidths[0], w0);
@ -1729,7 +1729,7 @@ float ImGuiSimpleColumns::DeclColumns(float w0, float w1, float w2) // not using
return ImMax(Width, NextWidth); return ImMax(Width, NextWidth);
} }
float ImGuiSimpleColumns::CalcExtraSpace(float avail_w) float ImGuiMenuColumns::CalcExtraSpace(float avail_w)
{ {
return ImMax(0.0f, avail_w - Width); return ImMax(0.0f, avail_w - Width);
} }

View File

@ -35,7 +35,7 @@ struct ImRect;
struct ImGuiColMod; struct ImGuiColMod;
struct ImGuiStyleMod; struct ImGuiStyleMod;
struct ImGuiGroupData; struct ImGuiGroupData;
struct ImGuiSimpleColumns; struct ImGuiMenuColumns;
struct ImGuiDrawContext; struct ImGuiDrawContext;
struct ImGuiTextEditState; struct ImGuiTextEditState;
struct ImGuiMouseCursorData; struct ImGuiMouseCursorData;
@ -323,14 +323,14 @@ struct ImGuiGroupData
}; };
// Simple column measurement currently used for MenuItem() only. This is very short-sighted/throw-away code and NOT a generic helper. // Simple column measurement currently used for MenuItem() only. This is very short-sighted/throw-away code and NOT a generic helper.
struct IMGUI_API ImGuiSimpleColumns struct IMGUI_API ImGuiMenuColumns
{ {
int Count; int Count;
float Spacing; float Spacing;
float Width, NextWidth; float Width, NextWidth;
float Pos[8], NextWidths[8]; float Pos[4], NextWidths[4];
ImGuiSimpleColumns(); ImGuiMenuColumns();
void Update(int count, float spacing, bool clear); void Update(int count, float spacing, bool clear);
float DeclColumns(float w0, float w1, float w2); float DeclColumns(float w0, float w1, float w2);
float CalcExtraSpace(float avail_w); float CalcExtraSpace(float avail_w);
@ -801,7 +801,7 @@ struct IMGUI_API ImGuiWindow
ImRect InnerRect; ImRect InnerRect;
int LastFrameActive; int LastFrameActive;
float ItemWidthDefault; float ItemWidthDefault;
ImGuiSimpleColumns MenuColumns; // Simplified columns storage for menu items ImGuiMenuColumns MenuColumns; // Simplified columns storage for menu items
ImGuiStorage StateStorage; ImGuiStorage StateStorage;
ImVector<ImGuiColumnsSet> ColumnsStorage; ImVector<ImGuiColumnsSet> ColumnsStorage;
float FontWindowScale; // Scale multiplier per-window float FontWindowScale; // Scale multiplier per-window