Updated ImGui.

This commit is contained in:
Branimir Karadžić 2017-10-06 22:05:53 -07:00
parent ba62e07459
commit 16ddf4f162
4 changed files with 74 additions and 72 deletions

View File

@ -1942,12 +1942,12 @@ static inline bool IsWindowContentHoverable(ImGuiWindow* window)
// Advance cursor given item size for layout.
void ImGui::ItemSize(const ImVec2& size, float text_offset_y)
{
ImGuiWindow* window = GetCurrentWindow();
ImGuiContext& g = *GImGui;
ImGuiWindow* window = g.CurrentWindow;
if (window->SkipItems)
return;
// Always align ourselves on pixel boundaries
ImGuiContext& g = *GImGui;
const float line_height = ImMax(window->DC.CurrentLineHeight, size.y);
const float text_base_offset = ImMax(window->DC.CurrentLineTextBaseOffset, text_offset_y);
//if (g.IO.KeyAlt) window->DrawList->AddRect(window->DC.CursorPos, window->DC.CursorPos + ImVec2(size.x, line_height), IM_COL32(255,0,0,200)); // [DEBUG]
@ -1974,12 +1974,12 @@ void ImGui::ItemSize(const ImRect& bb, float text_offset_y)
// Declare item bounding box for clipping and interaction.
// Note that the size can be different than the one provided to ItemSize(). Typically, widgets that spread over available surface
// declares their minimum size requirement to ItemSize() and then use a larger region for drawing/interaction, which is passed to ItemAdd().
bool ImGui::ItemAdd(const ImRect& bb, const ImGuiID* id)
bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = g.CurrentWindow;
const bool is_clipped = IsClippedEx(bb, id, false);
window->DC.LastItemId = id ? *id : 0;
window->DC.LastItemId = id;
window->DC.LastItemRect = bb;
window->DC.LastItemRectHoveredRect = false;
if (is_clipped)
@ -2036,12 +2036,12 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id)
return true;
}
bool ImGui::IsClippedEx(const ImRect& bb, const ImGuiID* id, bool clip_even_when_logged)
bool ImGui::IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindowRead();
ImGuiWindow* window = g.CurrentWindow;
if (!bb.Overlaps(window->ClipRect))
if (!id || *id != g.ActiveId)
if (id == 0 || id != g.ActiveId)
if (clip_even_when_logged || !g.LogEnabled)
return true;
return false;
@ -2898,7 +2898,7 @@ void ImGui::LogText(const char* fmt, ...)
static void LogRenderedText(const ImVec2* ref_pos, const char* text, const char* text_end = NULL)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = ImGui::GetCurrentWindowRead();
ImGuiWindow* window = g.CurrentWindow;
if (!text_end)
text_end = ImGui::FindRenderedTextEnd(text, text_end);
@ -2950,7 +2950,7 @@ static void LogRenderedText(const ImVec2* ref_pos, const char* text, const char*
void ImGui::RenderText(ImVec2 pos, const char* text, const char* text_end, bool hide_text_after_hash)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow();
ImGuiWindow* window = g.CurrentWindow;
// Hide anything after a '##' string
const char* text_display_end;
@ -2977,7 +2977,7 @@ void ImGui::RenderText(ImVec2 pos, const char* text, const char* text_end, bool
void ImGui::RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow();
ImGuiWindow* window = g.CurrentWindow;
if (!text_end)
text_end = text + strlen(text); // FIXME-OPT
@ -3002,7 +3002,7 @@ void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, cons
return;
ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow();
ImGuiWindow* window = g.CurrentWindow;
// Perform CPU side clipping for single clipped element to avoid using scissor state
ImVec2 pos = pos_min;
@ -3035,8 +3035,8 @@ void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, cons
// Render a rectangle shaped with optional rounding and borders
void ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border, float rounding)
{
ImGuiWindow* window = GetCurrentWindow();
ImGuiContext& g = *GImGui;
ImGuiWindow* window = g.CurrentWindow;
window->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding);
if (border && (window->Flags & ImGuiWindowFlags_ShowBorders))
{
@ -3047,7 +3047,8 @@ void ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border,
void ImGui::RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding)
{
ImGuiWindow* window = GetCurrentWindow();
ImGuiContext& g = *GImGui;
ImGuiWindow* window = g.CurrentWindow;
if (window->Flags & ImGuiWindowFlags_ShowBorders)
{
window->DrawList->AddRect(p_min+ImVec2(1,1), p_max+ImVec2(1,1), GetColorU32(ImGuiCol_BorderShadow), rounding);
@ -3059,7 +3060,7 @@ void ImGui::RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding)
void ImGui::RenderCollapseTriangle(ImVec2 p_min, bool is_open, float scale)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow();
ImGuiWindow* window = g.CurrentWindow;
const float h = g.FontSize * 1.00f;
const float r = h * 0.40f * scale;
@ -3085,14 +3086,15 @@ void ImGui::RenderCollapseTriangle(ImVec2 p_min, bool is_open, float scale)
void ImGui::RenderBullet(ImVec2 pos)
{
ImGuiWindow* window = GetCurrentWindow();
ImGuiContext& g = *GImGui;
ImGuiWindow* window = g.CurrentWindow;
window->DrawList->AddCircleFilled(pos, GImGui->FontSize*0.20f, GetColorU32(ImGuiCol_Text), 8);
}
void ImGui::RenderCheckMark(ImVec2 pos, ImU32 col)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow();
ImGuiWindow* window = g.CurrentWindow;
float start_x = (float)(int)(g.FontSize * 0.307f + 0.5f);
float rem_third = (float)(int)((g.FontSize - start_x) / 3.0f);
float bx = pos.x + 0.5f + start_x + rem_third;
@ -3137,7 +3139,7 @@ ImVec2 ImGui::CalcTextSize(const char* text, const char* text_end, bool hide_tex
void ImGui::CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindowRead();
ImGuiWindow* window = g.CurrentWindow;
if (g.LogEnabled)
{
// If logging is active, do not perform any clipping
@ -3189,7 +3191,7 @@ static ImGuiWindow* FindHoveredWindow(ImVec2 pos, bool excluding_childs)
bool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindowRead();
ImGuiWindow* window = g.CurrentWindow;
// Clip
ImRect rect_clipped(r_min, r_max);
@ -3387,7 +3389,7 @@ bool ImGui::IsItemActive()
ImGuiContext& g = *GImGui;
if (g.ActiveId)
{
ImGuiWindow* window = GetCurrentWindowRead();
ImGuiWindow* window = g.CurrentWindow;
return g.ActiveId == window->DC.LastItemId;
}
return false;
@ -3793,7 +3795,7 @@ void ImGui::EndChild()
ImGuiWindow* parent_window = GetCurrentWindow();
ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz);
ItemSize(sz);
ItemAdd(bb, NULL);
ItemAdd(bb, 0);
}
}
@ -5602,7 +5604,7 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
while (line < text_end)
{
const char* line_end = strchr(line, '\n');
if (IsClippedEx(line_rect, NULL, false))
if (IsClippedEx(line_rect, 0, false))
break;
const ImVec2 line_size = CalcTextSize(line, line_end, false);
@ -5634,7 +5636,7 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
ImRect bb(text_pos, text_pos + text_size);
ItemSize(bb);
ItemAdd(bb, NULL);
ItemAdd(bb, 0);
}
else
{
@ -5644,7 +5646,7 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
// Account of baseline offset
ImRect bb(text_pos, text_pos + text_size);
ItemSize(text_size);
if (!ItemAdd(bb, NULL))
if (!ItemAdd(bb, 0))
return;
// Render (we don't hide text after ## in this end-user function)
@ -5678,7 +5680,7 @@ void ImGui::LabelTextV(const char* label, const char* fmt, va_list args)
const ImRect value_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2));
const ImRect total_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + (label_size.x > 0.0f ? style.ItemInnerSpacing.x : 0.0f), style.FramePadding.y*2) + label_size);
ItemSize(total_bb, style.FramePadding.y);
if (!ItemAdd(total_bb, NULL))
if (!ItemAdd(total_bb, 0))
return;
// Render
@ -5803,7 +5805,7 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags
const ImRect bb(pos, pos + size);
ItemSize(bb, style.FramePadding.y);
if (!ItemAdd(bb, &id))
if (!ItemAdd(bb, id))
return false;
if (window->DC.ItemFlags & ImGuiItemFlags_ButtonRepeat) flags |= ImGuiButtonFlags_Repeat;
@ -5850,7 +5852,7 @@ bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg)
ImVec2 size = CalcItemSize(size_arg, 0.0f, 0.0f);
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
ItemSize(bb);
if (!ItemAdd(bb, &id))
if (!ItemAdd(bb, id))
return false;
bool hovered, held;
@ -5894,7 +5896,7 @@ void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2&
if (border_col.w > 0.0f)
bb.Max += ImVec2(2,2);
ItemSize(bb);
if (!ItemAdd(bb, NULL))
if (!ItemAdd(bb, 0))
return;
if (border_col.w > 0.0f)
@ -5931,7 +5933,7 @@ bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const I
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size + padding*2);
const ImRect image_bb(window->DC.CursorPos + padding, window->DC.CursorPos + padding + size);
ItemSize(bb);
if (!ItemAdd(bb, &id))
if (!ItemAdd(bb, id))
return false;
bool hovered, held;
@ -5953,7 +5955,7 @@ void ImGui::LogToTTY(int max_depth)
ImGuiContext& g = *GImGui;
if (g.LogEnabled)
return;
ImGuiWindow* window = GetCurrentWindowRead();
ImGuiWindow* window = g.CurrentWindow;
g.LogEnabled = true;
g.LogFile = stdout;
@ -5968,7 +5970,7 @@ void ImGui::LogToFile(int max_depth, const char* filename)
ImGuiContext& g = *GImGui;
if (g.LogEnabled)
return;
ImGuiWindow* window = GetCurrentWindowRead();
ImGuiWindow* window = g.CurrentWindow;
if (!filename)
{
@ -5995,7 +5997,7 @@ void ImGui::LogToClipboard(int max_depth)
ImGuiContext& g = *GImGui;
if (g.LogEnabled)
return;
ImGuiWindow* window = GetCurrentWindowRead();
ImGuiWindow* window = g.CurrentWindow;
g.LogEnabled = true;
g.LogFile = NULL;
@ -6133,7 +6135,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
// (Ideally we'd want to add a flag for the user to specify we want want the hit test to be done up to the right side of the content or not)
const ImRect interact_bb = display_frame ? bb : ImRect(bb.Min.x, bb.Min.y, bb.Min.x + text_width + style.ItemSpacing.x*2, bb.Max.y);
bool is_open = TreeNodeBehaviorIsOpen(id, flags);
if (!ItemAdd(interact_bb, &id))
if (!ItemAdd(interact_bb, id))
{
if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
TreePushRawID(id);
@ -6403,7 +6405,7 @@ void ImGui::Bullet()
const float line_height = ImMax(ImMin(window->DC.CurrentLineHeight, g.FontSize + g.Style.FramePadding.y*2), g.FontSize);
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize, line_height));
ItemSize(bb);
if (!ItemAdd(bb, NULL))
if (!ItemAdd(bb, 0))
{
SameLine(0, style.FramePadding.x*2);
return;
@ -6431,7 +6433,7 @@ void ImGui::BulletTextV(const char* fmt, va_list args)
const float line_height = ImMax(ImMin(window->DC.CurrentLineHeight, g.FontSize + g.Style.FramePadding.y*2), g.FontSize);
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize + (label_size.x > 0.0f ? (label_size.x + style.FramePadding.x*2) : 0.0f), ImMax(line_height, label_size.y))); // Empty text doesn't add padding
ItemSize(bb);
if (!ItemAdd(bb, NULL))
if (!ItemAdd(bb, 0))
return;
// Render
@ -6787,7 +6789,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
// NB- we don't call ItemSize() yet because we may turn into a text edit box below
if (!ItemAdd(total_bb, &id))
if (!ItemAdd(total_bb, id))
{
ItemSize(total_bb, style.FramePadding.y);
return false;
@ -6844,7 +6846,7 @@ bool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float
const ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
ItemSize(bb, style.FramePadding.y);
if (!ItemAdd(frame_bb, &id))
if (!ItemAdd(frame_bb, id))
return false;
const bool hovered = ItemHoverable(frame_bb, id);
@ -7082,7 +7084,7 @@ bool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, f
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
// NB- we don't call ItemSize() yet because we may turn into a text edit box below
if (!ItemAdd(total_bb, &id))
if (!ItemAdd(total_bb, id))
{
ItemSize(total_bb, style.FramePadding.y);
return false;
@ -7288,7 +7290,7 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding);
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0));
ItemSize(total_bb, style.FramePadding.y);
if (!ItemAdd(total_bb, NULL))
if (!ItemAdd(total_bb, 0))
return;
const bool hovered = ItemHoverable(inner_bb, 0);
@ -7428,7 +7430,7 @@ void ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* over
ImVec2 pos = window->DC.CursorPos;
ImRect bb(pos, pos + CalcItemSize(size_arg, CalcItemWidth(), g.FontSize + style.FramePadding.y*2.0f));
ItemSize(bb, style.FramePadding.y);
if (!ItemAdd(bb, NULL))
if (!ItemAdd(bb, 0))
return;
// Render
@ -7475,7 +7477,7 @@ bool ImGui::Checkbox(const char* label, bool* v)
total_bb = ImRect(ImMin(check_bb.Min, text_bb.Min), ImMax(check_bb.Max, text_bb.Max));
}
if (!ItemAdd(total_bb, &id))
if (!ItemAdd(total_bb, id))
return false;
bool hovered, held;
@ -7538,7 +7540,7 @@ bool ImGui::RadioButton(const char* label, bool active)
total_bb.Add(text_bb);
}
if (!ItemAdd(total_bb, &id))
if (!ItemAdd(total_bb, id))
return false;
ImVec2 center = check_bb.GetCenter();
@ -7876,7 +7878,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
else
{
ItemSize(total_bb, style.FramePadding.y);
if (!ItemAdd(total_bb, &id))
if (!ItemAdd(total_bb, id))
return false;
}
const bool hovered = ItemHoverable(frame_bb, id);
@ -8661,7 +8663,7 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImVec2 popu
const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f));
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
ItemSize(total_bb, style.FramePadding.y);
if (!ItemAdd(total_bb, &id))
if (!ItemAdd(total_bb, id))
return false;
const float arrow_size = SmallSquareSize();
@ -8810,7 +8812,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
bb_with_spacing.Min.y -= spacing_U;
bb_with_spacing.Max.x += spacing_R;
bb_with_spacing.Max.y += spacing_D;
if (!ItemAdd(bb_with_spacing, &id))
if (!ItemAdd(bb_with_spacing, id))
{
if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsCount > 1)
PushColumnClipRect();
@ -9275,7 +9277,7 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl
size.y = default_size;
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
ItemSize(bb);
if (!ItemAdd(bb, &id))
if (!ItemAdd(bb, id))
return false;
bool hovered, held;
@ -9944,7 +9946,7 @@ void ImGui::Separator()
const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y+1.0f));
ItemSize(ImVec2(0.0f, 0.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit, we don't provide height to not alter layout.
if (!ItemAdd(bb, NULL))
if (!ItemAdd(bb, 0))
{
if (window->DC.ColumnsCount > 1)
PushColumnClipRect();
@ -9974,7 +9976,7 @@ void ImGui::VerticalSeparator()
float y2 = window->DC.CursorPos.y + window->DC.CurrentLineHeight;
const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + 1.0f, y2));
ItemSize(ImVec2(bb.GetWidth(), 0.0f));
if (!ItemAdd(bb, NULL))
if (!ItemAdd(bb, 0))
return;
window->DrawList->AddLine(ImVec2(bb.Min.x, bb.Min.y), ImVec2(bb.Min.x, bb.Max.y), GetColorU32(ImGuiCol_Separator));
@ -9998,7 +10000,7 @@ void ImGui::Dummy(const ImVec2& size)
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
ItemSize(bb);
ItemAdd(bb, NULL);
ItemAdd(bb, 0);
}
bool ImGui::IsRectVisible(const ImVec2& size)
@ -10062,7 +10064,7 @@ void ImGui::EndGroup()
{
window->DC.CurrentLineTextBaseOffset = ImMax(window->DC.PrevLineTextBaseOffset, group_data.BackupCurrentLineTextBaseOffset); // FIXME: Incorrect, we should grab the base offset from the *first line* of the group but it is hard to obtain now.
ItemSize(group_bb.GetSize(), group_data.BackupCurrentLineTextBaseOffset);
ItemAdd(group_bb, NULL);
ItemAdd(group_bb, 0);
}
// If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive() will be functional on the entire group.
@ -10181,7 +10183,7 @@ static float GetDraggedColumnOffset(int column_index)
// Active (dragged) column always follow mouse. The reason we need this is that dragging a column to the right edge of an auto-resizing
// window creates a feedback loop because we store normalized positions. So while dragging we enforce absolute positioning.
ImGuiContext& g = *GImGui;
ImGuiWindow* window = ImGui::GetCurrentWindowRead();
ImGuiWindow* window = g.CurrentWindow;
IM_ASSERT(column_index > 0); // We cannot drag column 0. If you get this assert you may have a conflict between the ID of your columns and another widgets.
IM_ASSERT(g.ActiveId == window->DC.ColumnsSetId + ImGuiID(column_index));
@ -10348,7 +10350,7 @@ void ImGui::EndColumns()
const ImGuiID column_id = window->DC.ColumnsSetId + ImGuiID(i);
const float column_w = 4.0f; // Width for interaction
const ImRect column_rect(ImVec2(x - column_w, y1), ImVec2(x + column_w, y2));
if (IsClippedEx(column_rect, &column_id, false))
if (IsClippedEx(column_rect, column_id, false))
continue;
bool hovered = false, held = false;

