|
@@ -16,6 +16,7 @@
|
|
// - Getting Started https://github.com/ocornut/imgui/wiki/Getting-Started
|
|
// - Getting Started https://github.com/ocornut/imgui/wiki/Getting-Started
|
|
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
|
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
|
// - Issues & support https://github.com/ocornut/imgui/issues
|
|
// - Issues & support https://github.com/ocornut/imgui/issues
|
|
|
|
+// - Tests & Automation https://github.com/ocornut/imgui_test_engine
|
|
|
|
|
|
// Getting Started?
|
|
// Getting Started?
|
|
// - Read https://github.com/ocornut/imgui/wiki/Getting-Started
|
|
// - Read https://github.com/ocornut/imgui/wiki/Getting-Started
|
|
@@ -25,8 +26,9 @@
|
|
// Developed by Omar Cornut and every direct or indirect contributors to the GitHub.
|
|
// Developed by Omar Cornut and every direct or indirect contributors to the GitHub.
|
|
// See LICENSE.txt for copyright and licensing details (standard MIT License).
|
|
// See LICENSE.txt for copyright and licensing details (standard MIT License).
|
|
// This library is free but needs your support to sustain development and maintenance.
|
|
// This library is free but needs your support to sustain development and maintenance.
|
|
-// Businesses: you can support continued development via invoiced technical support, maintenance and sponsoring contracts. Please reach out to "contact AT dearimgui.com".
|
|
|
|
-// Individuals: you can support continued development via donations. See docs/README or web page.
|
|
|
|
|
|
+// Businesses: you can support continued development via B2B invoiced technical support, maintenance and sponsoring contracts.
|
|
|
|
+// PLEASE reach out at contact AT dearimgui DOT com. See https://github.com/ocornut/imgui/wiki/Sponsors
|
|
|
|
+// Businesses: you can also purchase licenses for the Dear ImGui Automation/Test Engine.
|
|
|
|
|
|
// It is recommended that you don't modify imgui.cpp! It will become difficult for you to update the library.
|
|
// It is recommended that you don't modify imgui.cpp! It will become difficult for you to update the library.
|
|
// Note that 'ImGui::' being a namespace, you can add functions into the namespace from your own source files, without
|
|
// Note that 'ImGui::' being a namespace, you can add functions into the namespace from your own source files, without
|
|
@@ -110,9 +112,10 @@ CODE
|
|
- Portable, minimize dependencies, run on target (consoles, phones, etc.).
|
|
- Portable, minimize dependencies, run on target (consoles, phones, etc.).
|
|
- Efficient runtime and memory consumption.
|
|
- Efficient runtime and memory consumption.
|
|
|
|
|
|
- Designed for developers and content-creators, not the typical end-user! Some of the current weaknesses includes:
|
|
|
|
|
|
+ Designed primarily for developers and content-creators, not the typical end-user!
|
|
|
|
+ Some of the current weaknesses (which we aim to address in the future) includes:
|
|
|
|
|
|
- - Doesn't look fancy, doesn't animate.
|
|
|
|
|
|
+ - Doesn't look fancy.
|
|
- Limited layout features, intricate layouts are typically crafted in code.
|
|
- Limited layout features, intricate layouts are typically crafted in code.
|
|
|
|
|
|
|
|
|
|
@@ -191,9 +194,11 @@ CODE
|
|
READ FIRST
|
|
READ FIRST
|
|
----------
|
|
----------
|
|
- Remember to check the wonderful Wiki (https://github.com/ocornut/imgui/wiki)
|
|
- Remember to check the wonderful Wiki (https://github.com/ocornut/imgui/wiki)
|
|
- - Your code creates the UI, if your code doesn't run the UI is gone! The UI can be highly dynamic, there are no construction or
|
|
|
|
- destruction steps, less superfluous data retention on your side, less state duplication, less state synchronization, fewer bugs.
|
|
|
|
|
|
+ - Your code creates the UI every frame of your application loop, if your code doesn't run the UI is gone!
|
|
|
|
+ The UI can be highly dynamic, there are no construction or destruction steps, less superfluous
|
|
|
|
+ data retention on your side, less state duplication, less state synchronization, fewer bugs.
|
|
- Call and read ImGui::ShowDemoWindow() for demo code demonstrating most features.
|
|
- Call and read ImGui::ShowDemoWindow() for demo code demonstrating most features.
|
|
|
|
+ Or browse https://pthom.github.io/imgui_manual_online/manual/imgui_manual.html for interactive web version.
|
|
- The library is designed to be built from sources. Avoid pre-compiled binaries and packaged versions. See imconfig.h to configure your build.
|
|
- The library is designed to be built from sources. Avoid pre-compiled binaries and packaged versions. See imconfig.h to configure your build.
|
|
- Dear ImGui is an implementation of the IMGUI paradigm (immediate-mode graphical user interface, a term coined by Casey Muratori).
|
|
- Dear ImGui is an implementation of the IMGUI paradigm (immediate-mode graphical user interface, a term coined by Casey Muratori).
|
|
You can learn about IMGUI principles at http://www.johno.se/book/imgui.html, http://mollyrocket.com/861 & more links in Wiki.
|
|
You can learn about IMGUI principles at http://www.johno.se/book/imgui.html, http://mollyrocket.com/861 & more links in Wiki.
|
|
@@ -201,18 +206,38 @@ CODE
|
|
For every application frame, your UI code will be called only once. This is in contrast to e.g. Unity's implementation of an IMGUI,
|
|
For every application frame, your UI code will be called only once. This is in contrast to e.g. Unity's implementation of an IMGUI,
|
|
where the UI code is called multiple times ("multiple passes") from a single entry point. There are pros and cons to both approaches.
|
|
where the UI code is called multiple times ("multiple passes") from a single entry point. There are pros and cons to both approaches.
|
|
- Our origin is on the top-left. In axis aligned bounding boxes, Min = top-left, Max = bottom-right.
|
|
- Our origin is on the top-left. In axis aligned bounding boxes, Min = top-left, Max = bottom-right.
|
|
- - This codebase is also optimized to yield decent performances with typical "Debug" builds settings.
|
|
|
|
- Please make sure you have asserts enabled (IM_ASSERT redirects to assert() by default, but can be redirected).
|
|
- Please make sure you have asserts enabled (IM_ASSERT redirects to assert() by default, but can be redirected).
|
|
If you get an assert, read the messages and comments around the assert.
|
|
If you get an assert, read the messages and comments around the assert.
|
|
- - C++: this is a very C-ish codebase: we don't rely on C++11, we don't include any C++ headers, and ImGui:: is a namespace.
|
|
|
|
- - C++: ImVec2/ImVec4 do not expose math operators by default, because it is expected that you use your own math types.
|
|
|
|
- See FAQ "How can I use my own math types instead of ImVec2/ImVec4?" for details about setting up imconfig.h for that.
|
|
|
|
- However, imgui_internal.h can optionally export math operators for ImVec2/ImVec4, which we use in this codebase.
|
|
|
|
- - C++: pay attention that ImVector<> manipulates plain-old-data and does not honor construction/destruction (avoid using it in your code!).
|
|
|
|
|
|
+ - This codebase aims to be highly optimized:
|
|
|
|
+ - A typical idle frame should never call malloc/free.
|
|
|
|
+ - We rely on a maximum of constant-time or O(N) algorithms. Limiting searches/scans as much as possible.
|
|
|
|
+ - We put particular energy in making sure performances are decent with typical "Debug" build settings as well.
|
|
|
|
+ Which mean we tend to avoid over-relying on "zero-cost abstraction" as they aren't zero-cost at all.
|
|
|
|
+ - This codebase aims to be both highly opinionated and highly flexible:
|
|
|
|
+ - This code works because of the things it choose to solve or not solve.
|
|
|
|
+ - C++: this is a pragmatic C-ish codebase: we don't use fancy C++ features, we don't include C++ headers,
|
|
|
|
+ and ImGui:: is a namespace. We rarely use member functions (and when we did, I am mostly regretting it now).
|
|
|
|
+ This is to increase compatibility, increase maintainability and facilitate use from other languages.
|
|
|
|
+ - C++: ImVec2/ImVec4 do not expose math operators by default, because it is expected that you use your own math types.
|
|
|
|
+ See FAQ "How can I use my own math types instead of ImVec2/ImVec4?" for details about setting up imconfig.h for that.
|
|
|
|
+ We can can optionally export math operators for ImVec2/ImVec4 using IMGUI_DEFINE_MATH_OPERATORS, which we use internally.
|
|
|
|
+ - C++: pay attention that ImVector<> manipulates plain-old-data and does not honor construction/destruction
|
|
|
|
+ (so don't use ImVector in your code or at our own risk!).
|
|
|
|
+ - Building: We don't use nor mandate a build system for the main library.
|
|
|
|
+ This is in an effort to ensure that it works in the real world aka with any esoteric build setup.
|
|
|
|
+ This is also because providing a build system for the main library would be of little-value.
|
|
|
|
+ The build problems are almost never coming from the main library but from specific backends.
|
|
|
|
|
|
|
|
|
|
HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI
|
|
HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI
|
|
----------------------------------------------
|
|
----------------------------------------------
|
|
|
|
+ - Update submodule or copy/overwrite every file.
|
|
|
|
+ - About imconfig.h:
|
|
|
|
+ - You may modify your copy of imconfig.h, in this case don't overwrite it.
|
|
|
|
+ - or you may locally branch to modify imconfig.h and merge/rebase latest.
|
|
|
|
+ - or you may '#define IMGUI_USER_CONFIG "my_config_file.h"' globally from your build system to
|
|
|
|
+ specify a custom path for your imconfig.h file and instead not have to modify the default one.
|
|
|
|
+
|
|
- Overwrite all the sources files except for imconfig.h (if you have modified your copy of imconfig.h)
|
|
- Overwrite all the sources files except for imconfig.h (if you have modified your copy of imconfig.h)
|
|
- Or maintain your own branch where you have imconfig.h modified as a top-most commit which you can regularly rebase over "master".
|
|
- Or maintain your own branch where you have imconfig.h modified as a top-most commit which you can regularly rebase over "master".
|
|
- You can also use '#define IMGUI_USER_CONFIG "my_config_file.h" to redirect configuration to your own file.
|
|
- You can also use '#define IMGUI_USER_CONFIG "my_config_file.h" to redirect configuration to your own file.
|
|
@@ -221,11 +246,12 @@ CODE
|
|
from the public API. If you have a problem with a missing function/symbols, search for its name in the code, there will
|
|
from the public API. If you have a problem with a missing function/symbols, search for its name in the code, there will
|
|
likely be a comment about it. Please report any issue to the GitHub page!
|
|
likely be a comment about it. Please report any issue to the GitHub page!
|
|
- To find out usage of old API, you can add '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' in your configuration file.
|
|
- To find out usage of old API, you can add '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' in your configuration file.
|
|
- - Try to keep your copy of Dear ImGui reasonably up to date.
|
|
|
|
|
|
+ - Try to keep your copy of Dear ImGui reasonably up to date!
|
|
|
|
|
|
|
|
|
|
GETTING STARTED WITH INTEGRATING DEAR IMGUI IN YOUR CODE/ENGINE
|
|
GETTING STARTED WITH INTEGRATING DEAR IMGUI IN YOUR CODE/ENGINE
|
|
---------------------------------------------------------------
|
|
---------------------------------------------------------------
|
|
|
|
+ - See https://github.com/ocornut/imgui/wiki/Getting-Started.
|
|
- Run and study the examples and demo in imgui_demo.cpp to get acquainted with the library.
|
|
- Run and study the examples and demo in imgui_demo.cpp to get acquainted with the library.
|
|
- In the majority of cases you should be able to use unmodified backends files available in the backends/ folder.
|
|
- In the majority of cases you should be able to use unmodified backends files available in the backends/ folder.
|
|
- Add the Dear ImGui source files + selected backend source files to your projects or using your preferred build system.
|
|
- Add the Dear ImGui source files + selected backend source files to your projects or using your preferred build system.
|
|
@@ -411,6 +437,7 @@ CODE
|
|
- 2023/06/28 (1.89.7) - overlapping items: obsoleted 'SetItemAllowOverlap()' (called after item) in favor of calling 'SetNextItemAllowOverlap()' (called before item). 'SetItemAllowOverlap()' didn't and couldn't work reliably since 1.89 (2022-11-15).
|
|
- 2023/06/28 (1.89.7) - overlapping items: obsoleted 'SetItemAllowOverlap()' (called after item) in favor of calling 'SetNextItemAllowOverlap()' (called before item). 'SetItemAllowOverlap()' didn't and couldn't work reliably since 1.89 (2022-11-15).
|
|
- 2023/06/28 (1.89.7) - overlapping items: renamed 'ImGuiTreeNodeFlags_AllowItemOverlap' to 'ImGuiTreeNodeFlags_AllowOverlap', 'ImGuiSelectableFlags_AllowItemOverlap' to 'ImGuiSelectableFlags_AllowOverlap'. Kept redirecting enums (will obsolete).
|
|
- 2023/06/28 (1.89.7) - overlapping items: renamed 'ImGuiTreeNodeFlags_AllowItemOverlap' to 'ImGuiTreeNodeFlags_AllowOverlap', 'ImGuiSelectableFlags_AllowItemOverlap' to 'ImGuiSelectableFlags_AllowOverlap'. Kept redirecting enums (will obsolete).
|
|
- 2023/06/28 (1.89.7) - overlapping items: IsItemHovered() now by default return false when querying an item using AllowOverlap mode which is being overlapped. Use ImGuiHoveredFlags_AllowWhenOverlappedByItem to revert to old behavior.
|
|
- 2023/06/28 (1.89.7) - overlapping items: IsItemHovered() now by default return false when querying an item using AllowOverlap mode which is being overlapped. Use ImGuiHoveredFlags_AllowWhenOverlappedByItem to revert to old behavior.
|
|
|
|
+ - 2023/06/28 (1.89.7) - overlapping items: Selectable and TreeNode don't allow overlap when active so overlapping widgets won't appear as hovered. While this fixes a common small visual issue, it also means that calling IsItemHovered() after a non-reactive elements - e.g. Text() - overlapping an active one may fail if you don't use IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem). (#6610)
|
|
- 2023/06/20 (1.89.7) - moved io.HoverDelayShort/io.HoverDelayNormal to style.HoverDelayShort/style.HoverDelayNormal. As the fields were added in 1.89 and expected to be left unchanged by most users, or only tweaked once during app initialization, we are exceptionally accepting the breakage.
|
|
- 2023/06/20 (1.89.7) - moved io.HoverDelayShort/io.HoverDelayNormal to style.HoverDelayShort/style.HoverDelayNormal. As the fields were added in 1.89 and expected to be left unchanged by most users, or only tweaked once during app initialization, we are exceptionally accepting the breakage.
|
|
- 2023/05/30 (1.89.6) - backends: renamed "imgui_impl_sdlrenderer.cpp" to "imgui_impl_sdlrenderer2.cpp" and "imgui_impl_sdlrenderer.h" to "imgui_impl_sdlrenderer2.h". This is in prevision for the future release of SDL3.
|
|
- 2023/05/30 (1.89.6) - backends: renamed "imgui_impl_sdlrenderer.cpp" to "imgui_impl_sdlrenderer2.cpp" and "imgui_impl_sdlrenderer.h" to "imgui_impl_sdlrenderer2.h". This is in prevision for the future release of SDL3.
|
|
- 2023/05/22 (1.89.6) - listbox: commented out obsolete/redirecting functions that were marked obsolete more than two years ago:
|
|
- 2023/05/22 (1.89.6) - listbox: commented out obsolete/redirecting functions that were marked obsolete more than two years ago:
|
|
@@ -814,11 +841,12 @@ CODE
|
|
|
|
|
|
Q: Where is the documentation?
|
|
Q: Where is the documentation?
|
|
A: This library is poorly documented at the moment and expects the user to be acquainted with C/C++.
|
|
A: This library is poorly documented at the moment and expects the user to be acquainted with C/C++.
|
|
- - Run the examples/ and explore them.
|
|
|
|
|
|
+ - Run the examples/ applications and explore them.
|
|
|
|
+ - Read Getting Started (https://github.com/ocornut/imgui/wiki/Getting-Started) guide.
|
|
- See demo code in imgui_demo.cpp and particularly the ImGui::ShowDemoWindow() function.
|
|
- See demo code in imgui_demo.cpp and particularly the ImGui::ShowDemoWindow() function.
|
|
- The demo covers most features of Dear ImGui, so you can read the code and see its output.
|
|
- The demo covers most features of Dear ImGui, so you can read the code and see its output.
|
|
- See documentation and comments at the top of imgui.cpp + effectively imgui.h.
|
|
- See documentation and comments at the top of imgui.cpp + effectively imgui.h.
|
|
- - Dozens of standalone example applications using e.g. OpenGL/DirectX are provided in the
|
|
|
|
|
|
+ - 20+ standalone example applications using e.g. OpenGL/DirectX are provided in the
|
|
examples/ folder to explain how to integrate Dear ImGui with your own engine/application.
|
|
examples/ folder to explain how to integrate Dear ImGui with your own engine/application.
|
|
- The Wiki (https://github.com/ocornut/imgui/wiki) has many resources and links.
|
|
- The Wiki (https://github.com/ocornut/imgui/wiki) has many resources and links.
|
|
- The Glossary (https://github.com/ocornut/imgui/wiki/Glossary) page also may be useful.
|
|
- The Glossary (https://github.com/ocornut/imgui/wiki/Glossary) page also may be useful.
|
|
@@ -834,14 +862,14 @@ CODE
|
|
================
|
|
================
|
|
|
|
|
|
Q: How to get started?
|
|
Q: How to get started?
|
|
- A: Read 'PROGRAMMER GUIDE' above. Read examples/README.txt.
|
|
|
|
|
|
+ A: Read https://github.com/ocornut/imgui/wiki/Getting-Started. Read 'PROGRAMMER GUIDE' above. Read examples/README.txt.
|
|
|
|
|
|
Q: How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?
|
|
Q: How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?
|
|
A: You should read the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags!
|
|
A: You should read the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags!
|
|
>> See https://www.dearimgui.com/faq for a fully detailed answer. You really want to read this.
|
|
>> See https://www.dearimgui.com/faq for a fully detailed answer. You really want to read this.
|
|
|
|
|
|
- Q. How can I enable keyboard controls?
|
|
|
|
- Q: How can I use this without a mouse, without a keyboard or without a screen? (gamepad, input share, remote display)
|
|
|
|
|
|
+ Q. How can I enable keyboard or gamepad controls?
|
|
|
|
+ Q: How can I use this on a machine without mouse, keyboard or screen? (input share, remote display)
|
|
Q: I integrated Dear ImGui in my engine and little squares are showing instead of text...
|
|
Q: I integrated Dear ImGui in my engine and little squares are showing instead of text...
|
|
Q: I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around...
|
|
Q: I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around...
|
|
Q: I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries...
|
|
Q: I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries...
|
|
@@ -856,7 +884,7 @@ CODE
|
|
- How can I have multiple widgets with the same label?
|
|
- How can I have multiple widgets with the same label?
|
|
- How can I have multiple windows with the same label?
|
|
- How can I have multiple windows with the same label?
|
|
Q: How can I display an image? What is ImTextureID, how does it work?
|
|
Q: How can I display an image? What is ImTextureID, how does it work?
|
|
- Q: How can I use my own math types instead of ImVec2/ImVec4?
|
|
|
|
|
|
+ Q: How can I use my own math types instead of ImVec2?
|
|
Q: How can I interact with standard C++ types (such as std::string and std::vector)?
|
|
Q: How can I interact with standard C++ types (such as std::string and std::vector)?
|
|
Q: How can I display custom shapes? (using low-level ImDrawList API)
|
|
Q: How can I display custom shapes? (using low-level ImDrawList API)
|
|
>> See https://www.dearimgui.com/faq
|
|
>> See https://www.dearimgui.com/faq
|
|
@@ -886,10 +914,10 @@ CODE
|
|
Q: How can I help?
|
|
Q: How can I help?
|
|
A: - Businesses: please reach out to "contact AT dearimgui.com" if you work in a place using Dear ImGui!
|
|
A: - Businesses: please reach out to "contact AT dearimgui.com" if you work in a place using Dear ImGui!
|
|
We can discuss ways for your company to fund development via invoiced technical support, maintenance or sponsoring contacts.
|
|
We can discuss ways for your company to fund development via invoiced technical support, maintenance or sponsoring contacts.
|
|
- This is among the most useful thing you can do for Dear ImGui. With increased funding, we can hire more people working on this project.
|
|
|
|
- - Individuals: you can support continued development via PayPal donations. See README.
|
|
|
|
- - If you are experienced with Dear ImGui and C++, look at the GitHub issues, look at the Wiki, read docs/TODO.txt
|
|
|
|
- and see how you want to help and can help!
|
|
|
|
|
|
+ This is among the most useful thing you can do for Dear ImGui. With increased funding, we sustain and grow work on this project.
|
|
|
|
+ Also see https://github.com/ocornut/imgui/wiki/Sponsors
|
|
|
|
+ - Businesses: you can also purchase licenses for the Dear ImGui Automation/Test Engine.
|
|
|
|
+ - If you are experienced with Dear ImGui and C++, look at the GitHub issues, look at the Wiki, and see how you want to help and can help!
|
|
- Disclose your usage of Dear ImGui via a dev blog post, a tweet, a screenshot, a mention somewhere etc.
|
|
- Disclose your usage of Dear ImGui via a dev blog post, a tweet, a screenshot, a mention somewhere etc.
|
|
You may post screenshot or links in the gallery threads. Visuals are ideal as they inspire other programmers.
|
|
You may post screenshot or links in the gallery threads. Visuals are ideal as they inspire other programmers.
|
|
But even without visuals, disclosing your use of dear imgui helps the library grow credibility, and help other teams and programmers with taking decisions.
|
|
But even without visuals, disclosing your use of dear imgui helps the library grow credibility, and help other teams and programmers with taking decisions.
|
|
@@ -915,11 +943,7 @@ CODE
|
|
|
|
|
|
// System includes
|
|
// System includes
|
|
#include <stdio.h> // vsnprintf, sscanf, printf
|
|
#include <stdio.h> // vsnprintf, sscanf, printf
|
|
-#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
|
|
|
-#include <stddef.h> // intptr_t
|
|
|
|
-#else
|
|
|
|
#include <stdint.h> // intptr_t
|
|
#include <stdint.h> // intptr_t
|
|
-#endif
|
|
|
|
|
|
|
|
// [Windows] On non-Visual Studio compilers, we default to IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS unless explicitly enabled
|
|
// [Windows] On non-Visual Studio compilers, we default to IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS unless explicitly enabled
|
|
#if defined(_WIN32) && !defined(_MSC_VER) && !defined(IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS)
|
|
#if defined(_WIN32) && !defined(_MSC_VER) && !defined(IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS)
|
|
@@ -4151,7 +4175,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
|
|
// Internal facing ItemHoverable() used when submitting widgets. Differs slightly from IsItemHovered().
|
|
// Internal facing ItemHoverable() used when submitting widgets. Differs slightly from IsItemHovered().
|
|
// (this does not rely on LastItemData it can be called from a ButtonBehavior() call not following an ItemAdd() call)
|
|
// (this does not rely on LastItemData it can be called from a ButtonBehavior() call not following an ItemAdd() call)
|
|
// FIXME-LEGACY: the 'ImGuiItemFlags item_flags' parameter was added on 2023-06-28.
|
|
// FIXME-LEGACY: the 'ImGuiItemFlags item_flags' parameter was added on 2023-06-28.
|
|
-// If you used this ii your legacy/custom widgets code:
|
|
|
|
|
|
+// If you used this in your legacy/custom widgets code:
|
|
// - Commonly: if your ItemHoverable() call comes after an ItemAdd() call: pass 'item_flags = g.LastItemData.InFlags'.
|
|
// - Commonly: if your ItemHoverable() call comes after an ItemAdd() call: pass 'item_flags = g.LastItemData.InFlags'.
|
|
// - Rare: otherwise you may pass 'item_flags = 0' (ImGuiItemFlags_None) unless you want to benefit from special behavior handled by ItemHoverable.
|
|
// - Rare: otherwise you may pass 'item_flags = 0' (ImGuiItemFlags_None) unless you want to benefit from special behavior handled by ItemHoverable.
|
|
bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id, ImGuiItemFlags item_flags)
|
|
bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id, ImGuiItemFlags item_flags)
|
|
@@ -7190,6 +7214,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
|
|
|
// [LEGACY] Content Region
|
|
// [LEGACY] Content Region
|
|
// FIXME-OBSOLETE: window->ContentRegionRect.Max is currently very misleading / partly faulty, but some BeginChild() patterns relies on it.
|
|
// FIXME-OBSOLETE: window->ContentRegionRect.Max is currently very misleading / partly faulty, but some BeginChild() patterns relies on it.
|
|
|
|
+ // Unless explicit content size is specified by user, this currently represent the region leading to no scrolling.
|
|
// Used by:
|
|
// Used by:
|
|
// - Mouse wheel scrolling + many other things
|
|
// - Mouse wheel scrolling + many other things
|
|
window->ContentRegionRect.Min.x = window->Pos.x - window->Scroll.x + window->WindowPadding.x + window->DecoOuterSizeX1;
|
|
window->ContentRegionRect.Min.x = window->Pos.x - window->Scroll.x + window->WindowPadding.x + window->DecoOuterSizeX1;
|
|
@@ -10401,10 +10426,8 @@ ImVec2 ImGui::GetContentRegionMax()
|
|
{
|
|
{
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
- ImVec2 mx = window->ContentRegionRect.Max - window->Pos;
|
|
|
|
- if (window->DC.CurrentColumns || g.CurrentTable)
|
|
|
|
- mx.x = window->WorkRect.Max.x - window->Pos.x;
|
|
|
|
- return mx;
|
|
|
|
|
|
+ ImVec2 mx = (window->DC.CurrentColumns || g.CurrentTable) ? window->WorkRect.Max : window->ContentRegionRect.Max;
|
|
|
|
+ return mx - window->Pos;
|
|
}
|
|
}
|
|
|
|
|
|
// [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.
|
|
@@ -10412,9 +10435,7 @@ ImVec2 ImGui::GetContentRegionMaxAbs()
|
|
{
|
|
{
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
- ImVec2 mx = window->ContentRegionRect.Max;
|
|
|
|
- if (window->DC.CurrentColumns || g.CurrentTable)
|
|
|
|
- mx.x = window->WorkRect.Max.x;
|
|
|
|
|
|
+ ImVec2 mx = (window->DC.CurrentColumns || g.CurrentTable) ? window->WorkRect.Max : window->ContentRegionRect.Max;
|
|
return mx;
|
|
return mx;
|
|
}
|
|
}
|
|
|
|
|