Internals: Rename GetContentRegionMaxScreen() -> GetWorkRectMax(). At this point this is mostly useful to facilitate merge of other branches.

This commit is contained in:
omar 2019-05-02 16:29:40 +02:00
parent a1c432d1ad
commit ce19cb465f
3 changed files with 7 additions and 7 deletions

View File

@ -2983,7 +2983,7 @@ float ImGui::CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x)
ImGuiWindow* window = GImGui->CurrentWindow; ImGuiWindow* window = GImGui->CurrentWindow;
if (wrap_pos_x == 0.0f) if (wrap_pos_x == 0.0f)
wrap_pos_x = GetContentRegionMaxScreen().x; wrap_pos_x = GetWorkRectMax().x;
else if (wrap_pos_x > 0.0f) else if (wrap_pos_x > 0.0f)
wrap_pos_x += window->Pos.x - window->Scroll.x; // wrap_pos_x is provided is window local space wrap_pos_x += window->Pos.x - window->Scroll.x; // wrap_pos_x is provided is window local space
@ -5808,7 +5808,7 @@ float ImGui::GetNextItemWidth()
} }
if (w < 0.0f) if (w < 0.0f)
{ {
float region_max_x = GetContentRegionMaxScreen().x; float region_max_x = GetWorkRectMax().x;
w = ImMax(1.0f, region_max_x - window->DC.CursorPos.x + w); w = ImMax(1.0f, region_max_x - window->DC.CursorPos.x + w);
} }
w = (float)(int)w; w = (float)(int)w;
@ -5836,7 +5836,7 @@ ImVec2 ImGui::CalcItemSize(ImVec2 size, float default_w, float default_h)
ImVec2 region_max; ImVec2 region_max;
if (size.x < 0.0f || size.y < 0.0f) if (size.x < 0.0f || size.y < 0.0f)
region_max = GetContentRegionMaxScreen(); region_max = GetWorkRectMax();
if (size.x == 0.0f) if (size.x == 0.0f)
size.x = default_w; size.x = default_w;
@ -6424,7 +6424,7 @@ ImVec2 ImGui::GetContentRegionMax()
} }
// [Internal] Absolute coordinate. Saner. This is not exposed until we finishing refactoring work rect features. // [Internal] Absolute coordinate. Saner. This is not exposed until we finishing refactoring work rect features.
ImVec2 ImGui::GetContentRegionMaxScreen() ImVec2 ImGui::GetWorkRectMax()
{ {
ImGuiWindow* window = GImGui->CurrentWindow; ImGuiWindow* window = GImGui->CurrentWindow;
ImVec2 mx = window->ContentsRegionRect.Max; ImVec2 mx = window->ContentsRegionRect.Max;
@ -6436,7 +6436,7 @@ ImVec2 ImGui::GetContentRegionMaxScreen()
ImVec2 ImGui::GetContentRegionAvail() ImVec2 ImGui::GetContentRegionAvail()
{ {
ImGuiWindow* window = GImGui->CurrentWindow; ImGuiWindow* window = GImGui->CurrentWindow;
return GetContentRegionMaxScreen() - window->DC.CursorPos; return GetWorkRectMax() - window->DC.CursorPos;
} }
// In window space (not screen space!) // In window space (not screen space!)

View File

@ -1458,7 +1458,7 @@ namespace ImGui
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled); IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled);
IMGUI_API void PopItemFlag(); IMGUI_API void PopItemFlag();
IMGUI_API bool IsItemToggledSelection(); // was the last item selection toggled? (after Selectable(), TreeNode() etc. We only returns toggle _event_ in order to handle clipping correctly) IMGUI_API bool IsItemToggledSelection(); // was the last item selection toggled? (after Selectable(), TreeNode() etc. We only returns toggle _event_ in order to handle clipping correctly)
IMGUI_API ImVec2 GetContentRegionMaxScreen(); IMGUI_API ImVec2 GetWorkRectMax();
// Logging/Capture // Logging/Capture
IMGUI_API void LogBegin(ImGuiLogType type, int auto_open_depth); // -> BeginCapture() when we design v2 api, for now stay under the radar by using the old name. IMGUI_API void LogBegin(ImGuiLogType type, int auto_open_depth); // -> BeginCapture() when we design v2 api, for now stay under the radar by using the old name.

View File

@ -5044,7 +5044,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
// We vertically grow up to current line height up the typical widget height. // We vertically grow up to current line height up the typical widget height.
const float text_base_offset_y = ImMax(padding.y, window->DC.CurrentLineTextBaseOffset); // Latch before ItemSize changes it const float text_base_offset_y = ImMax(padding.y, window->DC.CurrentLineTextBaseOffset); // Latch before ItemSize changes it
const float frame_height = ImMax(ImMin(window->DC.CurrentLineSize.y, g.FontSize + style.FramePadding.y*2), label_size.y + padding.y*2); const float frame_height = ImMax(ImMin(window->DC.CurrentLineSize.y, g.FontSize + style.FramePadding.y*2), label_size.y + padding.y*2);
ImRect frame_bb = ImRect(window->DC.CursorPos, ImVec2(GetContentRegionMaxScreen().x, window->DC.CursorPos.y + frame_height)); ImRect frame_bb = ImRect(window->DC.CursorPos, ImVec2(GetWorkRectMax().x, window->DC.CursorPos.y + frame_height));
if (display_frame) if (display_frame)
{ {
// Framed header expand a little outside the default padding // Framed header expand a little outside the default padding