View File

@ -69,17 +69,17 @@ typedef unsigned int ImU32; // 32-bit unsigned integer (typically used t
typedef unsigned int ImGuiID; // unique ID used by widgets (typically hashed from a stack of string)
typedef unsigned short ImWchar; // character for keyboard input/display
typedef void* ImTextureID; // user data to identify a texture (this is whatever to you want it to be! read the FAQ about ImTextureID in imgui.cpp)
typedef int ImGuiCol; // a color identifier for styling // enum ImGuiCol_
typedef int ImGuiStyleVar; // a variable identifier for styling // enum ImGuiStyleVar_
typedef int ImGuiKey; // a key identifier (ImGui-side enum) // enum ImGuiKey_
typedef int ImGuiColorEditFlags; // color edit flags for Color*() // enum ImGuiColorEditFlags_
typedef int ImGuiMouseCursor; // a mouse cursor identifier // enum ImGuiMouseCursor_
typedef int ImGuiWindowFlags; // window flags for Begin*() // enum ImGuiWindowFlags_
typedef int ImGuiCond; // condition flags for Set*() // enum ImGuiCond_
typedef int ImGuiColumnsFlags; // flags for *Columns*() // enum ImGuiColumnsFlags_
typedef int ImGuiInputTextFlags; // flags for InputText*() // enum ImGuiInputTextFlags_
typedef int ImGuiSelectableFlags; // flags for Selectable() // enum ImGuiSelectableFlags_
typedef int ImGuiTreeNodeFlags; // flags for TreeNode*(), Collapsing*() // enum ImGuiTreeNodeFlags_
typedef int ImGuiCol; // enum: a color identifier for styling // enum ImGuiCol_
typedef int ImGuiStyleVar; // enum: a variable identifier for styling // enum ImGuiStyleVar_
typedef int ImGuiKey; // enum: a key identifier (ImGui-side enum) // enum ImGuiKey_
typedef int ImGuiMouseCursor; // enum: a mouse cursor identifier // enum ImGuiMouseCursor_
typedef int ImGuiCond; // enum: a condition for Set*() // enum ImGuiCond_
typedef int ImGuiColorEditFlags; // flags: color edit flags for Color*() // enum ImGuiColorEditFlags_
typedef int ImGuiWindowFlags; // flags: window flags for Begin*() // enum ImGuiWindowFlags_
typedef int ImGuiColumnsFlags; // flags: for *Columns*() // enum ImGuiColumnsFlags_
typedef int ImGuiInputTextFlags; // flags: for InputText*() // enum ImGuiInputTextFlags_
typedef int ImGuiSelectableFlags; // flags: for Selectable() // enum ImGuiSelectableFlags_
typedef int ImGuiTreeNodeFlags; // flags: for TreeNode*(), Collapsing*() // enum ImGuiTreeNodeFlags_
typedef int (*ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data);
typedef void (*ImGuiSizeConstraintCallback)(ImGuiSizeConstraintCallbackData* data);
#ifdef _MSC_VER
@ -727,14 +727,14 @@ enum ImGuiMouseCursor_
ImGuiMouseCursor_Count_
};
// Condition flags for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions
// All those functions treat 0 as a shortcut to ImGuiCond_Always
// Condition for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions
// All those functions treat 0 as a shortcut to ImGuiCond_Always. From the point of view of the user use this as an enum (don't combine multiple values into flags).
enum ImGuiCond_
{
ImGuiCond_Always = 1 << 0, // Set the variable
ImGuiCond_Once = 1 << 1, // Set the variable once per runtime session (only the first call with succeed)
ImGuiCond_FirstUseEver = 1 << 2, // Set the variable if the window has no saved data (if doesn't exist in the .ini file)
ImGuiCond_Appearing = 1 << 3 // Set the variable if the window is appearing after being hidden/inactive (or the first time)
ImGuiCond_Always = 1 << 0, // Set the variable
ImGuiCond_Once = 1 << 1, // Set the variable once per runtime session (only the first call with succeed)
ImGuiCond_FirstUseEver = 1 << 2, // Set the variable if the window has no saved data (if doesn't exist in the .ini file)
ImGuiCond_Appearing = 1 << 3 // Set the variable if the window is appearing after being hidden/inactive (or the first time)
// Obsolete names (will be removed)
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS

View File

@ -771,9 +771,9 @@ namespace ImGui
IMGUI_API void ItemSize(const ImVec2& size, float text_offset_y = 0.0f);
IMGUI_API void ItemSize(const ImRect& bb, float text_offset_y = 0.0f);
IMGUI_API bool ItemAdd(const ImRect& bb, const ImGuiID* id);
IMGUI_API bool IsClippedEx(const ImRect& bb, const ImGuiID* id, bool clip_even_when_logged);
IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id);
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged);
IMGUI_API bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop = true); // Return true if focus is requested
IMGUI_API void FocusableItemUnregister(ImGuiWindow* window);
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_x, float default_y);

View File

@ -160,7 +160,7 @@ bool RangeSliderFloat(const char* label, float* v1, float* v2, float v_min, floa
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
// NB- we don't call ItemSize() yet because we may turn into a text edit box below
if (!ItemAdd(total_bb, &id))
if (!ItemAdd(total_bb, id))
{
ItemSize(total_bb, style.FramePadding.y);
return false;