mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-27 16:29:02 +08:00
Obsoleted GetContentRegionMax().
This commit is contained in:
parent
4227402b2f
commit
b20f62b162
@ -46,12 +46,14 @@ Breaking changes:
|
||||
- new: io.PlatformSetImeDataFn(ImGuiContext* ctx, ImGuiViewport* viewport, ImGuiPlatformImeData* data);
|
||||
It is expected that for a vast majority of users this is automatically set by core
|
||||
library and/or platform backend so it won't have any effect.
|
||||
- Obsoleted GetWindowContentRegionMin() and GetWindowContentRegionMax().
|
||||
You should never need those functions. Always use GetCursorScreenPos() and GetContentRegionAvail().
|
||||
Also consider that if you are using GetWindowPos() and GetCursorPos() you may also be making things
|
||||
unnecessarily complicated. You can do everything with GetCursorScreenPos() and GetContentRegionAvail()!!
|
||||
- Obsoleted GetContentRegionMax(), GetWindowContentRegionMin() and GetWindowContentRegionMax().
|
||||
You should never need those functions! You can do everything in less a confusing manner by only
|
||||
using GetCursorScreenPos() and GetContentRegionAvail(). Also always consider that if you are using
|
||||
GetWindowPos() and GetCursorPos() you may also be making things unnecessarily complicated.
|
||||
I repeat: You can do everything with GetCursorScreenPos() and GetContentRegionAvail()!!
|
||||
- GetWindowContentRegionMax().x - GetCursorPos().x --> GetContentRegionAvail().x
|
||||
- GetWindowContentRegionMax().x + GetWindowPos().x --> GetCursorScreenPos().x + GetContentRegionAvail().x
|
||||
- GetContentRegionMax() --> GetContentRegionAvail() + GetCursorScreenPos() - GetWindowPos() // right edge in weird local coordinates
|
||||
- Item flag changes:
|
||||
- Obsoleted PushButtonRepeat()/PopButtonRepeat() in favor of using new PushItemFlag()/PopItemFlag()
|
||||
with ImGuiItemFlags_ButtonRepeat. Kept inline redirecting functions (will obsolete).
|
||||
|
21
imgui.cpp
21
imgui.cpp
@ -430,11 +430,14 @@ CODE
|
||||
When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
||||
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||
|
||||
- 2024/07/25 (1.91.0) - obsoleted GetWindowContentRegionMin() and GetWindowContentRegionMax(). You should never need those functions. Always use GetCursorScreenPos() and GetContentRegionAvail().
|
||||
- 2024/07/25 (1.91.0) - obsoleted GetContentRegionMax(), GetWindowContentRegionMin() and GetWindowContentRegionMax().
|
||||
you should never need those functions. you can do everything with GetCursorScreenPos() and GetContentRegionAvail() in a more simple way.
|
||||
- instead of: GetWindowContentRegionMax().x - GetCursorPos().x
|
||||
- you can use: GetContentRegionAvail().x
|
||||
- instead of: GetWindowContentRegionMax().x + GetWindowPos().x
|
||||
- you can use: GetCursorScreenPos().x + GetContentRegionAvail().x (from left edge of window)
|
||||
- instead of: GetContentRegionMax()
|
||||
- you cna use: GetContentRegionAvail() + GetCursorScreenPos() - GetWindowPos() // right edge in weird local coordinates
|
||||
- 2024/07/15 (1.91.0) - renamed ImGuiSelectableFlags_DontClosePopups to ImGuiSelectableFlags_NoAutoClosePopups. (#1379, #1468, #2200, #4936, #5216, #7302, #7573)
|
||||
(internals: also renamed ImGuiItemFlags_SelectableDontClosePopup into ImGuiItemFlags_AutoClosePopups with inverted behaviors)
|
||||
- 2024/07/15 (1.91.0) - obsoleted PushButtonRepeat()/PopButtonRepeat() in favor of using new PushItemFlag(ImGuiItemFlags_ButtonRepeat, ...)/PopItemFlag().
|
||||
@ -10591,19 +10594,15 @@ ImVec2 ImGui::GetContentRegionAvail()
|
||||
return mx - window->DC.CursorPos;
|
||||
}
|
||||
|
||||
// FIXME: All the Contents Region function are messy or misleading. WE WILL AIM TO OBSOLETE ALL OF THEM WITH A NEW "WORK RECT" API. Thanks for your patience!
|
||||
// FIXME: This is in window space (not screen space!).
|
||||
ImVec2 ImGui::GetContentRegionMax()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
ImVec2 mx = (window->DC.CurrentColumns || g.CurrentTable) ? window->WorkRect.Max : window->ContentRegionRect.Max;
|
||||
return mx - window->Pos;
|
||||
}
|
||||
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
|
||||
// You should never need those functions. Always use GetCursorScreenPos() and GetContentRegionAvail()!
|
||||
// They are bizarre local-coordinates which don't play well with scrolling.
|
||||
ImVec2 ImGui::GetContentRegionMax()
|
||||
{
|
||||
return GetContentRegionAvail() + GetCursorScreenPos() - GetWindowPos();
|
||||
}
|
||||
|
||||
ImVec2 ImGui::GetWindowContentRegionMin()
|
||||
{
|
||||
ImGuiWindow* window = GImGui->CurrentWindow;
|
||||
|
13
imgui.h
13
imgui.h
@ -468,19 +468,19 @@ namespace ImGui
|
||||
// - YOU CAN DO 99% OF WHAT YOU NEED WITH ONLY GetCursorScreenPos() and GetContentRegionAvail().
|
||||
// - Attention! We currently have inconsistencies between window-local and absolute positions we will aim to fix with future API:
|
||||
// - Absolute coordinate: GetCursorScreenPos(), SetCursorScreenPos(), all ImDrawList:: functions. -> this is the preferred way forward.
|
||||
// - Window-local coordinates: SameLine(offset), GetCursorPos(), SetCursorPos(), GetCursorStartPos(), GetContentRegionMax(), PushTextWrapPos()
|
||||
// - Window-local coordinates: SameLine(offset), GetCursorPos(), SetCursorPos(), GetCursorStartPos(), PushTextWrapPos()
|
||||
// - Window-local coordinates: GetContentRegionMax(), GetWindowContentRegionMin(), GetWindowContentRegionMax() --> all obsoleted. YOU DON'T NEED THEM.
|
||||
// - GetCursorScreenPos() = GetCursorPos() + GetWindowPos(). GetWindowPos() is almost only ever useful to convert from window-local to absolute coordinates. Try not to use it.
|
||||
IMGUI_API ImVec2 GetCursorScreenPos(); // cursor position in absolute coordinates. THIS IS YOUR BEST FRIEND (prefer using this rather than GetCursorPos(), also more useful to work with ImDrawList API).
|
||||
IMGUI_API void SetCursorScreenPos(const ImVec2& pos); // cursor position in absolute coordinates
|
||||
IMGUI_API ImVec2 GetCursorScreenPos(); // cursor position, absolute coordinates. THIS IS YOUR BEST FRIEND (prefer using this rather than GetCursorPos(), also more useful to work with ImDrawList API).
|
||||
IMGUI_API void SetCursorScreenPos(const ImVec2& pos); // cursor position, absolute coordinates. THIS IS YOUR BEST FRIEND.
|
||||
IMGUI_API ImVec2 GetContentRegionAvail(); // available space from current position. THIS IS YOUR BEST FRIEND.
|
||||
IMGUI_API ImVec2 GetContentRegionMax(); // [window-local] current content boundaries (e.g. window boundaries including scrolling, or current column boundaries)
|
||||
IMGUI_API ImVec2 GetCursorPos(); // [window-local] cursor position in window coordinates (relative to window position)
|
||||
IMGUI_API ImVec2 GetCursorPos(); // [window-local] cursor position in window-local coordinates. This is not your best friend.
|
||||
IMGUI_API float GetCursorPosX(); // [window-local] "
|
||||
IMGUI_API float GetCursorPosY(); // [window-local] "
|
||||
IMGUI_API void SetCursorPos(const ImVec2& local_pos); // [window-local] "
|
||||
IMGUI_API void SetCursorPosX(float local_x); // [window-local] "
|
||||
IMGUI_API void SetCursorPosY(float local_y); // [window-local] "
|
||||
IMGUI_API ImVec2 GetCursorStartPos(); // [window-local] initial cursor position, in window coordinates
|
||||
IMGUI_API ImVec2 GetCursorStartPos(); // [window-local] initial cursor position, in window-local coordinates
|
||||
|
||||
// Other layout functions
|
||||
IMGUI_API void Separator(); // separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator.
|
||||
@ -3499,6 +3499,7 @@ namespace ImGui
|
||||
static inline void PopButtonRepeat() { PopItemFlag(); }
|
||||
static inline void PushTabStop(bool tab_stop) { PushItemFlag(ImGuiItemFlags_NoTabStop, !tab_stop); }
|
||||
static inline void PopTabStop() { PopItemFlag(); }
|
||||
IMGUI_API ImVec2 GetContentRegionMax(); // Content boundaries max (e.g. window boundaries including scrolling, or current column boundaries). You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()!
|
||||
IMGUI_API ImVec2 GetWindowContentRegionMin(); // Content boundaries min for the window (roughly (0,0)-Scroll), in window-local coordinates. You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()!
|
||||
IMGUI_API ImVec2 GetWindowContentRegionMax(); // Content boundaries max for the window (roughly (0,0)+Size-Scroll), in window-local coordinates. You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()!
|
||||
// OBSOLETED in 1.90.0 (from September 2023)
|
||||
|
Loading…
Reference in New Issue
Block a user