mirror of
https://github.com/Drezil/imgui.git
synced 2025-01-18 11:06:35 +00:00
Merge branch 'master' into drag_and_drop
This commit is contained in:
commit
ae060b1d67
19
README.md
19
README.md
@ -55,15 +55,17 @@ Integrating Dear ImGui within your custom engine is a matter of wiring mouse/key
|
|||||||
_NB: those third-party bindings may be more or less maintained, more or less close to the spirit of original API and therefore I cannot give much guarantee about them. People who create language bindings sometimes haven't used the C++ API themselves (for the good reason that they aren't C++ users). Dear ImGui was designed with C++ in mind and some of the subtleties may be lost in translation with other languages. If your language supports it, I would suggest replicating the function overloading and default parameters used in the original, else the API may be harder to use. In doubt, please check the original C++ version first!_
|
_NB: those third-party bindings may be more or less maintained, more or less close to the spirit of original API and therefore I cannot give much guarantee about them. People who create language bindings sometimes haven't used the C++ API themselves (for the good reason that they aren't C++ users). Dear ImGui was designed with C++ in mind and some of the subtleties may be lost in translation with other languages. If your language supports it, I would suggest replicating the function overloading and default parameters used in the original, else the API may be harder to use. In doubt, please check the original C++ version first!_
|
||||||
|
|
||||||
Languages:
|
Languages:
|
||||||
- C (cimgui): thin c-api wrapper for ImGui https://github.com/Extrawurst/cimgui
|
- C (cimgui): https://github.com/Extrawurst/cimgui
|
||||||
- C#/.Net (ImGui.NET): An ImGui wrapper for .NET Core https://github.com/mellinoe/ImGui.NET
|
- C#/.Net (ImGui.NET): https://github.com/mellinoe/ImGui.NET
|
||||||
- D (DerelictImgui): Dynamic bindings for the D programming language: https://github.com/Extrawurst/DerelictImgui
|
- ChaiScript: https://github.com/JuJuBoSc/imgui-chaiscript
|
||||||
|
- D (DerelictImgui): https://github.com/Extrawurst/DerelictImgui
|
||||||
- Go (go-imgui): https://github.com/Armored-Dragon/go-imgui
|
- Go (go-imgui): https://github.com/Armored-Dragon/go-imgui
|
||||||
- Lua: https://github.com/patrickriordan/imgui_lua_bindings
|
- Lua: https://github.com/patrickriordan/imgui_lua_bindings
|
||||||
- Pascal (imgui-pas) https://github.com/dpethes/imgui-pas
|
- Odin: https://github.com/ThisDrunkDane/odin-dear_imgui
|
||||||
- Python (CyImGui): Python bindings for dear imgui using Cython: https://github.com/chromy/cyimgui
|
- Pascal (imgui-pas): https://github.com/dpethes/imgui-pas
|
||||||
- Python (pyimgui): Another Python bindings for dear imgui: https://github.com/swistakm/pyimgui
|
- Python (CyImGui): https://github.com/chromy/cyimgui
|
||||||
- Rust (imgui-rs): Rust bindings for dear imgui https://github.com/Gekkio/imgui-rs
|
- Python (pyimgui): https://github.com/swistakm/pyimgui
|
||||||
|
- Rust (imgui-rs): https://github.com/Gekkio/imgui-rs
|
||||||
|
|
||||||
Frameworks:
|
Frameworks:
|
||||||
- Main ImGui repository include examples for DirectX9, DirectX10, DirectX11, OpenGL2/3, Vulkan, Allegro 5, SDL+GL2/3, iOS and Marmalade: https://github.com/ocornut/imgui/tree/master/examples
|
- Main ImGui repository include examples for DirectX9, DirectX10, DirectX11, OpenGL2/3, Vulkan, Allegro 5, SDL+GL2/3, iOS and Marmalade: https://github.com/ocornut/imgui/tree/master/examples
|
||||||
@ -78,6 +80,7 @@ Frameworks:
|
|||||||
- Irrlicht (IrrIMGUI): https://github.com/ZahlGraf/IrrIMGUI
|
- Irrlicht (IrrIMGUI): https://github.com/ZahlGraf/IrrIMGUI
|
||||||
- Ogre: https://bitbucket.org/LMCrashy/ogreimgui/src
|
- Ogre: https://bitbucket.org/LMCrashy/ogreimgui/src
|
||||||
- openFrameworks (ofxImGui): https://github.com/jvcleave/ofxImGui
|
- openFrameworks (ofxImGui): https://github.com/jvcleave/ofxImGui
|
||||||
|
- OpenSceneGraph/OSG: https://gist.github.com/fulezi/d2442ca7626bf270226014501357042c
|
||||||
- LÖVE: https://github.com/slages/love-imgui
|
- LÖVE: https://github.com/slages/love-imgui
|
||||||
- NanoRT (software raytraced) https://github.com/syoyo/imgui/tree/nanort/examples/raytrace_example
|
- NanoRT (software raytraced) https://github.com/syoyo/imgui/tree/nanort/examples/raytrace_example
|
||||||
- Qt3d https://github.com/alpqr/imgui-qt3d
|
- Qt3d https://github.com/alpqr/imgui-qt3d
|
||||||
@ -126,6 +129,8 @@ The Immediate Mode GUI paradigm may at first appear unusual to some users. This
|
|||||||
- [Nicolas Guillemot's CppCon'16 flashtalk about Dear ImGui](https://www.youtube.com/watch?v=LSRJ1jZq90k).
|
- [Nicolas Guillemot's CppCon'16 flashtalk about Dear ImGui](https://www.youtube.com/watch?v=LSRJ1jZq90k).
|
||||||
- [Thierry Excoffier's Zero Memory Widget](http://perso.univ-lyon1.fr/thierry.excoffier/ZMW/).
|
- [Thierry Excoffier's Zero Memory Widget](http://perso.univ-lyon1.fr/thierry.excoffier/ZMW/).
|
||||||
|
|
||||||
|
See the [Software using dear imgui page](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) for an incomplete list of software which are publicly known to use dear migui.
|
||||||
|
|
||||||
See the [Links page](https://github.com/ocornut/imgui/wiki/Links) for third-party bindings to different languages and frameworks.
|
See the [Links page](https://github.com/ocornut/imgui/wiki/Links) for third-party bindings to different languages and frameworks.
|
||||||
|
|
||||||
Frequently Asked Question (FAQ)
|
Frequently Asked Question (FAQ)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
The code in imgui.cpp embeds a copy of 'ProggyClean.ttf' that you can use without any external files.
|
The code in imgui.cpp embeds a copy of 'ProggyClean.ttf' (by Tristan Grimmer) that is used by default.
|
||||||
The files in this folder are only provided as a convenience, you can use any .TTF/.OTF.
|
We embed the font in source code so you can use Dear ImGui without any file system access.
|
||||||
|
You may also load external .TTF/.OTF files.
|
||||||
|
The files in this folder are suggested fonts, provided as a convenience.
|
||||||
(Note: .OTF support in stb_truetype.h currently doesn't appear to load every font)
|
(Note: .OTF support in stb_truetype.h currently doesn't appear to load every font)
|
||||||
|
|
||||||
Fonts are rasterized in a single texture at the time of calling either of io.Fonts.GetTexDataAsAlpha8()/GetTexDataAsRGBA32()/Build().
|
Fonts are rasterized in a single texture at the time of calling either of io.Fonts.GetTexDataAsAlpha8()/GetTexDataAsRGBA32()/Build().
|
||||||
@ -12,6 +14,7 @@
|
|||||||
Using an icon font (such as FontAwesome: http://fontawesome.io) is an easy and practical way to use icons in your ImGui application.
|
Using an icon font (such as FontAwesome: http://fontawesome.io) is an easy and practical way to use icons in your ImGui application.
|
||||||
A common pattern is to merge the icon font within your main font, so you can refer to the icons directly from your strings without having to change fonts back and forth.
|
A common pattern is to merge the icon font within your main font, so you can refer to the icons directly from your strings without having to change fonts back and forth.
|
||||||
To refer to the icon from your C++ code, you can use headers files created by Juliette Foucaut, at https://github.com/juliettef/IconFontCppHeaders
|
To refer to the icon from your C++ code, you can use headers files created by Juliette Foucaut, at https://github.com/juliettef/IconFontCppHeaders
|
||||||
|
See Links below for other icons fonts and related tools.
|
||||||
|
|
||||||
// Merge icons into default tool font
|
// Merge icons into default tool font
|
||||||
#include "IconsFontAwesome.h"
|
#include "IconsFontAwesome.h"
|
||||||
@ -40,7 +43,7 @@
|
|||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels);
|
io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels);
|
||||||
|
|
||||||
Detailed options:
|
Advanced options:
|
||||||
|
|
||||||
ImFontConfig config;
|
ImFontConfig config;
|
||||||
config.OversampleH = 3;
|
config.OversampleH = 3;
|
||||||
@ -106,17 +109,23 @@
|
|||||||
REMAPPING CODEPOINTS
|
REMAPPING CODEPOINTS
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
All your strings needs to use UTF-8 encoding. Specifying literal in your source code using a local code page (such as CP-923 for Japanese CP-1251 for Cyrillic) will NOT work!
|
All your strings needs to use UTF-8 encoding. Specifying literal in your source code using a local code page (such as CP-923 for Japanese, or CP-1251 for Cyrillic) will NOT work!
|
||||||
In C++11 you can encode a string literal in UTF-8 by using the u8"hello" syntax. Otherwise you can convert yourself to UTF-8 or load text data from file already saved as UTF-8.
|
In C++11 you can encode a string literal in UTF-8 by using the u8"hello" syntax. Otherwise you can convert yourself to UTF-8 or load text data from file already saved as UTF-8.
|
||||||
You can also try to remap your local codepage characters to their Unicode codepoint using font->AddRemapChar(), but international users may have problems reading/editing your source code.
|
e.g.
|
||||||
|
u8"hello"
|
||||||
|
u8"こんにちは"
|
||||||
|
You may also try to remap your local codepage characters to their Unicode codepoint using font->AddRemapChar(), but international users may have problems reading/editing your source code.
|
||||||
|
|
||||||
|
|
||||||
---------------------------------
|
---------------------------------
|
||||||
EMBEDDING FONT IN SOURCE CODE
|
EMBEDDING FONT IN SOURCE CODE
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
Compile and use 'binary_to_compressed_c.cpp' to create a compressed C style array.
|
Compile and use 'binary_to_compressed_c.cpp' to create a compressed C style array that you can embed in source code.
|
||||||
See the documentation in binary_to_compressed_c.cpp for instruction on how to use the tool.
|
See the documentation in binary_to_compressed_c.cpp for instruction on how to use the tool.
|
||||||
|
You may find a precompiled version binary_to_compressed_c.exe for Windows instead of demo binaries package (see README).
|
||||||
|
The tool optionally used Base85 encoding to reduce the size of _source code_ but the read-only arrays will be about 20% bigger.
|
||||||
|
|
||||||
Then load the font with:
|
Then load the font with:
|
||||||
|
|
||||||
ImFont* font = io.Fonts->AddFontFromMemoryCompressedTTF(compressed_data, compressed_data_size, size_pixels, ...);
|
ImFont* font = io.Fonts->AddFontFromMemoryCompressedTTF(compressed_data, compressed_data_size, size_pixels, ...);
|
||||||
@ -164,36 +173,40 @@
|
|||||||
|
|
||||||
|
|
||||||
---------------------------------
|
---------------------------------
|
||||||
LINKS
|
LINKS & OTHER FONTS
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
Icon fonts
|
(Icons) Icon fonts
|
||||||
https://fortawesome.github.io/Font-Awesome/
|
https://fortawesome.github.io/Font-Awesome/
|
||||||
https://github.com/SamBrishes/kenney-icon-font
|
https://github.com/SamBrishes/kenney-icon-font
|
||||||
https://design.google.com/icons/
|
https://design.google.com/icons/
|
||||||
|
You can use https://github.com/juliettef/IconFontCppHeaders for C/C++ header files with name #define to access icon codepoint in source code.
|
||||||
|
|
||||||
IcoMoon - Custom Icon font builder
|
(Icons) IcoMoon - Custom Icon font builder
|
||||||
https://icomoon.io/app
|
https://icomoon.io/app
|
||||||
|
|
||||||
Typefaces for source code beautification
|
(Regular) Open Sans Fonts
|
||||||
https://github.com/chrissimpkins/codeface
|
https://fonts.google.com/specimen/Open+Sans
|
||||||
|
|
||||||
Programmation fonts
|
(Regular) Google Noto Fonts (worldwide languages)
|
||||||
http://s9w.github.io/font_compare/
|
|
||||||
|
|
||||||
Proggy Programming Fonts
|
|
||||||
http://upperbounds.net
|
|
||||||
|
|
||||||
Inconsolata
|
|
||||||
http://www.levien.com/type/myfonts/inconsolata.html
|
|
||||||
|
|
||||||
Google Noto Fonts (worldwide languages)
|
|
||||||
https://www.google.com/get/noto/
|
https://www.google.com/get/noto/
|
||||||
|
|
||||||
Adobe Source Code Pro: Monospaced font family for user interface and coding environments
|
(Monospace) Typefaces for source code beautification
|
||||||
|
https://github.com/chrissimpkins/codeface
|
||||||
|
|
||||||
|
(Monospace) Programmation fonts
|
||||||
|
http://s9w.github.io/font_compare/
|
||||||
|
|
||||||
|
(Monospace) Proggy Programming Fonts
|
||||||
|
http://upperbounds.net
|
||||||
|
|
||||||
|
(Monospace) Inconsolata
|
||||||
|
http://www.levien.com/type/myfonts/inconsolata.html
|
||||||
|
|
||||||
|
(Monospace) Adobe Source Code Pro: Monospaced font family for user interface and coding environments
|
||||||
https://github.com/adobe-fonts/source-code-pro
|
https://github.com/adobe-fonts/source-code-pro
|
||||||
|
|
||||||
Monospace/Fixed Width Programmer's Fonts
|
(Monospace) Monospace/Fixed Width Programmer's Fonts
|
||||||
http://www.lowing.org/fonts/
|
http://www.lowing.org/fonts/
|
||||||
|
|
||||||
(Japanese) M+ fonts by Coji Morishita are free and include most useful Kanjis you would need.
|
(Japanese) M+ fonts by Coji Morishita are free and include most useful Kanjis you would need.
|
||||||
|
161
imgui.cpp
161
imgui.cpp
@ -775,7 +775,15 @@ ImGuiIO::ImGuiIO()
|
|||||||
DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
|
DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
|
||||||
DisplayVisibleMin = DisplayVisibleMax = ImVec2(0.0f, 0.0f);
|
DisplayVisibleMin = DisplayVisibleMax = ImVec2(0.0f, 0.0f);
|
||||||
|
|
||||||
// User functions
|
// Advanced/subtle behaviors
|
||||||
|
#ifdef __APPLE__
|
||||||
|
OptMacOSXBehaviors = true; // Set Mac OS X style defaults based on __APPLE__ compile time flag
|
||||||
|
#else
|
||||||
|
OptMacOSXBehaviors = false;
|
||||||
|
#endif
|
||||||
|
OptCursorBlink = true;
|
||||||
|
|
||||||
|
// Settings (User Functions)
|
||||||
RenderDrawListsFn = NULL;
|
RenderDrawListsFn = NULL;
|
||||||
MemAllocFn = malloc;
|
MemAllocFn = malloc;
|
||||||
MemFreeFn = free;
|
MemFreeFn = free;
|
||||||
@ -791,11 +799,6 @@ ImGuiIO::ImGuiIO()
|
|||||||
MouseDragThreshold = 6.0f;
|
MouseDragThreshold = 6.0f;
|
||||||
for (int i = 0; i < IM_ARRAYSIZE(MouseDownDuration); i++) MouseDownDuration[i] = MouseDownDurationPrev[i] = -1.0f;
|
for (int i = 0; i < IM_ARRAYSIZE(MouseDownDuration); i++) MouseDownDuration[i] = MouseDownDurationPrev[i] = -1.0f;
|
||||||
for (int i = 0; i < IM_ARRAYSIZE(KeysDownDuration); i++) KeysDownDuration[i] = KeysDownDurationPrev[i] = -1.0f;
|
for (int i = 0; i < IM_ARRAYSIZE(KeysDownDuration); i++) KeysDownDuration[i] = KeysDownDurationPrev[i] = -1.0f;
|
||||||
|
|
||||||
// Set OS X style defaults based on __APPLE__ compile time flag
|
|
||||||
#ifdef __APPLE__
|
|
||||||
OSXBehaviors = true;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass in translated ASCII characters for text input.
|
// Pass in translated ASCII characters for text input.
|
||||||
@ -1386,10 +1389,10 @@ static ImVector<ImGuiStorage::Pair>::iterator LowerBound(ImVector<ImGuiStorage::
|
|||||||
{
|
{
|
||||||
ImVector<ImGuiStorage::Pair>::iterator first = data.begin();
|
ImVector<ImGuiStorage::Pair>::iterator first = data.begin();
|
||||||
ImVector<ImGuiStorage::Pair>::iterator last = data.end();
|
ImVector<ImGuiStorage::Pair>::iterator last = data.end();
|
||||||
int count = (int)(last - first);
|
size_t count = (size_t)(last - first);
|
||||||
while (count > 0)
|
while (count > 0)
|
||||||
{
|
{
|
||||||
int count2 = count / 2;
|
size_t count2 = count >> 1;
|
||||||
ImVector<ImGuiStorage::Pair>::iterator mid = first + count2;
|
ImVector<ImGuiStorage::Pair>::iterator mid = first + count2;
|
||||||
if (mid->key < key)
|
if (mid->key < key)
|
||||||
{
|
{
|
||||||
@ -2484,6 +2487,7 @@ void ImGui::Shutdown()
|
|||||||
g.WindowsSortBuffer.clear();
|
g.WindowsSortBuffer.clear();
|
||||||
g.CurrentWindow = NULL;
|
g.CurrentWindow = NULL;
|
||||||
g.CurrentWindowStack.clear();
|
g.CurrentWindowStack.clear();
|
||||||
|
g.WindowsById.Clear();
|
||||||
g.NavWindow = NULL;
|
g.NavWindow = NULL;
|
||||||
g.HoveredWindow = NULL;
|
g.HoveredWindow = NULL;
|
||||||
g.HoveredRootWindow = NULL;
|
g.HoveredRootWindow = NULL;
|
||||||
@ -3127,6 +3131,7 @@ void ImGui::RenderTriangle(ImVec2 p_min, ImGuiDir dir, float scale)
|
|||||||
case ImGuiDir_Left:
|
case ImGuiDir_Left:
|
||||||
r = -r; // ...fall through, no break!
|
r = -r; // ...fall through, no break!
|
||||||
case ImGuiDir_Right:
|
case ImGuiDir_Right:
|
||||||
|
center.x -= r * 0.25f;
|
||||||
a = ImVec2(1,0) * r;
|
a = ImVec2(1,0) * r;
|
||||||
b = ImVec2(-0.500f,+0.866f) * r;
|
b = ImVec2(-0.500f,+0.866f) * r;
|
||||||
c = ImVec2(-0.500f,-0.866f) * r;
|
c = ImVec2(-0.500f,-0.866f) * r;
|
||||||
@ -3941,13 +3946,9 @@ static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size,
|
|||||||
|
|
||||||
ImGuiWindow* ImGui::FindWindowByName(const char* name)
|
ImGuiWindow* ImGui::FindWindowByName(const char* name)
|
||||||
{
|
{
|
||||||
// FIXME-OPT: Store sorted hashes -> pointers so we can do a bissection in a contiguous block
|
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiID id = ImHash(name, 0);
|
ImGuiID id = ImHash(name, 0);
|
||||||
for (int i = 0; i < g.Windows.Size; i++)
|
return (ImGuiWindow*)g.WindowsById.GetVoidPtr(id);
|
||||||
if (g.Windows[i]->ID == id)
|
|
||||||
return g.Windows[i];
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags)
|
static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags)
|
||||||
@ -3958,6 +3959,7 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFl
|
|||||||
ImGuiWindow* window = (ImGuiWindow*)ImGui::MemAlloc(sizeof(ImGuiWindow));
|
ImGuiWindow* window = (ImGuiWindow*)ImGui::MemAlloc(sizeof(ImGuiWindow));
|
||||||
IM_PLACEMENT_NEW(window) ImGuiWindow(name);
|
IM_PLACEMENT_NEW(window) ImGuiWindow(name);
|
||||||
window->Flags = flags;
|
window->Flags = flags;
|
||||||
|
g.WindowsById.SetVoidPtr(window->ID, window);
|
||||||
|
|
||||||
if (flags & ImGuiWindowFlags_NoSavedSettings)
|
if (flags & ImGuiWindowFlags_NoSavedSettings)
|
||||||
{
|
{
|
||||||
@ -4060,7 +4062,7 @@ static ImVec2 CalcSizeAutoFit(ImGuiWindow* window)
|
|||||||
if (size_auto_fit_after_constraint.x < window->SizeContents.x && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar))
|
if (size_auto_fit_after_constraint.x < window->SizeContents.x && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar))
|
||||||
size_auto_fit.y += style.ScrollbarSize;
|
size_auto_fit.y += style.ScrollbarSize;
|
||||||
if (size_auto_fit_after_constraint.y < window->SizeContents.y && !(flags & ImGuiWindowFlags_NoScrollbar))
|
if (size_auto_fit_after_constraint.y < window->SizeContents.y && !(flags & ImGuiWindowFlags_NoScrollbar))
|
||||||
size_auto_fit.x += style.ScrollbarSize * 2.0f;
|
size_auto_fit.x += style.ScrollbarSize;
|
||||||
size_auto_fit.y = ImMax(size_auto_fit.y - style.ItemSpacing.y, 0.0f);
|
size_auto_fit.y = ImMax(size_auto_fit.y - style.ItemSpacing.y, 0.0f);
|
||||||
}
|
}
|
||||||
return size_auto_fit;
|
return size_auto_fit;
|
||||||
@ -4130,12 +4132,14 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
else
|
else
|
||||||
flags = window->Flags;
|
flags = window->Flags;
|
||||||
|
|
||||||
|
// Parent window is latched only on the first call to Begin() of the frame, so further append-calls can be done from a different window stack
|
||||||
|
ImGuiWindow* parent_window = first_begin_of_the_frame ? (!g.CurrentWindowStack.empty() ? g.CurrentWindowStack.back() : NULL) : window->ParentWindow;
|
||||||
|
IM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow));
|
||||||
|
|
||||||
// Add to stack
|
// Add to stack
|
||||||
ImGuiWindow* parent_window = !g.CurrentWindowStack.empty() ? g.CurrentWindowStack.back() : NULL;
|
|
||||||
g.CurrentWindowStack.push_back(window);
|
g.CurrentWindowStack.push_back(window);
|
||||||
SetCurrentWindow(window);
|
SetCurrentWindow(window);
|
||||||
CheckStacksSize(window, true);
|
CheckStacksSize(window, true);
|
||||||
IM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow));
|
|
||||||
|
|
||||||
bool window_just_activated_by_user = (window->LastFrameActive < current_frame - 1); // Not using !WasActive because the implicit "Debug" window would always toggle off->on
|
bool window_just_activated_by_user = (window->LastFrameActive < current_frame - 1); // Not using !WasActive because the implicit "Debug" window would always toggle off->on
|
||||||
if (flags & ImGuiWindowFlags_Popup)
|
if (flags & ImGuiWindowFlags_Popup)
|
||||||
@ -4202,21 +4206,17 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
g.SetNextWindowFocus = false;
|
g.SetNextWindowFocus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update known root window (if we are a child window, otherwise window == window->RootWindow)
|
|
||||||
int root_idx, root_non_popup_idx;
|
|
||||||
for (root_idx = g.CurrentWindowStack.Size - 1; root_idx > 0; root_idx--)
|
|
||||||
if (!(g.CurrentWindowStack[root_idx]->Flags & ImGuiWindowFlags_ChildWindow))
|
|
||||||
break;
|
|
||||||
for (root_non_popup_idx = root_idx; root_non_popup_idx > 0; root_non_popup_idx--)
|
|
||||||
if (!(g.CurrentWindowStack[root_non_popup_idx]->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)) || (g.CurrentWindowStack[root_non_popup_idx]->Flags & ImGuiWindowFlags_Modal))
|
|
||||||
break;
|
|
||||||
window->ParentWindow = parent_window;
|
|
||||||
window->RootWindow = g.CurrentWindowStack[root_idx];
|
|
||||||
window->RootNonPopupWindow = g.CurrentWindowStack[root_non_popup_idx]; // Used to display TitleBgActive color and for selecting which window to use for NavWindowing
|
|
||||||
|
|
||||||
// When reusing window again multiple times a frame, just append content (don't need to setup again)
|
// When reusing window again multiple times a frame, just append content (don't need to setup again)
|
||||||
if (first_begin_of_the_frame)
|
if (first_begin_of_the_frame)
|
||||||
{
|
{
|
||||||
|
// Initialize
|
||||||
|
window->ParentWindow = parent_window;
|
||||||
|
window->RootWindow = !(flags & ImGuiWindowFlags_ChildWindow) ? window : parent_window->RootWindow;
|
||||||
|
window->RootNonPopupWindow = !(flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)) || (flags & ImGuiWindowFlags_Modal) ? window : parent_window->RootNonPopupWindow; // Used to display TitleBgActive color and for selecting which window to use for NavWindowing
|
||||||
|
//window->RootNavWindow = window;
|
||||||
|
//while (window->RootNavWindow->Flags & ImGuiWindowFlags_NavFlattened)
|
||||||
|
// window->RootNavWindow = window->RootNavWindow->ParentWindow;
|
||||||
|
|
||||||
window->Active = true;
|
window->Active = true;
|
||||||
window->OrderWithinParent = 0;
|
window->OrderWithinParent = 0;
|
||||||
window->BeginCount = 0;
|
window->BeginCount = 0;
|
||||||
@ -4260,7 +4260,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
|
|
||||||
// SIZE
|
// SIZE
|
||||||
|
|
||||||
// Save contents size from last frame for auto-fitting (unless explicitly specified)
|
// Update contents size from last frame for auto-fitting (unless explicitly specified)
|
||||||
window->SizeContents.x = (float)(int)((window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.x - window->Pos.x) + window->Scroll.x));
|
window->SizeContents.x = (float)(int)((window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.x - window->Pos.x) + window->Scroll.x));
|
||||||
window->SizeContents.y = (float)(int)((window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.y - window->Pos.y) + window->Scroll.y));
|
window->SizeContents.y = (float)(int)((window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.y - window->Pos.y) + window->Scroll.y));
|
||||||
|
|
||||||
@ -4279,7 +4279,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Lock window padding so that altering the ShowBorders flag for children doesn't have side-effects.
|
// Lock window padding so that altering the ShowBorders flag for children doesn't have side-effects.
|
||||||
window->WindowPadding = ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_ShowBorders | ImGuiWindowFlags_ComboBox | ImGuiWindowFlags_Popup))) ? ImVec2(0,0) : style.WindowPadding;
|
window->WindowPadding = style.WindowPadding;
|
||||||
|
if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_ShowBorders | ImGuiWindowFlags_ComboBox | ImGuiWindowFlags_Popup)))
|
||||||
|
window->WindowPadding = ImVec2(0.0f, (flags & ImGuiWindowFlags_MenuBar) ? style.WindowPadding.y : 0.0f);
|
||||||
|
|
||||||
// Calculate auto-fit size, handle automatic resize
|
// Calculate auto-fit size, handle automatic resize
|
||||||
const ImVec2 size_auto_fit = CalcSizeAutoFit(window);
|
const ImVec2 size_auto_fit = CalcSizeAutoFit(window);
|
||||||
@ -4312,6 +4314,21 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
// Apply minimum/maximum window size constraints and final size
|
// Apply minimum/maximum window size constraints and final size
|
||||||
window->SizeFull = CalcSizeFullWithConstraint(window, window->SizeFull);
|
window->SizeFull = CalcSizeFullWithConstraint(window, window->SizeFull);
|
||||||
window->Size = window->Collapsed ? window->TitleBarRect().GetSize() : window->SizeFull;
|
window->Size = window->Collapsed ? window->TitleBarRect().GetSize() : window->SizeFull;
|
||||||
|
if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup))
|
||||||
|
window->Size = window->SizeFull;
|
||||||
|
|
||||||
|
// SCROLLBAR STATUS
|
||||||
|
|
||||||
|
// Update scrollbar status (based on the Size that was effective during last frame or the auto-resized Size). We need to do this before manual resize (below) is effective.
|
||||||
|
if (!window->Collapsed)
|
||||||
|
{
|
||||||
|
window->ScrollbarY = (flags & ImGuiWindowFlags_AlwaysVerticalScrollbar) || ((window->SizeContents.y > window->SizeFull.y + style.ItemSpacing.y) && !(flags & ImGuiWindowFlags_NoScrollbar));
|
||||||
|
window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((window->SizeContents.x > window->SizeFull.x - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar));
|
||||||
|
if (window->ScrollbarX && !window->ScrollbarY)
|
||||||
|
window->ScrollbarY = (window->SizeContents.y > window->SizeFull.y + style.ItemSpacing.y - style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar);
|
||||||
|
window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);
|
||||||
|
window->BorderSize = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
// POSITION
|
// POSITION
|
||||||
|
|
||||||
@ -4325,7 +4342,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
{
|
{
|
||||||
IM_ASSERT(window_size_set_by_api); // Submitted by BeginChild()
|
IM_ASSERT(window_size_set_by_api); // Submitted by BeginChild()
|
||||||
window->Pos = window->PosFloat = parent_window->DC.CursorPos;
|
window->Pos = window->PosFloat = parent_window->DC.CursorPos;
|
||||||
window->Size = window->SizeFull;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFrames == 0);
|
const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFrames == 0);
|
||||||
@ -4412,7 +4428,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
// Manual resize
|
// Manual resize
|
||||||
// Using the FlattenChilds button flag, we make the resize button accessible even if we are hovering over a child window
|
// Using the FlattenChilds button flag, we make the resize button accessible even if we are hovering over a child window
|
||||||
const ImVec2 br = window->Rect().GetBR();
|
const ImVec2 br = window->Rect().GetBR();
|
||||||
const ImRect resize_rect(br - ImVec2(resize_corner_size * 0.75f, resize_corner_size * 0.75f), br);
|
const ImRect resize_rect(br - ImFloor(ImVec2(resize_corner_size * 0.75f, resize_corner_size * 0.75f)), br);
|
||||||
const ImGuiID resize_id = window->GetID("#RESIZE");
|
const ImGuiID resize_id = window->GetID("#RESIZE");
|
||||||
bool hovered, held;
|
bool hovered, held;
|
||||||
ButtonBehavior(resize_rect, resize_id, &hovered, &held, ImGuiButtonFlags_FlattenChilds);
|
ButtonBehavior(resize_rect, resize_id, &hovered, &held, ImGuiButtonFlags_FlattenChilds);
|
||||||
@ -4430,7 +4446,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
else if (held)
|
else if (held)
|
||||||
{
|
{
|
||||||
// We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position
|
// We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position
|
||||||
size_target = (g.IO.MousePos - g.ActiveIdClickOffset + resize_rect.GetSize()) - window->Pos;
|
size_target = (g.IO.MousePos - g.ActiveIdClickOffset - window->Pos) + resize_rect.GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size_target.x != FLT_MAX && size_target.y != FLT_MAX)
|
if (size_target.x != FLT_MAX && size_target.y != FLT_MAX)
|
||||||
@ -4442,14 +4458,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
title_bar_rect = window->TitleBarRect();
|
title_bar_rect = window->TitleBarRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scrollbars
|
|
||||||
window->ScrollbarY = (flags & ImGuiWindowFlags_AlwaysVerticalScrollbar) || ((window->SizeContents.y > window->Size.y + style.ItemSpacing.y) && !(flags & ImGuiWindowFlags_NoScrollbar));
|
|
||||||
window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((window->SizeContents.x > window->Size.x - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar));
|
|
||||||
if (window->ScrollbarX && !window->ScrollbarY)
|
|
||||||
window->ScrollbarY = (window->SizeContents.y > window->Size.y + style.ItemSpacing.y - style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar);
|
|
||||||
window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);
|
|
||||||
window->BorderSize = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
|
||||||
|
|
||||||
// Window background, Default Alpha
|
// Window background, Default Alpha
|
||||||
ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags));
|
ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags));
|
||||||
window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImGuiCorner_All : ImGuiCorner_BotLeft|ImGuiCorner_BotRight);
|
window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImGuiCorner_All : ImGuiCorner_BotLeft|ImGuiCorner_BotRight);
|
||||||
@ -4502,6 +4510,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
window->ContentsRegionRect.Max.y = -window->Scroll.y - window->WindowPadding.y + (window->SizeContentsExplicit.y != 0.0f ? window->SizeContentsExplicit.y : (window->Size.y - window->ScrollbarSizes.y));
|
window->ContentsRegionRect.Max.y = -window->Scroll.y - window->WindowPadding.y + (window->SizeContentsExplicit.y != 0.0f ? window->SizeContentsExplicit.y : (window->Size.y - window->ScrollbarSizes.y));
|
||||||
|
|
||||||
// Setup drawing context
|
// Setup drawing context
|
||||||
|
// (NB: That term "drawing context / DC" lost its meaning a long time ago. Initially was meant to hold transient data only. Nowadays difference between window-> and window->DC-> is dubious.)
|
||||||
window->DC.IndentX = 0.0f + window->WindowPadding.x - window->Scroll.x;
|
window->DC.IndentX = 0.0f + window->WindowPadding.x - window->Scroll.x;
|
||||||
window->DC.GroupOffsetX = 0.0f;
|
window->DC.GroupOffsetX = 0.0f;
|
||||||
window->DC.ColumnsOffsetX = 0.0f;
|
window->DC.ColumnsOffsetX = 0.0f;
|
||||||
@ -5305,8 +5314,7 @@ bool ImGui::IsWindowAppearing()
|
|||||||
|
|
||||||
void ImGui::SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond)
|
void ImGui::SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = FindWindowByName(name);
|
if (ImGuiWindow* window = FindWindowByName(name))
|
||||||
if (window)
|
|
||||||
SetWindowCollapsed(window, collapsed, cond);
|
SetWindowCollapsed(window, collapsed, cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5858,6 +5866,10 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
if ((flags & ImGuiButtonFlags_FlattenChilds) && g.HoveredRootWindow == window)
|
if ((flags & ImGuiButtonFlags_FlattenChilds) && g.HoveredRootWindow == window)
|
||||||
g.HoveredWindow = backup_hovered_window;
|
g.HoveredWindow = backup_hovered_window;
|
||||||
|
|
||||||
|
// AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. This allows using patterns where a later submitted widget overlaps a previous one.
|
||||||
|
if (hovered && (flags & ImGuiButtonFlags_AllowOverlapMode) && (g.HoveredIdPreviousFrame != id && g.HoveredIdPreviousFrame != 0))
|
||||||
|
hovered = false;
|
||||||
|
|
||||||
if (hovered)
|
if (hovered)
|
||||||
{
|
{
|
||||||
if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))
|
if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))
|
||||||
@ -5877,12 +5889,16 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
{
|
{
|
||||||
pressed = true;
|
pressed = true;
|
||||||
if (flags & ImGuiButtonFlags_NoHoldingActiveID)
|
if (flags & ImGuiButtonFlags_NoHoldingActiveID)
|
||||||
|
{
|
||||||
ClearActiveID();
|
ClearActiveID();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SetActiveID(id, window); // Hold on ID
|
SetActiveID(id, window); // Hold on ID
|
||||||
FocusWindow(window);
|
|
||||||
g.ActiveIdClickOffset = g.IO.MousePos - bb.Min;
|
g.ActiveIdClickOffset = g.IO.MousePos - bb.Min;
|
||||||
}
|
}
|
||||||
|
FocusWindow(window);
|
||||||
|
}
|
||||||
if ((flags & ImGuiButtonFlags_PressedOnRelease) && g.IO.MouseReleased[0])
|
if ((flags & ImGuiButtonFlags_PressedOnRelease) && g.IO.MouseReleased[0])
|
||||||
{
|
{
|
||||||
if (!((flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[0] >= g.IO.KeyRepeatDelay)) // Repeat mode trumps <on release>
|
if (!((flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[0] >= g.IO.KeyRepeatDelay)) // Repeat mode trumps <on release>
|
||||||
@ -5914,10 +5930,6 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. This allows using patterns where a later submitted widget overlaps a previous one.
|
|
||||||
if (hovered && (flags & ImGuiButtonFlags_AllowOverlapMode) && (g.HoveredIdPreviousFrame != id && g.HoveredIdPreviousFrame != 0))
|
|
||||||
hovered = pressed = held = false;
|
|
||||||
|
|
||||||
if (out_hovered) *out_hovered = hovered;
|
if (out_hovered) *out_hovered = hovered;
|
||||||
if (out_held) *out_held = held;
|
if (out_held) *out_held = held;
|
||||||
|
|
||||||
@ -6023,6 +6035,34 @@ bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos, float radius)
|
|||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [Internal]
|
||||||
|
bool ImGui::ArrowButton(ImGuiID id, ImGuiDir dir, ImVec2 padding, ImGuiButtonFlags flags)
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
|
if (window->SkipItems)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const ImGuiStyle& style = g.Style;
|
||||||
|
|
||||||
|
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize + padding.x * 2.0f, g.FontSize + padding.y * 2.0f));
|
||||||
|
ItemSize(bb, style.FramePadding.y);
|
||||||
|
if (!ItemAdd(bb, id))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool hovered, held;
|
||||||
|
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
|
||||||
|
|
||||||
|
const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
||||||
|
#ifdef IMGUI_HAS_NAV
|
||||||
|
RenderNavHighlight(bb, id);
|
||||||
|
#endif
|
||||||
|
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
||||||
|
RenderTriangle(bb.Min + padding, dir, 1.0f);
|
||||||
|
|
||||||
|
return pressed;
|
||||||
|
}
|
||||||
|
|
||||||
void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col)
|
void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
@ -8133,7 +8173,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|||||||
const float mouse_x = (io.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + edit_state.ScrollX;
|
const float mouse_x = (io.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + edit_state.ScrollX;
|
||||||
const float mouse_y = (is_multiline ? (io.MousePos.y - draw_window->DC.CursorPos.y - style.FramePadding.y) : (g.FontSize*0.5f));
|
const float mouse_y = (is_multiline ? (io.MousePos.y - draw_window->DC.CursorPos.y - style.FramePadding.y) : (g.FontSize*0.5f));
|
||||||
|
|
||||||
const bool osx_double_click_selects_words = io.OSXBehaviors; // OS X style: Double click selects by word instead of selecting whole text
|
const bool osx_double_click_selects_words = io.OptMacOSXBehaviors; // OS X style: Double click selects by word instead of selecting whole text
|
||||||
if (select_all || (hovered && !osx_double_click_selects_words && io.MouseDoubleClicked[0]))
|
if (select_all || (hovered && !osx_double_click_selects_words && io.MouseDoubleClicked[0]))
|
||||||
{
|
{
|
||||||
edit_state.SelectAll();
|
edit_state.SelectAll();
|
||||||
@ -8185,9 +8225,9 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|||||||
{
|
{
|
||||||
// Handle key-presses
|
// Handle key-presses
|
||||||
const int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0);
|
const int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0);
|
||||||
const bool is_shortcut_key_only = (io.OSXBehaviors ? (io.KeySuper && !io.KeyCtrl) : (io.KeyCtrl && !io.KeySuper)) && !io.KeyAlt && !io.KeyShift; // OS X style: Shortcuts using Cmd/Super instead of Ctrl
|
const bool is_shortcut_key_only = (io.OptMacOSXBehaviors ? (io.KeySuper && !io.KeyCtrl) : (io.KeyCtrl && !io.KeySuper)) && !io.KeyAlt && !io.KeyShift; // OS X style: Shortcuts using Cmd/Super instead of Ctrl
|
||||||
const bool is_wordmove_key_down = io.OSXBehaviors ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl
|
const bool is_wordmove_key_down = io.OptMacOSXBehaviors ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl
|
||||||
const bool is_startend_key_down = io.OSXBehaviors && io.KeySuper && !io.KeyCtrl && !io.KeyAlt; // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End
|
const bool is_startend_key_down = io.OptMacOSXBehaviors && io.KeySuper && !io.KeyCtrl && !io.KeyAlt; // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End
|
||||||
|
|
||||||
if (IsKeyPressedMap(ImGuiKey_LeftArrow)) { edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); }
|
if (IsKeyPressedMap(ImGuiKey_LeftArrow)) { edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); }
|
||||||
else if (IsKeyPressedMap(ImGuiKey_RightArrow)) { edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); }
|
else if (IsKeyPressedMap(ImGuiKey_RightArrow)) { edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); }
|
||||||
@ -8201,7 +8241,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|||||||
if (!edit_state.HasSelection())
|
if (!edit_state.HasSelection())
|
||||||
{
|
{
|
||||||
if (is_wordmove_key_down) edit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT|STB_TEXTEDIT_K_SHIFT);
|
if (is_wordmove_key_down) edit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT|STB_TEXTEDIT_K_SHIFT);
|
||||||
else if (io.OSXBehaviors && io.KeySuper && !io.KeyAlt && !io.KeyCtrl) edit_state.OnKeyPressed(STB_TEXTEDIT_K_LINESTART|STB_TEXTEDIT_K_SHIFT);
|
else if (io.OptMacOSXBehaviors && io.KeySuper && !io.KeyAlt && !io.KeyCtrl) edit_state.OnKeyPressed(STB_TEXTEDIT_K_LINESTART|STB_TEXTEDIT_K_SHIFT);
|
||||||
}
|
}
|
||||||
edit_state.OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask);
|
edit_state.OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask);
|
||||||
}
|
}
|
||||||
@ -8525,7 +8565,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|||||||
draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos - render_scroll, GetColorU32(ImGuiCol_Text), buf_display, buf_display + edit_state.CurLenA, 0.0f, is_multiline ? NULL : &clip_rect);
|
draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos - render_scroll, GetColorU32(ImGuiCol_Text), buf_display, buf_display + edit_state.CurLenA, 0.0f, is_multiline ? NULL : &clip_rect);
|
||||||
|
|
||||||
// Draw blinking cursor
|
// Draw blinking cursor
|
||||||
bool cursor_is_visible = (g.InputTextState.CursorAnim <= 0.0f) || fmodf(g.InputTextState.CursorAnim, 1.20f) <= 0.80f;
|
bool cursor_is_visible = (!g.IO.OptCursorBlink) || (g.InputTextState.CursorAnim <= 0.0f) || fmodf(g.InputTextState.CursorAnim, 1.20f) <= 0.80f;
|
||||||
ImVec2 cursor_screen_pos = render_pos + cursor_offset - render_scroll;
|
ImVec2 cursor_screen_pos = render_pos + cursor_offset - render_scroll;
|
||||||
ImRect cursor_screen_rect(cursor_screen_pos.x, cursor_screen_pos.y-g.FontSize+0.5f, cursor_screen_pos.x+1.0f, cursor_screen_pos.y-1.5f);
|
ImRect cursor_screen_rect(cursor_screen_pos.x, cursor_screen_pos.y-g.FontSize+0.5f, cursor_screen_pos.x+1.0f, cursor_screen_pos.y-1.5f);
|
||||||
if (cursor_is_visible && cursor_screen_rect.Overlaps(clip_rect))
|
if (cursor_is_visible && cursor_screen_rect.Overlaps(clip_rect))
|
||||||
@ -9135,7 +9175,7 @@ bool ImGui::MenuItem(const char* label, const char* shortcut, bool selected, boo
|
|||||||
PopStyleColor();
|
PopStyleColor();
|
||||||
}
|
}
|
||||||
if (selected)
|
if (selected)
|
||||||
RenderCheckMark(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * (0.20f+0.200f), g.FontSize * 0.134f * 0.5f), GetColorU32(enabled ? ImGuiCol_Text : ImGuiCol_TextDisabled), g.FontSize * 0.866f);
|
RenderCheckMark(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.40f, g.FontSize * 0.134f * 0.5f), GetColorU32(enabled ? ImGuiCol_Text : ImGuiCol_TextDisabled), g.FontSize * 0.866f);
|
||||||
}
|
}
|
||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
@ -9254,7 +9294,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
|||||||
float extra_w = ImMax(0.0f, GetContentRegionAvail().x - w);
|
float extra_w = ImMax(0.0f, GetContentRegionAvail().x - w);
|
||||||
pressed = Selectable(label, menu_is_open, ImGuiSelectableFlags_Menu | ImGuiSelectableFlags_DontClosePopups | ImGuiSelectableFlags_DrawFillAvailWidth | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f));
|
pressed = Selectable(label, menu_is_open, ImGuiSelectableFlags_Menu | ImGuiSelectableFlags_DontClosePopups | ImGuiSelectableFlags_DrawFillAvailWidth | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f));
|
||||||
if (!enabled) PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);
|
if (!enabled) PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);
|
||||||
RenderTriangle(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.20f, 0.0f), ImGuiDir_Right);
|
RenderTriangle(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.30f, 0.0f), ImGuiDir_Right);
|
||||||
if (!enabled) PopStyleColor();
|
if (!enabled) PopStyleColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10496,8 +10536,8 @@ void ImGui::EndColumns()
|
|||||||
{
|
{
|
||||||
float x = window->Pos.x + GetColumnOffset(i);
|
float x = window->Pos.x + GetColumnOffset(i);
|
||||||
const ImGuiID column_id = window->DC.ColumnsSetId + ImGuiID(i);
|
const ImGuiID column_id = window->DC.ColumnsSetId + ImGuiID(i);
|
||||||
const float column_w = 4.0f; // Width for interaction
|
const float column_hw = 4.0f; // Half-width for interaction
|
||||||
const ImRect column_rect(ImVec2(x - column_w, y1), ImVec2(x + column_w, y2));
|
const ImRect column_rect(ImVec2(x - column_hw, y1), ImVec2(x + column_hw, y2));
|
||||||
if (IsClippedEx(column_rect, column_id, false))
|
if (IsClippedEx(column_rect, column_id, false))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -10508,15 +10548,16 @@ void ImGui::EndColumns()
|
|||||||
if (hovered || held)
|
if (hovered || held)
|
||||||
g.MouseCursor = ImGuiMouseCursor_ResizeEW;
|
g.MouseCursor = ImGuiMouseCursor_ResizeEW;
|
||||||
if (held && g.ActiveIdIsJustActivated)
|
if (held && g.ActiveIdIsJustActivated)
|
||||||
g.ActiveIdClickOffset.x -= column_w; // Store from center of column line (we used a 8 wide rect for columns clicking). This is used by GetDraggedColumnOffset().
|
g.ActiveIdClickOffset.x -= column_hw; // Store from center of column line (we used a 8 wide rect for columns clicking). This is used by GetDraggedColumnOffset().
|
||||||
if (held)
|
if (held)
|
||||||
dragging_column = i;
|
dragging_column = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw column
|
// Draw column
|
||||||
|
// We clip the Y boundaries CPU side because very long triangles are mishandled by some GPU drivers.
|
||||||
const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : hovered ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);
|
const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : hovered ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);
|
||||||
const float xi = (float)(int)x;
|
const float xi = (float)(int)x;
|
||||||
window->DrawList->AddLine(ImVec2(xi, y1 + 1.0f), ImVec2(xi, y2), col);
|
window->DrawList->AddLine(ImVec2(xi, ImMax(y1 + 1.0f, window->ClipRect.Min.y)), ImVec2(xi, ImMin(y2, window->ClipRect.Max.y)), col);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply dragging after drawing the column lines, so our rendered lines are in sync with how items were displayed during the frame.
|
// Apply dragging after drawing the column lines, so our rendered lines are in sync with how items were displayed during the frame.
|
||||||
|
3
imgui.h
3
imgui.h
@ -827,7 +827,8 @@ struct ImGuiIO
|
|||||||
ImVec2 DisplayVisibleMax; // <unset> (0.0f,0.0f) // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize
|
ImVec2 DisplayVisibleMax; // <unset> (0.0f,0.0f) // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize
|
||||||
|
|
||||||
// Advanced/subtle behaviors
|
// Advanced/subtle behaviors
|
||||||
bool OSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl
|
bool OptMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl
|
||||||
|
bool OptCursorBlink; // = true // Enable blinking cursor, for users who consider it annoying.
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Settings (User Functions)
|
// Settings (User Functions)
|
||||||
|
@ -1652,14 +1652,19 @@ void ImGui::ShowTestWindow(bool* p_open)
|
|||||||
if (ImGui::TreeNode("Horizontal Scrolling"))
|
if (ImGui::TreeNode("Horizontal Scrolling"))
|
||||||
{
|
{
|
||||||
ImGui::SetNextWindowContentWidth(1500);
|
ImGui::SetNextWindowContentWidth(1500);
|
||||||
ImGui::BeginChild("##scrollingregion", ImVec2(0, 120), false, ImGuiWindowFlags_HorizontalScrollbar);
|
ImGui::BeginChild("##ScrollingRegion", ImVec2(0, ImGui::GetFontSize() * 20), false, ImGuiWindowFlags_HorizontalScrollbar);
|
||||||
ImGui::Columns(10);
|
ImGui::Columns(10);
|
||||||
for (int i = 0; i < 20; i++)
|
int ITEMS_COUNT = 2000;
|
||||||
|
ImGuiListClipper clipper(ITEMS_COUNT); // Also demonstrate using the clipper for large list
|
||||||
|
while (clipper.Step())
|
||||||
|
{
|
||||||
|
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
|
||||||
for (int j = 0; j < 10; j++)
|
for (int j = 0; j < 10; j++)
|
||||||
{
|
{
|
||||||
ImGui::Text("Line %d Column %d...", i, j);
|
ImGui::Text("Line %d Column %d...", i, j);
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ImGui::Columns(1);
|
ImGui::Columns(1);
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
@ -2145,31 +2150,40 @@ static void ShowExampleAppConstrainedResize(bool* p_open)
|
|||||||
static void Step(ImGuiSizeConstraintCallbackData* data) { float step = (float)(int)(intptr_t)data->UserData; data->DesiredSize = ImVec2((int)(data->DesiredSize.x / step + 0.5f) * step, (int)(data->DesiredSize.y / step + 0.5f) * step); }
|
static void Step(ImGuiSizeConstraintCallbackData* data) { float step = (float)(int)(intptr_t)data->UserData; data->DesiredSize = ImVec2((int)(data->DesiredSize.x / step + 0.5f) * step, (int)(data->DesiredSize.y / step + 0.5f) * step); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool auto_resize = false;
|
||||||
static int type = 0;
|
static int type = 0;
|
||||||
|
static int display_lines = 10;
|
||||||
if (type == 0) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 0), ImVec2(-1, FLT_MAX)); // Vertical only
|
if (type == 0) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 0), ImVec2(-1, FLT_MAX)); // Vertical only
|
||||||
if (type == 1) ImGui::SetNextWindowSizeConstraints(ImVec2(0, -1), ImVec2(FLT_MAX, -1)); // Horizontal only
|
if (type == 1) ImGui::SetNextWindowSizeConstraints(ImVec2(0, -1), ImVec2(FLT_MAX, -1)); // Horizontal only
|
||||||
if (type == 2) ImGui::SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(FLT_MAX, FLT_MAX)); // Width > 100, Height > 100
|
if (type == 2) ImGui::SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(FLT_MAX, FLT_MAX)); // Width > 100, Height > 100
|
||||||
if (type == 3) ImGui::SetNextWindowSizeConstraints(ImVec2(300, 0), ImVec2(400, FLT_MAX)); // Width 300-400
|
if (type == 3) ImGui::SetNextWindowSizeConstraints(ImVec2(400, -1), ImVec2(500, -1)); // Width 400-500
|
||||||
if (type == 4) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Square); // Always Square
|
if (type == 4) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 400), ImVec2(-1, 500)); // Height 400-500
|
||||||
if (type == 5) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Step, (void*)100);// Fixed Step
|
if (type == 5) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Square); // Always Square
|
||||||
|
if (type == 6) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Step, (void*)100);// Fixed Step
|
||||||
|
|
||||||
if (ImGui::Begin("Example: Constrained Resize", p_open))
|
ImGuiWindowFlags flags = auto_resize ? ImGuiWindowFlags_AlwaysAutoResize : 0;
|
||||||
|
if (ImGui::Begin("Example: Constrained Resize", p_open, flags))
|
||||||
{
|
{
|
||||||
const char* desc[] =
|
const char* desc[] =
|
||||||
{
|
{
|
||||||
"Resize vertical only",
|
"Resize vertical only",
|
||||||
"Resize horizontal only",
|
"Resize horizontal only",
|
||||||
"Width > 100, Height > 100",
|
"Width > 100, Height > 100",
|
||||||
"Width 300-400",
|
"Width 400-500",
|
||||||
|
"Height 400-500",
|
||||||
"Custom: Always Square",
|
"Custom: Always Square",
|
||||||
"Custom: Fixed Steps (100)",
|
"Custom: Fixed Steps (100)",
|
||||||
};
|
};
|
||||||
ImGui::Combo("Constraint", &type, desc, IM_ARRAYSIZE(desc));
|
|
||||||
if (ImGui::Button("200x200")) { ImGui::SetWindowSize(ImVec2(200, 200)); } ImGui::SameLine();
|
if (ImGui::Button("200x200")) { ImGui::SetWindowSize(ImVec2(200, 200)); } ImGui::SameLine();
|
||||||
if (ImGui::Button("500x500")) { ImGui::SetWindowSize(ImVec2(500, 500)); } ImGui::SameLine();
|
if (ImGui::Button("500x500")) { ImGui::SetWindowSize(ImVec2(500, 500)); } ImGui::SameLine();
|
||||||
if (ImGui::Button("800x200")) { ImGui::SetWindowSize(ImVec2(800, 200)); }
|
if (ImGui::Button("800x200")) { ImGui::SetWindowSize(ImVec2(800, 200)); }
|
||||||
for (int i = 0; i < 10; i++)
|
ImGui::PushItemWidth(200);
|
||||||
ImGui::Text("Hello, sailor! Making this line long enough for the example.");
|
ImGui::Combo("Constraint", &type, desc, IM_ARRAYSIZE(desc));
|
||||||
|
ImGui::DragInt("Lines", &display_lines, 0.2f, 1, 100);
|
||||||
|
ImGui::PopItemWidth();
|
||||||
|
ImGui::Checkbox("Auto-resize", &auto_resize);
|
||||||
|
for (int i = 0; i < display_lines; i++)
|
||||||
|
ImGui::Text("%*sHello, sailor! Making this line long enough for the example.", i * 4, "");
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
@ -2318,7 +2332,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|||||||
points.pop_back();
|
points.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
draw_list->PushClipRect(canvas_pos, ImVec2(canvas_pos.x+canvas_size.x, canvas_pos.y+canvas_size.y)); // clip lines within the canvas (if we resize it, etc.)
|
draw_list->PushClipRect(canvas_pos, ImVec2(canvas_pos.x+canvas_size.x, canvas_pos.y+canvas_size.y), true); // clip lines within the canvas (if we resize it, etc.)
|
||||||
for (int i = 0; i < points.Size - 1; i += 2)
|
for (int i = 0; i < points.Size - 1; i += 2)
|
||||||
draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i+1].x, canvas_pos.y + points[i+1].y), IM_COL32(255,255,0,255), 2.0f);
|
draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i+1].x, canvas_pos.y + points[i+1].y), IM_COL32(255,255,0,255), 2.0f);
|
||||||
draw_list->PopClipRect();
|
draw_list->PopClipRect();
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
// (internals)
|
// (internals)
|
||||||
|
|
||||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||||
// Implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators)
|
// Set:
|
||||||
// #define IMGUI_DEFINE_MATH_OPERATORS
|
// #define IMGUI_DEFINE_MATH_OPERATORS
|
||||||
// Define IM_PLACEMENT_NEW() macro helper.
|
// To implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators)
|
||||||
// #define IMGUI_DEFINE_PLACEMENT_NEW
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -159,12 +158,10 @@ static inline float ImLinearSweep(float current, float target, float speed)
|
|||||||
|
|
||||||
// We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax.
|
// We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax.
|
||||||
// Defining a custom placement new() with a dummy parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions.
|
// Defining a custom placement new() with a dummy parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions.
|
||||||
#ifdef IMGUI_DEFINE_PLACEMENT_NEW
|
|
||||||
struct ImPlacementNewDummy {};
|
struct ImPlacementNewDummy {};
|
||||||
inline void* operator new(size_t, ImPlacementNewDummy, void* ptr) { return ptr; }
|
inline void* operator new(size_t, ImPlacementNewDummy, void* ptr) { return ptr; }
|
||||||
inline void operator delete(void*, ImPlacementNewDummy, void*) {}
|
inline void operator delete(void*, ImPlacementNewDummy, void*) {}
|
||||||
#define IM_PLACEMENT_NEW(_PTR) new(ImPlacementNewDummy(), _PTR)
|
#define IM_PLACEMENT_NEW(_PTR) new(ImPlacementNewDummy(), _PTR)
|
||||||
#endif
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Types
|
// Types
|
||||||
@ -423,6 +420,7 @@ struct ImGuiContext
|
|||||||
ImVector<ImGuiWindow*> Windows;
|
ImVector<ImGuiWindow*> Windows;
|
||||||
ImVector<ImGuiWindow*> WindowsSortBuffer;
|
ImVector<ImGuiWindow*> WindowsSortBuffer;
|
||||||
ImVector<ImGuiWindow*> CurrentWindowStack;
|
ImVector<ImGuiWindow*> CurrentWindowStack;
|
||||||
|
ImGuiStorage WindowsById;
|
||||||
ImGuiWindow* CurrentWindow; // Being drawn into
|
ImGuiWindow* CurrentWindow; // Being drawn into
|
||||||
ImGuiWindow* NavWindow; // Nav/focused window for navigation
|
ImGuiWindow* NavWindow; // Nav/focused window for navigation
|
||||||
ImGuiWindow* HoveredWindow; // Will catch mouse inputs
|
ImGuiWindow* HoveredWindow; // Will catch mouse inputs
|
||||||
@ -866,6 +864,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
||||||
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0);
|
||||||
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos, float radius);
|
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos, float radius);
|
||||||
|
IMGUI_API bool ArrowButton(ImGuiID id, ImGuiDir dir, ImVec2 padding, ImGuiButtonFlags flags = 0);
|
||||||
|
|
||||||
IMGUI_API bool SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags = 0);
|
IMGUI_API bool SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderFloatN(const char* label, float* v, int components, float v_min, float v_max, const char* display_format, float power);
|
IMGUI_API bool SliderFloatN(const char* label, float* v, int components, float v_min, float v_max, const char* display_format, float power);
|
||||||
|
Loading…
Reference in New Issue
Block a user