Merge branch 'viewport' into docking

# Conflicts:
#	imgui.cpp
This commit is contained in:
omar
2019-01-10 16:02:32 +01:00
9 changed files with 238 additions and 169 deletions

View File

@ -204,7 +204,7 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
}
ImRect bb(text_pos, text_pos + text_size);
ItemSize(bb);
ItemSize(text_size);
ItemAdd(bb, 0);
}
else
@ -282,10 +282,12 @@ void ImGui::TextWrapped(const char* fmt, ...)
void ImGui::TextWrappedV(const char* fmt, va_list args)
{
bool need_wrap = (GImGui->CurrentWindow->DC.TextWrapPos < 0.0f); // Keep existing wrap position is one ia already set
if (need_wrap) PushTextWrapPos(0.0f);
bool need_backup = (GImGui->CurrentWindow->DC.TextWrapPos < 0.0f); // Keep existing wrap position if one is already set
if (need_backup)
PushTextWrapPos(0.0f);
TextV(fmt, args);
if (need_wrap) PopTextWrapPos();
if (need_backup)
PopTextWrapPos();
}
void ImGui::LabelText(const char* label, const char* fmt, ...)
@ -398,8 +400,8 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
g.HoveredWindow = window;
#ifdef IMGUI_ENABLE_TEST_ENGINE
if (window->DC.LastItemId != id)
ImGuiTestEngineHook_ItemAdd(bb, id);
if (id != 0 && window->DC.LastItemId != id)
ImGuiTestEngineHook_ItemAdd(&g, bb, id);
#endif
bool pressed = false;
@ -547,7 +549,7 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags
ImVec2 size = CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f);
const ImRect bb(pos, pos + size);
ItemSize(bb, style.FramePadding.y);
ItemSize(size, style.FramePadding.y);
if (!ItemAdd(bb, id))
return false;
@ -601,7 +603,7 @@ bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg)
const ImGuiID id = window->GetID(str_id);
ImVec2 size = CalcItemSize(size_arg, 0.0f, 0.0f);
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
ItemSize(bb);
ItemSize(size);
if (!ItemAdd(bb, id))
return false;
@ -5064,7 +5066,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
bb.Min.y -= spacing_U;
bb.Max.x += spacing_R;
bb.Max.y += spacing_D;
if (!ItemAdd(bb, (flags & ImGuiSelectableFlags_Disabled) ? 0 : id))
if (!ItemAdd(bb, id))
{
if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsSet)
PushColumnClipRect();
@ -6395,7 +6397,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
tab->Width = size.x;
tab_is_new = true;
}
tab_bar->LastTabItemIdx = (short)tab_bar->Tabs.index_from_pointer(tab);
tab_bar->LastTabItemIdx = (short)tab_bar->Tabs.index_from_ptr(tab);
tab->WidthContents = size.x;
const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount);