mirror of
https://github.com/ocornut/imgui.git
synced 2026-07-07 18:09:39 +00:00
Compare commits
94 Commits
v1.90.6-do
...
external/w
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebbd8c320d | ||
|
|
3232e7bb03 | ||
|
|
15545a7925 | ||
|
|
86049c5d5b | ||
|
|
7260bb51cf | ||
|
|
6f7b5d0ee2 | ||
|
|
67d886fd63 | ||
|
|
2a418f054d | ||
|
|
f1eaf8d7c0 | ||
|
|
47db0698d2 | ||
|
|
3460014e05 | ||
|
|
0561d708ba | ||
|
|
219c6adc58 | ||
|
|
b95b2b4574 | ||
|
|
209edcc247 | ||
|
|
a31aa683ff | ||
|
|
f8de9fec8c | ||
|
|
68a05e3f04 | ||
|
|
6cefd4fd88 | ||
|
|
8ab8965713 | ||
|
|
9aec6d7217 | ||
|
|
0fce21e890 | ||
|
|
854e21d4b4 | ||
|
|
538960bf17 | ||
|
|
f953ebf9ca | ||
|
|
e47015aef4 | ||
|
|
97a1111b94 | ||
|
|
661c388515 | ||
|
|
868f444620 | ||
|
|
109a8632d7 | ||
|
|
51823d117d | ||
|
|
5cbc34a10c | ||
|
|
479c5f62fc | ||
|
|
ed9eb880b5 | ||
|
|
5a1a9a804a | ||
|
|
7f5d5c80b2 | ||
|
|
1f9fc382c3 | ||
|
|
00ad3c65bc | ||
|
|
f814ef816f | ||
|
|
b9084949bd | ||
|
|
86931393a3 | ||
|
|
7832e6a70e | ||
|
|
85d982011e | ||
|
|
ce4e210dcb | ||
|
|
5ce3d29955 | ||
|
|
650cb51bf1 | ||
|
|
ef9d525f02 | ||
|
|
16b72f2d21 | ||
|
|
29439bdd27 | ||
|
|
374b9a7fb4 | ||
|
|
c150ad50c4 | ||
|
|
1002cfa6d2 | ||
|
|
7c71e66370 | ||
|
|
d5a600e9c6 | ||
|
|
0eb025f484 | ||
|
|
a689fa262a | ||
|
|
c06e6340cd | ||
|
|
77e4171894 | ||
|
|
197f8904fe | ||
|
|
dc5caa483c | ||
|
|
fc512a2474 | ||
|
|
85513de247 | ||
|
|
900b29055c | ||
|
|
55748cdbe1 | ||
|
|
ec1d2be96f | ||
|
|
6d1a6f1c74 | ||
|
|
4c3eac2c10 | ||
|
|
a1566c5e1b | ||
|
|
aa725ca79d | ||
|
|
cd48059dc5 | ||
|
|
28a283b460 | ||
|
|
aa5a6098ee | ||
|
|
d39ca33b63 | ||
|
|
ae8218a3ea | ||
|
|
25e279ee73 | ||
|
|
b4f564c1ed | ||
|
|
5107e58b0f | ||
|
|
8bd5d1d42f | ||
|
|
7747106647 | ||
|
|
07dbcf1f70 | ||
|
|
93daf23223 | ||
|
|
e45efa9951 | ||
|
|
5d973a87d4 | ||
|
|
af2fbf043d | ||
|
|
e4576914cb | ||
|
|
d0524df887 | ||
|
|
f806c76e97 | ||
|
|
f0912833ba | ||
|
|
ac90e1bd5b | ||
|
|
0a5d40a016 | ||
|
|
d06b8b58d8 | ||
|
|
5e23680454 | ||
|
|
510eb8f480 | ||
|
|
f48aae600a |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1 +1 @@
|
|||||||
custom: ['https://github.com/ocornut/imgui/wiki/Sponsors']
|
custom: ['https://github.com/ocornut/imgui/wiki/Funding']
|
||||||
|
|||||||
BIN
MS Sans Serif Bold.ttf
Normal file
BIN
MS Sans Serif Bold.ttf
Normal file
Binary file not shown.
BIN
MS Sans Serif.ttf
Normal file
BIN
MS Sans Serif.ttf
Normal file
Binary file not shown.
5
README.md
Normal file
5
README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
This is a fork of [Dear ImGui](https://github.com/ocornut/imgui) to style based on Windows 98
|
||||||
|
|
||||||
|
[Compare diff from master](https://github.com/JakeCoxon/imgui-win98/compare/master...JakeCoxon:win98)
|
||||||
|
|
||||||
|

|
||||||
@@ -423,6 +423,7 @@ static ImGuiKey ImGui_ImplAllegro5_KeyCodeToImGuiKey(int key_code)
|
|||||||
bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display)
|
bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
|
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
|
||||||
|
|
||||||
// Setup backend capabilities flags
|
// Setup backend capabilities flags
|
||||||
|
|||||||
@@ -263,6 +263,8 @@ int32_t ImGui_ImplAndroid_HandleInputEvent(const AInputEvent* input_event)
|
|||||||
|
|
||||||
bool ImGui_ImplAndroid_Init(ANativeWindow* window)
|
bool ImGui_ImplAndroid_Init(ANativeWindow* window)
|
||||||
{
|
{
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
|
|
||||||
g_Window = window;
|
g_Window = window;
|
||||||
g_Time = 0.0;
|
g_Time = 0.0;
|
||||||
|
|
||||||
|
|||||||
@@ -534,6 +534,7 @@ void ImGui_ImplDX10_InvalidateDeviceObjects()
|
|||||||
bool ImGui_ImplDX10_Init(ID3D10Device* device)
|
bool ImGui_ImplDX10_Init(ID3D10Device* device)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
||||||
|
|
||||||
// Setup backend capabilities flags
|
// Setup backend capabilities flags
|
||||||
|
|||||||
@@ -546,6 +546,7 @@ void ImGui_ImplDX11_InvalidateDeviceObjects()
|
|||||||
bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context)
|
bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
||||||
|
|
||||||
// Setup backend capabilities flags
|
// Setup backend capabilities flags
|
||||||
|
|||||||
@@ -702,6 +702,7 @@ bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FO
|
|||||||
D3D12_CPU_DESCRIPTOR_HANDLE font_srv_cpu_desc_handle, D3D12_GPU_DESCRIPTOR_HANDLE font_srv_gpu_desc_handle)
|
D3D12_CPU_DESCRIPTOR_HANDLE font_srv_cpu_desc_handle, D3D12_GPU_DESCRIPTOR_HANDLE font_srv_gpu_desc_handle)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
||||||
|
|
||||||
// Setup backend capabilities flags
|
// Setup backend capabilities flags
|
||||||
|
|||||||
@@ -285,6 +285,7 @@ void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data)
|
|||||||
bool ImGui_ImplDX9_Init(IDirect3DDevice9* device)
|
bool ImGui_ImplDX9_Init(IDirect3DDevice9* device)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
||||||
|
|
||||||
// Setup backend capabilities flags
|
// Setup backend capabilities flags
|
||||||
|
|||||||
@@ -556,6 +556,7 @@ void ImGui_ImplGlfw_SetCallbacksChainForAllWindows(bool chain_for_all_windows)
|
|||||||
static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, GlfwClientApi client_api)
|
static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, GlfwClientApi client_api)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
|
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
|
||||||
//printf("GLFW_VERSION: %d.%d.%d (%d)", GLFW_VERSION_MAJOR, GLFW_VERSION_MINOR, GLFW_VERSION_REVISION, GLFW_VERSION_COMBINED);
|
//printf("GLFW_VERSION: %d.%d.%d (%d)", GLFW_VERSION_MAJOR, GLFW_VERSION_MINOR, GLFW_VERSION_REVISION, GLFW_VERSION_COMBINED);
|
||||||
|
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ static ImGuiKey ImGui_ImplGLUT_KeyToImGuiKey(int key)
|
|||||||
bool ImGui_ImplGLUT_Init()
|
bool ImGui_ImplGLUT_Init()
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
|
|
||||||
#ifdef FREEGLUT
|
#ifdef FREEGLUT
|
||||||
io.BackendPlatformName = "imgui_impl_glut (freeglut)";
|
io.BackendPlatformName = "imgui_impl_glut (freeglut)";
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ struct ImGui_ImplMetal_Data
|
|||||||
ImGui_ImplMetal_Data() { memset(this, 0, sizeof(*this)); }
|
ImGui_ImplMetal_Data() { memset(this, 0, sizeof(*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
static ImGui_ImplMetal_Data* ImGui_ImplMetal_CreateBackendData() { return IM_NEW(ImGui_ImplMetal_Data)(); }
|
|
||||||
static ImGui_ImplMetal_Data* ImGui_ImplMetal_GetBackendData() { return ImGui::GetCurrentContext() ? (ImGui_ImplMetal_Data*)ImGui::GetIO().BackendRendererUserData : nullptr; }
|
static ImGui_ImplMetal_Data* ImGui_ImplMetal_GetBackendData() { return ImGui::GetCurrentContext() ? (ImGui_ImplMetal_Data*)ImGui::GetIO().BackendRendererUserData : nullptr; }
|
||||||
static void ImGui_ImplMetal_DestroyBackendData(){ IM_DELETE(ImGui_ImplMetal_GetBackendData()); }
|
static void ImGui_ImplMetal_DestroyBackendData(){ IM_DELETE(ImGui_ImplMetal_GetBackendData()); }
|
||||||
|
|
||||||
@@ -125,8 +124,11 @@ bool ImGui_ImplMetal_CreateDeviceObjects(MTL::Device* device)
|
|||||||
|
|
||||||
bool ImGui_ImplMetal_Init(id<MTLDevice> device)
|
bool ImGui_ImplMetal_Init(id<MTLDevice> device)
|
||||||
{
|
{
|
||||||
ImGui_ImplMetal_Data* bd = ImGui_ImplMetal_CreateBackendData();
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
|
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
||||||
|
|
||||||
|
ImGui_ImplMetal_Data* bd = IM_NEW(ImGui_ImplMetal_Data)();
|
||||||
io.BackendRendererUserData = (void*)bd;
|
io.BackendRendererUserData = (void*)bd;
|
||||||
io.BackendRendererName = "imgui_impl_metal";
|
io.BackendRendererName = "imgui_impl_metal";
|
||||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ static ImGui_ImplOpenGL2_Data* ImGui_ImplOpenGL2_GetBackendData()
|
|||||||
bool ImGui_ImplOpenGL2_Init()
|
bool ImGui_ImplOpenGL2_Init()
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
||||||
|
|
||||||
// Setup backend capabilities flags
|
// Setup backend capabilities flags
|
||||||
|
|||||||
@@ -275,6 +275,7 @@ struct ImGui_ImplOpenGL3_VtxAttribState
|
|||||||
bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
||||||
|
|
||||||
// Initialize our loader
|
// Initialize our loader
|
||||||
@@ -749,7 +750,7 @@ bool ImGui_ImplOpenGL3_CreateDeviceObjects()
|
|||||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||||
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
|
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
|
||||||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_BUFFER_PIXEL_UNPACK
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_BUFFER_PIXEL_UNPACK
|
||||||
GLint last_pixel_unpack_buffer;
|
GLint last_pixel_unpack_buffer = 0;
|
||||||
if (bd->GlVersion >= 210) { glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &last_pixel_unpack_buffer); glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); }
|
if (bd->GlVersion >= 210) { glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &last_pixel_unpack_buffer); glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); }
|
||||||
#endif
|
#endif
|
||||||
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
// THE REST OF YOUR APP SHOULD USE A DIFFERENT GL LOADER: ANY GL LOADER OF YOUR CHOICE.
|
// THE REST OF YOUR APP SHOULD USE A DIFFERENT GL LOADER: ANY GL LOADER OF YOUR CHOICE.
|
||||||
//
|
//
|
||||||
// IF YOU GET BUILD ERRORS IN THIS FILE (commonly macro redefinitions or function redefinitions):
|
// IF YOU GET BUILD ERRORS IN THIS FILE (commonly macro redefinitions or function redefinitions):
|
||||||
// IT LIKELY MEANS THAT YOU ARE BUILDING 'imgui_impl_opengl3.cpp' OR INCUDING 'imgui_impl_opengl3_loader.h'
|
// IT LIKELY MEANS THAT YOU ARE BUILDING 'imgui_impl_opengl3.cpp' OR INCLUDING 'imgui_impl_opengl3_loader.h'
|
||||||
// IN THE SAME COMPILATION UNIT AS ONE OF YOUR FILE WHICH IS USING A THIRD-PARTY OPENGL LOADER.
|
// IN THE SAME COMPILATION UNIT AS ONE OF YOUR FILE WHICH IS USING A THIRD-PARTY OPENGL LOADER.
|
||||||
// (e.g. COULD HAPPEN IF YOU ARE DOING A UNITY/JUMBO BUILD, OR INCLUDING .CPP FILES FROM OTHERS)
|
// (e.g. COULD HAPPEN IF YOU ARE DOING A UNITY/JUMBO BUILD, OR INCLUDING .CPP FILES FROM OTHERS)
|
||||||
// YOU SHOULD NOT BUILD BOTH IN THE SAME COMPILATION UNIT.
|
// YOU SHOULD NOT BUILD BOTH IN THE SAME COMPILATION UNIT.
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ struct ImGui_ImplOSX_Data
|
|||||||
ImGui_ImplOSX_Data() { memset(this, 0, sizeof(*this)); }
|
ImGui_ImplOSX_Data() { memset(this, 0, sizeof(*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
static ImGui_ImplOSX_Data* ImGui_ImplOSX_CreateBackendData() { return IM_NEW(ImGui_ImplOSX_Data)(); }
|
|
||||||
static ImGui_ImplOSX_Data* ImGui_ImplOSX_GetBackendData() { return (ImGui_ImplOSX_Data*)ImGui::GetIO().BackendPlatformUserData; }
|
static ImGui_ImplOSX_Data* ImGui_ImplOSX_GetBackendData() { return (ImGui_ImplOSX_Data*)ImGui::GetIO().BackendPlatformUserData; }
|
||||||
static void ImGui_ImplOSX_DestroyBackendData() { IM_DELETE(ImGui_ImplOSX_GetBackendData()); }
|
static void ImGui_ImplOSX_DestroyBackendData() { IM_DELETE(ImGui_ImplOSX_GetBackendData()); }
|
||||||
|
|
||||||
@@ -392,13 +391,15 @@ IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(void* _Nullable view) {
|
|||||||
bool ImGui_ImplOSX_Init(NSView* view)
|
bool ImGui_ImplOSX_Init(NSView* view)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
ImGui_ImplOSX_Data* bd = ImGui_ImplOSX_CreateBackendData();
|
IMGUI_CHECKVERSION();
|
||||||
io.BackendPlatformUserData = (void*)bd;
|
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
|
||||||
|
|
||||||
// Setup backend capabilities flags
|
// Setup backend capabilities flags
|
||||||
|
ImGui_ImplOSX_Data* bd = IM_NEW(ImGui_ImplOSX_Data)();
|
||||||
|
io.BackendPlatformUserData = (void*)bd;
|
||||||
|
io.BackendPlatformName = "imgui_impl_osx";
|
||||||
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
||||||
//io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
|
//io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
|
||||||
io.BackendPlatformName = "imgui_impl_osx";
|
|
||||||
|
|
||||||
bd->Observer = [ImGuiObserver new];
|
bd->Observer = [ImGuiObserver new];
|
||||||
|
|
||||||
|
|||||||
@@ -400,6 +400,7 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event)
|
|||||||
static bool ImGui_ImplSDL2_Init(SDL_Window* window, SDL_Renderer* renderer)
|
static bool ImGui_ImplSDL2_Init(SDL_Window* window, SDL_Renderer* renderer)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
|
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
|
||||||
|
|
||||||
// Check and store if we are on a SDL backend that supports global mouse position
|
// Check and store if we are on a SDL backend that supports global mouse position
|
||||||
|
|||||||
@@ -60,6 +60,14 @@
|
|||||||
#define SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE 0
|
#define SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// FIXME-LEGACY: remove when SDL 3.1.3 preview is released.
|
||||||
|
#ifndef SDLK_APOSTROPHE
|
||||||
|
#define SDLK_APOSTROPHE SDLK_QUOTE
|
||||||
|
#endif
|
||||||
|
#ifndef SDLK_GRAVE
|
||||||
|
#define SDLK_GRAVE SDLK_BACKQUOTE
|
||||||
|
#endif
|
||||||
|
|
||||||
// SDL Data
|
// SDL Data
|
||||||
struct ImGui_ImplSDL3_Data
|
struct ImGui_ImplSDL3_Data
|
||||||
{
|
{
|
||||||
@@ -145,7 +153,7 @@ static ImGuiKey ImGui_ImplSDL3_KeycodeToImGuiKey(int keycode)
|
|||||||
case SDLK_SPACE: return ImGuiKey_Space;
|
case SDLK_SPACE: return ImGuiKey_Space;
|
||||||
case SDLK_RETURN: return ImGuiKey_Enter;
|
case SDLK_RETURN: return ImGuiKey_Enter;
|
||||||
case SDLK_ESCAPE: return ImGuiKey_Escape;
|
case SDLK_ESCAPE: return ImGuiKey_Escape;
|
||||||
case SDLK_QUOTE: return ImGuiKey_Apostrophe;
|
case SDLK_APOSTROPHE: return ImGuiKey_Apostrophe;
|
||||||
case SDLK_COMMA: return ImGuiKey_Comma;
|
case SDLK_COMMA: return ImGuiKey_Comma;
|
||||||
case SDLK_MINUS: return ImGuiKey_Minus;
|
case SDLK_MINUS: return ImGuiKey_Minus;
|
||||||
case SDLK_PERIOD: return ImGuiKey_Period;
|
case SDLK_PERIOD: return ImGuiKey_Period;
|
||||||
@@ -155,7 +163,7 @@ static ImGuiKey ImGui_ImplSDL3_KeycodeToImGuiKey(int keycode)
|
|||||||
case SDLK_LEFTBRACKET: return ImGuiKey_LeftBracket;
|
case SDLK_LEFTBRACKET: return ImGuiKey_LeftBracket;
|
||||||
case SDLK_BACKSLASH: return ImGuiKey_Backslash;
|
case SDLK_BACKSLASH: return ImGuiKey_Backslash;
|
||||||
case SDLK_RIGHTBRACKET: return ImGuiKey_RightBracket;
|
case SDLK_RIGHTBRACKET: return ImGuiKey_RightBracket;
|
||||||
case SDLK_BACKQUOTE: return ImGuiKey_GraveAccent;
|
case SDLK_GRAVE: return ImGuiKey_GraveAccent;
|
||||||
case SDLK_CAPSLOCK: return ImGuiKey_CapsLock;
|
case SDLK_CAPSLOCK: return ImGuiKey_CapsLock;
|
||||||
case SDLK_SCROLLLOCK: return ImGuiKey_ScrollLock;
|
case SDLK_SCROLLLOCK: return ImGuiKey_ScrollLock;
|
||||||
case SDLK_NUMLOCKCLEAR: return ImGuiKey_NumLock;
|
case SDLK_NUMLOCKCLEAR: return ImGuiKey_NumLock;
|
||||||
@@ -369,6 +377,7 @@ static void ImGui_ImplSDL3_SetupPlatformHandles(ImGuiViewport* viewport, SDL_Win
|
|||||||
static bool ImGui_ImplSDL3_Init(SDL_Window* window, SDL_Renderer* renderer, void* sdl_gl_context)
|
static bool ImGui_ImplSDL3_Init(SDL_Window* window, SDL_Renderer* renderer, void* sdl_gl_context)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
|
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
|
||||||
IM_UNUSED(sdl_gl_context); // Unused in this branch
|
IM_UNUSED(sdl_gl_context); // Unused in this branch
|
||||||
|
|
||||||
@@ -404,15 +413,15 @@ static bool ImGui_ImplSDL3_Init(SDL_Window* window, SDL_Renderer* renderer, void
|
|||||||
bd->WantUpdateGamepadsList = true;
|
bd->WantUpdateGamepadsList = true;
|
||||||
|
|
||||||
// Load mouse cursors
|
// Load mouse cursors
|
||||||
bd->MouseCursors[ImGuiMouseCursor_Arrow] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
|
bd->MouseCursors[ImGuiMouseCursor_Arrow] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_DEFAULT);
|
||||||
bd->MouseCursors[ImGuiMouseCursor_TextInput] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM);
|
bd->MouseCursors[ImGuiMouseCursor_TextInput] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_TEXT);
|
||||||
bd->MouseCursors[ImGuiMouseCursor_ResizeAll] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL);
|
bd->MouseCursors[ImGuiMouseCursor_ResizeAll] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_MOVE);
|
||||||
bd->MouseCursors[ImGuiMouseCursor_ResizeNS] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENS);
|
bd->MouseCursors[ImGuiMouseCursor_ResizeNS] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NS_RESIZE);
|
||||||
bd->MouseCursors[ImGuiMouseCursor_ResizeEW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE);
|
bd->MouseCursors[ImGuiMouseCursor_ResizeEW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_EW_RESIZE);
|
||||||
bd->MouseCursors[ImGuiMouseCursor_ResizeNESW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENESW);
|
bd->MouseCursors[ImGuiMouseCursor_ResizeNESW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NESW_RESIZE);
|
||||||
bd->MouseCursors[ImGuiMouseCursor_ResizeNWSE] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENWSE);
|
bd->MouseCursors[ImGuiMouseCursor_ResizeNWSE] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NWSE_RESIZE);
|
||||||
bd->MouseCursors[ImGuiMouseCursor_Hand] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND);
|
bd->MouseCursors[ImGuiMouseCursor_Hand] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_POINTER);
|
||||||
bd->MouseCursors[ImGuiMouseCursor_NotAllowed] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO);
|
bd->MouseCursors[ImGuiMouseCursor_NotAllowed] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NOT_ALLOWED);
|
||||||
|
|
||||||
// Set platform dependent data in viewport
|
// Set platform dependent data in viewport
|
||||||
// Our mouse update function expect PlatformHandle to be filled for the main viewport
|
// Our mouse update function expect PlatformHandle to be filled for the main viewport
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
// - Introduction, links and more at the top of imgui.cpp
|
// - Introduction, links and more at the top of imgui.cpp
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
|
// 2024-05-14: *BREAKING CHANGE* ImGui_ImplSDLRenderer3_RenderDrawData() requires SDL_Renderer* passed as parameter.
|
||||||
// 2023-05-30: Renamed imgui_impl_sdlrenderer.h/.cpp to imgui_impl_sdlrenderer2.h/.cpp to accommodate for upcoming SDL3.
|
// 2023-05-30: Renamed imgui_impl_sdlrenderer.h/.cpp to imgui_impl_sdlrenderer2.h/.cpp to accommodate for upcoming SDL3.
|
||||||
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
|
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
|
||||||
// 2021-12-21: Update SDL_RenderGeometryRaw() format to work with SDL 2.0.19.
|
// 2021-12-21: Update SDL_RenderGeometryRaw() format to work with SDL 2.0.19.
|
||||||
@@ -47,9 +48,9 @@
|
|||||||
// SDL_Renderer data
|
// SDL_Renderer data
|
||||||
struct ImGui_ImplSDLRenderer2_Data
|
struct ImGui_ImplSDLRenderer2_Data
|
||||||
{
|
{
|
||||||
SDL_Renderer* SDLRenderer;
|
SDL_Renderer* Renderer; // Main viewport's renderer
|
||||||
SDL_Texture* FontTexture;
|
SDL_Texture* FontTexture;
|
||||||
ImGui_ImplSDLRenderer2_Data() { memset((void*)this, 0, sizeof(*this)); }
|
ImGui_ImplSDLRenderer2_Data() { memset((void*)this, 0, sizeof(*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts
|
// Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts
|
||||||
@@ -63,6 +64,7 @@ static ImGui_ImplSDLRenderer2_Data* ImGui_ImplSDLRenderer2_GetBackendData()
|
|||||||
bool ImGui_ImplSDLRenderer2_Init(SDL_Renderer* renderer)
|
bool ImGui_ImplSDLRenderer2_Init(SDL_Renderer* renderer)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
||||||
IM_ASSERT(renderer != nullptr && "SDL_Renderer not initialized!");
|
IM_ASSERT(renderer != nullptr && "SDL_Renderer not initialized!");
|
||||||
|
|
||||||
@@ -72,7 +74,7 @@ bool ImGui_ImplSDLRenderer2_Init(SDL_Renderer* renderer)
|
|||||||
io.BackendRendererName = "imgui_impl_sdlrenderer2";
|
io.BackendRendererName = "imgui_impl_sdlrenderer2";
|
||||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
||||||
|
|
||||||
bd->SDLRenderer = renderer;
|
bd->Renderer = renderer;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -91,14 +93,12 @@ void ImGui_ImplSDLRenderer2_Shutdown()
|
|||||||
IM_DELETE(bd);
|
IM_DELETE(bd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ImGui_ImplSDLRenderer2_SetupRenderState()
|
static void ImGui_ImplSDLRenderer2_SetupRenderState(SDL_Renderer* renderer)
|
||||||
{
|
{
|
||||||
ImGui_ImplSDLRenderer2_Data* bd = ImGui_ImplSDLRenderer2_GetBackendData();
|
|
||||||
|
|
||||||
// Clear out any viewports and cliprect set by the user
|
// Clear out any viewports and cliprect set by the user
|
||||||
// FIXME: Technically speaking there are lots of other things we could backup/setup/restore during our render process.
|
// FIXME: Technically speaking there are lots of other things we could backup/setup/restore during our render process.
|
||||||
SDL_RenderSetViewport(bd->SDLRenderer, nullptr);
|
SDL_RenderSetViewport(renderer, nullptr);
|
||||||
SDL_RenderSetClipRect(bd->SDLRenderer, nullptr);
|
SDL_RenderSetClipRect(renderer, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplSDLRenderer2_NewFrame()
|
void ImGui_ImplSDLRenderer2_NewFrame()
|
||||||
@@ -110,16 +110,14 @@ void ImGui_ImplSDLRenderer2_NewFrame()
|
|||||||
ImGui_ImplSDLRenderer2_CreateDeviceObjects();
|
ImGui_ImplSDLRenderer2_CreateDeviceObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplSDLRenderer2_RenderDrawData(ImDrawData* draw_data)
|
void ImGui_ImplSDLRenderer2_RenderDrawData(ImDrawData* draw_data, SDL_Renderer* renderer)
|
||||||
{
|
{
|
||||||
ImGui_ImplSDLRenderer2_Data* bd = ImGui_ImplSDLRenderer2_GetBackendData();
|
|
||||||
|
|
||||||
// If there's a scale factor set by the user, use that instead
|
// If there's a scale factor set by the user, use that instead
|
||||||
// If the user has specified a scale factor to SDL_Renderer already via SDL_RenderSetScale(), SDL will scale whatever we pass
|
// If the user has specified a scale factor to SDL_Renderer already via SDL_RenderSetScale(), SDL will scale whatever we pass
|
||||||
// to SDL_RenderGeometryRaw() by that scale factor. In that case we don't want to be also scaling it ourselves here.
|
// to SDL_RenderGeometryRaw() by that scale factor. In that case we don't want to be also scaling it ourselves here.
|
||||||
float rsx = 1.0f;
|
float rsx = 1.0f;
|
||||||
float rsy = 1.0f;
|
float rsy = 1.0f;
|
||||||
SDL_RenderGetScale(bd->SDLRenderer, &rsx, &rsy);
|
SDL_RenderGetScale(renderer, &rsx, &rsy);
|
||||||
ImVec2 render_scale;
|
ImVec2 render_scale;
|
||||||
render_scale.x = (rsx == 1.0f) ? draw_data->FramebufferScale.x : 1.0f;
|
render_scale.x = (rsx == 1.0f) ? draw_data->FramebufferScale.x : 1.0f;
|
||||||
render_scale.y = (rsy == 1.0f) ? draw_data->FramebufferScale.y : 1.0f;
|
render_scale.y = (rsy == 1.0f) ? draw_data->FramebufferScale.y : 1.0f;
|
||||||
@@ -138,16 +136,16 @@ void ImGui_ImplSDLRenderer2_RenderDrawData(ImDrawData* draw_data)
|
|||||||
SDL_Rect ClipRect;
|
SDL_Rect ClipRect;
|
||||||
};
|
};
|
||||||
BackupSDLRendererState old = {};
|
BackupSDLRendererState old = {};
|
||||||
old.ClipEnabled = SDL_RenderIsClipEnabled(bd->SDLRenderer) == SDL_TRUE;
|
old.ClipEnabled = SDL_RenderIsClipEnabled(renderer) == SDL_TRUE;
|
||||||
SDL_RenderGetViewport(bd->SDLRenderer, &old.Viewport);
|
SDL_RenderGetViewport(renderer, &old.Viewport);
|
||||||
SDL_RenderGetClipRect(bd->SDLRenderer, &old.ClipRect);
|
SDL_RenderGetClipRect(renderer, &old.ClipRect);
|
||||||
|
|
||||||
// Will project scissor/clipping rectangles into framebuffer space
|
// Will project scissor/clipping rectangles into framebuffer space
|
||||||
ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
|
ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
|
||||||
ImVec2 clip_scale = render_scale;
|
ImVec2 clip_scale = render_scale;
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
ImGui_ImplSDLRenderer2_SetupRenderState();
|
ImGui_ImplSDLRenderer2_SetupRenderState(renderer);
|
||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
@@ -162,7 +160,7 @@ void ImGui_ImplSDLRenderer2_RenderDrawData(ImDrawData* draw_data)
|
|||||||
// User callback, registered via ImDrawList::AddCallback()
|
// User callback, registered via ImDrawList::AddCallback()
|
||||||
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
|
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
|
||||||
if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
|
if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
|
||||||
ImGui_ImplSDLRenderer2_SetupRenderState();
|
ImGui_ImplSDLRenderer2_SetupRenderState(renderer);
|
||||||
else
|
else
|
||||||
pcmd->UserCallback(cmd_list, pcmd);
|
pcmd->UserCallback(cmd_list, pcmd);
|
||||||
}
|
}
|
||||||
@@ -179,7 +177,7 @@ void ImGui_ImplSDLRenderer2_RenderDrawData(ImDrawData* draw_data)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
SDL_Rect r = { (int)(clip_min.x), (int)(clip_min.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y) };
|
SDL_Rect r = { (int)(clip_min.x), (int)(clip_min.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y) };
|
||||||
SDL_RenderSetClipRect(bd->SDLRenderer, &r);
|
SDL_RenderSetClipRect(renderer, &r);
|
||||||
|
|
||||||
const float* xy = (const float*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + offsetof(ImDrawVert, pos));
|
const float* xy = (const float*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + offsetof(ImDrawVert, pos));
|
||||||
const float* uv = (const float*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + offsetof(ImDrawVert, uv));
|
const float* uv = (const float*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + offsetof(ImDrawVert, uv));
|
||||||
@@ -191,7 +189,7 @@ void ImGui_ImplSDLRenderer2_RenderDrawData(ImDrawData* draw_data)
|
|||||||
|
|
||||||
// Bind texture, Draw
|
// Bind texture, Draw
|
||||||
SDL_Texture* tex = (SDL_Texture*)pcmd->GetTexID();
|
SDL_Texture* tex = (SDL_Texture*)pcmd->GetTexID();
|
||||||
SDL_RenderGeometryRaw(bd->SDLRenderer, tex,
|
SDL_RenderGeometryRaw(renderer, tex,
|
||||||
xy, (int)sizeof(ImDrawVert),
|
xy, (int)sizeof(ImDrawVert),
|
||||||
color, (int)sizeof(ImDrawVert),
|
color, (int)sizeof(ImDrawVert),
|
||||||
uv, (int)sizeof(ImDrawVert),
|
uv, (int)sizeof(ImDrawVert),
|
||||||
@@ -202,8 +200,8 @@ void ImGui_ImplSDLRenderer2_RenderDrawData(ImDrawData* draw_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Restore modified SDL_Renderer state
|
// Restore modified SDL_Renderer state
|
||||||
SDL_RenderSetViewport(bd->SDLRenderer, &old.Viewport);
|
SDL_RenderSetViewport(renderer, &old.Viewport);
|
||||||
SDL_RenderSetClipRect(bd->SDLRenderer, old.ClipEnabled ? &old.ClipRect : nullptr);
|
SDL_RenderSetClipRect(renderer, old.ClipEnabled ? &old.ClipRect : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called by Init/NewFrame/Shutdown
|
// Called by Init/NewFrame/Shutdown
|
||||||
@@ -219,7 +217,7 @@ bool ImGui_ImplSDLRenderer2_CreateFontsTexture()
|
|||||||
|
|
||||||
// Upload texture to graphics system
|
// Upload texture to graphics system
|
||||||
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
|
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
|
||||||
bd->FontTexture = SDL_CreateTexture(bd->SDLRenderer, SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STATIC, width, height);
|
bd->FontTexture = SDL_CreateTexture(bd->Renderer, SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STATIC, width, height);
|
||||||
if (bd->FontTexture == nullptr)
|
if (bd->FontTexture == nullptr)
|
||||||
{
|
{
|
||||||
SDL_Log("error creating texture");
|
SDL_Log("error creating texture");
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ struct SDL_Renderer;
|
|||||||
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer2_Init(SDL_Renderer* renderer);
|
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer2_Init(SDL_Renderer* renderer);
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer2_Shutdown();
|
IMGUI_IMPL_API void ImGui_ImplSDLRenderer2_Shutdown();
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer2_NewFrame();
|
IMGUI_IMPL_API void ImGui_ImplSDLRenderer2_NewFrame();
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer2_RenderDrawData(ImDrawData* draw_data);
|
IMGUI_IMPL_API void ImGui_ImplSDLRenderer2_RenderDrawData(ImDrawData* draw_data, SDL_Renderer* renderer);
|
||||||
|
|
||||||
// Called by Init/NewFrame/Shutdown
|
// Called by Init/NewFrame/Shutdown
|
||||||
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer2_CreateFontsTexture();
|
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer2_CreateFontsTexture();
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
// - Introduction, links and more at the top of imgui.cpp
|
// - Introduction, links and more at the top of imgui.cpp
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
|
// 2024-05-14: *BREAKING CHANGE* ImGui_ImplSDLRenderer3_RenderDrawData() requires SDL_Renderer* passed as parameter.
|
||||||
// 2024-02-12: Amend to query SDL_RenderViewportSet() and restore viewport accordingly.
|
// 2024-02-12: Amend to query SDL_RenderViewportSet() and restore viewport accordingly.
|
||||||
// 2023-05-30: Initial version.
|
// 2023-05-30: Initial version.
|
||||||
|
|
||||||
@@ -43,9 +44,9 @@
|
|||||||
// SDL_Renderer data
|
// SDL_Renderer data
|
||||||
struct ImGui_ImplSDLRenderer3_Data
|
struct ImGui_ImplSDLRenderer3_Data
|
||||||
{
|
{
|
||||||
SDL_Renderer* SDLRenderer;
|
SDL_Renderer* Renderer; // Main viewport's renderer
|
||||||
SDL_Texture* FontTexture;
|
SDL_Texture* FontTexture;
|
||||||
ImGui_ImplSDLRenderer3_Data() { memset((void*)this, 0, sizeof(*this)); }
|
ImGui_ImplSDLRenderer3_Data() { memset((void*)this, 0, sizeof(*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts
|
// Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts
|
||||||
@@ -59,6 +60,7 @@ static ImGui_ImplSDLRenderer3_Data* ImGui_ImplSDLRenderer3_GetBackendData()
|
|||||||
bool ImGui_ImplSDLRenderer3_Init(SDL_Renderer* renderer)
|
bool ImGui_ImplSDLRenderer3_Init(SDL_Renderer* renderer)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
||||||
IM_ASSERT(renderer != nullptr && "SDL_Renderer not initialized!");
|
IM_ASSERT(renderer != nullptr && "SDL_Renderer not initialized!");
|
||||||
|
|
||||||
@@ -68,7 +70,7 @@ bool ImGui_ImplSDLRenderer3_Init(SDL_Renderer* renderer)
|
|||||||
io.BackendRendererName = "imgui_impl_sdlrenderer3";
|
io.BackendRendererName = "imgui_impl_sdlrenderer3";
|
||||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
||||||
|
|
||||||
bd->SDLRenderer = renderer;
|
bd->Renderer = renderer;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -87,14 +89,12 @@ void ImGui_ImplSDLRenderer3_Shutdown()
|
|||||||
IM_DELETE(bd);
|
IM_DELETE(bd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ImGui_ImplSDLRenderer3_SetupRenderState()
|
static void ImGui_ImplSDLRenderer3_SetupRenderState(SDL_Renderer* renderer)
|
||||||
{
|
{
|
||||||
ImGui_ImplSDLRenderer3_Data* bd = ImGui_ImplSDLRenderer3_GetBackendData();
|
|
||||||
|
|
||||||
// Clear out any viewports and cliprect set by the user
|
// Clear out any viewports and cliprect set by the user
|
||||||
// FIXME: Technically speaking there are lots of other things we could backup/setup/restore during our render process.
|
// FIXME: Technically speaking there are lots of other things we could backup/setup/restore during our render process.
|
||||||
SDL_SetRenderViewport(bd->SDLRenderer, nullptr);
|
SDL_SetRenderViewport(renderer, nullptr);
|
||||||
SDL_SetRenderClipRect(bd->SDLRenderer, nullptr);
|
SDL_SetRenderClipRect(renderer, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplSDLRenderer3_NewFrame()
|
void ImGui_ImplSDLRenderer3_NewFrame()
|
||||||
@@ -106,16 +106,14 @@ void ImGui_ImplSDLRenderer3_NewFrame()
|
|||||||
ImGui_ImplSDLRenderer3_CreateDeviceObjects();
|
ImGui_ImplSDLRenderer3_CreateDeviceObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data)
|
void ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data, SDL_Renderer* renderer)
|
||||||
{
|
{
|
||||||
ImGui_ImplSDLRenderer3_Data* bd = ImGui_ImplSDLRenderer3_GetBackendData();
|
|
||||||
|
|
||||||
// If there's a scale factor set by the user, use that instead
|
// If there's a scale factor set by the user, use that instead
|
||||||
// If the user has specified a scale factor to SDL_Renderer already via SDL_RenderSetScale(), SDL will scale whatever we pass
|
// If the user has specified a scale factor to SDL_Renderer already via SDL_RenderSetScale(), SDL will scale whatever we pass
|
||||||
// to SDL_RenderGeometryRaw() by that scale factor. In that case we don't want to be also scaling it ourselves here.
|
// to SDL_RenderGeometryRaw() by that scale factor. In that case we don't want to be also scaling it ourselves here.
|
||||||
float rsx = 1.0f;
|
float rsx = 1.0f;
|
||||||
float rsy = 1.0f;
|
float rsy = 1.0f;
|
||||||
SDL_GetRenderScale(bd->SDLRenderer, &rsx, &rsy);
|
SDL_GetRenderScale(renderer, &rsx, &rsy);
|
||||||
ImVec2 render_scale;
|
ImVec2 render_scale;
|
||||||
render_scale.x = (rsx == 1.0f) ? draw_data->FramebufferScale.x : 1.0f;
|
render_scale.x = (rsx == 1.0f) ? draw_data->FramebufferScale.x : 1.0f;
|
||||||
render_scale.y = (rsy == 1.0f) ? draw_data->FramebufferScale.y : 1.0f;
|
render_scale.y = (rsy == 1.0f) ? draw_data->FramebufferScale.y : 1.0f;
|
||||||
@@ -135,17 +133,17 @@ void ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
SDL_Rect ClipRect;
|
SDL_Rect ClipRect;
|
||||||
};
|
};
|
||||||
BackupSDLRendererState old = {};
|
BackupSDLRendererState old = {};
|
||||||
old.ViewportEnabled = SDL_RenderViewportSet(bd->SDLRenderer) == SDL_TRUE;
|
old.ViewportEnabled = SDL_RenderViewportSet(renderer) == SDL_TRUE;
|
||||||
old.ClipEnabled = SDL_RenderClipEnabled(bd->SDLRenderer) == SDL_TRUE;
|
old.ClipEnabled = SDL_RenderClipEnabled(renderer) == SDL_TRUE;
|
||||||
SDL_GetRenderViewport(bd->SDLRenderer, &old.Viewport);
|
SDL_GetRenderViewport(renderer, &old.Viewport);
|
||||||
SDL_GetRenderClipRect(bd->SDLRenderer, &old.ClipRect);
|
SDL_GetRenderClipRect(renderer, &old.ClipRect);
|
||||||
|
|
||||||
// Will project scissor/clipping rectangles into framebuffer space
|
// Will project scissor/clipping rectangles into framebuffer space
|
||||||
ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
|
ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
|
||||||
ImVec2 clip_scale = render_scale;
|
ImVec2 clip_scale = render_scale;
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
ImGui_ImplSDLRenderer3_SetupRenderState();
|
ImGui_ImplSDLRenderer3_SetupRenderState(renderer);
|
||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
@@ -160,7 +158,7 @@ void ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
// User callback, registered via ImDrawList::AddCallback()
|
// User callback, registered via ImDrawList::AddCallback()
|
||||||
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
|
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
|
||||||
if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
|
if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
|
||||||
ImGui_ImplSDLRenderer3_SetupRenderState();
|
ImGui_ImplSDLRenderer3_SetupRenderState(renderer);
|
||||||
else
|
else
|
||||||
pcmd->UserCallback(cmd_list, pcmd);
|
pcmd->UserCallback(cmd_list, pcmd);
|
||||||
}
|
}
|
||||||
@@ -177,7 +175,7 @@ void ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
SDL_Rect r = { (int)(clip_min.x), (int)(clip_min.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y) };
|
SDL_Rect r = { (int)(clip_min.x), (int)(clip_min.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y) };
|
||||||
SDL_SetRenderClipRect(bd->SDLRenderer, &r);
|
SDL_SetRenderClipRect(renderer, &r);
|
||||||
|
|
||||||
const float* xy = (const float*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + offsetof(ImDrawVert, pos));
|
const float* xy = (const float*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + offsetof(ImDrawVert, pos));
|
||||||
const float* uv = (const float*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + offsetof(ImDrawVert, uv));
|
const float* uv = (const float*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + offsetof(ImDrawVert, uv));
|
||||||
@@ -185,7 +183,7 @@ void ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
|
|
||||||
// Bind texture, Draw
|
// Bind texture, Draw
|
||||||
SDL_Texture* tex = (SDL_Texture*)pcmd->GetTexID();
|
SDL_Texture* tex = (SDL_Texture*)pcmd->GetTexID();
|
||||||
SDL_RenderGeometryRaw(bd->SDLRenderer, tex,
|
SDL_RenderGeometryRaw(renderer, tex,
|
||||||
xy, (int)sizeof(ImDrawVert),
|
xy, (int)sizeof(ImDrawVert),
|
||||||
color, (int)sizeof(ImDrawVert),
|
color, (int)sizeof(ImDrawVert),
|
||||||
uv, (int)sizeof(ImDrawVert),
|
uv, (int)sizeof(ImDrawVert),
|
||||||
@@ -196,8 +194,8 @@ void ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Restore modified SDL_Renderer state
|
// Restore modified SDL_Renderer state
|
||||||
SDL_SetRenderViewport(bd->SDLRenderer, old.ViewportEnabled ? &old.Viewport : nullptr);
|
SDL_SetRenderViewport(renderer, old.ViewportEnabled ? &old.Viewport : nullptr);
|
||||||
SDL_SetRenderClipRect(bd->SDLRenderer, old.ClipEnabled ? &old.ClipRect : nullptr);
|
SDL_SetRenderClipRect(renderer, old.ClipEnabled ? &old.ClipRect : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called by Init/NewFrame/Shutdown
|
// Called by Init/NewFrame/Shutdown
|
||||||
@@ -213,7 +211,7 @@ bool ImGui_ImplSDLRenderer3_CreateFontsTexture()
|
|||||||
|
|
||||||
// Upload texture to graphics system
|
// Upload texture to graphics system
|
||||||
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
|
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
|
||||||
bd->FontTexture = SDL_CreateTexture(bd->SDLRenderer, SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STATIC, width, height);
|
bd->FontTexture = SDL_CreateTexture(bd->Renderer, SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STATIC, width, height);
|
||||||
if (bd->FontTexture == nullptr)
|
if (bd->FontTexture == nullptr)
|
||||||
{
|
{
|
||||||
SDL_Log("error creating texture");
|
SDL_Log("error creating texture");
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ struct SDL_Renderer;
|
|||||||
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer3_Init(SDL_Renderer* renderer);
|
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer3_Init(SDL_Renderer* renderer);
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer3_Shutdown();
|
IMGUI_IMPL_API void ImGui_ImplSDLRenderer3_Shutdown();
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer3_NewFrame();
|
IMGUI_IMPL_API void ImGui_ImplSDLRenderer3_NewFrame();
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data);
|
IMGUI_IMPL_API void ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data, SDL_Renderer* renderer);
|
||||||
|
|
||||||
// Called by Init/NewFrame/Shutdown
|
// Called by Init/NewFrame/Shutdown
|
||||||
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer3_CreateFontsTexture();
|
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer3_CreateFontsTexture();
|
||||||
|
|||||||
@@ -42,14 +42,14 @@
|
|||||||
// 2024-01-03: Vulkan: Stopped creating command pools with VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT as we don't reset them.
|
// 2024-01-03: Vulkan: Stopped creating command pools with VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT as we don't reset them.
|
||||||
// 2023-11-29: Vulkan: Fixed mismatching allocator passed to vkCreateCommandPool() vs vkDestroyCommandPool(). (#7075)
|
// 2023-11-29: Vulkan: Fixed mismatching allocator passed to vkCreateCommandPool() vs vkDestroyCommandPool(). (#7075)
|
||||||
// 2023-11-10: *BREAKING CHANGE*: Removed parameter from ImGui_ImplVulkan_CreateFontsTexture(): backend now creates its own command-buffer to upload fonts.
|
// 2023-11-10: *BREAKING CHANGE*: Removed parameter from ImGui_ImplVulkan_CreateFontsTexture(): backend now creates its own command-buffer to upload fonts.
|
||||||
// *BREAKING CHANGE*: Removed ImGui_ImplVulkan_DestroyFontUploadObjects() which is now unecessary as we create and destroy those objects in the backend.
|
// *BREAKING CHANGE*: Removed ImGui_ImplVulkan_DestroyFontUploadObjects() which is now unnecessary as we create and destroy those objects in the backend.
|
||||||
// ImGui_ImplVulkan_CreateFontsTexture() is automatically called by NewFrame() the first time.
|
// ImGui_ImplVulkan_CreateFontsTexture() is automatically called by NewFrame() the first time.
|
||||||
// You can call ImGui_ImplVulkan_CreateFontsTexture() again to recreate the font atlas texture.
|
// You can call ImGui_ImplVulkan_CreateFontsTexture() again to recreate the font atlas texture.
|
||||||
// Added ImGui_ImplVulkan_DestroyFontsTexture() but you probably never need to call this.
|
// Added ImGui_ImplVulkan_DestroyFontsTexture() but you probably never need to call this.
|
||||||
// 2023-07-04: Vulkan: Added optional support for VK_KHR_dynamic_rendering. User needs to set init_info->UseDynamicRendering = true and init_info->ColorAttachmentFormat.
|
// 2023-07-04: Vulkan: Added optional support for VK_KHR_dynamic_rendering. User needs to set init_info->UseDynamicRendering = true and init_info->ColorAttachmentFormat.
|
||||||
// 2023-01-02: Vulkan: Fixed sampler passed to ImGui_ImplVulkan_AddTexture() not being honored + removed a bunch of duplicate code.
|
// 2023-01-02: Vulkan: Fixed sampler passed to ImGui_ImplVulkan_AddTexture() not being honored + removed a bunch of duplicate code.
|
||||||
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
|
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
|
||||||
// 2022-10-04: Vulkan: Added experimental ImGui_ImplVulkan_RemoveTexture() for api symetry. (#914, #5738).
|
// 2022-10-04: Vulkan: Added experimental ImGui_ImplVulkan_RemoveTexture() for api symmetry. (#914, #5738).
|
||||||
// 2022-01-20: Vulkan: Added support for ImTextureID as VkDescriptorSet. User need to call ImGui_ImplVulkan_AddTexture(). Building for 32-bit targets requires '#define ImTextureID ImU64'. (#914).
|
// 2022-01-20: Vulkan: Added support for ImTextureID as VkDescriptorSet. User need to call ImGui_ImplVulkan_AddTexture(). Building for 32-bit targets requires '#define ImTextureID ImU64'. (#914).
|
||||||
// 2021-10-15: Vulkan: Call vkCmdSetScissor() at the end of render a full-viewport to reduce likehood of issues with people using VK_DYNAMIC_STATE_SCISSOR in their app without calling vkCmdSetScissor() explicitly every frame.
|
// 2021-10-15: Vulkan: Call vkCmdSetScissor() at the end of render a full-viewport to reduce likehood of issues with people using VK_DYNAMIC_STATE_SCISSOR in their app without calling vkCmdSetScissor() explicitly every frame.
|
||||||
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
||||||
@@ -1092,6 +1092,7 @@ bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
||||||
|
|
||||||
// Setup backend capabilities flags
|
// Setup backend capabilities flags
|
||||||
|
|||||||
@@ -724,6 +724,7 @@ void ImGui_ImplWGPU_InvalidateDeviceObjects()
|
|||||||
bool ImGui_ImplWGPU_Init(ImGui_ImplWGPU_InitInfo* init_info)
|
bool ImGui_ImplWGPU_Init(ImGui_ImplWGPU_InitInfo* init_info)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
||||||
|
|
||||||
// Setup backend capabilities flags
|
// Setup backend capabilities flags
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ static void ImGui_ImplWin32_UpdateKeyboardCodePage()
|
|||||||
static bool ImGui_ImplWin32_InitEx(void* hwnd, bool platform_has_own_dc)
|
static bool ImGui_ImplWin32_InitEx(void* hwnd, bool platform_has_own_dc)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
|
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
|
||||||
|
|
||||||
INT64 perf_frequency, perf_counter;
|
INT64 perf_frequency, perf_counter;
|
||||||
@@ -581,11 +582,10 @@ static ImGuiMouseSource GetMouseSourceFromMessageExtraInfo()
|
|||||||
IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// Most backends don't have silent checks like this one, but we need it because WndProc are called early in CreateWindow().
|
// Most backends don't have silent checks like this one, but we need it because WndProc are called early in CreateWindow().
|
||||||
if (ImGui::GetCurrentContext() == nullptr)
|
// We silently allow both context or just only backend data to be nullptr.
|
||||||
return 0;
|
|
||||||
|
|
||||||
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();
|
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();
|
||||||
IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplWin32_Init()?");
|
if (bd == nullptr)
|
||||||
|
return 0;
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
switch (msg)
|
switch (msg)
|
||||||
@@ -608,10 +608,10 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA
|
|||||||
}
|
}
|
||||||
POINT mouse_pos = { (LONG)GET_X_LPARAM(lParam), (LONG)GET_Y_LPARAM(lParam) };
|
POINT mouse_pos = { (LONG)GET_X_LPARAM(lParam), (LONG)GET_Y_LPARAM(lParam) };
|
||||||
if (msg == WM_NCMOUSEMOVE && ::ScreenToClient(hwnd, &mouse_pos) == FALSE) // WM_NCMOUSEMOVE are provided in absolute coordinates.
|
if (msg == WM_NCMOUSEMOVE && ::ScreenToClient(hwnd, &mouse_pos) == FALSE) // WM_NCMOUSEMOVE are provided in absolute coordinates.
|
||||||
break;
|
return 0;
|
||||||
io.AddMouseSourceEvent(mouse_source);
|
io.AddMouseSourceEvent(mouse_source);
|
||||||
io.AddMousePosEvent((float)mouse_pos.x, (float)mouse_pos.y);
|
io.AddMousePosEvent((float)mouse_pos.x, (float)mouse_pos.y);
|
||||||
break;
|
return 0;
|
||||||
}
|
}
|
||||||
case WM_MOUSELEAVE:
|
case WM_MOUSELEAVE:
|
||||||
case WM_NCMOUSELEAVE:
|
case WM_NCMOUSELEAVE:
|
||||||
@@ -624,7 +624,7 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA
|
|||||||
bd->MouseTrackedArea = 0;
|
bd->MouseTrackedArea = 0;
|
||||||
io.AddMousePosEvent(-FLT_MAX, -FLT_MAX);
|
io.AddMousePosEvent(-FLT_MAX, -FLT_MAX);
|
||||||
}
|
}
|
||||||
break;
|
return 0;
|
||||||
}
|
}
|
||||||
case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK:
|
case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK:
|
||||||
case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK:
|
case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK:
|
||||||
|
|||||||
@@ -35,6 +35,165 @@ HOW TO UPDATE?
|
|||||||
and API updates have been a little more frequent lately. They are documented below and in imgui.cpp and should not affect all users.
|
and API updates have been a little more frequent lately. They are documented below and in imgui.cpp and should not affect all users.
|
||||||
- Please report any issue!
|
- Please report any issue!
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
VERSION 1.90.9 WIP (In Progress)
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Breaking changes:
|
||||||
|
|
||||||
|
Other changes:
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
VERSION 1.90.8 (Released 2024-06-06)
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.90.8
|
||||||
|
|
||||||
|
Breaking changes:
|
||||||
|
|
||||||
|
- Reordered various ImGuiInputTextFlags values. This should NOT be breaking unless
|
||||||
|
you are using generated headers that have values not matching the main library.
|
||||||
|
- Removed ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft
|
||||||
|
from imgui.h, was mostly unused and misleading.
|
||||||
|
|
||||||
|
Other changes:
|
||||||
|
|
||||||
|
- Inputs: fixed IsMouseClicked(..., repeat=true); broken in 1.90.7 on 2024/05/22.
|
||||||
|
(due to an internal api parameter swap, repeat wouldn't be honored and
|
||||||
|
ownership would be accidentally checked even though this api is meant to not
|
||||||
|
check ownership). (#7657) [@korenkonder]
|
||||||
|
- Windows: fixed altering FramePadding mid-frame not correctly affecting logic
|
||||||
|
responsible for honoring io.ConfigWindowsMoveFromTitleBarOnly. (#7576, #899)
|
||||||
|
- Scrollbar: made scrolling logic more standard: clicking above or below the
|
||||||
|
grab scrolls by one page, holding mouse button repeats scrolling. (#7328, #150)
|
||||||
|
- Scrollbar: fixed miscalculation of vertical scrollbar visibility when required
|
||||||
|
solely by the presence of an horizontal scrollbar. (#1574)
|
||||||
|
- InputScalar, InputInt, InputFloat: added ImGuiInputTextFlags_ParseEmptyRefVal
|
||||||
|
to parse an empty field as zero-value. (#7305) [@supermerill, @ocornut]
|
||||||
|
- InputScalar, InputInt, InputFloat: added ImGuiInputTextFlags_DisplayEmptyRefVal
|
||||||
|
to display a zero-value as empty. (#7305) [@supermerill, @ocornut]
|
||||||
|
- Popups: fixed an issue preventing to close a popup opened over a modal by clicking
|
||||||
|
over void (it required clicking over the visible part of the modal). (#7654)
|
||||||
|
- Tables: fixed an issue where ideal size reported to parent container wouldn't
|
||||||
|
correctly take account of inner scrollbar, affecting potential auto-resize of
|
||||||
|
parent container. (#7651)
|
||||||
|
- Tables: fixed a bug where after disabling the ScrollY flag for a table,
|
||||||
|
previous scrollbar width would be accounted for. (#5920)
|
||||||
|
- Combo: simplified Combo() API uses a list clipper (due to its api it wasn't
|
||||||
|
previously trivial before we added clipper.IncludeItemByIndex() function).
|
||||||
|
- Disabled: nested tooltips or other non-child window within a BeginDisabled()
|
||||||
|
block disable the disabled state. (#211, #7640)
|
||||||
|
- Misc: made ImGuiDir and ImGuiSortDirection stronger-typed enums.
|
||||||
|
- Backends: SDL3: Update for SDL_SYSTEM_CURSOR_xxx api renames. (#7653)
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
VERSION 1.90.7 (Released 2024-05-27)
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.90.7
|
||||||
|
|
||||||
|
Breaking changes:
|
||||||
|
|
||||||
|
- Inputs: on macOS X, Cmd and Ctrl keys are now automatically swapped by io.AddKeyEvent(),
|
||||||
|
as this naturally align with how macOS X uses those keys. (#2343, #4084, #5923, #456)
|
||||||
|
- Effectively it means that e.g. ImGuiMod_Ctrl | ImGuiKey_C is a valid idiomatic shortcut
|
||||||
|
for both Windows and Mac style users.
|
||||||
|
- It shouldn't really affect your code unless you had explicit/custom shortcut swapping in
|
||||||
|
place for macOS X apps in your input logic.
|
||||||
|
- Removed ImGuiMod_Shortcut which was previously dynamically remapping to Ctrl or Cmd/Super.
|
||||||
|
It is now unnecessary to specific cross-platform idiomatic shortcuts.
|
||||||
|
Kept symbols redirecting ImGuiMod_Shortcut to ImGuiMod_Ctrl (will obsolete).
|
||||||
|
- Commented out obsolete symbols renamed in 1.88 (May 2022):
|
||||||
|
CaptureKeyboardFromApp() -> SetNextFrameWantCaptureKeyboard()
|
||||||
|
CaptureMouseFromApp() -> SetNextFrameWantCaptureMouse()
|
||||||
|
- Backends: SDL_Renderer2/SDL_Renderer3: ImGui_ImplSDLRenderer2_RenderDrawData() and
|
||||||
|
ImGui_ImplSDLRenderer3_RenderDrawData() now takes a SDL_Renderer* parameter. This was previously
|
||||||
|
overlooked from the API but it will allow eventual support for multi-viewports.
|
||||||
|
|
||||||
|
Other changes:
|
||||||
|
|
||||||
|
- Windows: BeginChild(): fixed visibility of fully clipped child windows and tables to Test Engine.
|
||||||
|
- Windows: BeginChild(): fixed auto-fit calculation when using either (not both) ResizeX/ResizeY
|
||||||
|
and double-clicking on a border. Calculation incorrectly didn't always account for scrollbar as
|
||||||
|
it assumed the other axis would also be auto-fit. (#1710)
|
||||||
|
- Inputs: added shortcut and routing system in public API. (#456, #2637) [BETA]
|
||||||
|
- The general idea is that several callers may register interest in a shortcut, and only one owner gets it.
|
||||||
|
- in Parent: call Shortcut(Ctrl+S) // When Parent is focused, Parent gets the shortcut.
|
||||||
|
- in Child1: call Shortcut(Ctrl+S) // When Child1 is focused, Child1 gets the shortcut (Child1 overrides Parent shortcuts)
|
||||||
|
- in Child2: no call // When Child2 is focused, Parent gets the shortcut.
|
||||||
|
The whole system is order independent, so if Child1 makes its calls before Parent, results will be identical.
|
||||||
|
This is an important property as it facilitate working with foreign code or larger codebase.
|
||||||
|
- Added Shortcut() function:
|
||||||
|
e.g. Using ImGui::Shortcut(ImGuiMod_Ctrl | ImGuiKey_C); with default policy:
|
||||||
|
- checks that CTRL+C is pressed,
|
||||||
|
- and that current window is in focus stack,
|
||||||
|
- and that no other requests for CTRL+C have been made from higher priority locations
|
||||||
|
(e.g. deeper in the window/item stack).
|
||||||
|
- Added SetNextItemShortcut() to set a shortcut to locally or remotely press or activate
|
||||||
|
an item (depending on specified routing policy: using ImGuiInputFlags_RouteGlobal the item
|
||||||
|
shortcut may be executed even if its window is not in focus stack).
|
||||||
|
Items like buttons are not fully activated, in the sense that they get pressed but another
|
||||||
|
active item, e.g. InputText() won't be deactivated.
|
||||||
|
- Added routing policies for Shortcut(), SetNextItemShortcut(): (#456, #2637)
|
||||||
|
- ImGuiInputFlags_RouteFocused: focus stack route (default)
|
||||||
|
- ImGuiInputFlags_RouteActive: only route to active item
|
||||||
|
- ImGuiInputFlags_RouteGlobal: route globally, unless a focus route claim shame shortcut.
|
||||||
|
- ImGuiInputFlags_RouteAlways: no routing submission, no routing check.
|
||||||
|
- Added other shortcut/routing options: (#456, #2637)
|
||||||
|
- ImGuiInputFlags_Repeat: for use by Shortcut() and by upcoming rework of various
|
||||||
|
input functions (which are still internal for now).
|
||||||
|
- ImGuiInputFlags_Tooltip: for SetNextItemShortcut() to show a tooltip when hovering item.
|
||||||
|
- ImGuiInputFlags_RouteOverFocused: global route takes priority over focus route.
|
||||||
|
- ImGuiInputFlags_RouteOverActive: global route takes priority over active item.
|
||||||
|
- ImGuiInputFlags_RouteUnlessBgFocused: global route disabled if no imgui window focused.
|
||||||
|
- ImGuiInputFlags_RouteFromRootWindow: route evaluated from the point of view of root window rather than current window.
|
||||||
|
- Inputs: (OSX) Fixes variety of code which inconsistently required using Ctrl instead of Cmd.
|
||||||
|
- e.g. Drags/Sliders now use Cmd+Click to input a value. (#4084)
|
||||||
|
- Some shortcuts still uses Ctrl on Mac: e.g. Ctrl+Tab to switch windows. (#4828)
|
||||||
|
- Inputs: (OSX) Ctrl+Left Click alias as a Right click. (#2343) [@haldean, @ocornut]
|
||||||
|
- Inputs: Fixed ImGui::GetKeyName(ImGuiKey_None) from returning "N/A" or "None" depending
|
||||||
|
on value of IMGUI_DISABLE_OBSOLETE_KEYIO. It always returns "None".
|
||||||
|
- Nav: fixed holding Ctrl or gamepad L1 from not slowing down keyboard/gamepad tweak speed.
|
||||||
|
Broken during a refactor refactor for 1.89. Holding Shift/R1 to speed up wasn't broken.
|
||||||
|
- Tables: fixed cell background of fully clipped row overlapping with header. (#7575, #7041) [@prabuinet]
|
||||||
|
- Demo: Added "Inputs & Focus -> Shortcuts" section. (#456, #2637)
|
||||||
|
- Demo: Documents: Added shortcuts and renaming tabs/documents. (#7233)
|
||||||
|
- Examples: Win32+DX9,DX10,DX11,DX12: rework main loop to handle minimization and screen
|
||||||
|
locking without burning resources by running unthrottled code. (#2496, #3907, #6308, #7615)
|
||||||
|
- Backends: all backends + demo now call IMGUI_CHECKVERSION() to verify ABI compatibility between caller
|
||||||
|
code and compiled version of Dear ImGui. If you get an assert it most likely mean you have a build issue,
|
||||||
|
read comments near the assert. (#7568)
|
||||||
|
- Backends: Win32: undo an assert introduced in 1.90.6 which didn't allow WndProc
|
||||||
|
handler to be called before backend initialization. Because of how ::CreateWindow()
|
||||||
|
calls in WndProc this is facilitating. (#6275) [@MennoVink]
|
||||||
|
- Backends, Examples: SDL3: updates for latest SDL3 API changes. (#7580) [@kuvaus, @ocornut]
|
||||||
|
|
||||||
|
Breaking changes IF you were using imgui_internal.h versions of Shortcut() or owner-aware
|
||||||
|
versions of IsKeyPressed(), IsKeyChordPressed(), IsMouseClicked() prior to this version:
|
||||||
|
|
||||||
|
- Inputs (Internals): Renamed ImGuiKeyOwner_None to ImGuiKeyOwner_NoOwner, to make use more
|
||||||
|
explicit and reduce confusion with the fact it is a non-zero value and cannot be a default.
|
||||||
|
- Inputs (Internals): Renamed symbols global routes:
|
||||||
|
Renamed ImGuiInputFlags_RouteGlobalLow -> ImGuiInputFlags_RouteGlobal (this is the suggested global route)
|
||||||
|
Renamed ImGuiInputFlags_RouteGlobal -> ImGuiInputFlags_RouteGlobal | ImGuiInputFlags_RouteOverFocused
|
||||||
|
Renamed ImGuiInputFlags_RouteGlobalHigh -> ImGuiInputFlags_RouteGlobal | ImGuiInputFlags_RouteOverFocused | ImGuiInputFlags_RouteOverActive
|
||||||
|
- Inputs (Internals): Shortcut(), SetShortcutRouting(): swapped last two parameters order
|
||||||
|
in function signatures:
|
||||||
|
Before: Shortcut(ImGuiKeyChord key_chord, ImGuiID owner_id = 0, ImGuiInputFlags flags = 0);
|
||||||
|
After: Shortcut(ImGuiKeyChord key_chord, ImGuiInputFlags flags = 0, ImGuiID owner_id = 0);
|
||||||
|
- Inputs (Internals): owner-aware versions of IsKeyPressed(), IsKeyChordPressed(), IsMouseClicked():
|
||||||
|
swapped last two parameters order in function signatures:
|
||||||
|
Before: IsKeyPressed(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags = 0);
|
||||||
|
After: IsKeyPressed(ImGuiKey key, ImGuiInputFlags flags, ImGuiID owner_id = 0);
|
||||||
|
Before: IsMouseClicked(ImGuiMouseButton button, ImGuiID owner_id, ImGuiInputFlags flags = 0);
|
||||||
|
After: IsMouseClicked(ImGuiMouseButton button, ImGuiInputFlags flags, ImGuiID owner_id = 0);
|
||||||
|
- For several reasons those changes makes sense. They were all made before making some of
|
||||||
|
those API public. Only past users of imgui_internal.h with the extra parameters will be affected.
|
||||||
|
Added asserts for valid flags in various functions to detect _some_ misuses, BUT NOT ALL.
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
VERSION 1.90.6 (Released 2024-05-08)
|
VERSION 1.90.6 (Released 2024-05-08)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@@ -820,7 +979,7 @@ Breaking changes:
|
|||||||
- ListBoxFooter() -> use EndListBox()
|
- ListBoxFooter() -> use EndListBox()
|
||||||
- Note how two variants of ListBoxHeader() existed. Check commented versions in imgui.h for refeence.
|
- Note how two variants of ListBoxHeader() existed. Check commented versions in imgui.h for refeence.
|
||||||
- Backends: SDL_Renderer: Renamed 'imgui_impl_sdlrenderer.h/cpp' to 'imgui_impl_sdlrenderer2.h/cpp',
|
- Backends: SDL_Renderer: Renamed 'imgui_impl_sdlrenderer.h/cpp' to 'imgui_impl_sdlrenderer2.h/cpp',
|
||||||
in order to accomodate for upcoming SDL3 and change in its SDL_Renderer API. (#6286)
|
in order to accommodate for upcoming SDL3 and change in its SDL_Renderer API. (#6286)
|
||||||
- Backends: GLUT: Removed call to ImGui::NewFrame() from ImGui_ImplGLUT_NewFrame().
|
- Backends: GLUT: Removed call to ImGui::NewFrame() from ImGui_ImplGLUT_NewFrame().
|
||||||
It needs to be called from the main app loop, like with every other backends. (#6337) [@GereonV]
|
It needs to be called from the main app loop, like with every other backends. (#6337) [@GereonV]
|
||||||
|
|
||||||
@@ -1383,7 +1542,7 @@ Other Changes:
|
|||||||
- Backends: Metal: Use __bridge for ARC based systems. (#5403) [@stack]
|
- Backends: Metal: Use __bridge for ARC based systems. (#5403) [@stack]
|
||||||
- Backends: Metal: Add dispatch synchronization. (#5447) [@luigifcruz]
|
- Backends: Metal: Add dispatch synchronization. (#5447) [@luigifcruz]
|
||||||
- Backends: Metal: Update deprecated property 'sampleCount'->'rasterSampleCount'. (#5603) [@dcvz]
|
- Backends: Metal: Update deprecated property 'sampleCount'->'rasterSampleCount'. (#5603) [@dcvz]
|
||||||
- Backends: Vulkan: Added experimental ImGui_ImplVulkan_RemoveTexture() for api symetry. (#914, #5738).
|
- Backends: Vulkan: Added experimental ImGui_ImplVulkan_RemoveTexture() for api symmetry. (#914, #5738).
|
||||||
- Backends: WebGPU: fixed rendering when a depth buffer is enabled. (#5869) [@brainlag]
|
- Backends: WebGPU: fixed rendering when a depth buffer is enabled. (#5869) [@brainlag]
|
||||||
|
|
||||||
|
|
||||||
@@ -2156,7 +2315,7 @@ Other Changes:
|
|||||||
alpha compositing and transparent windows. (#2766, #3447 etc.).
|
alpha compositing and transparent windows. (#2766, #3447 etc.).
|
||||||
- Backends: OpenGL, Vulkan, DX9, DX10, DX11, DX12, Metal, WebGPU, Allegro: Rework blending equation to
|
- Backends: OpenGL, Vulkan, DX9, DX10, DX11, DX12, Metal, WebGPU, Allegro: Rework blending equation to
|
||||||
preserve alpha in output buffer (using SrcBlendAlpha = ONE, DstBlendAlpha = ONE_MINUS_SRC_ALPHA consistently
|
preserve alpha in output buffer (using SrcBlendAlpha = ONE, DstBlendAlpha = ONE_MINUS_SRC_ALPHA consistently
|
||||||
accross all backends), facilitating compositing of the output buffer with another buffer.
|
across all backends), facilitating compositing of the output buffer with another buffer.
|
||||||
(#2693, #2764, #2766, #2873, #3447, #3813, #3816) [@ocornut, @thedmd, @ShawnM427, @Ubpa, @aiekick]
|
(#2693, #2764, #2766, #2873, #3447, #3813, #3816) [@ocornut, @thedmd, @ShawnM427, @Ubpa, @aiekick]
|
||||||
- Backends: DX9: Fix to support IMGUI_USE_BGRA_PACKED_COLOR. (#3844) [@Xiliusha]
|
- Backends: DX9: Fix to support IMGUI_USE_BGRA_PACKED_COLOR. (#3844) [@Xiliusha]
|
||||||
- Backends: DX9: Fix to support colored glyphs, using newly introduced 'TexPixelsUseColors' info. (#3844)
|
- Backends: DX9: Fix to support colored glyphs, using newly introduced 'TexPixelsUseColors' info. (#3844)
|
||||||
@@ -5565,7 +5724,7 @@ Other Changes:
|
|||||||
VERSION 1.08 (2014-08-25)
|
VERSION 1.08 (2014-08-25)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.09
|
Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.08
|
||||||
|
|
||||||
- Fixed ImGuiTextFilter trimming of leading/trailing blanks.
|
- Fixed ImGuiTextFilter trimming of leading/trailing blanks.
|
||||||
- Fixed file descriptor leak on LoadSettings() failure.
|
- Fixed file descriptor leak on LoadSettings() failure.
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ state, and might confuse your GPU driver. One star, not recommended.
|
|||||||
GLFW (Win32, Mac, Linux) + OpenGL3+/ES2/ES3 example (modern, programmable pipeline). <BR>
|
GLFW (Win32, Mac, Linux) + OpenGL3+/ES2/ES3 example (modern, programmable pipeline). <BR>
|
||||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp <BR>
|
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp <BR>
|
||||||
This uses more modern GL calls and custom shaders.<BR>
|
This uses more modern GL calls and custom shaders.<BR>
|
||||||
This support building with Emscripten and targetting WebGL.<BR>
|
This support building with Emscripten and targeting WebGL.<BR>
|
||||||
Prefer using that if you are using modern GL or WebGL in your application.
|
Prefer using that if you are using modern GL or WebGL in your application.
|
||||||
|
|
||||||
[example_glfw_vulkan/](https://github.com/ocornut/imgui/blob/master/examples/example_glfw_vulkan/) <BR>
|
[example_glfw_vulkan/](https://github.com/ocornut/imgui/blob/master/examples/example_glfw_vulkan/) <BR>
|
||||||
@@ -168,7 +168,7 @@ state, and might confuse your GPU driver. One star, not recommended.
|
|||||||
SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+/ES2/ES3 example. <BR>
|
SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+/ES2/ES3 example. <BR>
|
||||||
= main.cpp + imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp <BR>
|
= main.cpp + imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp <BR>
|
||||||
This uses more modern GL calls and custom shaders. <BR>
|
This uses more modern GL calls and custom shaders. <BR>
|
||||||
This support building with Emscripten and targetting WebGL.<BR>
|
This support building with Emscripten and targeting WebGL.<BR>
|
||||||
Prefer using that if you are using modern GL or WebGL in your application.
|
Prefer using that if you are using modern GL or WebGL in your application.
|
||||||
|
|
||||||
[example_sdl2_sdlrenderer2/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl2_sdlrenderer2/) <BR>
|
[example_sdl2_sdlrenderer2/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl2_sdlrenderer2/) <BR>
|
||||||
|
|||||||
34
docs/FAQ.md
34
docs/FAQ.md
@@ -23,7 +23,7 @@ or view this file with any Markdown viewer.
|
|||||||
| [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) |
|
| [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) |
|
||||||
| [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) |
|
| [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) |
|
||||||
| **Q&A: Usage** |
|
| **Q&A: Usage** |
|
||||||
| **[About the ID Stack system..<br>Why is my widget not reacting when I click on it?<br>How can I have widgets with an empty label?<br>How can I have multiple widgets with the same label?<br>How can I have multiple windows with the same label?](#q-about-the-id-stack-system)** |
|
| **[About the ID Stack system..<br>Why is my widget not reacting when I click on it?<br>Why is the wrong widget reacting when I click on one?<br>How can I have widgets with an empty label?<br>How can I have multiple widgets with the same label?<br>How can I have multiple windows with the same label?](#q-about-the-id-stack-system)** |
|
||||||
| [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)|
|
| [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)|
|
||||||
| [How can I use maths operators with ImVec2?](#q-how-can-i-use-maths-operators-with-imvec2) |
|
| [How can I use maths operators with ImVec2?](#q-how-can-i-use-maths-operators-with-imvec2) |
|
||||||
| [How can I use my own maths types instead of ImVec2/ImVec4?](#q-how-can-i-use-my-own-maths-types-instead-of-imvec2imvec4) |
|
| [How can I use my own maths types instead of ImVec2/ImVec4?](#q-how-can-i-use-my-own-maths-types-instead-of-imvec2imvec4) |
|
||||||
@@ -199,10 +199,42 @@ ctx->RSSetScissorRects(1, &r);
|
|||||||
|
|
||||||
### Q: About the ID Stack system...
|
### Q: About the ID Stack system...
|
||||||
### Q: Why is my widget not reacting when I click on it?
|
### Q: Why is my widget not reacting when I click on it?
|
||||||
|
### Q: Why is the wrong widget reacting when I click on one?
|
||||||
### Q: How can I have widgets with an empty label?
|
### Q: How can I have widgets with an empty label?
|
||||||
### Q: How can I have multiple widgets with the same label?
|
### Q: How can I have multiple widgets with the same label?
|
||||||
### Q: How can I have multiple windows with the same label?
|
### Q: How can I have multiple windows with the same label?
|
||||||
|
|
||||||
|
**USING THE SAME LABEL+ID IS THE MOST COMMON USER MISTAKE:**
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td><img src="https://github.com/ocornut/imgui/assets/8225057/76eb9467-74d1-4e95-9f56-be81c6dd029d"></td>
|
||||||
|
<td>
|
||||||
|
<pre lang="cpp">
|
||||||
|
ImGui::Begin("Incorrect!");
|
||||||
|
ImGui::DragFloat2("My value", &objects[0]->pos.x);
|
||||||
|
ImGui::DragFloat2("My value", &objects[1]->pos.x);
|
||||||
|
ImGui::DragFloat2("My value", &objects[2]->pos.x);
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
|
ImGui::Begin("Correct!");
|
||||||
|
ImGui::DragFloat2("My value", &objects[0]->pos.x);
|
||||||
|
ImGui::DragFloat2("My value##2", &objects[1]->pos.x);
|
||||||
|
ImGui::DragFloat2("My value##3", &objects[2]->pos.x);
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
|
ImGui::Begin("Also Correct!");
|
||||||
|
for (int n = 0; n < 3; n++)
|
||||||
|
{
|
||||||
|
ImGui::PushID(n);
|
||||||
|
ImGui::DragFloat2("My value", &objects[n]->pos.x);
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
</pre>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
A primer on labels and the ID Stack...
|
A primer on labels and the ID Stack...
|
||||||
|
|
||||||
Dear ImGui internally needs to uniquely identify UI elements.
|
Dear ImGui internally needs to uniquely identify UI elements.
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ See: [Upcoming Changes](https://github.com/ocornut/imgui/wiki/Upcoming-Changes).
|
|||||||
|
|
||||||
See: [Dear ImGui Test Engine + Test Suite](https://github.com/ocornut/imgui_test_engine) for Automation & Testing.
|
See: [Dear ImGui Test Engine + Test Suite](https://github.com/ocornut/imgui_test_engine) for Automation & Testing.
|
||||||
|
|
||||||
For the purposes of getting search engines to crawl the wiki, here's a link to the [Crawable Wiki](https://github-wiki-see.page/m/ocornut/imgui/wiki) (not for humans, [here's why](https://github-wiki-see.page/)).
|
For the purposes of getting search engines to crawl the wiki, here's a link to the [Crawlable Wiki](https://github-wiki-see.page/m/ocornut/imgui/wiki) (not for humans, [here's why](https://github-wiki-see.page/)).
|
||||||
|
|
||||||
Getting started? For first-time users having issues compiling/linking/running or issues loading fonts, please use [GitHub Discussions](https://github.com/ocornut/imgui/discussions). For ANY other questions, bug reports, requests, feedback, please post on [GitHub Issues](https://github.com/ocornut/imgui/issues). Please read and fill the New Issue template carefully.
|
Getting started? For first-time users having issues compiling/linking/running or issues loading fonts, please use [GitHub Discussions](https://github.com/ocornut/imgui/discussions). For ANY other questions, bug reports, requests, feedback, please post on [GitHub Issues](https://github.com/ocornut/imgui/issues). Please read and fill the New Issue template carefully.
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- scrolling: forward mouse wheel scrolling to parent window when at the edge of scrolling limits? (useful for listbox,tables?)
|
- scrolling: forward mouse wheel scrolling to parent window when at the edge of scrolling limits? (useful for listbox,tables?)
|
||||||
- scrolling/style: shadows on scrollable areas to denote that there is more contents (see e.g. DaVinci Resolve ui)
|
- scrolling/style: shadows on scrollable areas to denote that there is more contents (see e.g. DaVinci Resolve ui)
|
||||||
|
|
||||||
- drawdata: make it easy to deep-copy (or swap?) a full ImDrawData so user can easily save that data if they use threaded rendering. (e.g. #2646)
|
- drawdata: make it easy to deep-copy (or swap?) a full ImDrawData so user can easily save that data if they use threaded rendering. (#1860 see ImDrawDataSnapshot)
|
||||||
! drawlist: add CalcTextSize() func to facilitate consistent code from user pov (currently need to use ImGui or ImFont alternatives!)
|
! drawlist: add CalcTextSize() func to facilitate consistent code from user pov (currently need to use ImGui or ImFont alternatives!)
|
||||||
- drawlist: maintaining bounding box per command would allow to merge draw command when clipping isn't relied on (typical non-scrolling window or non-overflowing column would merge with previous command). (WIP branch)
|
- drawlist: maintaining bounding box per command would allow to merge draw command when clipping isn't relied on (typical non-scrolling window or non-overflowing column would merge with previous command). (WIP branch)
|
||||||
- drawlist: make it easier to toggle AA per primitive, so we can use e.g. non-AA fill + AA borders more naturally
|
- drawlist: make it easier to toggle AA per primitive, so we can use e.g. non-AA fill + AA borders more naturally
|
||||||
@@ -117,7 +117,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
!- color: the color conversion helpers/types are a mess and needs sorting out.
|
!- color: the color conversion helpers/types are a mess and needs sorting out.
|
||||||
- color: (api breaking) ImGui::ColorConvertXXX functions should be loose ImColorConvertXX to match imgui_internals.h
|
- color: (api breaking) ImGui::ColorConvertXXX functions should be loose ImColorConvertXX to match imgui_internals.h
|
||||||
|
|
||||||
- plot: full featured plot/graph api w/ scrolling, zooming etc. --> ImPlot
|
- plot: full featured plot/graph api w/ scrolling, zooming etc. --> promote using ImPlot
|
||||||
- (plot: deleted all other todo lines on 2023-06-28)
|
- (plot: deleted all other todo lines on 2023-06-28)
|
||||||
|
|
||||||
- clipper: ability to disable the clipping through a simple flag/bool.
|
- clipper: ability to disable the clipping through a simple flag/bool.
|
||||||
@@ -150,7 +150,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- drag float: power != 0.0f with current value being outside the range keeps the value stuck.
|
- drag float: power != 0.0f with current value being outside the range keeps the value stuck.
|
||||||
- drag float: added leeway on edge (e.g. a few invisible steps past the clamp limits)
|
- drag float: added leeway on edge (e.g. a few invisible steps past the clamp limits)
|
||||||
|
|
||||||
- combo: use clipper.
|
|
||||||
- combo: a way/helper to customize the combo preview (#1658) -> experimental BeginComboPreview()
|
- combo: a way/helper to customize the combo preview (#1658) -> experimental BeginComboPreview()
|
||||||
- combo/listbox: keyboard control. need InputText-like non-active focus + key handling. considering keyboard for custom listbox (pr #203)
|
- combo/listbox: keyboard control. need InputText-like non-active focus + key handling. considering keyboard for custom listbox (pr #203)
|
||||||
- listbox: multiple selection (WIP range-select branch)
|
- listbox: multiple selection (WIP range-select branch)
|
||||||
@@ -173,13 +172,14 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- tooltip: drag and drop with tooltip near monitor edges lose/changes its last direction instead of locking one. The drag and drop tooltip should always follow without changing direction.
|
- tooltip: drag and drop with tooltip near monitor edges lose/changes its last direction instead of locking one. The drag and drop tooltip should always follow without changing direction.
|
||||||
- tooltip: allow to set the width of a tooltip to allow TextWrapped() etc. while keeping the height automatic.
|
- tooltip: allow to set the width of a tooltip to allow TextWrapped() etc. while keeping the height automatic.
|
||||||
- tooltip: drag tooltip hovering over source widget with IsItemHovered/SetTooltip flickers (WIP branch)
|
- tooltip: drag tooltip hovering over source widget with IsItemHovered/SetTooltip flickers (WIP branch)
|
||||||
|
- tooltip: tooltip priorities to override a stock tooltip (e.g. shortcut tooltip)
|
||||||
|
|
||||||
- status-bar: add a per-window status bar helper similar to what menu-bar does. generalize concept of layer0 rect in window (can make _MenuBar window flag obsolete too).
|
- status-bar: add a per-window status bar helper similar to what menu-bar does. generalize concept of layer0 rect in window (can make _MenuBar window flag obsolete too).
|
||||||
|
- shortcuts: store multiple keychords in ImGuiKeyChord
|
||||||
|
- shortcuts: Hovered route (lower than Focused, higher than Global)
|
||||||
- shortcuts: local-style shortcut api, e.g. parse "&Save"
|
- shortcuts: local-style shortcut api, e.g. parse "&Save"
|
||||||
- shortcuts,menus: global-style shortcut api e.g. "Save (CTRL+S)" -> explicit flag for recursing into closed menu
|
- shortcuts,menus: global-style shortcut api e.g. "Save (CTRL+S)" -> explicit flag for recursing into closed menu
|
||||||
- shortcuts: programmatically access shortcuts "Focus("&Save"))
|
- menus: hovering from menu to menu on a menu-bar has 1 frame without any menu, which is a little annoying. ideally zero.
|
||||||
- menus: menu-bar: main menu-bar could affect clamping of windows position (~ akin to modifying DisplayMin)
|
|
||||||
- menus: hovering from menu to menu on a menu-bar has 1 frame without any menu, which is a little annoying. ideally either 0 either longer.
|
|
||||||
- menus: would be nice if the Selectable() supported horizontal alignment (must be given the equivalent of WorkRect.Max.x matching the position of the shortcut column)
|
- menus: would be nice if the Selectable() supported horizontal alignment (must be given the equivalent of WorkRect.Max.x matching the position of the shortcut column)
|
||||||
|
|
||||||
- tree node: add treenode/treepush int variants? not there because (void*) cast from int warns on some platforms/settings?
|
- tree node: add treenode/treepush int variants? not there because (void*) cast from int warns on some platforms/settings?
|
||||||
@@ -275,7 +275,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- font/opt: Considering storing standalone AdvanceX table as 16-bit fixed point integer?
|
- font/opt: Considering storing standalone AdvanceX table as 16-bit fixed point integer?
|
||||||
- font/opt: Glyph currently 40 bytes (2+9*4). Consider storing UV as 16-bits integer? (->32 bytes). X0/Y0/X1/Y1 as 16 fixed-point integers? Or X0/Y0 as float and X1/Y1 as fixed8_8?
|
- font/opt: Glyph currently 40 bytes (2+9*4). Consider storing UV as 16-bits integer? (->32 bytes). X0/Y0/X1/Y1 as 16 fixed-point integers? Or X0/Y0 as float and X1/Y1 as fixed8_8?
|
||||||
|
|
||||||
- nav: visual feedback on button press.
|
|
||||||
- nav: some features such as PageUp/Down/Home/End should probably work without ImGuiConfigFlags_NavEnableKeyboard? (where do we draw the line? how about CTRL+Tab)
|
- nav: some features such as PageUp/Down/Home/End should probably work without ImGuiConfigFlags_NavEnableKeyboard? (where do we draw the line? how about CTRL+Tab)
|
||||||
! nav: never clear NavId on some setup (e.g. gamepad centric)
|
! nav: never clear NavId on some setup (e.g. gamepad centric)
|
||||||
- nav: there's currently no way to completely clear focus with the keyboard. depending on patterns used by the application to dispatch inputs, it may be desirable.
|
- nav: there's currently no way to completely clear focus with the keyboard. depending on patterns used by the application to dispatch inputs, it may be desirable.
|
||||||
@@ -315,8 +314,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- misc: make the ImGuiCond values linear (non-power-of-two). internal storage for ImGuiWindow can use integers to combine into flags (Why?)
|
- misc: make the ImGuiCond values linear (non-power-of-two). internal storage for ImGuiWindow can use integers to combine into flags (Why?)
|
||||||
- misc: PushItemFlag(): add a flag to disable keyboard capture when used with mouse? (#1682)
|
- misc: PushItemFlag(): add a flag to disable keyboard capture when used with mouse? (#1682)
|
||||||
- misc: use more size_t in public api?
|
- misc: use more size_t in public api?
|
||||||
- misc: possible compile-time support for string view/range instead of char* would e.g. facilitate usage with Rust (#683, #3038, WIP string_view branch)
|
- misc: support for string view/range instead of char* would e.g. facilitate usage with Rust (#683, #3038, WIP string_view branch)
|
||||||
- misc: possible compile-time support for wchar_t instead of char*?
|
|
||||||
|
|
||||||
- demo: demonstrate using PushStyleVar() in more details.
|
- demo: demonstrate using PushStyleVar() in more details.
|
||||||
- demo: add vertical separator demo
|
- demo: add vertical separator demo
|
||||||
@@ -336,7 +334,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- backends: bgfx: https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
|
- backends: bgfx: https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
|
||||||
- backends: emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
|
- backends: emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
|
||||||
|
|
||||||
- bindings: ways to use clang ast dump to generate bindings or helpers for bindings? (e.g. clang++ -Xclang -ast-dump=json imgui.h) (WIP project "dear-bindings" still private)
|
- bindings: ways to use clang ast dump to generate bindings or helpers for bindings? (e.g. clang++ -Xclang -ast-dump=json imgui.h) (--> use https://github.com/dearimgui/dear_bindings)
|
||||||
|
|
||||||
- optimization: replace vsnprintf with stb_printf? using IMGUI_USE_STB_SPRINTF. (#1038 + needed for string_view)
|
- optimization: replace vsnprintf with stb_printf? using IMGUI_USE_STB_SPRINTF. (#1038 + needed for string_view)
|
||||||
- optimization: add clipping for multi-component widgets (SliderFloatX, ColorEditX, etc.). one problem is that nav branch can't easily clip parent group when there is a move request.
|
- optimization: add clipping for multi-component widgets (SliderFloatX, ColorEditX, etc.). one problem is that nav branch can't easily clip parent group when there is a move request.
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ void Init(struct android_app* app)
|
|||||||
|
|
||||||
// We load the default font with increased size to improve readability on many devices with "high" DPI.
|
// We load the default font with increased size to improve readability on many devices with "high" DPI.
|
||||||
// FIXME: Put some effort into DPI awareness.
|
// FIXME: Put some effort into DPI awareness.
|
||||||
// Important: when calling AddFontFromMemoryTTF(), ownership of font_data is transfered by Dear ImGui by default (deleted is handled by Dear ImGui), unless we set FontDataOwnedByAtlas=false in ImFontConfig
|
// Important: when calling AddFontFromMemoryTTF(), ownership of font_data is transferred by Dear ImGui by default (deleted is handled by Dear ImGui), unless we set FontDataOwnedByAtlas=false in ImFontConfig
|
||||||
ImFontConfig font_cfg;
|
ImFontConfig font_cfg;
|
||||||
font_cfg.SizePixels = 22.0f;
|
font_cfg.SizePixels = 22.0f;
|
||||||
io.Fonts->AddFontDefault(&font_cfg);
|
io.Fonts->AddFontDefault(&font_cfg);
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ int main(int, char**)
|
|||||||
SDL_RenderSetScale(renderer, io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y);
|
SDL_RenderSetScale(renderer, io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y);
|
||||||
SDL_SetRenderDrawColor(renderer, (Uint8)(clear_color.x * 255), (Uint8)(clear_color.y * 255), (Uint8)(clear_color.z * 255), (Uint8)(clear_color.w * 255));
|
SDL_SetRenderDrawColor(renderer, (Uint8)(clear_color.x * 255), (Uint8)(clear_color.y * 255), (Uint8)(clear_color.z * 255), (Uint8)(clear_color.w * 255));
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
ImGui_ImplSDLRenderer2_RenderDrawData(ImGui::GetDrawData());
|
ImGui_ImplSDLRenderer2_RenderDrawData(ImGui::GetDrawData(), renderer);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ LIBS =
|
|||||||
|
|
||||||
ifeq ($(UNAME_S), Linux) #LINUX
|
ifeq ($(UNAME_S), Linux) #LINUX
|
||||||
ECHO_MESSAGE = "Linux"
|
ECHO_MESSAGE = "Linux"
|
||||||
LIBS += $(LINUX_GL_LIBS) -ldl `sdl3-config --libs`
|
LIBS += $(LINUX_GL_LIBS) -ldl `pkg-config sdl3 --libs`
|
||||||
|
|
||||||
CXXFLAGS += `sdl3-config --cflags`
|
CXXFLAGS += `pkg-config sdl3 --cflags`
|
||||||
CFLAGS = $(CXXFLAGS)
|
CFLAGS = $(CXXFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ ifeq ($(UNAME_S), Darwin) #APPLE
|
|||||||
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl3-config --libs`
|
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl3-config --libs`
|
||||||
LIBS += -L/usr/local/lib -L/opt/local/lib
|
LIBS += -L/usr/local/lib -L/opt/local/lib
|
||||||
|
|
||||||
CXXFLAGS += `sdl3-config --cflags`
|
CXXFLAGS += `pkg-config sdl3 --cflags`
|
||||||
CXXFLAGS += -I/usr/local/include -I/opt/local/include
|
CXXFLAGS += -I/usr/local/include -I/opt/local/include
|
||||||
CFLAGS = $(CXXFLAGS)
|
CFLAGS = $(CXXFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ LIBS =
|
|||||||
|
|
||||||
ifeq ($(UNAME_S), Linux) #LINUX
|
ifeq ($(UNAME_S), Linux) #LINUX
|
||||||
ECHO_MESSAGE = "Linux"
|
ECHO_MESSAGE = "Linux"
|
||||||
LIBS += -ldl `sdl3-config --libs`
|
LIBS += -ldl `pkg-config sdl3 --libs`
|
||||||
|
|
||||||
CXXFLAGS += `sdl3-config --cflags`
|
CXXFLAGS += `pkg-config sdl3 --cflags`
|
||||||
CFLAGS = $(CXXFLAGS)
|
CFLAGS = $(CXXFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ ifeq ($(UNAME_S), Darwin) #APPLE
|
|||||||
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl3-config --libs`
|
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl3-config --libs`
|
||||||
LIBS += -L/usr/local/lib -L/opt/local/lib
|
LIBS += -L/usr/local/lib -L/opt/local/lib
|
||||||
|
|
||||||
CXXFLAGS += `sdl3-config --cflags`
|
CXXFLAGS += `pkg-config sdl3 --cflags`
|
||||||
CXXFLAGS += -I/usr/local/include -I/opt/local/include
|
CXXFLAGS += -I/usr/local/include -I/opt/local/include
|
||||||
CFLAGS = $(CXXFLAGS)
|
CFLAGS = $(CXXFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ int main(int, char**)
|
|||||||
printf("Error: SDL_CreateWindow(): %s\n", SDL_GetError());
|
printf("Error: SDL_CreateWindow(): %s\n", SDL_GetError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
SDL_Renderer* renderer = SDL_CreateRenderer(window, nullptr, SDL_RENDERER_PRESENTVSYNC);
|
SDL_Renderer* renderer = SDL_CreateRenderer(window, nullptr);
|
||||||
|
SDL_SetRenderVSync(renderer, 1);
|
||||||
if (renderer == nullptr)
|
if (renderer == nullptr)
|
||||||
{
|
{
|
||||||
SDL_Log("Error: SDL_CreateRenderer(): %s\n", SDL_GetError());
|
SDL_Log("Error: SDL_CreateRenderer(): %s\n", SDL_GetError());
|
||||||
@@ -159,9 +160,9 @@ int main(int, char**)
|
|||||||
// Rendering
|
// Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
//SDL_RenderSetScale(renderer, io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y);
|
//SDL_RenderSetScale(renderer, io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y);
|
||||||
SDL_SetRenderDrawColor(renderer, (Uint8)(clear_color.x * 255), (Uint8)(clear_color.y * 255), (Uint8)(clear_color.z * 255), (Uint8)(clear_color.w * 255));
|
SDL_SetRenderDrawColorFloat(renderer, clear_color.x, clear_color.y, clear_color.z, clear_color.w);
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
ImGui_ImplSDLRenderer3_RenderDrawData(ImGui::GetDrawData());
|
ImGui_ImplSDLRenderer3_RenderDrawData(ImGui::GetDrawData(), renderer);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
// Data
|
// Data
|
||||||
static ID3D10Device* g_pd3dDevice = nullptr;
|
static ID3D10Device* g_pd3dDevice = nullptr;
|
||||||
static IDXGISwapChain* g_pSwapChain = nullptr;
|
static IDXGISwapChain* g_pSwapChain = nullptr;
|
||||||
|
static bool g_SwapChainOccluded = false;
|
||||||
static UINT g_ResizeWidth = 0, g_ResizeHeight = 0;
|
static UINT g_ResizeWidth = 0, g_ResizeHeight = 0;
|
||||||
static ID3D10RenderTargetView* g_mainRenderTargetView = nullptr;
|
static ID3D10RenderTargetView* g_mainRenderTargetView = nullptr;
|
||||||
|
|
||||||
@@ -100,6 +101,14 @@ int main(int, char**)
|
|||||||
if (done)
|
if (done)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Handle window being minimized or screen locked
|
||||||
|
if (g_SwapChainOccluded && g_pSwapChain->Present(0, DXGI_PRESENT_TEST) == DXGI_STATUS_OCCLUDED)
|
||||||
|
{
|
||||||
|
::Sleep(10);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
g_SwapChainOccluded = false;
|
||||||
|
|
||||||
// Handle window resize (we don't resize directly in the WM_SIZE handler)
|
// Handle window resize (we don't resize directly in the WM_SIZE handler)
|
||||||
if (g_ResizeWidth != 0 && g_ResizeHeight != 0)
|
if (g_ResizeWidth != 0 && g_ResizeHeight != 0)
|
||||||
{
|
{
|
||||||
@@ -158,10 +167,13 @@ int main(int, char**)
|
|||||||
g_pd3dDevice->ClearRenderTargetView(g_mainRenderTargetView, clear_color_with_alpha);
|
g_pd3dDevice->ClearRenderTargetView(g_mainRenderTargetView, clear_color_with_alpha);
|
||||||
ImGui_ImplDX10_RenderDrawData(ImGui::GetDrawData());
|
ImGui_ImplDX10_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
|
||||||
g_pSwapChain->Present(1, 0); // Present with vsync
|
// Present
|
||||||
//g_pSwapChain->Present(0, 0); // Present without vsync
|
HRESULT hr = g_pSwapChain->Present(1, 0); // Present with vsync
|
||||||
|
//HRESULT hr = g_pSwapChain->Present(0, 0); // Present without vsync
|
||||||
|
g_SwapChainOccluded = (hr == DXGI_STATUS_OCCLUDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
ImGui_ImplDX10_Shutdown();
|
ImGui_ImplDX10_Shutdown();
|
||||||
ImGui_ImplWin32_Shutdown();
|
ImGui_ImplWin32_Shutdown();
|
||||||
ImGui::DestroyContext();
|
ImGui::DestroyContext();
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
static ID3D11Device* g_pd3dDevice = nullptr;
|
static ID3D11Device* g_pd3dDevice = nullptr;
|
||||||
static ID3D11DeviceContext* g_pd3dDeviceContext = nullptr;
|
static ID3D11DeviceContext* g_pd3dDeviceContext = nullptr;
|
||||||
static IDXGISwapChain* g_pSwapChain = nullptr;
|
static IDXGISwapChain* g_pSwapChain = nullptr;
|
||||||
|
static bool g_SwapChainOccluded = false;
|
||||||
static UINT g_ResizeWidth = 0, g_ResizeHeight = 0;
|
static UINT g_ResizeWidth = 0, g_ResizeHeight = 0;
|
||||||
static ID3D11RenderTargetView* g_mainRenderTargetView = nullptr;
|
static ID3D11RenderTargetView* g_mainRenderTargetView = nullptr;
|
||||||
|
|
||||||
@@ -100,6 +101,14 @@ int main(int, char**)
|
|||||||
if (done)
|
if (done)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Handle window being minimized or screen locked
|
||||||
|
if (g_SwapChainOccluded && g_pSwapChain->Present(0, DXGI_PRESENT_TEST) == DXGI_STATUS_OCCLUDED)
|
||||||
|
{
|
||||||
|
::Sleep(10);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
g_SwapChainOccluded = false;
|
||||||
|
|
||||||
// Handle window resize (we don't resize directly in the WM_SIZE handler)
|
// Handle window resize (we don't resize directly in the WM_SIZE handler)
|
||||||
if (g_ResizeWidth != 0 && g_ResizeHeight != 0)
|
if (g_ResizeWidth != 0 && g_ResizeHeight != 0)
|
||||||
{
|
{
|
||||||
@@ -158,8 +167,10 @@ int main(int, char**)
|
|||||||
g_pd3dDeviceContext->ClearRenderTargetView(g_mainRenderTargetView, clear_color_with_alpha);
|
g_pd3dDeviceContext->ClearRenderTargetView(g_mainRenderTargetView, clear_color_with_alpha);
|
||||||
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
|
||||||
g_pSwapChain->Present(1, 0); // Present with vsync
|
// Present
|
||||||
//g_pSwapChain->Present(0, 0); // Present without vsync
|
HRESULT hr = g_pSwapChain->Present(1, 0); // Present with vsync
|
||||||
|
//HRESULT hr = g_pSwapChain->Present(0, 0); // Present without vsync
|
||||||
|
g_SwapChainOccluded = (hr == DXGI_STATUS_OCCLUDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
#pragma comment(lib, "dxguid.lib")
|
#pragma comment(lib, "dxguid.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "imgui_internal.h"
|
||||||
|
|
||||||
struct FrameContext
|
struct FrameContext
|
||||||
{
|
{
|
||||||
ID3D12CommandAllocator* CommandAllocator;
|
ID3D12CommandAllocator* CommandAllocator;
|
||||||
@@ -47,6 +49,7 @@ static ID3D12Fence* g_fence = nullptr;
|
|||||||
static HANDLE g_fenceEvent = nullptr;
|
static HANDLE g_fenceEvent = nullptr;
|
||||||
static UINT64 g_fenceLastSignaledValue = 0;
|
static UINT64 g_fenceLastSignaledValue = 0;
|
||||||
static IDXGISwapChain3* g_pSwapChain = nullptr;
|
static IDXGISwapChain3* g_pSwapChain = nullptr;
|
||||||
|
static bool g_SwapChainOccluded = false;
|
||||||
static HANDLE g_hSwapChainWaitableObject = nullptr;
|
static HANDLE g_hSwapChainWaitableObject = nullptr;
|
||||||
static ID3D12Resource* g_mainRenderTargetResource[NUM_BACK_BUFFERS] = {};
|
static ID3D12Resource* g_mainRenderTargetResource[NUM_BACK_BUFFERS] = {};
|
||||||
static D3D12_CPU_DESCRIPTOR_HANDLE g_mainRenderTargetDescriptor[NUM_BACK_BUFFERS] = {};
|
static D3D12_CPU_DESCRIPTOR_HANDLE g_mainRenderTargetDescriptor[NUM_BACK_BUFFERS] = {};
|
||||||
@@ -137,6 +140,14 @@ int main(int, char**)
|
|||||||
if (done)
|
if (done)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Handle window screen locked
|
||||||
|
if (g_SwapChainOccluded && g_pSwapChain->Present(0, DXGI_PRESENT_TEST) == DXGI_STATUS_OCCLUDED)
|
||||||
|
{
|
||||||
|
::Sleep(10);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
g_SwapChainOccluded = false;
|
||||||
|
|
||||||
// Start the Dear ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplDX12_NewFrame();
|
ImGui_ImplDX12_NewFrame();
|
||||||
ImGui_ImplWin32_NewFrame();
|
ImGui_ImplWin32_NewFrame();
|
||||||
@@ -209,8 +220,10 @@ int main(int, char**)
|
|||||||
|
|
||||||
g_pd3dCommandQueue->ExecuteCommandLists(1, (ID3D12CommandList* const*)&g_pd3dCommandList);
|
g_pd3dCommandQueue->ExecuteCommandLists(1, (ID3D12CommandList* const*)&g_pd3dCommandList);
|
||||||
|
|
||||||
g_pSwapChain->Present(1, 0); // Present with vsync
|
// Present
|
||||||
//g_pSwapChain->Present(0, 0); // Present without vsync
|
HRESULT hr = g_pSwapChain->Present(1, 0); // Present with vsync
|
||||||
|
//HRESULT hr = g_pSwapChain->Present(0, 0); // Present without vsync
|
||||||
|
g_SwapChainOccluded = (hr == DXGI_STATUS_OCCLUDED);
|
||||||
|
|
||||||
UINT64 fenceValue = g_fenceLastSignaledValue + 1;
|
UINT64 fenceValue = g_fenceLastSignaledValue + 1;
|
||||||
g_pd3dCommandQueue->Signal(g_fence, fenceValue);
|
g_pd3dCommandQueue->Signal(g_fence, fenceValue);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
// Data
|
// Data
|
||||||
static LPDIRECT3D9 g_pD3D = nullptr;
|
static LPDIRECT3D9 g_pD3D = nullptr;
|
||||||
static LPDIRECT3DDEVICE9 g_pd3dDevice = nullptr;
|
static LPDIRECT3DDEVICE9 g_pd3dDevice = nullptr;
|
||||||
|
static bool g_DeviceLost = false;
|
||||||
static UINT g_ResizeWidth = 0, g_ResizeHeight = 0;
|
static UINT g_ResizeWidth = 0, g_ResizeHeight = 0;
|
||||||
static D3DPRESENT_PARAMETERS g_d3dpp = {};
|
static D3DPRESENT_PARAMETERS g_d3dpp = {};
|
||||||
|
|
||||||
@@ -98,6 +99,20 @@ int main(int, char**)
|
|||||||
if (done)
|
if (done)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Handle lost D3D9 device
|
||||||
|
if (g_DeviceLost)
|
||||||
|
{
|
||||||
|
HRESULT hr = g_pd3dDevice->TestCooperativeLevel();
|
||||||
|
if (hr == D3DERR_DEVICELOST)
|
||||||
|
{
|
||||||
|
::Sleep(10);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (hr == D3DERR_DEVICENOTRESET)
|
||||||
|
ResetDevice();
|
||||||
|
g_DeviceLost = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Handle window resize (we don't resize directly in the WM_SIZE handler)
|
// Handle window resize (we don't resize directly in the WM_SIZE handler)
|
||||||
if (g_ResizeWidth != 0 && g_ResizeHeight != 0)
|
if (g_ResizeWidth != 0 && g_ResizeHeight != 0)
|
||||||
{
|
{
|
||||||
@@ -163,12 +178,11 @@ int main(int, char**)
|
|||||||
g_pd3dDevice->EndScene();
|
g_pd3dDevice->EndScene();
|
||||||
}
|
}
|
||||||
HRESULT result = g_pd3dDevice->Present(nullptr, nullptr, nullptr, nullptr);
|
HRESULT result = g_pd3dDevice->Present(nullptr, nullptr, nullptr, nullptr);
|
||||||
|
if (result == D3DERR_DEVICELOST)
|
||||||
// Handle loss of D3D9 device
|
g_DeviceLost = true;
|
||||||
if (result == D3DERR_DEVICELOST && g_pd3dDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET)
|
|
||||||
ResetDevice();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
ImGui_ImplDX9_Shutdown();
|
ImGui_ImplDX9_Shutdown();
|
||||||
ImGui_ImplWin32_Shutdown();
|
ImGui_ImplWin32_Shutdown();
|
||||||
ImGui::DestroyContext();
|
ImGui::DestroyContext();
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ typedef void (*uSynergySleepFunc)(uSynergyCookie cookie, int timeMs);
|
|||||||
@brief Get time function
|
@brief Get time function
|
||||||
|
|
||||||
This function is called when uSynergy needs to know the current time. This is used to determine when timeouts
|
This function is called when uSynergy needs to know the current time. This is used to determine when timeouts
|
||||||
have occured. The time base should be a cyclic millisecond time value.
|
have occurred. The time base should be a cyclic millisecond time value.
|
||||||
|
|
||||||
@returns Time value in milliseconds
|
@returns Time value in milliseconds
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#define WIN98
|
||||||
|
|
||||||
//---- Define assertion handler. Defaults to calling assert().
|
//---- Define assertion handler. Defaults to calling assert().
|
||||||
// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
|
// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
|
||||||
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
|
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
|
||||||
|
|||||||
181
imgui.h
181
imgui.h
@@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.90.6 WIP
|
// dear imgui, v1.90.9 WIP
|
||||||
// (headers)
|
// (headers)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
|
|
||||||
// Library Version
|
// Library Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||||
#define IMGUI_VERSION "1.90.6"
|
#define IMGUI_VERSION "1.90.9 WIP"
|
||||||
#define IMGUI_VERSION_NUM 19060
|
#define IMGUI_VERSION_NUM 19080
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -90,6 +90,8 @@ Index of this file:
|
|||||||
#endif
|
#endif
|
||||||
#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*(_ARR)))) // Size of a static C-style array. Don't use on pointers!
|
#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*(_ARR)))) // Size of a static C-style array. Don't use on pointers!
|
||||||
#define IM_UNUSED(_VAR) ((void)(_VAR)) // Used to silence "unused variable warnings". Often useful as asserts may be stripped out from final builds.
|
#define IM_UNUSED(_VAR) ((void)(_VAR)) // Used to silence "unused variable warnings". Often useful as asserts may be stripped out from final builds.
|
||||||
|
|
||||||
|
// Check that version and structures layouts are matching between compiled imgui code and caller. Read comments above DebugCheckVersionAndDataLayout() for details.
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
|
|
||||||
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions.
|
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions.
|
||||||
@@ -141,6 +143,17 @@ Index of this file:
|
|||||||
// [SECTION] Forward declarations and basic types
|
// [SECTION] Forward declarations and basic types
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Scalar data types
|
||||||
|
typedef unsigned int ImGuiID;// A unique ID used by widgets (typically the result of hashing a stack of string)
|
||||||
|
typedef signed char ImS8; // 8-bit signed integer
|
||||||
|
typedef unsigned char ImU8; // 8-bit unsigned integer
|
||||||
|
typedef signed short ImS16; // 16-bit signed integer
|
||||||
|
typedef unsigned short ImU16; // 16-bit unsigned integer
|
||||||
|
typedef signed int ImS32; // 32-bit signed integer == int
|
||||||
|
typedef unsigned int ImU32; // 32-bit unsigned integer (often used to store packed colors)
|
||||||
|
typedef signed long long ImS64; // 64-bit signed integer
|
||||||
|
typedef unsigned long long ImU64; // 64-bit unsigned integer
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
struct ImDrawChannel; // Temporary storage to output draw commands out of order, used by ImDrawListSplitter and ImDrawList::ChannelsSplit()
|
struct ImDrawChannel; // Temporary storage to output draw commands out of order, used by ImDrawListSplitter and ImDrawList::ChannelsSplit()
|
||||||
struct ImDrawCmd; // A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call, unless it is a callback)
|
struct ImDrawCmd; // A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call, unless it is a callback)
|
||||||
@@ -179,15 +192,15 @@ struct ImGuiViewport; // A Platform Window (always only one in 'ma
|
|||||||
// - In Visual Studio: CTRL+comma ("Edit.GoToAll") can follow symbols inside comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
|
// - In Visual Studio: CTRL+comma ("Edit.GoToAll") can follow symbols inside comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
|
||||||
// - In Visual Studio w/ Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols inside comments.
|
// - In Visual Studio w/ Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols inside comments.
|
||||||
// - In VS Code, CLion, etc.: CTRL+click can follow symbols inside comments.
|
// - In VS Code, CLion, etc.: CTRL+click can follow symbols inside comments.
|
||||||
|
enum ImGuiDir : int; // -> enum ImGuiDir // Enum: A cardinal direction (Left, Right, Up, Down)
|
||||||
enum ImGuiKey : int; // -> enum ImGuiKey // Enum: A key identifier (ImGuiKey_XXX or ImGuiMod_XXX value)
|
enum ImGuiKey : int; // -> enum ImGuiKey // Enum: A key identifier (ImGuiKey_XXX or ImGuiMod_XXX value)
|
||||||
enum ImGuiMouseSource : int; // -> enum ImGuiMouseSource // Enum; A mouse input source identifier (Mouse, TouchScreen, Pen)
|
enum ImGuiMouseSource : int; // -> enum ImGuiMouseSource // Enum; A mouse input source identifier (Mouse, TouchScreen, Pen)
|
||||||
|
enum ImGuiSortDirection : ImU8; // -> enum ImGuiSortDirection // Enum: A sorting direction (ascending or descending)
|
||||||
typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color identifier for styling
|
typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color identifier for styling
|
||||||
typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A condition for many Set*() functions
|
typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A condition for many Set*() functions
|
||||||
typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type
|
typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type
|
||||||
typedef int ImGuiDir; // -> enum ImGuiDir_ // Enum: A cardinal direction
|
|
||||||
typedef int ImGuiMouseButton; // -> enum ImGuiMouseButton_ // Enum: A mouse button identifier (0=left, 1=right, 2=middle)
|
typedef int ImGuiMouseButton; // -> enum ImGuiMouseButton_ // Enum: A mouse button identifier (0=left, 1=right, 2=middle)
|
||||||
typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse cursor shape
|
typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse cursor shape
|
||||||
typedef int ImGuiSortDirection; // -> enum ImGuiSortDirection_ // Enum: A sorting direction (ascending or descending)
|
|
||||||
typedef int ImGuiStyleVar; // -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling
|
typedef int ImGuiStyleVar; // -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling
|
||||||
typedef int ImGuiTableBgTarget; // -> enum ImGuiTableBgTarget_ // Enum: A color target for TableSetBgColor()
|
typedef int ImGuiTableBgTarget; // -> enum ImGuiTableBgTarget_ // Enum: A color target for TableSetBgColor()
|
||||||
|
|
||||||
@@ -208,6 +221,7 @@ typedef int ImGuiComboFlags; // -> enum ImGuiComboFlags_ // Flags: f
|
|||||||
typedef int ImGuiDragDropFlags; // -> enum ImGuiDragDropFlags_ // Flags: for BeginDragDropSource(), AcceptDragDropPayload()
|
typedef int ImGuiDragDropFlags; // -> enum ImGuiDragDropFlags_ // Flags: for BeginDragDropSource(), AcceptDragDropPayload()
|
||||||
typedef int ImGuiFocusedFlags; // -> enum ImGuiFocusedFlags_ // Flags: for IsWindowFocused()
|
typedef int ImGuiFocusedFlags; // -> enum ImGuiFocusedFlags_ // Flags: for IsWindowFocused()
|
||||||
typedef int ImGuiHoveredFlags; // -> enum ImGuiHoveredFlags_ // Flags: for IsItemHovered(), IsWindowHovered() etc.
|
typedef int ImGuiHoveredFlags; // -> enum ImGuiHoveredFlags_ // Flags: for IsItemHovered(), IsWindowHovered() etc.
|
||||||
|
typedef int ImGuiInputFlags; // -> enum ImGuiInputFlags_ // Flags: for Shortcut(), SetNextItemShortcut()
|
||||||
typedef int ImGuiInputTextFlags; // -> enum ImGuiInputTextFlags_ // Flags: for InputText(), InputTextMultiline()
|
typedef int ImGuiInputTextFlags; // -> enum ImGuiInputTextFlags_ // Flags: for InputText(), InputTextMultiline()
|
||||||
typedef int ImGuiKeyChord; // -> ImGuiKey | ImGuiMod_XXX // Flags: for IsKeyChordPressed(), Shortcut() etc. an ImGuiKey optionally OR-ed with one or more ImGuiMod_XXX values.
|
typedef int ImGuiKeyChord; // -> ImGuiKey | ImGuiMod_XXX // Flags: for IsKeyChordPressed(), Shortcut() etc. an ImGuiKey optionally OR-ed with one or more ImGuiMod_XXX values.
|
||||||
typedef int ImGuiPopupFlags; // -> enum ImGuiPopupFlags_ // Flags: for OpenPopup*(), BeginPopupContext*(), IsPopupOpen()
|
typedef int ImGuiPopupFlags; // -> enum ImGuiPopupFlags_ // Flags: for OpenPopup*(), BeginPopupContext*(), IsPopupOpen()
|
||||||
@@ -236,17 +250,6 @@ typedef void* ImTextureID; // Default: store a pointer or an integer fi
|
|||||||
typedef unsigned short ImDrawIdx; // Default: 16-bit (for maximum compatibility with renderer backends)
|
typedef unsigned short ImDrawIdx; // Default: 16-bit (for maximum compatibility with renderer backends)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Scalar data types
|
|
||||||
typedef unsigned int ImGuiID;// A unique ID used by widgets (typically the result of hashing a stack of string)
|
|
||||||
typedef signed char ImS8; // 8-bit signed integer
|
|
||||||
typedef unsigned char ImU8; // 8-bit unsigned integer
|
|
||||||
typedef signed short ImS16; // 16-bit signed integer
|
|
||||||
typedef unsigned short ImU16; // 16-bit unsigned integer
|
|
||||||
typedef signed int ImS32; // 32-bit signed integer == int
|
|
||||||
typedef unsigned int ImU32; // 32-bit unsigned integer (often used to store packed colors)
|
|
||||||
typedef signed long long ImS64; // 64-bit signed integer
|
|
||||||
typedef unsigned long long ImU64; // 64-bit unsigned integer
|
|
||||||
|
|
||||||
// Character types
|
// Character types
|
||||||
// (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display)
|
// (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display)
|
||||||
typedef unsigned int ImWchar32; // A single decoded U32 character/code point. We encode them as multi bytes UTF-8 when used in strings.
|
typedef unsigned int ImWchar32; // A single decoded U32 character/code point. We encode them as multi bytes UTF-8 when used in strings.
|
||||||
@@ -697,7 +700,8 @@ namespace ImGui
|
|||||||
|
|
||||||
// Tooltips
|
// Tooltips
|
||||||
// - Tooltips are windows following the mouse. They do not take focus away.
|
// - Tooltips are windows following the mouse. They do not take focus away.
|
||||||
// - A tooltip window can contain items of any types. SetTooltip() is a shortcut for the 'if (BeginTooltip()) { Text(...); EndTooltip(); }' idiom.
|
// - A tooltip window can contain items of any types.
|
||||||
|
// - SetTooltip() is more or less a shortcut for the 'if (BeginTooltip()) { Text(...); EndTooltip(); }' idiom (with a subtlety that it discard any previously submitted tooltip)
|
||||||
IMGUI_API bool BeginTooltip(); // begin/append a tooltip window.
|
IMGUI_API bool BeginTooltip(); // begin/append a tooltip window.
|
||||||
IMGUI_API void EndTooltip(); // only call EndTooltip() if BeginTooltip()/BeginItemTooltip() returns true!
|
IMGUI_API void EndTooltip(); // only call EndTooltip() if BeginTooltip()/BeginItemTooltip() returns true!
|
||||||
IMGUI_API void SetTooltip(const char* fmt, ...) IM_FMTARGS(1); // set a text-only tooltip. Often used after a ImGui::IsItemHovered() check. Override any previous call to SetTooltip().
|
IMGUI_API void SetTooltip(const char* fmt, ...) IM_FMTARGS(1); // set a text-only tooltip. Often used after a ImGui::IsItemHovered() check. Override any previous call to SetTooltip().
|
||||||
@@ -708,7 +712,7 @@ namespace ImGui
|
|||||||
// - SetItemTooltip() is a shortcut for the 'if (IsItemHovered(ImGuiHoveredFlags_ForTooltip)) { SetTooltip(...); }' idiom.
|
// - SetItemTooltip() is a shortcut for the 'if (IsItemHovered(ImGuiHoveredFlags_ForTooltip)) { SetTooltip(...); }' idiom.
|
||||||
// - Where 'ImGuiHoveredFlags_ForTooltip' itself is a shortcut to use 'style.HoverFlagsForTooltipMouse' or 'style.HoverFlagsForTooltipNav' depending on active input type. For mouse it defaults to 'ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort'.
|
// - Where 'ImGuiHoveredFlags_ForTooltip' itself is a shortcut to use 'style.HoverFlagsForTooltipMouse' or 'style.HoverFlagsForTooltipNav' depending on active input type. For mouse it defaults to 'ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort'.
|
||||||
IMGUI_API bool BeginItemTooltip(); // begin/append a tooltip window if preceding item was hovered.
|
IMGUI_API bool BeginItemTooltip(); // begin/append a tooltip window if preceding item was hovered.
|
||||||
IMGUI_API void SetItemTooltip(const char* fmt, ...) IM_FMTARGS(1); // set a text-only tooltip if preceeding item was hovered. override any previous call to SetTooltip().
|
IMGUI_API void SetItemTooltip(const char* fmt, ...) IM_FMTARGS(1); // set a text-only tooltip if preceding item was hovered. override any previous call to SetTooltip().
|
||||||
IMGUI_API void SetItemTooltipV(const char* fmt, va_list args) IM_FMTLIST(1);
|
IMGUI_API void SetItemTooltipV(const char* fmt, va_list args) IM_FMTLIST(1);
|
||||||
|
|
||||||
// Popups, Modals
|
// Popups, Modals
|
||||||
@@ -935,6 +939,24 @@ namespace ImGui
|
|||||||
IMGUI_API const char* GetKeyName(ImGuiKey key); // [DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared.
|
IMGUI_API const char* GetKeyName(ImGuiKey key); // [DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared.
|
||||||
IMGUI_API void SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard); // Override io.WantCaptureKeyboard flag next frame (said flag is left for your application to handle, typically when true it instructs your app to ignore inputs). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard"; after the next NewFrame() call.
|
IMGUI_API void SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard); // Override io.WantCaptureKeyboard flag next frame (said flag is left for your application to handle, typically when true it instructs your app to ignore inputs). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard"; after the next NewFrame() call.
|
||||||
|
|
||||||
|
// Inputs Utilities: Shortcut Testing & Routing [BETA]
|
||||||
|
// - ImGuiKeyChord = a ImGuiKey + optional ImGuiMod_Alt/ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Super.
|
||||||
|
// ImGuiKey_C // Accepted by functions taking ImGuiKey or ImGuiKeyChord arguments)
|
||||||
|
// ImGuiMod_Ctrl | ImGuiKey_C // Accepted by functions taking ImGuiKeyChord arguments)
|
||||||
|
// only ImGuiMod_XXX values are legal to combine with an ImGuiKey. You CANNOT combine two ImGuiKey values.
|
||||||
|
// - The general idea is that several callers may register interest in a shortcut, and only one owner gets it.
|
||||||
|
// Parent -> call Shortcut(Ctrl+S) // When Parent is focused, Parent gets the shortcut.
|
||||||
|
// Child1 -> call Shortcut(Ctrl+S) // When Child1 is focused, Child1 gets the shortcut (Child1 overrides Parent shortcuts)
|
||||||
|
// Child2 -> no call // When Child2 is focused, Parent gets the shortcut.
|
||||||
|
// The whole system is order independent, so if Child1 makes its calls before Parent, results will be identical.
|
||||||
|
// This is an important property as it facilitate working with foreign code or larger codebase.
|
||||||
|
// - To understand the difference:
|
||||||
|
// - IsKeyChordPressed() compares mods and call IsKeyPressed() -> function has no side-effect.
|
||||||
|
// - Shortcut() submits a route, routes are resolved, if it currently can be routed it calls IsKeyChordPressed() -> function has (desirable) side-effects as it can prevents another call from getting the route.
|
||||||
|
// - Visualize registered routes in 'Metrics/Debugger->Inputs'.
|
||||||
|
IMGUI_API bool Shortcut(ImGuiKeyChord key_chord, ImGuiInputFlags flags = 0);
|
||||||
|
IMGUI_API void SetNextItemShortcut(ImGuiKeyChord key_chord, ImGuiInputFlags flags = 0);
|
||||||
|
|
||||||
// Inputs Utilities: Mouse specific
|
// Inputs Utilities: Mouse specific
|
||||||
// - To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right.
|
// - To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right.
|
||||||
// - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.
|
// - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.
|
||||||
@@ -949,8 +971,8 @@ namespace ImGui
|
|||||||
IMGUI_API bool IsAnyMouseDown(); // [WILL OBSOLETE] is any mouse button held? This was designed for backends, but prefer having backend maintain a mask of held mouse buttons, because upcoming input queue system will make this invalid.
|
IMGUI_API bool IsAnyMouseDown(); // [WILL OBSOLETE] is any mouse button held? This was designed for backends, but prefer having backend maintain a mask of held mouse buttons, because upcoming input queue system will make this invalid.
|
||||||
IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
|
IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
|
||||||
IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup(); // retrieve mouse position at the time of opening popup we have BeginPopup() into (helper to avoid user backing that value themselves)
|
IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup(); // retrieve mouse position at the time of opening popup we have BeginPopup() into (helper to avoid user backing that value themselves)
|
||||||
IMGUI_API bool IsMouseDragging(ImGuiMouseButton button, float lock_threshold = -1.0f); // is mouse dragging? (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold)
|
IMGUI_API bool IsMouseDragging(ImGuiMouseButton button, float lock_threshold = -1.0f); // is mouse dragging? (uses io.MouseDraggingThreshold if lock_threshold < 0.0f)
|
||||||
IMGUI_API ImVec2 GetMouseDragDelta(ImGuiMouseButton button = 0, float lock_threshold = -1.0f); // return the delta from the initial clicking position while the mouse button is pressed or was just released. This is locked and return 0.0f until the mouse moves past a distance threshold at least once (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold)
|
IMGUI_API ImVec2 GetMouseDragDelta(ImGuiMouseButton button = 0, float lock_threshold = -1.0f); // return the delta from the initial clicking position while the mouse button is pressed or was just released. This is locked and return 0.0f until the mouse moves past a distance threshold at least once (uses io.MouseDraggingThreshold if lock_threshold < 0.0f)
|
||||||
IMGUI_API void ResetMouseDragDelta(ImGuiMouseButton button = 0); //
|
IMGUI_API void ResetMouseDragDelta(ImGuiMouseButton button = 0); //
|
||||||
IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired mouse cursor shape. Important: reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you
|
IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired mouse cursor shape. Important: reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you
|
||||||
IMGUI_API void SetMouseCursor(ImGuiMouseCursor cursor_type); // set desired mouse cursor shape
|
IMGUI_API void SetMouseCursor(ImGuiMouseCursor cursor_type); // set desired mouse cursor shape
|
||||||
@@ -986,6 +1008,11 @@ namespace ImGui
|
|||||||
IMGUI_API void* MemAlloc(size_t size);
|
IMGUI_API void* MemAlloc(size_t size);
|
||||||
IMGUI_API void MemFree(void* ptr);
|
IMGUI_API void MemFree(void* ptr);
|
||||||
|
|
||||||
|
// Windows98 functions
|
||||||
|
IMGUI_API void WinAddRect(const ImVec2& min, const ImVec2& max, bool inset);
|
||||||
|
IMGUI_API void StyleWin98(ImGuiStyle* dst = NULL);
|
||||||
|
|
||||||
|
|
||||||
} // namespace ImGui
|
} // namespace ImGui
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -1060,28 +1087,37 @@ enum ImGuiChildFlags_
|
|||||||
// (Those are per-item flags. There are shared flags in ImGuiIO: io.ConfigInputTextCursorBlink and io.ConfigInputTextEnterKeepActive)
|
// (Those are per-item flags. There are shared flags in ImGuiIO: io.ConfigInputTextCursorBlink and io.ConfigInputTextEnterKeepActive)
|
||||||
enum ImGuiInputTextFlags_
|
enum ImGuiInputTextFlags_
|
||||||
{
|
{
|
||||||
|
// Basic filters (also see ImGuiInputTextFlags_CallbackCharFilter)
|
||||||
ImGuiInputTextFlags_None = 0,
|
ImGuiInputTextFlags_None = 0,
|
||||||
ImGuiInputTextFlags_CharsDecimal = 1 << 0, // Allow 0123456789.+-*/
|
ImGuiInputTextFlags_CharsDecimal = 1 << 0, // Allow 0123456789.+-*/
|
||||||
ImGuiInputTextFlags_CharsHexadecimal = 1 << 1, // Allow 0123456789ABCDEFabcdef
|
ImGuiInputTextFlags_CharsHexadecimal = 1 << 1, // Allow 0123456789ABCDEFabcdef
|
||||||
ImGuiInputTextFlags_CharsUppercase = 1 << 2, // Turn a..z into A..Z
|
ImGuiInputTextFlags_CharsScientific = 1 << 2, // Allow 0123456789.+-*/eE (Scientific notation input)
|
||||||
ImGuiInputTextFlags_CharsNoBlank = 1 << 3, // Filter out spaces, tabs
|
ImGuiInputTextFlags_CharsUppercase = 1 << 3, // Turn a..z into A..Z
|
||||||
ImGuiInputTextFlags_AutoSelectAll = 1 << 4, // Select entire text when first taking mouse focus
|
ImGuiInputTextFlags_CharsNoBlank = 1 << 4, // Filter out spaces, tabs
|
||||||
ImGuiInputTextFlags_EnterReturnsTrue = 1 << 5, // Return 'true' when Enter is pressed (as opposed to every time the value was modified). Consider looking at the IsItemDeactivatedAfterEdit() function.
|
|
||||||
ImGuiInputTextFlags_CallbackCompletion = 1 << 6, // Callback on pressing TAB (for completion handling)
|
// Inputs
|
||||||
ImGuiInputTextFlags_CallbackHistory = 1 << 7, // Callback on pressing Up/Down arrows (for history handling)
|
ImGuiInputTextFlags_AllowTabInput = 1 << 5, // Pressing TAB input a '\t' character into the text field
|
||||||
ImGuiInputTextFlags_CallbackAlways = 1 << 8, // Callback on each iteration. User code may query cursor position, modify text buffer.
|
ImGuiInputTextFlags_EnterReturnsTrue = 1 << 6, // Return 'true' when Enter is pressed (as opposed to every time the value was modified). Consider looking at the IsItemDeactivatedAfterEdit() function.
|
||||||
ImGuiInputTextFlags_CallbackCharFilter = 1 << 9, // Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard.
|
ImGuiInputTextFlags_EscapeClearsAll = 1 << 7, // Escape key clears content if not empty, and deactivate otherwise (contrast to default behavior of Escape to revert)
|
||||||
ImGuiInputTextFlags_AllowTabInput = 1 << 10, // Pressing TAB input a '\t' character into the text field
|
ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 8, // In multi-line mode, validate with Enter, add new line with Ctrl+Enter (default is opposite: validate with Ctrl+Enter, add line with Enter).
|
||||||
ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11, // In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter).
|
|
||||||
ImGuiInputTextFlags_NoHorizontalScroll = 1 << 12, // Disable following the cursor horizontally
|
// Other options
|
||||||
ImGuiInputTextFlags_AlwaysOverwrite = 1 << 13, // Overwrite mode
|
ImGuiInputTextFlags_ReadOnly = 1 << 9, // Read-only mode
|
||||||
ImGuiInputTextFlags_ReadOnly = 1 << 14, // Read-only mode
|
ImGuiInputTextFlags_Password = 1 << 10, // Password mode, display all characters as '*', disable copy
|
||||||
ImGuiInputTextFlags_Password = 1 << 15, // Password mode, display all characters as '*'
|
ImGuiInputTextFlags_AlwaysOverwrite = 1 << 11, // Overwrite mode
|
||||||
|
ImGuiInputTextFlags_AutoSelectAll = 1 << 12, // Select entire text when first taking mouse focus
|
||||||
|
ImGuiInputTextFlags_ParseEmptyRefVal = 1 << 13, // InputFloat(), InputInt(), InputScalar() etc. only: parse empty string as zero value.
|
||||||
|
ImGuiInputTextFlags_DisplayEmptyRefVal = 1 << 14, // InputFloat(), InputInt(), InputScalar() etc. only: when value is zero, do not display it. Generally used with ImGuiInputTextFlags_ParseEmptyRefVal.
|
||||||
|
ImGuiInputTextFlags_NoHorizontalScroll = 1 << 15, // Disable following the cursor horizontally
|
||||||
ImGuiInputTextFlags_NoUndoRedo = 1 << 16, // Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().
|
ImGuiInputTextFlags_NoUndoRedo = 1 << 16, // Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().
|
||||||
ImGuiInputTextFlags_CharsScientific = 1 << 17, // Allow 0123456789.+-*/eE (Scientific notation input)
|
|
||||||
ImGuiInputTextFlags_CallbackResize = 1 << 18, // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)
|
// Callback features
|
||||||
ImGuiInputTextFlags_CallbackEdit = 1 << 19, // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)
|
ImGuiInputTextFlags_CallbackCompletion = 1 << 17, // Callback on pressing TAB (for completion handling)
|
||||||
ImGuiInputTextFlags_EscapeClearsAll = 1 << 20, // Escape key clears content if not empty, and deactivate otherwise (contrast to default behavior of Escape to revert)
|
ImGuiInputTextFlags_CallbackHistory = 1 << 18, // Callback on pressing Up/Down arrows (for history handling)
|
||||||
|
ImGuiInputTextFlags_CallbackAlways = 1 << 19, // Callback on each iteration. User code may query cursor position, modify text buffer.
|
||||||
|
ImGuiInputTextFlags_CallbackCharFilter = 1 << 20, // Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard.
|
||||||
|
ImGuiInputTextFlags_CallbackResize = 1 << 21, // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)
|
||||||
|
ImGuiInputTextFlags_CallbackEdit = 1 << 22, // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)
|
||||||
|
|
||||||
// Obsolete names
|
// Obsolete names
|
||||||
//ImGuiInputTextFlags_AlwaysInsertMode = ImGuiInputTextFlags_AlwaysOverwrite // [renamed in 1.82] name was not matching behavior
|
//ImGuiInputTextFlags_AlwaysInsertMode = ImGuiInputTextFlags_AlwaysOverwrite // [renamed in 1.82] name was not matching behavior
|
||||||
@@ -1101,7 +1137,7 @@ enum ImGuiTreeNodeFlags_
|
|||||||
ImGuiTreeNodeFlags_OpenOnArrow = 1 << 7, // Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open.
|
ImGuiTreeNodeFlags_OpenOnArrow = 1 << 7, // Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open.
|
||||||
ImGuiTreeNodeFlags_Leaf = 1 << 8, // No collapsing, no arrow (use as a convenience for leaf nodes).
|
ImGuiTreeNodeFlags_Leaf = 1 << 8, // No collapsing, no arrow (use as a convenience for leaf nodes).
|
||||||
ImGuiTreeNodeFlags_Bullet = 1 << 9, // Display a bullet instead of arrow. IMPORTANT: node can still be marked open/close if you don't set the _Leaf flag!
|
ImGuiTreeNodeFlags_Bullet = 1 << 9, // Display a bullet instead of arrow. IMPORTANT: node can still be marked open/close if you don't set the _Leaf flag!
|
||||||
ImGuiTreeNodeFlags_FramePadding = 1 << 10, // Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding().
|
ImGuiTreeNodeFlags_FramePadding = 1 << 10, // Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding() before the node.
|
||||||
ImGuiTreeNodeFlags_SpanAvailWidth = 1 << 11, // Extend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line without using AllowOverlap mode.
|
ImGuiTreeNodeFlags_SpanAvailWidth = 1 << 11, // Extend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line without using AllowOverlap mode.
|
||||||
ImGuiTreeNodeFlags_SpanFullWidth = 1 << 12, // Extend hit box to the left-most and right-most edges (cover the indent area).
|
ImGuiTreeNodeFlags_SpanFullWidth = 1 << 12, // Extend hit box to the left-most and right-most edges (cover the indent area).
|
||||||
ImGuiTreeNodeFlags_SpanTextWidth = 1 << 13, // Narrow hit box + narrow hovering highlight, will only cover the label text.
|
ImGuiTreeNodeFlags_SpanTextWidth = 1 << 13, // Narrow hit box + narrow hovering highlight, will only cover the label text.
|
||||||
@@ -1292,7 +1328,7 @@ enum ImGuiDataType_
|
|||||||
};
|
};
|
||||||
|
|
||||||
// A cardinal direction
|
// A cardinal direction
|
||||||
enum ImGuiDir_
|
enum ImGuiDir : int
|
||||||
{
|
{
|
||||||
ImGuiDir_None = -1,
|
ImGuiDir_None = -1,
|
||||||
ImGuiDir_Left = 0,
|
ImGuiDir_Left = 0,
|
||||||
@@ -1303,7 +1339,7 @@ enum ImGuiDir_
|
|||||||
};
|
};
|
||||||
|
|
||||||
// A sorting direction
|
// A sorting direction
|
||||||
enum ImGuiSortDirection_
|
enum ImGuiSortDirection : ImU8
|
||||||
{
|
{
|
||||||
ImGuiSortDirection_None = 0,
|
ImGuiSortDirection_None = 0,
|
||||||
ImGuiSortDirection_Ascending = 1, // Ascending = 0->9, A->Z etc.
|
ImGuiSortDirection_Ascending = 1, // Ascending = 0->9, A->Z etc.
|
||||||
@@ -1422,13 +1458,13 @@ enum ImGuiKey : int
|
|||||||
// - In theory the value of keyboard modifiers should be roughly equivalent to a logical or of the equivalent left/right keys.
|
// - In theory the value of keyboard modifiers should be roughly equivalent to a logical or of the equivalent left/right keys.
|
||||||
// In practice: it's complicated; mods are often provided from different sources. Keyboard layout, IME, sticky keys and
|
// In practice: it's complicated; mods are often provided from different sources. Keyboard layout, IME, sticky keys and
|
||||||
// backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user...
|
// backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user...
|
||||||
|
// - On macOS, we swap Cmd(Super) and Ctrl keys at the time of the io.AddKeyEvent() call.
|
||||||
ImGuiMod_None = 0,
|
ImGuiMod_None = 0,
|
||||||
ImGuiMod_Ctrl = 1 << 12, // Ctrl
|
ImGuiMod_Ctrl = 1 << 12, // Ctrl (non-macOS), Cmd (macOS)
|
||||||
ImGuiMod_Shift = 1 << 13, // Shift
|
ImGuiMod_Shift = 1 << 13, // Shift
|
||||||
ImGuiMod_Alt = 1 << 14, // Option/Menu
|
ImGuiMod_Alt = 1 << 14, // Option/Menu
|
||||||
ImGuiMod_Super = 1 << 15, // Cmd/Super/Windows
|
ImGuiMod_Super = 1 << 15, // Windows/Super (non-macOS), Ctrl (macOS)
|
||||||
ImGuiMod_Shortcut = 1 << 11, // Alias for Ctrl (non-macOS) _or_ Super (macOS).
|
ImGuiMod_Mask_ = 0xF000, // 4-bits
|
||||||
ImGuiMod_Mask_ = 0xF800, // 5-bits
|
|
||||||
|
|
||||||
// [Internal] Prior to 1.87 we required user to fill io.KeysDown[512] using their own native index + the io.KeyMap[] array.
|
// [Internal] Prior to 1.87 we required user to fill io.KeysDown[512] using their own native index + the io.KeyMap[] array.
|
||||||
// We are ditching this method but keeping a legacy path for user code doing e.g. IsKeyPressed(MY_NATIVE_KEY_CODE)
|
// We are ditching this method but keeping a legacy path for user code doing e.g. IsKeyPressed(MY_NATIVE_KEY_CODE)
|
||||||
@@ -1445,11 +1481,37 @@ enum ImGuiKey : int
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
ImGuiMod_Shortcut = ImGuiMod_Ctrl, // Removed in 1.90.7, you can now simply use ImGuiMod_Ctrl
|
||||||
ImGuiKey_ModCtrl = ImGuiMod_Ctrl, ImGuiKey_ModShift = ImGuiMod_Shift, ImGuiKey_ModAlt = ImGuiMod_Alt, ImGuiKey_ModSuper = ImGuiMod_Super, // Renamed in 1.89
|
ImGuiKey_ModCtrl = ImGuiMod_Ctrl, ImGuiKey_ModShift = ImGuiMod_Shift, ImGuiKey_ModAlt = ImGuiMod_Alt, ImGuiKey_ModSuper = ImGuiMod_Super, // Renamed in 1.89
|
||||||
//ImGuiKey_KeyPadEnter = ImGuiKey_KeypadEnter, // Renamed in 1.87
|
//ImGuiKey_KeyPadEnter = ImGuiKey_KeypadEnter, // Renamed in 1.87
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Flags for Shortcut(), SetNextItemShortcut(),
|
||||||
|
// (and for upcoming extended versions of IsKeyPressed(), IsMouseClicked(), Shortcut(), SetKeyOwner(), SetItemKeyOwner() that are still in imgui_internal.h)
|
||||||
|
// Don't mistake with ImGuiInputTextFlags! (which is for ImGui::InputText() function)
|
||||||
|
enum ImGuiInputFlags_
|
||||||
|
{
|
||||||
|
ImGuiInputFlags_None = 0,
|
||||||
|
ImGuiInputFlags_Repeat = 1 << 0, // Enable repeat. Return true on successive repeats. Default for legacy IsKeyPressed(). NOT Default for legacy IsMouseClicked(). MUST BE == 1.
|
||||||
|
|
||||||
|
// Flags for Shortcut(), SetNextItemShortcut()
|
||||||
|
// - Routing policies: RouteGlobal+OverActive >> RouteActive or RouteFocused (if owner is active item) >> RouteGlobal+OverFocused >> RouteFocused (if in focused window stack) >> RouteGlobal.
|
||||||
|
// - Default policy is RouteFocused. Can select only 1 policy among all available.
|
||||||
|
ImGuiInputFlags_RouteActive = 1 << 10, // Route to active item only.
|
||||||
|
ImGuiInputFlags_RouteFocused = 1 << 11, // Route to windows in the focus stack (DEFAULT). Deep-most focused window takes inputs. Active item takes inputs over deep-most focused window.
|
||||||
|
ImGuiInputFlags_RouteGlobal = 1 << 12, // Global route (unless a focused window or active item registered the route).
|
||||||
|
ImGuiInputFlags_RouteAlways = 1 << 13, // Do not register route, poll keys directly.
|
||||||
|
// - Routing options
|
||||||
|
ImGuiInputFlags_RouteOverFocused = 1 << 14, // Option: global route: higher priority than focused route (unless active item in focused route).
|
||||||
|
ImGuiInputFlags_RouteOverActive = 1 << 15, // Option: global route: higher priority than active item. Unlikely you need to use that: will interfere with every active items, e.g. CTRL+A registered by InputText will be overridden by this. May not be fully honored as user/internal code is likely to always assume they can access keys when active.
|
||||||
|
ImGuiInputFlags_RouteUnlessBgFocused = 1 << 16, // Option: global route: will not be applied if underlying background/void is focused (== no Dear ImGui windows are focused). Useful for overlay applications.
|
||||||
|
ImGuiInputFlags_RouteFromRootWindow = 1 << 17, // Option: route evaluated from the point of view of root window rather than current window.
|
||||||
|
|
||||||
|
// Flags for SetNextItemShortcut()
|
||||||
|
ImGuiInputFlags_Tooltip = 1 << 18, // Automatically display a tooltip when hovering item [BETA] Unsure of right api (opt-in/opt-out)
|
||||||
|
};
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
// OBSOLETED in 1.88 (from July 2022): ImGuiNavInput and io.NavInputs[].
|
// OBSOLETED in 1.88 (from July 2022): ImGuiNavInput and io.NavInputs[].
|
||||||
// Official backends between 1.60 and 1.86: will keep working and feed gamepad inputs as long as IMGUI_DISABLE_OBSOLETE_KEYIO is not set.
|
// Official backends between 1.60 and 1.86: will keep working and feed gamepad inputs as long as IMGUI_DISABLE_OBSOLETE_KEYIO is not set.
|
||||||
@@ -1600,10 +1662,8 @@ enum ImGuiButtonFlags_
|
|||||||
ImGuiButtonFlags_MouseButtonLeft = 1 << 0, // React on left mouse button (default)
|
ImGuiButtonFlags_MouseButtonLeft = 1 << 0, // React on left mouse button (default)
|
||||||
ImGuiButtonFlags_MouseButtonRight = 1 << 1, // React on right mouse button
|
ImGuiButtonFlags_MouseButtonRight = 1 << 1, // React on right mouse button
|
||||||
ImGuiButtonFlags_MouseButtonMiddle = 1 << 2, // React on center mouse button
|
ImGuiButtonFlags_MouseButtonMiddle = 1 << 2, // React on center mouse button
|
||||||
|
ImGuiButtonFlags_MouseButtonMask_ = ImGuiButtonFlags_MouseButtonLeft | ImGuiButtonFlags_MouseButtonRight | ImGuiButtonFlags_MouseButtonMiddle, // [Internal]
|
||||||
// [Internal]
|
//ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft,
|
||||||
ImGuiButtonFlags_MouseButtonMask_ = ImGuiButtonFlags_MouseButtonLeft | ImGuiButtonFlags_MouseButtonRight | ImGuiButtonFlags_MouseButtonMiddle,
|
|
||||||
ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton()
|
// Flags for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton()
|
||||||
@@ -1876,7 +1936,7 @@ struct ImGuiTableColumnSortSpecs
|
|||||||
ImGuiID ColumnUserID; // User id of the column (if specified by a TableSetupColumn() call)
|
ImGuiID ColumnUserID; // User id of the column (if specified by a TableSetupColumn() call)
|
||||||
ImS16 ColumnIndex; // Index of the column
|
ImS16 ColumnIndex; // Index of the column
|
||||||
ImS16 SortOrder; // Index within parent ImGuiTableSortSpecs (always stored in order starting from 0, tables sorted on a single criteria will always have a 0 here)
|
ImS16 SortOrder; // Index within parent ImGuiTableSortSpecs (always stored in order starting from 0, tables sorted on a single criteria will always have a 0 here)
|
||||||
ImGuiSortDirection SortDirection : 8; // ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending
|
ImGuiSortDirection SortDirection; // ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending
|
||||||
|
|
||||||
ImGuiTableColumnSortSpecs() { memset(this, 0, sizeof(*this)); }
|
ImGuiTableColumnSortSpecs() { memset(this, 0, sizeof(*this)); }
|
||||||
};
|
};
|
||||||
@@ -2025,9 +2085,9 @@ struct ImGuiStyle
|
|||||||
float SeparatorTextBorderSize; // Thickkness of border in SeparatorText()
|
float SeparatorTextBorderSize; // Thickkness of border in SeparatorText()
|
||||||
ImVec2 SeparatorTextAlign; // Alignment of text within the separator. Defaults to (0.0f, 0.5f) (left aligned, center).
|
ImVec2 SeparatorTextAlign; // Alignment of text within the separator. Defaults to (0.0f, 0.5f) (left aligned, center).
|
||||||
ImVec2 SeparatorTextPadding; // Horizontal offset of text from each edge of the separator + spacing on other axis. Generally small values. .y is recommended to be == FramePadding.y.
|
ImVec2 SeparatorTextPadding; // Horizontal offset of text from each edge of the separator + spacing on other axis. Generally small values. .y is recommended to be == FramePadding.y.
|
||||||
ImVec2 DisplayWindowPadding; // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows.
|
ImVec2 DisplayWindowPadding; // Apply to regular windows: amount which we enforce to keep visible when moving near edges of your screen.
|
||||||
ImVec2 DisplaySafeAreaPadding; // If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly!
|
ImVec2 DisplaySafeAreaPadding; // Apply to every windows, menus, popups, tooltips: amount where we avoid displaying contents. Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured).
|
||||||
float MouseCursorScale; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later.
|
float MouseCursorScale; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). We apply per-monitor DPI scaling over this scale. May be removed later.
|
||||||
bool AntiAliasedLines; // Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList).
|
bool AntiAliasedLines; // Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList).
|
||||||
bool AntiAliasedLinesUseTex; // Enable anti-aliased lines/borders using textures where possible. Require backend to render with bilinear filtering (NOT point/nearest filtering). Latched at the beginning of the frame (copied to ImDrawList).
|
bool AntiAliasedLinesUseTex; // Enable anti-aliased lines/borders using textures where possible. Require backend to render with bilinear filtering (NOT point/nearest filtering). Latched at the beginning of the frame (copied to ImDrawList).
|
||||||
bool AntiAliasedFill; // Enable anti-aliased edges around filled shapes (rounded rectangles, circles, etc.). Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList).
|
bool AntiAliasedFill; // Enable anti-aliased edges around filled shapes (rounded rectangles, circles, etc.). Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList).
|
||||||
@@ -2090,7 +2150,7 @@ struct ImGuiIO
|
|||||||
|
|
||||||
// Miscellaneous options
|
// Miscellaneous options
|
||||||
bool MouseDrawCursor; // = false // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by backend implementations.
|
bool MouseDrawCursor; // = false // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by backend implementations.
|
||||||
bool ConfigMacOSXBehaviors; // = 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 ConfigMacOSXBehaviors; // = defined(__APPLE__) // Swap Cmd<>Ctrl keys + 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 ConfigInputTrickleEventQueue; // = true // Enable input queue trickling: some types of events submitted during the same frame (e.g. button down + up) will be spread over multiple frames, improving interactions with low framerates.
|
bool ConfigInputTrickleEventQueue; // = true // Enable input queue trickling: some types of events submitted during the same frame (e.g. button down + up) will be spread over multiple frames, improving interactions with low framerates.
|
||||||
bool ConfigInputTextCursorBlink; // = true // Enable blinking cursor (optional as some users consider it to be distracting).
|
bool ConfigInputTextCursorBlink; // = true // Enable blinking cursor (optional as some users consider it to be distracting).
|
||||||
bool ConfigInputTextEnterKeepActive; // = false // [BETA] Pressing Enter will keep item active and select contents (single-line only).
|
bool ConfigInputTextEnterKeepActive; // = false // [BETA] Pressing Enter will keep item active and select contents (single-line only).
|
||||||
@@ -2221,7 +2281,7 @@ struct ImGuiIO
|
|||||||
bool KeySuper; // Keyboard modifier down: Cmd/Super/Windows
|
bool KeySuper; // Keyboard modifier down: Cmd/Super/Windows
|
||||||
|
|
||||||
// Other state maintained from data above + IO function calls
|
// Other state maintained from data above + IO function calls
|
||||||
ImGuiKeyChord KeyMods; // Key mods flags (any of ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Alt/ImGuiMod_Super flags, same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags. DOES NOT CONTAINS ImGuiMod_Shortcut which is pretranslated). Read-only, updated by NewFrame()
|
ImGuiKeyChord KeyMods; // Key mods flags (any of ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Alt/ImGuiMod_Super flags, same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags. Read-only, updated by NewFrame()
|
||||||
ImGuiKeyData KeysData[ImGuiKey_KeysData_SIZE]; // Key state for all known keys. Use IsKeyXXX() functions to access this.
|
ImGuiKeyData KeysData[ImGuiKey_KeysData_SIZE]; // Key state for all known keys. Use IsKeyXXX() functions to access this.
|
||||||
bool WantCaptureMouseUnlessPopupClose; // Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup.
|
bool WantCaptureMouseUnlessPopupClose; // Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup.
|
||||||
ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
|
ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
|
||||||
@@ -2235,6 +2295,7 @@ struct ImGuiIO
|
|||||||
bool MouseDownOwned[5]; // Track if button was clicked inside a dear imgui window or over void blocked by a popup. We don't request mouse capture from the application if click started outside ImGui bounds.
|
bool MouseDownOwned[5]; // Track if button was clicked inside a dear imgui window or over void blocked by a popup. We don't request mouse capture from the application if click started outside ImGui bounds.
|
||||||
bool MouseDownOwnedUnlessPopupClose[5]; // Track if button was clicked inside a dear imgui window.
|
bool MouseDownOwnedUnlessPopupClose[5]; // Track if button was clicked inside a dear imgui window.
|
||||||
bool MouseWheelRequestAxisSwap; // On a non-Mac system, holding SHIFT requests WheelY to perform the equivalent of a WheelX event. On a Mac system this is already enforced by the system.
|
bool MouseWheelRequestAxisSwap; // On a non-Mac system, holding SHIFT requests WheelY to perform the equivalent of a WheelX event. On a Mac system this is already enforced by the system.
|
||||||
|
bool MouseCtrlLeftAsRightClick; // (OSX) Set to true when the current click was a ctrl-click that spawned a simulated right click
|
||||||
float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked)
|
float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked)
|
||||||
float MouseDownDurationPrev[5]; // Previous time the mouse button has been down
|
float MouseDownDurationPrev[5]; // Previous time the mouse button has been down
|
||||||
float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the clicking point (used for moving thresholds)
|
float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the clicking point (used for moving thresholds)
|
||||||
@@ -3023,7 +3084,7 @@ struct ImFontAtlas
|
|||||||
|
|
||||||
// You can request arbitrary rectangles to be packed into the atlas, for your own purposes.
|
// You can request arbitrary rectangles to be packed into the atlas, for your own purposes.
|
||||||
// - After calling Build(), you can query the rectangle position and render your pixels.
|
// - After calling Build(), you can query the rectangle position and render your pixels.
|
||||||
// - If you render colored output, set 'atlas->TexPixelsUseColors = true' as this may help some backends decide of prefered texture format.
|
// - If you render colored output, set 'atlas->TexPixelsUseColors = true' as this may help some backends decide of preferred texture format.
|
||||||
// - You can also request your rectangles to be mapped as font glyph (given a font + Unicode point),
|
// - You can also request your rectangles to be mapped as font glyph (given a font + Unicode point),
|
||||||
// so you can render e.g. custom colorful icons and use them as regular glyphs.
|
// so you can render e.g. custom colorful icons and use them as regular glyphs.
|
||||||
// - Read docs/FONTS.md for more details about using colorful icons.
|
// - Read docs/FONTS.md for more details about using colorful icons.
|
||||||
@@ -3207,14 +3268,14 @@ namespace ImGui
|
|||||||
static inline void PopAllowKeyboardFocus() { PopTabStop(); }
|
static inline void PopAllowKeyboardFocus() { PopTabStop(); }
|
||||||
// OBSOLETED in 1.89 (from August 2022)
|
// OBSOLETED in 1.89 (from August 2022)
|
||||||
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1)); // Use new ImageButton() signature (explicit item id, regular FramePadding)
|
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1)); // Use new ImageButton() signature (explicit item id, regular FramePadding)
|
||||||
// OBSOLETED in 1.88 (from May 2022)
|
// OBSOLETED in 1.87 (from February 2022 but more formally obsoleted April 2024)
|
||||||
static inline void CaptureKeyboardFromApp(bool want_capture_keyboard = true) { SetNextFrameWantCaptureKeyboard(want_capture_keyboard); } // Renamed as name was misleading + removed default value.
|
|
||||||
static inline void CaptureMouseFromApp(bool want_capture_mouse = true) { SetNextFrameWantCaptureMouse(want_capture_mouse); } // Renamed as name was misleading + removed default value.
|
|
||||||
// OBSOLETED in 1.87 (from February 2022)
|
|
||||||
IMGUI_API ImGuiKey GetKeyIndex(ImGuiKey key); // Map ImGuiKey_* values into legacy native key index. == io.KeyMap[key]. When using a 1.87+ backend using io.AddKeyEvent(), calling GetKeyIndex() with ANY ImGuiKey_XXXX values will return the same value!
|
IMGUI_API ImGuiKey GetKeyIndex(ImGuiKey key); // Map ImGuiKey_* values into legacy native key index. == io.KeyMap[key]. When using a 1.87+ backend using io.AddKeyEvent(), calling GetKeyIndex() with ANY ImGuiKey_XXXX values will return the same value!
|
||||||
//static inline ImGuiKey GetKeyIndex(ImGuiKey key) { IM_ASSERT(key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END); return key; }
|
//static inline ImGuiKey GetKeyIndex(ImGuiKey key) { IM_ASSERT(key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END); return key; }
|
||||||
|
|
||||||
// Some of the older obsolete names along with their replacement (commented out so they are not reported in IDE)
|
// Some of the older obsolete names along with their replacement (commented out so they are not reported in IDE)
|
||||||
|
//-- OBSOLETED in 1.88 (from May 2022)
|
||||||
|
//static inline void CaptureKeyboardFromApp(bool want_capture_keyboard = true) { SetNextFrameWantCaptureKeyboard(want_capture_keyboard); } // Renamed as name was misleading + removed default value.
|
||||||
|
//static inline void CaptureMouseFromApp(bool want_capture_mouse = true) { SetNextFrameWantCaptureMouse(want_capture_mouse); } // Renamed as name was misleading + removed default value.
|
||||||
//-- OBSOLETED in 1.86 (from November 2021)
|
//-- OBSOLETED in 1.86 (from November 2021)
|
||||||
//IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // Code removed, see 1.90 for last version of the code. Calculate range of visible items for large list of evenly sized items. Prefer using ImGuiListClipper.
|
//IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // Code removed, see 1.90 for last version of the code. Calculate range of visible items for large list of evenly sized items. Prefer using ImGuiListClipper.
|
||||||
//-- OBSOLETED in 1.85 (from August 2021)
|
//-- OBSOLETED in 1.85 (from August 2021)
|
||||||
|
|||||||
368
imgui_demo.cpp
368
imgui_demo.cpp
@@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.90.6
|
// dear imgui, v1.90.9 WIP
|
||||||
// (demo code)
|
// (demo code)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
@@ -266,6 +266,9 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
// Most functions would normally just assert/crash if the context is missing.
|
// Most functions would normally just assert/crash if the context is missing.
|
||||||
IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing Dear ImGui context. Refer to examples app!");
|
IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing Dear ImGui context. Refer to examples app!");
|
||||||
|
|
||||||
|
// Verify ABI compatibility between caller code and compiled version of Dear ImGui. This helps detects some build issues.
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
|
|
||||||
// Examples Apps (accessible from the "Examples" menu)
|
// Examples Apps (accessible from the "Examples" menu)
|
||||||
static bool show_app_main_menu_bar = false;
|
static bool show_app_main_menu_bar = false;
|
||||||
static bool show_app_console = false;
|
static bool show_app_console = false;
|
||||||
@@ -488,6 +491,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::SameLine(); HelpMarker("Enable resizing of windows from their edges and from the lower-left corner.\nThis requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback.");
|
ImGui::SameLine(); HelpMarker("Enable resizing of windows from their edges and from the lower-left corner.\nThis requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback.");
|
||||||
ImGui::Checkbox("io.ConfigWindowsMoveFromTitleBarOnly", &io.ConfigWindowsMoveFromTitleBarOnly);
|
ImGui::Checkbox("io.ConfigWindowsMoveFromTitleBarOnly", &io.ConfigWindowsMoveFromTitleBarOnly);
|
||||||
ImGui::Checkbox("io.ConfigMacOSXBehaviors", &io.ConfigMacOSXBehaviors);
|
ImGui::Checkbox("io.ConfigMacOSXBehaviors", &io.ConfigMacOSXBehaviors);
|
||||||
|
ImGui::SameLine(); HelpMarker("Swap Cmd<>Ctrl keys, enable various MacOS style behaviors.");
|
||||||
ImGui::Text("Also see Style->Rendering for rendering options.");
|
ImGui::Text("Also see Style->Rendering for rendering options.");
|
||||||
|
|
||||||
ImGui::SeparatorText("Debug");
|
ImGui::SeparatorText("Debug");
|
||||||
@@ -2269,20 +2273,24 @@ static void ShowDemoWindowWidgets()
|
|||||||
|
|
||||||
IMGUI_DEMO_MARKER("Widgets/Data Types/Inputs");
|
IMGUI_DEMO_MARKER("Widgets/Data Types/Inputs");
|
||||||
static bool inputs_step = true;
|
static bool inputs_step = true;
|
||||||
|
static ImGuiInputTextFlags flags = ImGuiInputTextFlags_None;
|
||||||
ImGui::SeparatorText("Inputs");
|
ImGui::SeparatorText("Inputs");
|
||||||
ImGui::Checkbox("Show step buttons", &inputs_step);
|
ImGui::Checkbox("Show step buttons", &inputs_step);
|
||||||
ImGui::InputScalar("input s8", ImGuiDataType_S8, &s8_v, inputs_step ? &s8_one : NULL, NULL, "%d");
|
ImGui::CheckboxFlags("ImGuiInputTextFlags_ReadOnly", &flags, ImGuiInputTextFlags_ReadOnly);
|
||||||
ImGui::InputScalar("input u8", ImGuiDataType_U8, &u8_v, inputs_step ? &u8_one : NULL, NULL, "%u");
|
ImGui::CheckboxFlags("ImGuiInputTextFlags_ParseEmptyRefVal", &flags, ImGuiInputTextFlags_ParseEmptyRefVal);
|
||||||
ImGui::InputScalar("input s16", ImGuiDataType_S16, &s16_v, inputs_step ? &s16_one : NULL, NULL, "%d");
|
ImGui::CheckboxFlags("ImGuiInputTextFlags_DisplayEmptyRefVal", &flags, ImGuiInputTextFlags_DisplayEmptyRefVal);
|
||||||
ImGui::InputScalar("input u16", ImGuiDataType_U16, &u16_v, inputs_step ? &u16_one : NULL, NULL, "%u");
|
ImGui::InputScalar("input s8", ImGuiDataType_S8, &s8_v, inputs_step ? &s8_one : NULL, NULL, "%d", flags);
|
||||||
ImGui::InputScalar("input s32", ImGuiDataType_S32, &s32_v, inputs_step ? &s32_one : NULL, NULL, "%d");
|
ImGui::InputScalar("input u8", ImGuiDataType_U8, &u8_v, inputs_step ? &u8_one : NULL, NULL, "%u", flags);
|
||||||
ImGui::InputScalar("input s32 hex", ImGuiDataType_S32, &s32_v, inputs_step ? &s32_one : NULL, NULL, "%04X");
|
ImGui::InputScalar("input s16", ImGuiDataType_S16, &s16_v, inputs_step ? &s16_one : NULL, NULL, "%d", flags);
|
||||||
ImGui::InputScalar("input u32", ImGuiDataType_U32, &u32_v, inputs_step ? &u32_one : NULL, NULL, "%u");
|
ImGui::InputScalar("input u16", ImGuiDataType_U16, &u16_v, inputs_step ? &u16_one : NULL, NULL, "%u", flags);
|
||||||
ImGui::InputScalar("input u32 hex", ImGuiDataType_U32, &u32_v, inputs_step ? &u32_one : NULL, NULL, "%08X");
|
ImGui::InputScalar("input s32", ImGuiDataType_S32, &s32_v, inputs_step ? &s32_one : NULL, NULL, "%d", flags);
|
||||||
ImGui::InputScalar("input s64", ImGuiDataType_S64, &s64_v, inputs_step ? &s64_one : NULL);
|
ImGui::InputScalar("input s32 hex", ImGuiDataType_S32, &s32_v, inputs_step ? &s32_one : NULL, NULL, "%04X", flags);
|
||||||
ImGui::InputScalar("input u64", ImGuiDataType_U64, &u64_v, inputs_step ? &u64_one : NULL);
|
ImGui::InputScalar("input u32", ImGuiDataType_U32, &u32_v, inputs_step ? &u32_one : NULL, NULL, "%u", flags);
|
||||||
ImGui::InputScalar("input float", ImGuiDataType_Float, &f32_v, inputs_step ? &f32_one : NULL);
|
ImGui::InputScalar("input u32 hex", ImGuiDataType_U32, &u32_v, inputs_step ? &u32_one : NULL, NULL, "%08X", flags);
|
||||||
ImGui::InputScalar("input double", ImGuiDataType_Double, &f64_v, inputs_step ? &f64_one : NULL);
|
ImGui::InputScalar("input s64", ImGuiDataType_S64, &s64_v, inputs_step ? &s64_one : NULL, NULL, NULL, flags);
|
||||||
|
ImGui::InputScalar("input u64", ImGuiDataType_U64, &u64_v, inputs_step ? &u64_one : NULL, NULL, NULL, flags);
|
||||||
|
ImGui::InputScalar("input float", ImGuiDataType_Float, &f32_v, inputs_step ? &f32_one : NULL, NULL, NULL, flags);
|
||||||
|
ImGui::InputScalar("input double", ImGuiDataType_Double, &f64_v, inputs_step ? &f64_one : NULL, NULL, NULL, flags);
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
@@ -3871,7 +3879,7 @@ static void ShowDemoWindowPopups()
|
|||||||
static int item = 1;
|
static int item = 1;
|
||||||
static float color[4] = { 0.4f, 0.7f, 0.0f, 0.5f };
|
static float color[4] = { 0.4f, 0.7f, 0.0f, 0.5f };
|
||||||
ImGui::Combo("Combo", &item, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0");
|
ImGui::Combo("Combo", &item, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0");
|
||||||
ImGui::ColorEdit4("color", color);
|
ImGui::ColorEdit4("Color", color);
|
||||||
|
|
||||||
if (ImGui::Button("Add another modal.."))
|
if (ImGui::Button("Add another modal.."))
|
||||||
ImGui::OpenPopup("Stacked 2");
|
ImGui::OpenPopup("Stacked 2");
|
||||||
@@ -3883,6 +3891,7 @@ static void ShowDemoWindowPopups()
|
|||||||
if (ImGui::BeginPopupModal("Stacked 2", &unused_open))
|
if (ImGui::BeginPopupModal("Stacked 2", &unused_open))
|
||||||
{
|
{
|
||||||
ImGui::Text("Hello from Stacked The Second!");
|
ImGui::Text("Hello from Stacked The Second!");
|
||||||
|
ImGui::ColorEdit4("Color", color); // Allow opening another nested popup
|
||||||
if (ImGui::Button("Close"))
|
if (ImGui::Button("Close"))
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
@@ -6180,12 +6189,14 @@ static void ShowDemoWindowInputs()
|
|||||||
// Display inputs submitted to ImGuiIO
|
// Display inputs submitted to ImGuiIO
|
||||||
IMGUI_DEMO_MARKER("Inputs & Focus/Inputs");
|
IMGUI_DEMO_MARKER("Inputs & Focus/Inputs");
|
||||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||||
if (ImGui::TreeNode("Inputs"))
|
bool inputs_opened = ImGui::TreeNode("Inputs");
|
||||||
|
ImGui::SameLine();
|
||||||
|
HelpMarker(
|
||||||
|
"This is a simplified view. See more detailed input state:\n"
|
||||||
|
"- in 'Tools->Metrics/Debugger->Inputs'.\n"
|
||||||
|
"- in 'Tools->Debug Log->IO'.");
|
||||||
|
if (inputs_opened)
|
||||||
{
|
{
|
||||||
HelpMarker(
|
|
||||||
"This is a simplified view. See more detailed input state:\n"
|
|
||||||
"- in 'Tools->Metrics/Debugger->Inputs'.\n"
|
|
||||||
"- in 'Tools->Debug Log->IO'.");
|
|
||||||
if (ImGui::IsMousePosValid())
|
if (ImGui::IsMousePosValid())
|
||||||
ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y);
|
ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y);
|
||||||
else
|
else
|
||||||
@@ -6216,15 +6227,17 @@ static void ShowDemoWindowInputs()
|
|||||||
// Display ImGuiIO output flags
|
// Display ImGuiIO output flags
|
||||||
IMGUI_DEMO_MARKER("Inputs & Focus/Outputs");
|
IMGUI_DEMO_MARKER("Inputs & Focus/Outputs");
|
||||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||||
if (ImGui::TreeNode("Outputs"))
|
bool outputs_opened = ImGui::TreeNode("Outputs");
|
||||||
|
ImGui::SameLine();
|
||||||
|
HelpMarker(
|
||||||
|
"The value of io.WantCaptureMouse and io.WantCaptureKeyboard are normally set by Dear ImGui "
|
||||||
|
"to instruct your application of how to route inputs. Typically, when a value is true, it means "
|
||||||
|
"Dear ImGui wants the corresponding inputs and we expect the underlying application to ignore them.\n\n"
|
||||||
|
"The most typical case is: when hovering a window, Dear ImGui set io.WantCaptureMouse to true, "
|
||||||
|
"and underlying application should ignore mouse inputs (in practice there are many and more subtle "
|
||||||
|
"rules leading to how those flags are set).");
|
||||||
|
if (outputs_opened)
|
||||||
{
|
{
|
||||||
HelpMarker(
|
|
||||||
"The value of io.WantCaptureMouse and io.WantCaptureKeyboard are normally set by Dear ImGui "
|
|
||||||
"to instruct your application of how to route inputs. Typically, when a value is true, it means "
|
|
||||||
"Dear ImGui wants the corresponding inputs and we expect the underlying application to ignore them.\n\n"
|
|
||||||
"The most typical case is: when hovering a window, Dear ImGui set io.WantCaptureMouse to true, "
|
|
||||||
"and underlying application should ignore mouse inputs (in practice there are many and more subtle "
|
|
||||||
"rules leading to how those flags are set).");
|
|
||||||
ImGui::Text("io.WantCaptureMouse: %d", io.WantCaptureMouse);
|
ImGui::Text("io.WantCaptureMouse: %d", io.WantCaptureMouse);
|
||||||
ImGui::Text("io.WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose);
|
ImGui::Text("io.WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose);
|
||||||
ImGui::Text("io.WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
ImGui::Text("io.WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
||||||
@@ -6258,6 +6271,102 @@ static void ShowDemoWindowInputs()
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Demonstrate using Shortcut() and Routing Policies.
|
||||||
|
// The general flow is:
|
||||||
|
// - Code interested in a chord (e.g. "Ctrl+A") declares their intent.
|
||||||
|
// - Multiple locations may be interested in same chord! Routing helps find a winner.
|
||||||
|
// - Every frame, we resolve all claims and assign one owner if the modifiers are matching.
|
||||||
|
// - The lower-level function is 'bool SetShortcutRouting()', returns true when caller got the route.
|
||||||
|
// - Most of the times, SetShortcutRouting() is not called directly. User mostly calls Shortcut() with routing flags.
|
||||||
|
// - If you call Shortcut() WITHOUT any routing option, it uses ImGuiInputFlags_RouteFocused.
|
||||||
|
// TL;DR: Most uses will simply be:
|
||||||
|
// - Shortcut(ImGuiMod_Ctrl | ImGuiKey_A); // Use ImGuiInputFlags_RouteFocused policy.
|
||||||
|
IMGUI_DEMO_MARKER("Inputs & Focus/Shortcuts");
|
||||||
|
if (ImGui::TreeNode("Shortcuts"))
|
||||||
|
{
|
||||||
|
static ImGuiInputFlags route_options = ImGuiInputFlags_Repeat;
|
||||||
|
static ImGuiInputFlags route_type = ImGuiInputFlags_RouteFocused;
|
||||||
|
ImGui::CheckboxFlags("ImGuiInputFlags_Repeat", &route_options, ImGuiInputFlags_Repeat);
|
||||||
|
ImGui::RadioButton("ImGuiInputFlags_RouteActive", &route_type, ImGuiInputFlags_RouteActive);
|
||||||
|
ImGui::RadioButton("ImGuiInputFlags_RouteFocused (default)", &route_type, ImGuiInputFlags_RouteFocused);
|
||||||
|
ImGui::RadioButton("ImGuiInputFlags_RouteGlobal", &route_type, ImGuiInputFlags_RouteGlobal);
|
||||||
|
ImGui::Indent();
|
||||||
|
ImGui::BeginDisabled(route_type != ImGuiInputFlags_RouteGlobal);
|
||||||
|
ImGui::CheckboxFlags("ImGuiInputFlags_RouteOverFocused", &route_options, ImGuiInputFlags_RouteOverFocused);
|
||||||
|
ImGui::CheckboxFlags("ImGuiInputFlags_RouteOverActive", &route_options, ImGuiInputFlags_RouteOverActive);
|
||||||
|
ImGui::CheckboxFlags("ImGuiInputFlags_RouteUnlessBgFocused", &route_options, ImGuiInputFlags_RouteUnlessBgFocused);
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
ImGui::Unindent();
|
||||||
|
ImGui::RadioButton("ImGuiInputFlags_RouteAlways", &route_type, ImGuiInputFlags_RouteAlways);
|
||||||
|
ImGuiInputFlags flags = route_type | route_options; // Merged flags
|
||||||
|
if (route_type != ImGuiInputFlags_RouteGlobal)
|
||||||
|
flags &= ~(ImGuiInputFlags_RouteOverFocused | ImGuiInputFlags_RouteOverActive | ImGuiInputFlags_RouteUnlessBgFocused);
|
||||||
|
|
||||||
|
ImGui::SeparatorText("Using SetNextItemShortcut()");
|
||||||
|
ImGui::Text("Ctrl+S");
|
||||||
|
ImGui::SetNextItemShortcut(ImGuiMod_Ctrl | ImGuiKey_S, flags | ImGuiInputFlags_Tooltip);
|
||||||
|
ImGui::Button("Save");
|
||||||
|
ImGui::Text("Alt+F");
|
||||||
|
ImGui::SetNextItemShortcut(ImGuiMod_Alt | ImGuiKey_F, flags | ImGuiInputFlags_Tooltip);
|
||||||
|
static float f = 0.5f;
|
||||||
|
ImGui::SliderFloat("Factor", &f, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
ImGui::SeparatorText("Using Shortcut()");
|
||||||
|
const float line_height = ImGui::GetTextLineHeightWithSpacing();
|
||||||
|
const ImGuiKeyChord key_chord = ImGuiMod_Ctrl | ImGuiKey_A;
|
||||||
|
|
||||||
|
ImGui::Text("Ctrl+A");
|
||||||
|
ImGui::Text("IsWindowFocused: %d, Shortcut: %s", ImGui::IsWindowFocused(), ImGui::Shortcut(key_chord, flags) ? "PRESSED" : "...");
|
||||||
|
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(1.0f, 0.0f, 1.0f, 0.1f));
|
||||||
|
|
||||||
|
ImGui::BeginChild("WindowA", ImVec2(-FLT_MIN, line_height * 14), true);
|
||||||
|
ImGui::Text("Press CTRL+A and see who receives it!");
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
// 1: Window polling for CTRL+A
|
||||||
|
ImGui::Text("(in WindowA)");
|
||||||
|
ImGui::Text("IsWindowFocused: %d, Shortcut: %s", ImGui::IsWindowFocused(), ImGui::Shortcut(key_chord, flags) ? "PRESSED" : "...");
|
||||||
|
|
||||||
|
// 2: InputText also polling for CTRL+A: it always uses _RouteFocused internally (gets priority when active)
|
||||||
|
// (Commmented because the owner-aware version of Shortcut() is still in imgui_internal.h)
|
||||||
|
//char str[16] = "Press CTRL+A";
|
||||||
|
//ImGui::Spacing();
|
||||||
|
//ImGui::InputText("InputTextB", str, IM_ARRAYSIZE(str), ImGuiInputTextFlags_ReadOnly);
|
||||||
|
//ImGuiID item_id = ImGui::GetItemID();
|
||||||
|
//ImGui::SameLine(); HelpMarker("Internal widgets always use _RouteFocused");
|
||||||
|
//ImGui::Text("IsWindowFocused: %d, Shortcut: %s", ImGui::IsWindowFocused(), ImGui::Shortcut(key_chord, flags, item_id) ? "PRESSED" : "...");
|
||||||
|
|
||||||
|
// 3: Dummy child is not claiming the route: focusing them shouldn't steal route away from WindowA
|
||||||
|
ImGui::BeginChild("ChildD", ImVec2(-FLT_MIN, line_height * 4), true);
|
||||||
|
ImGui::Text("(in ChildD: not using same Shortcut)");
|
||||||
|
ImGui::Text("IsWindowFocused: %d", ImGui::IsWindowFocused());
|
||||||
|
ImGui::EndChild();
|
||||||
|
|
||||||
|
// 4: Child window polling for CTRL+A. It is deeper than WindowA and gets priority when focused.
|
||||||
|
ImGui::BeginChild("ChildE", ImVec2(-FLT_MIN, line_height * 4), true);
|
||||||
|
ImGui::Text("(in ChildE: using same Shortcut)");
|
||||||
|
ImGui::Text("IsWindowFocused: %d, Shortcut: %s", ImGui::IsWindowFocused(), ImGui::Shortcut(key_chord, flags) ? "PRESSED" : "...");
|
||||||
|
ImGui::EndChild();
|
||||||
|
|
||||||
|
// 5: In a popup
|
||||||
|
if (ImGui::Button("Open Popup"))
|
||||||
|
ImGui::OpenPopup("PopupF");
|
||||||
|
if (ImGui::BeginPopup("PopupF"))
|
||||||
|
{
|
||||||
|
ImGui::Text("(in PopupF)");
|
||||||
|
ImGui::Text("IsWindowFocused: %d, Shortcut: %s", ImGui::IsWindowFocused(), ImGui::Shortcut(key_chord, flags) ? "PRESSED" : "...");
|
||||||
|
// (Commmented because the owner-aware version of Shortcut() is still in imgui_internal.h)
|
||||||
|
//ImGui::InputText("InputTextG", str, IM_ARRAYSIZE(str), ImGuiInputTextFlags_ReadOnly);
|
||||||
|
//ImGui::Text("IsWindowFocused: %d, Shortcut: %s", ImGui::IsWindowFocused(), ImGui::Shortcut(key_chord, flags, ImGui::GetItemID()) ? "PRESSED" : "...");
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
|
||||||
// Display mouse cursors
|
// Display mouse cursors
|
||||||
IMGUI_DEMO_MARKER("Inputs & Focus/Mouse Cursors");
|
IMGUI_DEMO_MARKER("Inputs & Focus/Mouse Cursors");
|
||||||
if (ImGui::TreeNode("Mouse Cursors"))
|
if (ImGui::TreeNode("Mouse Cursors"))
|
||||||
@@ -6664,7 +6773,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
|
ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
|
||||||
int window_menu_button_position = style.WindowMenuButtonPosition + 1;
|
int window_menu_button_position = style.WindowMenuButtonPosition + 1;
|
||||||
if (ImGui::Combo("WindowMenuButtonPosition", (int*)&window_menu_button_position, "None\0Left\0Right\0"))
|
if (ImGui::Combo("WindowMenuButtonPosition", (int*)&window_menu_button_position, "None\0Left\0Right\0"))
|
||||||
style.WindowMenuButtonPosition = window_menu_button_position - 1;
|
style.WindowMenuButtonPosition = (ImGuiDir)(window_menu_button_position - 1);
|
||||||
ImGui::Combo("ColorButtonPosition", (int*)&style.ColorButtonPosition, "Left\0Right\0");
|
ImGui::Combo("ColorButtonPosition", (int*)&style.ColorButtonPosition, "Left\0Right\0");
|
||||||
ImGui::SliderFloat2("ButtonTextAlign", (float*)&style.ButtonTextAlign, 0.0f, 1.0f, "%.2f");
|
ImGui::SliderFloat2("ButtonTextAlign", (float*)&style.ButtonTextAlign, 0.0f, 1.0f, "%.2f");
|
||||||
ImGui::SameLine(); HelpMarker("Alignment applies when a button is larger than its text content.");
|
ImGui::SameLine(); HelpMarker("Alignment applies when a button is larger than its text content.");
|
||||||
@@ -6689,7 +6798,8 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SeparatorText("Misc");
|
ImGui::SeparatorText("Misc");
|
||||||
ImGui::SliderFloat2("DisplaySafeAreaPadding", (float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f"); ImGui::SameLine(); HelpMarker("Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured).");
|
ImGui::SliderFloat2("DisplayWindowPadding", (float*)&style.DisplayWindowPadding, 0.0f, 30.0f, "%.0f"); ImGui::SameLine(); HelpMarker("Apply to regular windows: amount which we enforce to keep visible when moving near edges of your screen.");
|
||||||
|
ImGui::SliderFloat2("DisplaySafeAreaPadding", (float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f"); ImGui::SameLine(); HelpMarker("Apply to every windows, menus, popups, tooltips: amount where we avoid displaying contents. Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured).");
|
||||||
|
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
@@ -7122,6 +7232,7 @@ struct ExampleAppConsole
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Options, Filter
|
// Options, Filter
|
||||||
|
ImGui::SetNextItemShortcut(ImGuiMod_Ctrl | ImGuiKey_O, ImGuiInputFlags_Tooltip);
|
||||||
if (ImGui::Button("Options"))
|
if (ImGui::Button("Options"))
|
||||||
ImGui::OpenPopup("Options");
|
ImGui::OpenPopup("Options");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@@ -7130,7 +7241,7 @@ struct ExampleAppConsole
|
|||||||
|
|
||||||
// Reserve enough left-over height for 1 separator + 1 input text
|
// Reserve enough left-over height for 1 separator + 1 input text
|
||||||
const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();
|
const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();
|
||||||
if (ImGui::BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), ImGuiChildFlags_None, ImGuiWindowFlags_HorizontalScrollbar))
|
if (ImGui::BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), ImGuiChildFlags_None, ImGuiWindowFlags_HorizontalScrollbar | ImGuiWindowFlags_NavFlattened))
|
||||||
{
|
{
|
||||||
if (ImGui::BeginPopupContextWindow())
|
if (ImGui::BeginPopupContextWindow())
|
||||||
{
|
{
|
||||||
@@ -8324,92 +8435,119 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|||||||
// Simplified structure to mimic a Document model
|
// Simplified structure to mimic a Document model
|
||||||
struct MyDocument
|
struct MyDocument
|
||||||
{
|
{
|
||||||
const char* Name; // Document title
|
char Name[32]; // Document title
|
||||||
|
int UID; // Unique ID (necessary as we can change title)
|
||||||
bool Open; // Set when open (we keep an array of all available documents to simplify demo code!)
|
bool Open; // Set when open (we keep an array of all available documents to simplify demo code!)
|
||||||
bool OpenPrev; // Copy of Open from last update.
|
bool OpenPrev; // Copy of Open from last update.
|
||||||
bool Dirty; // Set when the document has been modified
|
bool Dirty; // Set when the document has been modified
|
||||||
bool WantClose; // Set when the document
|
|
||||||
ImVec4 Color; // An arbitrary variable associated to the document
|
ImVec4 Color; // An arbitrary variable associated to the document
|
||||||
|
|
||||||
MyDocument(const char* name, bool open = true, const ImVec4& color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f))
|
MyDocument(int uid, const char* name, bool open = true, const ImVec4& color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f))
|
||||||
{
|
{
|
||||||
Name = name;
|
UID = uid;
|
||||||
|
snprintf(Name, sizeof(Name), "%s", name);
|
||||||
Open = OpenPrev = open;
|
Open = OpenPrev = open;
|
||||||
Dirty = false;
|
Dirty = false;
|
||||||
WantClose = false;
|
|
||||||
Color = color;
|
Color = color;
|
||||||
}
|
}
|
||||||
void DoOpen() { Open = true; }
|
void DoOpen() { Open = true; }
|
||||||
void DoQueueClose() { WantClose = true; }
|
|
||||||
void DoForceClose() { Open = false; Dirty = false; }
|
void DoForceClose() { Open = false; Dirty = false; }
|
||||||
void DoSave() { Dirty = false; }
|
void DoSave() { Dirty = false; }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ExampleAppDocuments
|
||||||
|
{
|
||||||
|
ImVector<MyDocument> Documents;
|
||||||
|
ImVector<MyDocument*> CloseQueue;
|
||||||
|
MyDocument* RenamingDoc = NULL;
|
||||||
|
bool RenamingStarted = false;
|
||||||
|
|
||||||
|
ExampleAppDocuments()
|
||||||
|
{
|
||||||
|
Documents.push_back(MyDocument(0, "Lettuce", true, ImVec4(0.4f, 0.8f, 0.4f, 1.0f)));
|
||||||
|
Documents.push_back(MyDocument(1, "Eggplant", true, ImVec4(0.8f, 0.5f, 1.0f, 1.0f)));
|
||||||
|
Documents.push_back(MyDocument(2, "Carrot", true, ImVec4(1.0f, 0.8f, 0.5f, 1.0f)));
|
||||||
|
Documents.push_back(MyDocument(3, "Tomato", false, ImVec4(1.0f, 0.3f, 0.4f, 1.0f)));
|
||||||
|
Documents.push_back(MyDocument(4, "A Rather Long Title", false, ImVec4(0.4f, 0.8f, 0.8f, 1.0f)));
|
||||||
|
Documents.push_back(MyDocument(5, "Some Document", false, ImVec4(0.8f, 0.8f, 1.0f, 1.0f)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// As we allow to change document name, we append a never-changing document ID so tabs are stable
|
||||||
|
void GetTabName(MyDocument* doc, char* out_buf, size_t out_buf_size)
|
||||||
|
{
|
||||||
|
snprintf(out_buf, out_buf_size, "%s###doc%d", doc->Name, doc->UID);
|
||||||
|
}
|
||||||
|
|
||||||
// Display placeholder contents for the Document
|
// Display placeholder contents for the Document
|
||||||
static void DisplayContents(MyDocument* doc)
|
void DisplayDocContents(MyDocument* doc)
|
||||||
{
|
{
|
||||||
ImGui::PushID(doc);
|
ImGui::PushID(doc);
|
||||||
ImGui::Text("Document \"%s\"", doc->Name);
|
ImGui::Text("Document \"%s\"", doc->Name);
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, doc->Color);
|
ImGui::PushStyleColor(ImGuiCol_Text, doc->Color);
|
||||||
ImGui::TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
|
ImGui::TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
if (ImGui::Button("Modify", ImVec2(100, 0)))
|
|
||||||
doc->Dirty = true;
|
ImGui::SetNextItemShortcut(ImGuiMod_Ctrl | ImGuiKey_R, ImGuiInputFlags_Tooltip);
|
||||||
|
if (ImGui::Button("Rename.."))
|
||||||
|
{
|
||||||
|
RenamingDoc = doc;
|
||||||
|
RenamingStarted = true;
|
||||||
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Save", ImVec2(100, 0)))
|
|
||||||
|
ImGui::SetNextItemShortcut(ImGuiMod_Ctrl | ImGuiKey_M, ImGuiInputFlags_Tooltip);
|
||||||
|
if (ImGui::Button("Modify"))
|
||||||
|
doc->Dirty = true;
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemShortcut(ImGuiMod_Ctrl | ImGuiKey_S, ImGuiInputFlags_Tooltip);
|
||||||
|
if (ImGui::Button("Save"))
|
||||||
doc->DoSave();
|
doc->DoSave();
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemShortcut(ImGuiMod_Ctrl | ImGuiKey_W, ImGuiInputFlags_Tooltip);
|
||||||
|
if (ImGui::Button("Close"))
|
||||||
|
CloseQueue.push_back(doc);
|
||||||
ImGui::ColorEdit3("color", &doc->Color.x); // Useful to test drag and drop and hold-dragged-to-open-tab behavior.
|
ImGui::ColorEdit3("color", &doc->Color.x); // Useful to test drag and drop and hold-dragged-to-open-tab behavior.
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display context menu for the Document
|
// Display context menu for the Document
|
||||||
static void DisplayContextMenu(MyDocument* doc)
|
void DisplayDocContextMenu(MyDocument* doc)
|
||||||
{
|
{
|
||||||
if (!ImGui::BeginPopupContextItem())
|
if (!ImGui::BeginPopupContextItem())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf, "Save %s", doc->Name);
|
sprintf(buf, "Save %s", doc->Name);
|
||||||
if (ImGui::MenuItem(buf, "CTRL+S", false, doc->Open))
|
if (ImGui::MenuItem(buf, "Ctrl+S", false, doc->Open))
|
||||||
doc->DoSave();
|
doc->DoSave();
|
||||||
if (ImGui::MenuItem("Close", "CTRL+W", false, doc->Open))
|
if (ImGui::MenuItem("Rename...", "Ctrl+R", false, doc->Open))
|
||||||
doc->DoQueueClose();
|
RenamingDoc = doc;
|
||||||
|
if (ImGui::MenuItem("Close", "Ctrl+W", false, doc->Open))
|
||||||
|
CloseQueue.push_back(doc);
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
struct ExampleAppDocuments
|
// [Optional] Notify the system of Tabs/Windows closure that happened outside the regular tab interface.
|
||||||
{
|
// If a tab has been closed programmatically (aka closed from another source such as the Checkbox() in the demo,
|
||||||
ImVector<MyDocument> Documents;
|
// as opposed to clicking on the regular tab closing button) and stops being submitted, it will take a frame for
|
||||||
|
// the tab bar to notice its absence. During this frame there will be a gap in the tab bar, and if the tab that has
|
||||||
ExampleAppDocuments()
|
// disappeared was the selected one, the tab bar will report no selected tab during the frame. This will effectively
|
||||||
|
// give the impression of a flicker for one frame.
|
||||||
|
// We call SetTabItemClosed() to manually notify the Tab Bar or Docking system of removed tabs to avoid this glitch.
|
||||||
|
// Note that this completely optional, and only affect tab bars with the ImGuiTabBarFlags_Reorderable flag.
|
||||||
|
void NotifyOfDocumentsClosedElsewhere()
|
||||||
{
|
{
|
||||||
Documents.push_back(MyDocument("Lettuce", true, ImVec4(0.4f, 0.8f, 0.4f, 1.0f)));
|
for (MyDocument& doc : Documents)
|
||||||
Documents.push_back(MyDocument("Eggplant", true, ImVec4(0.8f, 0.5f, 1.0f, 1.0f)));
|
{
|
||||||
Documents.push_back(MyDocument("Carrot", true, ImVec4(1.0f, 0.8f, 0.5f, 1.0f)));
|
if (!doc.Open && doc.OpenPrev)
|
||||||
Documents.push_back(MyDocument("Tomato", false, ImVec4(1.0f, 0.3f, 0.4f, 1.0f)));
|
ImGui::SetTabItemClosed(doc.Name);
|
||||||
Documents.push_back(MyDocument("A Rather Long Title", false));
|
doc.OpenPrev = doc.Open;
|
||||||
Documents.push_back(MyDocument("Some Document", false));
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// [Optional] Notify the system of Tabs/Windows closure that happened outside the regular tab interface.
|
|
||||||
// If a tab has been closed programmatically (aka closed from another source such as the Checkbox() in the demo,
|
|
||||||
// as opposed to clicking on the regular tab closing button) and stops being submitted, it will take a frame for
|
|
||||||
// the tab bar to notice its absence. During this frame there will be a gap in the tab bar, and if the tab that has
|
|
||||||
// disappeared was the selected one, the tab bar will report no selected tab during the frame. This will effectively
|
|
||||||
// give the impression of a flicker for one frame.
|
|
||||||
// We call SetTabItemClosed() to manually notify the Tab Bar or Docking system of removed tabs to avoid this glitch.
|
|
||||||
// Note that this completely optional, and only affect tab bars with the ImGuiTabBarFlags_Reorderable flag.
|
|
||||||
static void NotifyOfDocumentsClosedElsewhere(ExampleAppDocuments& app)
|
|
||||||
{
|
|
||||||
for (MyDocument& doc : app.Documents)
|
|
||||||
{
|
|
||||||
if (!doc.Open && doc.OpenPrev)
|
|
||||||
ImGui::SetTabItemClosed(doc.Name);
|
|
||||||
doc.OpenPrev = doc.Open;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShowExampleAppDocuments(bool* p_open)
|
void ShowExampleAppDocuments(bool* p_open)
|
||||||
{
|
{
|
||||||
static ExampleAppDocuments app;
|
static ExampleAppDocuments app;
|
||||||
@@ -8443,8 +8581,8 @@ void ShowExampleAppDocuments(bool* p_open)
|
|||||||
}
|
}
|
||||||
if (ImGui::MenuItem("Close All Documents", NULL, false, open_count > 0))
|
if (ImGui::MenuItem("Close All Documents", NULL, false, open_count > 0))
|
||||||
for (MyDocument& doc : app.Documents)
|
for (MyDocument& doc : app.Documents)
|
||||||
doc.DoQueueClose();
|
app.CloseQueue.push_back(&doc);
|
||||||
if (ImGui::MenuItem("Exit", "Ctrl+F4") && p_open)
|
if (ImGui::MenuItem("Exit") && p_open)
|
||||||
*p_open = false;
|
*p_open = false;
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
@@ -8482,7 +8620,7 @@ void ShowExampleAppDocuments(bool* p_open)
|
|||||||
if (ImGui::BeginTabBar("##tabs", tab_bar_flags))
|
if (ImGui::BeginTabBar("##tabs", tab_bar_flags))
|
||||||
{
|
{
|
||||||
if (opt_reorderable)
|
if (opt_reorderable)
|
||||||
NotifyOfDocumentsClosedElsewhere(app);
|
app.NotifyOfDocumentsClosedElsewhere();
|
||||||
|
|
||||||
// [DEBUG] Stress tests
|
// [DEBUG] Stress tests
|
||||||
//if ((ImGui::GetFrameCount() % 30) == 0) docs[1].Open ^= 1; // [DEBUG] Automatically show/hide a tab. Test various interactions e.g. dragging with this on.
|
//if ((ImGui::GetFrameCount() % 30) == 0) docs[1].Open ^= 1; // [DEBUG] Automatically show/hide a tab. Test various interactions e.g. dragging with this on.
|
||||||
@@ -8494,20 +8632,23 @@ void ShowExampleAppDocuments(bool* p_open)
|
|||||||
if (!doc.Open)
|
if (!doc.Open)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// As we allow to change document name, we append a never-changing document id so tabs are stable
|
||||||
|
char doc_name_buf[64];
|
||||||
|
app.GetTabName(&doc, doc_name_buf, sizeof(doc_name_buf));
|
||||||
ImGuiTabItemFlags tab_flags = (doc.Dirty ? ImGuiTabItemFlags_UnsavedDocument : 0);
|
ImGuiTabItemFlags tab_flags = (doc.Dirty ? ImGuiTabItemFlags_UnsavedDocument : 0);
|
||||||
bool visible = ImGui::BeginTabItem(doc.Name, &doc.Open, tab_flags);
|
bool visible = ImGui::BeginTabItem(doc_name_buf, &doc.Open, tab_flags);
|
||||||
|
|
||||||
// Cancel attempt to close when unsaved add to save queue so we can display a popup.
|
// Cancel attempt to close when unsaved add to save queue so we can display a popup.
|
||||||
if (!doc.Open && doc.Dirty)
|
if (!doc.Open && doc.Dirty)
|
||||||
{
|
{
|
||||||
doc.Open = true;
|
doc.Open = true;
|
||||||
doc.DoQueueClose();
|
app.CloseQueue.push_back(&doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
MyDocument::DisplayContextMenu(&doc);
|
app.DisplayDocContextMenu(&doc);
|
||||||
if (visible)
|
if (visible)
|
||||||
{
|
{
|
||||||
MyDocument::DisplayContents(&doc);
|
app.DisplayDocContents(&doc);
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8516,33 +8657,44 @@ void ShowExampleAppDocuments(bool* p_open)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update closing queue
|
// Display renaming UI
|
||||||
static ImVector<MyDocument*> close_queue;
|
if (app.RenamingDoc != NULL)
|
||||||
if (close_queue.empty())
|
|
||||||
{
|
{
|
||||||
// Close queue is locked once we started a popup
|
if (app.RenamingStarted)
|
||||||
for (MyDocument& doc : app.Documents)
|
ImGui::OpenPopup("Rename");
|
||||||
if (doc.WantClose)
|
if (ImGui::BeginPopup("Rename"))
|
||||||
|
{
|
||||||
|
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 30);
|
||||||
|
if (ImGui::InputText("###Name", app.RenamingDoc->Name, IM_ARRAYSIZE(app.RenamingDoc->Name), ImGuiInputTextFlags_EnterReturnsTrue))
|
||||||
{
|
{
|
||||||
doc.WantClose = false;
|
ImGui::CloseCurrentPopup();
|
||||||
close_queue.push_back(&doc);
|
app.RenamingDoc = NULL;
|
||||||
}
|
}
|
||||||
|
if (app.RenamingStarted)
|
||||||
|
ImGui::SetKeyboardFocusHere(-1);
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
app.RenamingDoc = NULL;
|
||||||
|
}
|
||||||
|
app.RenamingStarted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display closing confirmation UI
|
// Display closing confirmation UI
|
||||||
if (!close_queue.empty())
|
if (!app.CloseQueue.empty())
|
||||||
{
|
{
|
||||||
int close_queue_unsaved_documents = 0;
|
int close_queue_unsaved_documents = 0;
|
||||||
for (int n = 0; n < close_queue.Size; n++)
|
for (int n = 0; n < app.CloseQueue.Size; n++)
|
||||||
if (close_queue[n]->Dirty)
|
if (app.CloseQueue[n]->Dirty)
|
||||||
close_queue_unsaved_documents++;
|
close_queue_unsaved_documents++;
|
||||||
|
|
||||||
if (close_queue_unsaved_documents == 0)
|
if (close_queue_unsaved_documents == 0)
|
||||||
{
|
{
|
||||||
// Close documents when all are unsaved
|
// Close documents when all are unsaved
|
||||||
for (int n = 0; n < close_queue.Size; n++)
|
for (int n = 0; n < app.CloseQueue.Size; n++)
|
||||||
close_queue[n]->DoForceClose();
|
app.CloseQueue[n]->DoForceClose();
|
||||||
close_queue.clear();
|
app.CloseQueue.clear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -8553,37 +8705,35 @@ void ShowExampleAppDocuments(bool* p_open)
|
|||||||
ImGui::Text("Save change to the following items?");
|
ImGui::Text("Save change to the following items?");
|
||||||
float item_height = ImGui::GetTextLineHeightWithSpacing();
|
float item_height = ImGui::GetTextLineHeightWithSpacing();
|
||||||
if (ImGui::BeginChild(ImGui::GetID("frame"), ImVec2(-FLT_MIN, 6.25f * item_height), ImGuiChildFlags_FrameStyle))
|
if (ImGui::BeginChild(ImGui::GetID("frame"), ImVec2(-FLT_MIN, 6.25f * item_height), ImGuiChildFlags_FrameStyle))
|
||||||
{
|
for (MyDocument* doc : app.CloseQueue)
|
||||||
for (int n = 0; n < close_queue.Size; n++)
|
if (doc->Dirty)
|
||||||
if (close_queue[n]->Dirty)
|
ImGui::Text("%s", doc->Name);
|
||||||
ImGui::Text("%s", close_queue[n]->Name);
|
|
||||||
}
|
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
|
||||||
ImVec2 button_size(ImGui::GetFontSize() * 7.0f, 0.0f);
|
ImVec2 button_size(ImGui::GetFontSize() * 7.0f, 0.0f);
|
||||||
if (ImGui::Button("Yes", button_size))
|
if (ImGui::Button("Yes", button_size))
|
||||||
{
|
{
|
||||||
for (int n = 0; n < close_queue.Size; n++)
|
for (MyDocument* doc : app.CloseQueue)
|
||||||
{
|
{
|
||||||
if (close_queue[n]->Dirty)
|
if (doc->Dirty)
|
||||||
close_queue[n]->DoSave();
|
doc->DoSave();
|
||||||
close_queue[n]->DoForceClose();
|
doc->DoForceClose();
|
||||||
}
|
}
|
||||||
close_queue.clear();
|
app.CloseQueue.clear();
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("No", button_size))
|
if (ImGui::Button("No", button_size))
|
||||||
{
|
{
|
||||||
for (int n = 0; n < close_queue.Size; n++)
|
for (MyDocument* doc : app.CloseQueue)
|
||||||
close_queue[n]->DoForceClose();
|
doc->DoForceClose();
|
||||||
close_queue.clear();
|
app.CloseQueue.clear();
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Cancel", button_size))
|
if (ImGui::Button("Cancel", button_size))
|
||||||
{
|
{
|
||||||
close_queue.clear();
|
app.CloseQueue.clear();
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
|
|||||||
147
imgui_draw.cpp
147
imgui_draw.cpp
@@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.90.6
|
// dear imgui, v1.90.9 WIP
|
||||||
// (drawing and font code)
|
// (drawing and font code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -175,6 +175,12 @@ using namespace IMGUI_STB_NAMESPACE;
|
|||||||
|
|
||||||
void ImGui::StyleColorsDark(ImGuiStyle* dst)
|
void ImGui::StyleColorsDark(ImGuiStyle* dst)
|
||||||
{
|
{
|
||||||
|
#ifdef WIN98
|
||||||
|
// These colors don't make sense with win98 so just call this anyway
|
||||||
|
// also means I don't have to change all the examples
|
||||||
|
StyleWin98(dst);
|
||||||
|
return;
|
||||||
|
#else
|
||||||
ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
|
ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
|
||||||
ImVec4* colors = style->Colors;
|
ImVec4* colors = style->Colors;
|
||||||
|
|
||||||
@@ -231,10 +237,17 @@ void ImGui::StyleColorsDark(ImGuiStyle* dst)
|
|||||||
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
|
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
|
||||||
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
|
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
|
||||||
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);
|
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::StyleColorsClassic(ImGuiStyle* dst)
|
void ImGui::StyleColorsClassic(ImGuiStyle* dst)
|
||||||
{
|
{
|
||||||
|
#ifdef WIN98
|
||||||
|
// These colors don't make sense with win98 so just call this anyway
|
||||||
|
// also means I don't have to change all the examples
|
||||||
|
StyleWin98(dst);
|
||||||
|
return;
|
||||||
|
#else
|
||||||
ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
|
ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
|
||||||
ImVec4* colors = style->Colors;
|
ImVec4* colors = style->Colors;
|
||||||
|
|
||||||
@@ -291,11 +304,19 @@ void ImGui::StyleColorsClassic(ImGuiStyle* dst)
|
|||||||
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
|
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
|
||||||
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
|
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
|
||||||
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Those light colors are better suited with a thicker font than the default one + FrameBorder
|
// Those light colors are better suited with a thicker font than the default one + FrameBorder
|
||||||
void ImGui::StyleColorsLight(ImGuiStyle* dst)
|
void ImGui::StyleColorsLight(ImGuiStyle* dst)
|
||||||
{
|
{
|
||||||
|
#ifdef WIN98
|
||||||
|
// These colors don't make sense with win98 so just call this anyway
|
||||||
|
// also means I don't have to change all the examples
|
||||||
|
StyleWin98(dst);
|
||||||
|
return;
|
||||||
|
#else
|
||||||
|
|
||||||
ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
|
ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
|
||||||
ImVec4* colors = style->Colors;
|
ImVec4* colors = style->Colors;
|
||||||
|
|
||||||
@@ -352,8 +373,132 @@ void ImGui::StyleColorsLight(ImGuiStyle* dst)
|
|||||||
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(0.70f, 0.70f, 0.70f, 0.70f);
|
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(0.70f, 0.70f, 0.70f, 0.70f);
|
||||||
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.20f);
|
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.20f);
|
||||||
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Windows style config
|
||||||
|
#ifdef WIN98
|
||||||
|
void ImGui::StyleWin98(ImGuiStyle* dst)
|
||||||
|
{
|
||||||
|
ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
|
||||||
|
style->FrameBorderSize = 1.0f;
|
||||||
|
style->FramePadding = ImVec2(4.0f, 4.0f);
|
||||||
|
style->WindowMenuButtonPosition = ImGuiDir_Right;
|
||||||
|
style->ScrollbarSize = 16.0f;
|
||||||
|
|
||||||
|
ImVec4* colors = style->Colors;
|
||||||
|
|
||||||
|
colors[ImGuiCol_Text] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
|
||||||
|
colors[ImGuiCol_WindowBg] = ImVec4(0.75f, 0.75f, 0.75f, 1.00f);
|
||||||
|
colors[ImGuiCol_ChildBg] = ImVec4(0.75f, 0.75f, 0.75f, 1.00f);
|
||||||
|
colors[ImGuiCol_PopupBg] = ImVec4(0.75f, 0.75f, 0.75f, 1.00f);
|
||||||
|
colors[ImGuiCol_Border] = ImVec4(0.00f, 0.00f, 0.00f, 0.30f);
|
||||||
|
colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||||
|
colors[ImGuiCol_FrameBg] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_FrameBgHovered] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_FrameBgActive] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_TitleBg] = ImVec4(0.96f, 0.96f, 0.96f, 1.00f);
|
||||||
|
colors[ImGuiCol_TitleBgActive] = ImVec4(0.00f, 0.00f, 0.50f, 1.00f);
|
||||||
|
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(1.00f, 1.00f, 1.00f, 0.51f);
|
||||||
|
colors[ImGuiCol_MenuBarBg] = ImVec4(0.86f, 0.86f, 0.86f, 1.00f);
|
||||||
|
colors[ImGuiCol_ScrollbarBg] = ImVec4(0.98f, 0.98f, 0.98f, 0.53f);
|
||||||
|
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.69f, 0.69f, 0.69f, 0.80f);
|
||||||
|
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.49f, 0.49f, 0.49f, 0.80f);
|
||||||
|
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.49f, 0.49f, 0.49f, 1.00f);
|
||||||
|
colors[ImGuiCol_CheckMark] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||||
|
colors[ImGuiCol_SliderGrab] = ImVec4(0.26f, 0.59f, 0.98f, 0.78f);
|
||||||
|
colors[ImGuiCol_SliderGrabActive] = ImVec4(0.46f, 0.54f, 0.80f, 0.60f);
|
||||||
|
colors[ImGuiCol_Button] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);
|
||||||
|
colors[ImGuiCol_ButtonHovered] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||||
|
colors[ImGuiCol_ButtonActive] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f);
|
||||||
|
colors[ImGuiCol_Header] = ImVec4(0.26f, 0.59f, 0.98f, 0.31f);
|
||||||
|
colors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f);
|
||||||
|
colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||||
|
colors[ImGuiCol_Separator] = ImVec4(0.39f, 0.39f, 0.39f, 0.62f);
|
||||||
|
colors[ImGuiCol_SeparatorHovered] = ImVec4(0.14f, 0.44f, 0.80f, 0.78f);
|
||||||
|
colors[ImGuiCol_SeparatorActive] = ImVec4(0.14f, 0.44f, 0.80f, 1.00f);
|
||||||
|
colors[ImGuiCol_ResizeGrip] = ImVec4(0.80f, 0.80f, 0.80f, 0.56f);
|
||||||
|
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
|
||||||
|
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
|
||||||
|
colors[ImGuiCol_Tab] = ImVec4(0.76f, 0.80f, 0.84f, 0.95f);
|
||||||
|
colors[ImGuiCol_TabHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
|
||||||
|
colors[ImGuiCol_TabActive] = ImVec4(0.60f, 0.73f, 0.88f, 0.95f);
|
||||||
|
colors[ImGuiCol_TabUnfocused] = ImVec4(0.92f, 0.92f, 0.94f, 0.95f);
|
||||||
|
colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.74f, 0.82f, 0.91f, 1.00f);
|
||||||
|
colors[ImGuiCol_PlotLines] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f);
|
||||||
|
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);
|
||||||
|
colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.45f, 0.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);
|
||||||
|
colors[ImGuiCol_DragDropTarget] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
|
||||||
|
colors[ImGuiCol_NavHighlight] = colors[ImGuiCol_HeaderHovered];
|
||||||
|
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(0.70f, 0.70f, 0.70f, 0.70f);
|
||||||
|
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.20f);
|
||||||
|
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
||||||
|
|
||||||
|
|
||||||
|
if (dst != NULL) return;
|
||||||
|
|
||||||
|
// Fonts + Icons
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
for (int i = 0; i < io.Fonts->ConfigData.size(); i++) {
|
||||||
|
if (strcmp(io.Fonts->ConfigData[i].Name, "MS Sans Serif")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImFont *font = io.Fonts->AddFontFromFileTTF("../../MS Sans Serif.ttf", 12.0f, NULL, io.Fonts->GetGlyphRangesDefault());
|
||||||
|
io.Fonts->AddFontFromFileTTF("../../MS Sans Serif Bold.ttf", 12.0f, NULL, io.Fonts->GetGlyphRangesDefault());
|
||||||
|
|
||||||
|
// Run-length encoding of some icons
|
||||||
|
// In retrorespect I should have used an icon map like FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS
|
||||||
|
unsigned char minimize[] = {86,6,6,6,0};
|
||||||
|
unsigned char close[] = {14,2,4,2,5,2,2,2,7,4,9,2,9,4,7,2,2,2,5,2,4,2,0};
|
||||||
|
unsigned char *run_length[] = {close, minimize};
|
||||||
|
|
||||||
|
int rect_ids[IM_ARRAYSIZE(run_length)];
|
||||||
|
for (int i = 0; i < IM_ARRAYSIZE(run_length); i++) {
|
||||||
|
// Starts with unicode multiplication sign and extends
|
||||||
|
rect_ids[i] = io.Fonts->AddCustomRectFontGlyph(font, (ImWchar)(215 + i), 12, 9, 13+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
io.Fonts->Build();
|
||||||
|
|
||||||
|
unsigned char* tex_pixels = NULL;
|
||||||
|
int tex_width, tex_height;
|
||||||
|
io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_width, &tex_height);
|
||||||
|
|
||||||
|
for (int i = 0; i < IM_ARRAYSIZE(run_length); i++) {
|
||||||
|
|
||||||
|
int rect_id = rect_ids[i];
|
||||||
|
if (const ImFontAtlasCustomRect* rect = io.Fonts->GetCustomRectByIndex(rect_id)) {
|
||||||
|
bool black = false;
|
||||||
|
unsigned char* run = run_length[i];
|
||||||
|
int run_size = 0;
|
||||||
|
|
||||||
|
for (int y = 0; y < rect->Height; y++)
|
||||||
|
{
|
||||||
|
ImU32* p = (ImU32*)tex_pixels + (rect->Y + y) * tex_width + (rect->X);
|
||||||
|
for (int x = rect->Width; x > 0; x--) {
|
||||||
|
if (black) *p = IM_COL32(255, 0, 0, 255);
|
||||||
|
p ++;
|
||||||
|
run_size ++;
|
||||||
|
if (run_size == *run) {
|
||||||
|
run_size = 0;
|
||||||
|
run ++;
|
||||||
|
black = !black;
|
||||||
|
if (*run == 0) goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
done:;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] ImDrawList
|
// [SECTION] ImDrawList
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
324
imgui_internal.h
324
imgui_internal.h
@@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.90.6
|
// dear imgui, v1.90.9 WIP
|
||||||
// (internal structures/api)
|
// (internal structures/api)
|
||||||
|
|
||||||
// You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility.
|
// You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility.
|
||||||
@@ -14,8 +14,8 @@ Index of this file:
|
|||||||
// [SECTION] Macros
|
// [SECTION] Macros
|
||||||
// [SECTION] Generic helpers
|
// [SECTION] Generic helpers
|
||||||
// [SECTION] ImDrawList support
|
// [SECTION] ImDrawList support
|
||||||
// [SECTION] Widgets support: flags, enums, data structures
|
|
||||||
// [SECTION] Data types support
|
// [SECTION] Data types support
|
||||||
|
// [SECTION] Widgets support: flags, enums, data structures
|
||||||
// [SECTION] Popup support
|
// [SECTION] Popup support
|
||||||
// [SECTION] Inputs support
|
// [SECTION] Inputs support
|
||||||
// [SECTION] Clipper support
|
// [SECTION] Clipper support
|
||||||
@@ -169,7 +169,6 @@ typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // E
|
|||||||
typedef int ImGuiActivateFlags; // -> enum ImGuiActivateFlags_ // Flags: for navigation/focus function (will be for ActivateItem() later)
|
typedef int ImGuiActivateFlags; // -> enum ImGuiActivateFlags_ // Flags: for navigation/focus function (will be for ActivateItem() later)
|
||||||
typedef int ImGuiDebugLogFlags; // -> enum ImGuiDebugLogFlags_ // Flags: for ShowDebugLogWindow(), g.DebugLogFlags
|
typedef int ImGuiDebugLogFlags; // -> enum ImGuiDebugLogFlags_ // Flags: for ShowDebugLogWindow(), g.DebugLogFlags
|
||||||
typedef int ImGuiFocusRequestFlags; // -> enum ImGuiFocusRequestFlags_ // Flags: for FocusWindow();
|
typedef int ImGuiFocusRequestFlags; // -> enum ImGuiFocusRequestFlags_ // Flags: for FocusWindow();
|
||||||
typedef int ImGuiInputFlags; // -> enum ImGuiInputFlags_ // Flags: for IsKeyPressed(), IsMouseClicked(), SetKeyOwner(), SetItemKeyOwner() etc.
|
|
||||||
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag(), g.LastItemData.InFlags
|
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag(), g.LastItemData.InFlags
|
||||||
typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for g.LastItemData.StatusFlags
|
typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for g.LastItemData.StatusFlags
|
||||||
typedef int ImGuiOldColumnFlags; // -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
|
typedef int ImGuiOldColumnFlags; // -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
|
||||||
@@ -473,7 +472,7 @@ template<typename T> static inline T ImSubClampOverflow(T a, T b, T mn, T mx)
|
|||||||
// - Misc maths helpers
|
// - Misc maths helpers
|
||||||
static inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x < rhs.x ? lhs.x : rhs.x, lhs.y < rhs.y ? lhs.y : rhs.y); }
|
static inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x < rhs.x ? lhs.x : rhs.x, lhs.y < rhs.y ? lhs.y : rhs.y); }
|
||||||
static inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x >= rhs.x ? lhs.x : rhs.x, lhs.y >= rhs.y ? lhs.y : rhs.y); }
|
static inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x >= rhs.x ? lhs.x : rhs.x, lhs.y >= rhs.y ? lhs.y : rhs.y); }
|
||||||
static inline ImVec2 ImClamp(const ImVec2& v, const ImVec2& mn, ImVec2 mx) { return ImVec2((v.x < mn.x) ? mn.x : (v.x > mx.x) ? mx.x : v.x, (v.y < mn.y) ? mn.y : (v.y > mx.y) ? mx.y : v.y); }
|
static inline ImVec2 ImClamp(const ImVec2& v, const ImVec2&mn, const ImVec2&mx) { return ImVec2((v.x < mn.x) ? mn.x : (v.x > mx.x) ? mx.x : v.x, (v.y < mn.y) ? mn.y : (v.y > mx.y) ? mx.y : v.y); }
|
||||||
static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, float t) { return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t); }
|
static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, float t) { return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t); }
|
||||||
static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, const ImVec2& t) { return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y); }
|
static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, const ImVec2& t) { return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y); }
|
||||||
static inline ImVec4 ImLerp(const ImVec4& a, const ImVec4& b, float t) { return ImVec4(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t, a.w + (b.w - a.w) * t); }
|
static inline ImVec4 ImLerp(const ImVec4& a, const ImVec4& b, float t) { return ImVec4(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t, a.w + (b.w - a.w) * t); }
|
||||||
@@ -799,6 +798,40 @@ struct ImDrawDataBuilder
|
|||||||
ImDrawDataBuilder() { memset(this, 0, sizeof(*this)); }
|
ImDrawDataBuilder() { memset(this, 0, sizeof(*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// [SECTION] Data types support
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
struct ImGuiDataVarInfo
|
||||||
|
{
|
||||||
|
ImGuiDataType Type;
|
||||||
|
ImU32 Count; // 1+
|
||||||
|
ImU32 Offset; // Offset in parent structure
|
||||||
|
void* GetVarPtr(void* parent) const { return (void*)((unsigned char*)parent + Offset); }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ImGuiDataTypeStorage
|
||||||
|
{
|
||||||
|
ImU8 Data[8]; // Opaque storage to fit any data up to ImGuiDataType_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
// Type information associated to one ImGuiDataType. Retrieve with DataTypeGetInfo().
|
||||||
|
struct ImGuiDataTypeInfo
|
||||||
|
{
|
||||||
|
size_t Size; // Size in bytes
|
||||||
|
const char* Name; // Short descriptive name for the type, for debugging
|
||||||
|
const char* PrintFmt; // Default printf format for the type
|
||||||
|
const char* ScanFmt; // Default scanf format for the type
|
||||||
|
};
|
||||||
|
|
||||||
|
// Extend ImGuiDataType_
|
||||||
|
enum ImGuiDataTypePrivate_
|
||||||
|
{
|
||||||
|
ImGuiDataType_String = ImGuiDataType_COUNT + 1,
|
||||||
|
ImGuiDataType_Pointer,
|
||||||
|
ImGuiDataType_ID,
|
||||||
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] Widgets support: flags, enums, data structures
|
// [SECTION] Widgets support: flags, enums, data structures
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -842,7 +875,8 @@ enum ImGuiItemStatusFlags_
|
|||||||
ImGuiItemStatusFlags_Deactivated = 1 << 6, // Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
|
ImGuiItemStatusFlags_Deactivated = 1 << 6, // Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
|
||||||
ImGuiItemStatusFlags_HoveredWindow = 1 << 7, // Override the HoveredWindow test to allow cross-window hover testing.
|
ImGuiItemStatusFlags_HoveredWindow = 1 << 7, // Override the HoveredWindow test to allow cross-window hover testing.
|
||||||
ImGuiItemStatusFlags_Visible = 1 << 8, // [WIP] Set when item is overlapping the current clipping rectangle (Used internally. Please don't use yet: API/system will change as we refactor Itemadd()).
|
ImGuiItemStatusFlags_Visible = 1 << 8, // [WIP] Set when item is overlapping the current clipping rectangle (Used internally. Please don't use yet: API/system will change as we refactor Itemadd()).
|
||||||
ImGuiItemStatusFlags_HasClipRect = 1 << 9, // g.LastItemData.ClipRect is valid
|
ImGuiItemStatusFlags_HasClipRect = 1 << 9, // g.LastItemData.ClipRect is valid.
|
||||||
|
ImGuiItemStatusFlags_HasShortcut = 1 << 10, // g.LastItemData.Shortcut valid. Set by SetNextItemShortcut() -> ItemAdd().
|
||||||
|
|
||||||
// Additional status + semantic for ImGuiTestEngine
|
// Additional status + semantic for ImGuiTestEngine
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
@@ -889,7 +923,7 @@ enum ImGuiButtonFlagsPrivate_
|
|||||||
ImGuiButtonFlags_AlignTextBaseLine = 1 << 15, // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine
|
ImGuiButtonFlags_AlignTextBaseLine = 1 << 15, // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine
|
||||||
ImGuiButtonFlags_NoKeyModifiers = 1 << 16, // disable mouse interaction if a key modifier is held
|
ImGuiButtonFlags_NoKeyModifiers = 1 << 16, // disable mouse interaction if a key modifier is held
|
||||||
ImGuiButtonFlags_NoHoldingActiveId = 1 << 17, // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
|
ImGuiButtonFlags_NoHoldingActiveId = 1 << 17, // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
|
||||||
ImGuiButtonFlags_NoNavFocus = 1 << 18, // don't override navigation focus when activated (FIXME: this is essentially used everytime an item uses ImGuiItemFlags_NoNav, but because legacy specs don't requires LastItemData to be set ButtonBehavior(), we can't poll g.LastItemData.InFlags)
|
ImGuiButtonFlags_NoNavFocus = 1 << 18, // don't override navigation focus when activated (FIXME: this is essentially used every time an item uses ImGuiItemFlags_NoNav, but because legacy specs don't requires LastItemData to be set ButtonBehavior(), we can't poll g.LastItemData.InFlags)
|
||||||
ImGuiButtonFlags_NoHoveredOnFocus = 1 << 19, // don't report as hovered when nav focus is on this item
|
ImGuiButtonFlags_NoHoveredOnFocus = 1 << 19, // don't report as hovered when nav focus is on this item
|
||||||
ImGuiButtonFlags_NoSetKeyOwner = 1 << 20, // don't set key/input owner on the initial click (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
|
ImGuiButtonFlags_NoSetKeyOwner = 1 << 20, // don't set key/input owner on the initial click (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
|
||||||
ImGuiButtonFlags_NoTestKeyOwner = 1 << 21, // don't test key/input owner when polling the key (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
|
ImGuiButtonFlags_NoTestKeyOwner = 1 << 21, // don't test key/input owner when polling the key (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
|
||||||
@@ -1177,6 +1211,7 @@ enum ImGuiNextItemDataFlags_
|
|||||||
ImGuiNextItemDataFlags_HasWidth = 1 << 0,
|
ImGuiNextItemDataFlags_HasWidth = 1 << 0,
|
||||||
ImGuiNextItemDataFlags_HasOpen = 1 << 1,
|
ImGuiNextItemDataFlags_HasOpen = 1 << 1,
|
||||||
ImGuiNextItemDataFlags_HasShortcut = 1 << 2,
|
ImGuiNextItemDataFlags_HasShortcut = 1 << 2,
|
||||||
|
ImGuiNextItemDataFlags_HasRefVal = 1 << 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiNextItemData
|
struct ImGuiNextItemData
|
||||||
@@ -1187,8 +1222,10 @@ struct ImGuiNextItemData
|
|||||||
ImGuiSelectionUserData SelectionUserData; // Set by SetNextItemSelectionUserData() (note that NULL/0 is a valid value, we use -1 == ImGuiSelectionUserData_Invalid to mark invalid values)
|
ImGuiSelectionUserData SelectionUserData; // Set by SetNextItemSelectionUserData() (note that NULL/0 is a valid value, we use -1 == ImGuiSelectionUserData_Invalid to mark invalid values)
|
||||||
float Width; // Set by SetNextItemWidth()
|
float Width; // Set by SetNextItemWidth()
|
||||||
ImGuiKeyChord Shortcut; // Set by SetNextItemShortcut()
|
ImGuiKeyChord Shortcut; // Set by SetNextItemShortcut()
|
||||||
|
ImGuiInputFlags ShortcutFlags; // Set by SetNextItemShortcut()
|
||||||
bool OpenVal; // Set by SetNextItemOpen()
|
bool OpenVal; // Set by SetNextItemOpen()
|
||||||
ImGuiCond OpenCond : 8;
|
ImU8 OpenCond; // Set by SetNextItemOpen()
|
||||||
|
ImGuiDataTypeStorage RefVal; // Not exposed yet, for ImGuiInputTextFlags_ParseEmptyAsRefVal
|
||||||
|
|
||||||
ImGuiNextItemData() { memset(this, 0, sizeof(*this)); SelectionUserData = -1; }
|
ImGuiNextItemData() { memset(this, 0, sizeof(*this)); SelectionUserData = -1; }
|
||||||
inline void ClearFlags() { Flags = ImGuiNextItemDataFlags_None; ItemFlags = ImGuiItemFlags_None; } // Also cleared manually by ItemAdd()!
|
inline void ClearFlags() { Flags = ImGuiNextItemDataFlags_None; ItemFlags = ImGuiItemFlags_None; } // Also cleared manually by ItemAdd()!
|
||||||
@@ -1202,9 +1239,10 @@ struct ImGuiLastItemData
|
|||||||
ImGuiItemStatusFlags StatusFlags; // See ImGuiItemStatusFlags_
|
ImGuiItemStatusFlags StatusFlags; // See ImGuiItemStatusFlags_
|
||||||
ImRect Rect; // Full rectangle
|
ImRect Rect; // Full rectangle
|
||||||
ImRect NavRect; // Navigation scoring rectangle (not displayed)
|
ImRect NavRect; // Navigation scoring rectangle (not displayed)
|
||||||
// Rarely used fields are not explicitly cleared, only valid when the corresponding ImGuiItemStatusFlags is set.
|
// Rarely used fields are not explicitly cleared, only valid when the corresponding ImGuiItemStatusFlags ar set.
|
||||||
ImRect DisplayRect; // Display rectangle (ONLY VALID IF ImGuiItemStatusFlags_HasDisplayRect is set)
|
ImRect DisplayRect; // Display rectangle. ONLY VALID IF (StatusFlags & ImGuiItemStatusFlags_HasDisplayRect) is set.
|
||||||
ImRect ClipRect; // Clip rectangle at the time of submitting item (ONLY VALID IF ImGuiItemStatusFlags_HasClipRect is set)
|
ImRect ClipRect; // Clip rectangle at the time of submitting item. ONLY VALID IF (StatusFlags & ImGuiItemStatusFlags_HasClipRect) is set..
|
||||||
|
ImGuiKeyChord Shortcut; // Shortcut at the time of submitting item. ONLY VALID IF (StatusFlags & ImGuiItemStatusFlags_HasShortcut) is set..
|
||||||
|
|
||||||
ImGuiLastItemData() { memset(this, 0, sizeof(*this)); }
|
ImGuiLastItemData() { memset(this, 0, sizeof(*this)); }
|
||||||
};
|
};
|
||||||
@@ -1241,7 +1279,8 @@ struct ImGuiWindowStackData
|
|||||||
{
|
{
|
||||||
ImGuiWindow* Window;
|
ImGuiWindow* Window;
|
||||||
ImGuiLastItemData ParentLastItemDataBackup;
|
ImGuiLastItemData ParentLastItemDataBackup;
|
||||||
ImGuiStackSizes StackSizesOnBegin; // Store size of various stacks for asserting
|
ImGuiStackSizes StackSizesOnBegin; // Store size of various stacks for asserting
|
||||||
|
bool DisabledOverrideReenable; // Non-child window override disabled flag
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiShrinkWidthItem
|
struct ImGuiShrinkWidthItem
|
||||||
@@ -1260,40 +1299,6 @@ struct ImGuiPtrOrIndex
|
|||||||
ImGuiPtrOrIndex(int index) { Ptr = NULL; Index = index; }
|
ImGuiPtrOrIndex(int index) { Ptr = NULL; Index = index; }
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// [SECTION] Data types support
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
struct ImGuiDataVarInfo
|
|
||||||
{
|
|
||||||
ImGuiDataType Type;
|
|
||||||
ImU32 Count; // 1+
|
|
||||||
ImU32 Offset; // Offset in parent structure
|
|
||||||
void* GetVarPtr(void* parent) const { return (void*)((unsigned char*)parent + Offset); }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ImGuiDataTypeTempStorage
|
|
||||||
{
|
|
||||||
ImU8 Data[8]; // Can fit any data up to ImGuiDataType_COUNT
|
|
||||||
};
|
|
||||||
|
|
||||||
// Type information associated to one ImGuiDataType. Retrieve with DataTypeGetInfo().
|
|
||||||
struct ImGuiDataTypeInfo
|
|
||||||
{
|
|
||||||
size_t Size; // Size in bytes
|
|
||||||
const char* Name; // Short descriptive name for the type, for debugging
|
|
||||||
const char* PrintFmt; // Default printf format for the type
|
|
||||||
const char* ScanFmt; // Default scanf format for the type
|
|
||||||
};
|
|
||||||
|
|
||||||
// Extend ImGuiDataType_
|
|
||||||
enum ImGuiDataTypePrivate_
|
|
||||||
{
|
|
||||||
ImGuiDataType_String = ImGuiDataType_COUNT + 1,
|
|
||||||
ImGuiDataType_Pointer,
|
|
||||||
ImGuiDataType_ID,
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] Popup support
|
// [SECTION] Popup support
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -1400,7 +1405,8 @@ struct ImGuiInputEvent
|
|||||||
|
|
||||||
// Input function taking an 'ImGuiID owner_id' argument defaults to (ImGuiKeyOwner_Any == 0) aka don't test ownership, which matches legacy behavior.
|
// Input function taking an 'ImGuiID owner_id' argument defaults to (ImGuiKeyOwner_Any == 0) aka don't test ownership, which matches legacy behavior.
|
||||||
#define ImGuiKeyOwner_Any ((ImGuiID)0) // Accept key that have an owner, UNLESS a call to SetKeyOwner() explicitly used ImGuiInputFlags_LockThisFrame or ImGuiInputFlags_LockUntilRelease.
|
#define ImGuiKeyOwner_Any ((ImGuiID)0) // Accept key that have an owner, UNLESS a call to SetKeyOwner() explicitly used ImGuiInputFlags_LockThisFrame or ImGuiInputFlags_LockUntilRelease.
|
||||||
#define ImGuiKeyOwner_None ((ImGuiID)-1) // Require key to have no owner.
|
#define ImGuiKeyOwner_NoOwner ((ImGuiID)-1) // Require key to have no owner.
|
||||||
|
//#define ImGuiKeyOwner_None ImGuiKeyOwner_NoOwner // We previously called this 'ImGuiKeyOwner_None' but it was inconsistent with our pattern that _None values == 0 and quite dangerous. Also using _NoOwner makes the IsKeyPressed() calls more explicit.
|
||||||
|
|
||||||
typedef ImS16 ImGuiKeyRoutingIndex;
|
typedef ImS16 ImGuiKeyRoutingIndex;
|
||||||
|
|
||||||
@@ -1408,13 +1414,13 @@ typedef ImS16 ImGuiKeyRoutingIndex;
|
|||||||
struct ImGuiKeyRoutingData
|
struct ImGuiKeyRoutingData
|
||||||
{
|
{
|
||||||
ImGuiKeyRoutingIndex NextEntryIndex;
|
ImGuiKeyRoutingIndex NextEntryIndex;
|
||||||
ImU16 Mods; // Technically we'd only need 4-bits but for simplify we store ImGuiMod_ values which need 16-bits. ImGuiMod_Shortcut is already translated to Ctrl/Super.
|
ImU16 Mods; // Technically we'd only need 4-bits but for simplify we store ImGuiMod_ values which need 16-bits.
|
||||||
ImU8 RoutingCurrScore; // [DEBUG] For debug display
|
ImU8 RoutingCurrScore; // [DEBUG] For debug display
|
||||||
ImU8 RoutingNextScore; // Lower is better (0: perfect score)
|
ImU8 RoutingNextScore; // Lower is better (0: perfect score)
|
||||||
ImGuiID RoutingCurr;
|
ImGuiID RoutingCurr;
|
||||||
ImGuiID RoutingNext;
|
ImGuiID RoutingNext;
|
||||||
|
|
||||||
ImGuiKeyRoutingData() { NextEntryIndex = -1; Mods = 0; RoutingCurrScore = RoutingNextScore = 255; RoutingCurr = RoutingNext = ImGuiKeyOwner_None; }
|
ImGuiKeyRoutingData() { NextEntryIndex = -1; Mods = 0; RoutingCurrScore = RoutingNextScore = 255; RoutingCurr = RoutingNext = ImGuiKeyOwner_NoOwner; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Routing table: maintain a desired owner for each possible key-chord (key + mods), and setup owner in NewFrame() when mods are matching.
|
// Routing table: maintain a desired owner for each possible key-chord (key + mods), and setup owner in NewFrame() when mods are matching.
|
||||||
@@ -1438,73 +1444,47 @@ struct ImGuiKeyOwnerData
|
|||||||
bool LockThisFrame; // Reading this key requires explicit owner id (until end of frame). Set by ImGuiInputFlags_LockThisFrame.
|
bool LockThisFrame; // Reading this key requires explicit owner id (until end of frame). Set by ImGuiInputFlags_LockThisFrame.
|
||||||
bool LockUntilRelease; // Reading this key requires explicit owner id (until key is released). Set by ImGuiInputFlags_LockUntilRelease. When this is true LockThisFrame is always true as well.
|
bool LockUntilRelease; // Reading this key requires explicit owner id (until key is released). Set by ImGuiInputFlags_LockUntilRelease. When this is true LockThisFrame is always true as well.
|
||||||
|
|
||||||
ImGuiKeyOwnerData() { OwnerCurr = OwnerNext = ImGuiKeyOwner_None; LockThisFrame = LockUntilRelease = false; }
|
ImGuiKeyOwnerData() { OwnerCurr = OwnerNext = ImGuiKeyOwner_NoOwner; LockThisFrame = LockUntilRelease = false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Extend ImGuiInputFlags_
|
||||||
// Flags for extended versions of IsKeyPressed(), IsMouseClicked(), Shortcut(), SetKeyOwner(), SetItemKeyOwner()
|
// Flags for extended versions of IsKeyPressed(), IsMouseClicked(), Shortcut(), SetKeyOwner(), SetItemKeyOwner()
|
||||||
// Don't mistake with ImGuiInputTextFlags! (which is for ImGui::InputText() function)
|
// Don't mistake with ImGuiInputTextFlags! (which is for ImGui::InputText() function)
|
||||||
enum ImGuiInputFlags_
|
enum ImGuiInputFlagsPrivate_
|
||||||
{
|
{
|
||||||
// Flags for IsKeyPressed(), IsKeyChordPressed(), IsMouseClicked(), Shortcut()
|
// Flags for IsKeyPressed(), IsKeyChordPressed(), IsMouseClicked(), Shortcut()
|
||||||
ImGuiInputFlags_None = 0,
|
// - Repeat mode: Repeat rate selection
|
||||||
|
ImGuiInputFlags_RepeatRateDefault = 1 << 1, // Repeat rate: Regular (default)
|
||||||
// Repeat mode
|
ImGuiInputFlags_RepeatRateNavMove = 1 << 2, // Repeat rate: Fast
|
||||||
ImGuiInputFlags_Repeat = 1 << 0, // Enable repeat. Return true on successive repeats. Default for legacy IsKeyPressed(). NOT Default for legacy IsMouseClicked(). MUST BE == 1.
|
ImGuiInputFlags_RepeatRateNavTweak = 1 << 3, // Repeat rate: Faster
|
||||||
ImGuiInputFlags_RepeatRateDefault = 1 << 1, // Repeat rate: Regular (default)
|
// - Repeat mode: Specify when repeating key pressed can be interrupted.
|
||||||
ImGuiInputFlags_RepeatRateNavMove = 1 << 2, // Repeat rate: Fast
|
// - In theory ImGuiInputFlags_RepeatUntilOtherKeyPress may be a desirable default, but it would break too many behavior so everything is opt-in.
|
||||||
ImGuiInputFlags_RepeatRateNavTweak = 1 << 3, // Repeat rate: Faster
|
ImGuiInputFlags_RepeatUntilRelease = 1 << 4, // Stop repeating when released (default for all functions except Shortcut). This only exists to allow overriding Shortcut() default behavior.
|
||||||
|
ImGuiInputFlags_RepeatUntilKeyModsChange = 1 << 5, // Stop repeating when released OR if keyboard mods are changed (default for Shortcut)
|
||||||
// Repeat mode: Specify when repeating key pressed can be interrupted.
|
|
||||||
// In theory ImGuiInputFlags_RepeatUntilOtherKeyPress may be a desirable default, but it would break too many behavior so everything is opt-in.
|
|
||||||
ImGuiInputFlags_RepeatUntilRelease = 1 << 4, // Stop repeating when released (default for all functions except Shortcut). This only exists to allow overriding Shortcut() default behavior.
|
|
||||||
ImGuiInputFlags_RepeatUntilKeyModsChange = 1 << 5, // Stop repeating when released OR if keyboard mods are changed (default for Shortcut)
|
|
||||||
ImGuiInputFlags_RepeatUntilKeyModsChangeFromNone = 1 << 6, // Stop repeating when released OR if keyboard mods are leaving the None state. Allows going from Mod+Key to Key by releasing Mod.
|
ImGuiInputFlags_RepeatUntilKeyModsChangeFromNone = 1 << 6, // Stop repeating when released OR if keyboard mods are leaving the None state. Allows going from Mod+Key to Key by releasing Mod.
|
||||||
ImGuiInputFlags_RepeatUntilOtherKeyPress = 1 << 7, // Stop repeating when released OR if any other keyboard key is pressed during the repeat
|
ImGuiInputFlags_RepeatUntilOtherKeyPress = 1 << 7, // Stop repeating when released OR if any other keyboard key is pressed during the repeat
|
||||||
|
|
||||||
// Flags for SetItemKeyOwner()
|
|
||||||
ImGuiInputFlags_CondHovered = 1 << 8, // Only set if item is hovered (default to both)
|
|
||||||
ImGuiInputFlags_CondActive = 1 << 9, // Only set if item is active (default to both)
|
|
||||||
ImGuiInputFlags_CondDefault_ = ImGuiInputFlags_CondHovered | ImGuiInputFlags_CondActive,
|
|
||||||
|
|
||||||
// Flags for SetKeyOwner(), SetItemKeyOwner()
|
// Flags for SetKeyOwner(), SetItemKeyOwner()
|
||||||
// Locking is useful to make input-owner-aware code steal keys from non-input-owner-aware code. If all code is input-owner-aware locking would never be necessary.
|
// - Locking key away from non-input aware code. Locking is useful to make input-owner-aware code steal keys from non-input-owner-aware code. If all code is input-owner-aware locking would never be necessary.
|
||||||
ImGuiInputFlags_LockThisFrame = 1 << 10, // Further accesses to key data will require EXPLICIT owner ID (ImGuiKeyOwner_Any/0 will NOT accepted for polling). Cleared at end of frame.
|
ImGuiInputFlags_LockThisFrame = 1 << 20, // Further accesses to key data will require EXPLICIT owner ID (ImGuiKeyOwner_Any/0 will NOT accepted for polling). Cleared at end of frame.
|
||||||
ImGuiInputFlags_LockUntilRelease = 1 << 11, // Further accesses to key data will require EXPLICIT owner ID (ImGuiKeyOwner_Any/0 will NOT accepted for polling). Cleared when the key is released or at end of each frame if key is released.
|
ImGuiInputFlags_LockUntilRelease = 1 << 21, // Further accesses to key data will require EXPLICIT owner ID (ImGuiKeyOwner_Any/0 will NOT accepted for polling). Cleared when the key is released or at end of each frame if key is released.
|
||||||
|
|
||||||
// Routing policies for Shortcut() + low-level SetShortcutRouting()
|
// - Condition for SetItemKeyOwner()
|
||||||
// - The general idea is that several callers register interest in a shortcut, and only one owner gets it.
|
ImGuiInputFlags_CondHovered = 1 << 22, // Only set if item is hovered (default to both)
|
||||||
// Parent -> call Shortcut(Ctrl+S) // When Parent is focused, Parent gets the shortcut.
|
ImGuiInputFlags_CondActive = 1 << 23, // Only set if item is active (default to both)
|
||||||
// Child1 -> call Shortcut(Ctrl+S) // When Child1 is focused, Child1 gets the shortcut (Child1 overrides Parent shortcuts)
|
ImGuiInputFlags_CondDefault_ = ImGuiInputFlags_CondHovered | ImGuiInputFlags_CondActive,
|
||||||
// Child2 -> no call // When Child2 is focused, Parent gets the shortcut.
|
|
||||||
// The whole system is order independent, so if Child1 does it calls before Parent results will be identical.
|
|
||||||
// This is an important property as it facilitate working with foreign code or larger codebase.
|
|
||||||
// - Visualize registered routes in 'Metrics->Inputs' and submitted routes in 'Debug Log->InputRouting'.
|
|
||||||
// - When a policy (except for _RouteAlways *) is set, Shortcut() will register itself with SetShortcutRouting(),
|
|
||||||
// allowing the system to decide where to route the input among other route-aware calls.
|
|
||||||
// (* Using ImGuiInputFlags_RouteAlways is roughly equivalent to calling IsKeyChordPressed(key)).
|
|
||||||
// - Shortcut() uses ImGuiInputFlags_RouteFocused by default. Meaning that a Shortcut() call will register
|
|
||||||
// a route and only succeed when parent window is in the focus-stack and if no-one with a higher priority
|
|
||||||
// is claiming the same shortcut.
|
|
||||||
// - You can chain two unrelated windows in the focus stack using SetWindowParentWindowForFocusRoute().
|
|
||||||
// - Priorities: GlobalHigh > Focused (when owner is active item) > Global > Focused (when focused window) > GlobalLow.
|
|
||||||
// - Can select only 1 policy among all available.
|
|
||||||
ImGuiInputFlags_RouteFocused = 1 << 12, // (Default) Honor focus route: Accept inputs if window is in focus stack. Deep-most focused window takes inputs. ActiveId takes inputs over deep-most focused window.
|
|
||||||
ImGuiInputFlags_RouteGlobalLow = 1 << 13, // Register route globally (lowest priority: unless a focused window or active item registered the route) -> recommended Global priority IF you need a Global priority.
|
|
||||||
ImGuiInputFlags_RouteGlobal = 1 << 14, // Register route globally (medium priority: unless an active item registered the route, e.g. CTRL+A registered by InputText will take priority over this).
|
|
||||||
ImGuiInputFlags_RouteGlobalHigh = 1 << 15, // Register route globally (higher priority: unlikely you need to use that: will interfere with every active items, e.g. CTRL+A registered by InputText will be overriden by this)
|
|
||||||
ImGuiInputFlags_RouteAlways = 1 << 16, // Do not register route, poll keys directly.
|
|
||||||
// Routing polices: extra options
|
|
||||||
ImGuiInputFlags_RouteUnlessBgFocused= 1 << 17, // Global routes will not be applied if underlying background/void is focused (== no Dear ImGui windows are focused). Useful for overlay applications.
|
|
||||||
|
|
||||||
// [Internal] Mask of which function support which flags
|
// [Internal] Mask of which function support which flags
|
||||||
ImGuiInputFlags_RepeatRateMask_ = ImGuiInputFlags_RepeatRateDefault | ImGuiInputFlags_RepeatRateNavMove | ImGuiInputFlags_RepeatRateNavTweak,
|
ImGuiInputFlags_RepeatRateMask_ = ImGuiInputFlags_RepeatRateDefault | ImGuiInputFlags_RepeatRateNavMove | ImGuiInputFlags_RepeatRateNavTweak,
|
||||||
ImGuiInputFlags_RepeatUntilMask_ = ImGuiInputFlags_RepeatUntilRelease | ImGuiInputFlags_RepeatUntilKeyModsChange | ImGuiInputFlags_RepeatUntilKeyModsChangeFromNone | ImGuiInputFlags_RepeatUntilOtherKeyPress,
|
ImGuiInputFlags_RepeatUntilMask_ = ImGuiInputFlags_RepeatUntilRelease | ImGuiInputFlags_RepeatUntilKeyModsChange | ImGuiInputFlags_RepeatUntilKeyModsChangeFromNone | ImGuiInputFlags_RepeatUntilOtherKeyPress,
|
||||||
ImGuiInputFlags_RepeatMask_ = ImGuiInputFlags_Repeat | ImGuiInputFlags_RepeatRateMask_ | ImGuiInputFlags_RepeatUntilMask_,
|
ImGuiInputFlags_RepeatMask_ = ImGuiInputFlags_Repeat | ImGuiInputFlags_RepeatRateMask_ | ImGuiInputFlags_RepeatUntilMask_,
|
||||||
ImGuiInputFlags_CondMask_ = ImGuiInputFlags_CondHovered | ImGuiInputFlags_CondActive,
|
ImGuiInputFlags_CondMask_ = ImGuiInputFlags_CondHovered | ImGuiInputFlags_CondActive,
|
||||||
ImGuiInputFlags_RouteMask_ = ImGuiInputFlags_RouteFocused | ImGuiInputFlags_RouteGlobal | ImGuiInputFlags_RouteGlobalLow | ImGuiInputFlags_RouteGlobalHigh, // _Always not part of this!
|
ImGuiInputFlags_RouteTypeMask_ = ImGuiInputFlags_RouteActive | ImGuiInputFlags_RouteFocused | ImGuiInputFlags_RouteGlobal | ImGuiInputFlags_RouteAlways,
|
||||||
|
ImGuiInputFlags_RouteOptionsMask_ = ImGuiInputFlags_RouteOverFocused | ImGuiInputFlags_RouteOverActive | ImGuiInputFlags_RouteUnlessBgFocused | ImGuiInputFlags_RouteFromRootWindow,
|
||||||
ImGuiInputFlags_SupportedByIsKeyPressed = ImGuiInputFlags_RepeatMask_,
|
ImGuiInputFlags_SupportedByIsKeyPressed = ImGuiInputFlags_RepeatMask_,
|
||||||
ImGuiInputFlags_SupportedByIsMouseClicked = ImGuiInputFlags_Repeat,
|
ImGuiInputFlags_SupportedByIsMouseClicked = ImGuiInputFlags_Repeat,
|
||||||
ImGuiInputFlags_SupportedByShortcut = ImGuiInputFlags_RepeatMask_ | ImGuiInputFlags_RouteMask_ | ImGuiInputFlags_RouteAlways | ImGuiInputFlags_RouteUnlessBgFocused,
|
ImGuiInputFlags_SupportedByShortcut = ImGuiInputFlags_RepeatMask_ | ImGuiInputFlags_RouteTypeMask_ | ImGuiInputFlags_RouteOptionsMask_,
|
||||||
|
ImGuiInputFlags_SupportedBySetNextItemShortcut = ImGuiInputFlags_RepeatMask_ | ImGuiInputFlags_RouteTypeMask_ | ImGuiInputFlags_RouteOptionsMask_ | ImGuiInputFlags_Tooltip,
|
||||||
ImGuiInputFlags_SupportedBySetKeyOwner = ImGuiInputFlags_LockThisFrame | ImGuiInputFlags_LockUntilRelease,
|
ImGuiInputFlags_SupportedBySetKeyOwner = ImGuiInputFlags_LockThisFrame | ImGuiInputFlags_LockUntilRelease,
|
||||||
ImGuiInputFlags_SupportedBySetItemKeyOwner = ImGuiInputFlags_SupportedBySetKeyOwner | ImGuiInputFlags_CondMask_,
|
ImGuiInputFlags_SupportedBySetItemKeyOwner = ImGuiInputFlags_SupportedBySetKeyOwner | ImGuiInputFlags_CondMask_,
|
||||||
};
|
};
|
||||||
@@ -1605,6 +1585,7 @@ enum ImGuiNavLayer
|
|||||||
ImGuiNavLayer_COUNT
|
ImGuiNavLayer_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Storage for navigation query/results
|
||||||
struct ImGuiNavItemData
|
struct ImGuiNavItemData
|
||||||
{
|
{
|
||||||
ImGuiWindow* Window; // Init,Move // Best candidate window (result->ItemWindow->RootWindowForNav == request->Window)
|
ImGuiWindow* Window; // Init,Move // Best candidate window (result->ItemWindow->RootWindowForNav == request->Window)
|
||||||
@@ -1621,6 +1602,7 @@ struct ImGuiNavItemData
|
|||||||
void Clear() { Window = NULL; ID = FocusScopeId = 0; InFlags = 0; SelectionUserData = -1; DistBox = DistCenter = DistAxial = FLT_MAX; }
|
void Clear() { Window = NULL; ID = FocusScopeId = 0; InFlags = 0; SelectionUserData = -1; DistBox = DistCenter = DistAxial = FLT_MAX; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Storage for PushFocusScope()
|
||||||
struct ImGuiFocusScopeData
|
struct ImGuiFocusScopeData
|
||||||
{
|
{
|
||||||
ImGuiID ID;
|
ImGuiID ID;
|
||||||
@@ -1942,6 +1924,7 @@ struct ImGuiContext
|
|||||||
ImFont* Font; // (Shortcut) == FontStack.empty() ? IO.Font : FontStack.back()
|
ImFont* Font; // (Shortcut) == FontStack.empty() ? IO.Font : FontStack.back()
|
||||||
float FontSize; // (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text height for current window.
|
float FontSize; // (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text height for current window.
|
||||||
float FontBaseSize; // (Shortcut) == IO.FontGlobalScale * Font->Scale * Font->FontSize. Base text height.
|
float FontBaseSize; // (Shortcut) == IO.FontGlobalScale * Font->Scale * Font->FontSize. Base text height.
|
||||||
|
float CurrentDpiScale; // Current window/viewport DpiScale
|
||||||
ImDrawListSharedData DrawListSharedData;
|
ImDrawListSharedData DrawListSharedData;
|
||||||
double Time;
|
double Time;
|
||||||
int FrameCount;
|
int FrameCount;
|
||||||
@@ -1967,7 +1950,7 @@ struct ImGuiContext
|
|||||||
ImVector<ImGuiWindowStackData> CurrentWindowStack;
|
ImVector<ImGuiWindowStackData> CurrentWindowStack;
|
||||||
ImGuiStorage WindowsById; // Map window's ImGuiID to ImGuiWindow*
|
ImGuiStorage WindowsById; // Map window's ImGuiID to ImGuiWindow*
|
||||||
int WindowsActiveCount; // Number of unique windows submitted by frame
|
int WindowsActiveCount; // Number of unique windows submitted by frame
|
||||||
ImVec2 WindowsHoverPadding; // Padding around resizable windows for which hovering on counts as hovering the window == ImMax(style.TouchExtraPadding, WINDOWS_HOVER_PADDING)
|
ImVec2 WindowsHoverPadding; // Padding around resizable windows for which hovering on counts as hovering the window == ImMax(style.TouchExtraPadding, WINDOWS_HOVER_PADDING).
|
||||||
ImGuiID DebugBreakInWindow; // Set to break in Begin() call.
|
ImGuiID DebugBreakInWindow; // Set to break in Begin() call.
|
||||||
ImGuiWindow* CurrentWindow; // Window being drawn into
|
ImGuiWindow* CurrentWindow; // Window being drawn into
|
||||||
ImGuiWindow* HoveredWindow; // Window the mouse is hovering. Will typically catch mouse inputs.
|
ImGuiWindow* HoveredWindow; // Window the mouse is hovering. Will typically catch mouse inputs.
|
||||||
@@ -1985,10 +1968,11 @@ struct ImGuiContext
|
|||||||
ImGuiID DebugHookIdInfo; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by ID Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
|
ImGuiID DebugHookIdInfo; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by ID Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
|
||||||
ImGuiID HoveredId; // Hovered widget, filled during the frame
|
ImGuiID HoveredId; // Hovered widget, filled during the frame
|
||||||
ImGuiID HoveredIdPreviousFrame;
|
ImGuiID HoveredIdPreviousFrame;
|
||||||
bool HoveredIdAllowOverlap;
|
|
||||||
bool HoveredIdDisabled; // At least one widget passed the rect test, but has been discarded by disabled flag or popup inhibit. May be true even if HoveredId == 0.
|
|
||||||
float HoveredIdTimer; // Measure contiguous hovering time
|
float HoveredIdTimer; // Measure contiguous hovering time
|
||||||
float HoveredIdNotActiveTimer; // Measure contiguous hovering time where the item has not been active
|
float HoveredIdNotActiveTimer; // Measure contiguous hovering time where the item has not been active
|
||||||
|
bool HoveredIdAllowOverlap;
|
||||||
|
bool HoveredIdDisabled; // At least one widget passed the rect test, but has been discarded by disabled flag or popup inhibit. May be true even if HoveredId == 0.
|
||||||
|
bool ItemUnclipByLog; // Disable ItemAdd() clipping, essentially a memory-locality friendly copy of LogEnabled
|
||||||
ImGuiID ActiveId; // Active widget
|
ImGuiID ActiveId; // Active widget
|
||||||
ImGuiID ActiveIdIsAlive; // Active widget has been seen this frame (we can't use a bool as the ActiveId may change within the frame)
|
ImGuiID ActiveIdIsAlive; // Active widget has been seen this frame (we can't use a bool as the ActiveId may change within the frame)
|
||||||
float ActiveIdTimer;
|
float ActiveIdTimer;
|
||||||
@@ -2010,9 +1994,9 @@ struct ImGuiContext
|
|||||||
ImGuiID LastActiveId; // Store the last non-zero ActiveId, useful for animation.
|
ImGuiID LastActiveId; // Store the last non-zero ActiveId, useful for animation.
|
||||||
float LastActiveIdTimer; // Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.
|
float LastActiveIdTimer; // Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.
|
||||||
|
|
||||||
// [EXPERIMENTAL] Key/Input Ownership + Shortcut Routing system
|
// Key/Input Ownership + Shortcut Routing system
|
||||||
// - The idea is that instead of "eating" a given key, we can link to an owner.
|
// - The idea is that instead of "eating" a given key, we can link to an owner.
|
||||||
// - Input query can then read input by specifying ImGuiKeyOwner_Any (== 0), ImGuiKeyOwner_None (== -1) or a custom ID.
|
// - Input query can then read input by specifying ImGuiKeyOwner_Any (== 0), ImGuiKeyOwner_NoOwner (== -1) or a custom ID.
|
||||||
// - Routing is requested ahead of time for a given chord (Key + Mods) and granted in NewFrame().
|
// - Routing is requested ahead of time for a given chord (Key + Mods) and granted in NewFrame().
|
||||||
double LastKeyModsChangeTime; // Record the last time key mods changed (affect repeat delay when using shortcut logic)
|
double LastKeyModsChangeTime; // Record the last time key mods changed (affect repeat delay when using shortcut logic)
|
||||||
double LastKeyModsChangeFromNoneTime; // Record the last time key mods changed away from being 0 (affect repeat delay when using shortcut logic)
|
double LastKeyModsChangeFromNoneTime; // Record the last time key mods changed away from being 0 (affect repeat delay when using shortcut logic)
|
||||||
@@ -2055,11 +2039,11 @@ struct ImGuiContext
|
|||||||
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusedWindow'
|
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusedWindow'
|
||||||
ImGuiID NavId; // Focused item for navigation
|
ImGuiID NavId; // Focused item for navigation
|
||||||
ImGuiID NavFocusScopeId; // Focused focus scope (e.g. selection code often wants to "clear other items" when landing on an item of the same scope)
|
ImGuiID NavFocusScopeId; // Focused focus scope (e.g. selection code often wants to "clear other items" when landing on an item of the same scope)
|
||||||
ImVector<ImGuiFocusScopeData> NavFocusRoute; // Reversed copy focus scope stack for NavId (should contains NavFocusScopeId). This essentially follow the window->ParentWindowForFocusRoute chain.
|
|
||||||
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItem()
|
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItem()
|
||||||
ImGuiID NavActivateDownId; // ~~ IsKeyDown(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyDown(ImGuiKey_NavGamepadActivate) ? NavId : 0
|
ImGuiID NavActivateDownId; // ~~ IsKeyDown(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyDown(ImGuiKey_NavGamepadActivate) ? NavId : 0
|
||||||
ImGuiID NavActivatePressedId; // ~~ IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate) ? NavId : 0 (no repeat)
|
ImGuiID NavActivatePressedId; // ~~ IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate) ? NavId : 0 (no repeat)
|
||||||
ImGuiActivateFlags NavActivateFlags;
|
ImGuiActivateFlags NavActivateFlags;
|
||||||
|
ImVector<ImGuiFocusScopeData> NavFocusRoute; // Reversed copy focus scope stack for NavId (should contains NavFocusScopeId). This essentially follow the window->ParentWindowForFocusRoute chain.
|
||||||
ImGuiID NavHighlightActivatedId;
|
ImGuiID NavHighlightActivatedId;
|
||||||
float NavHighlightActivatedTimer;
|
float NavHighlightActivatedTimer;
|
||||||
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest).
|
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest).
|
||||||
@@ -2100,8 +2084,8 @@ struct ImGuiContext
|
|||||||
ImGuiNavItemData NavTabbingResultFirst; // First tabbing request candidate within NavWindow and flattened hierarchy
|
ImGuiNavItemData NavTabbingResultFirst; // First tabbing request candidate within NavWindow and flattened hierarchy
|
||||||
|
|
||||||
// Navigation: Windowing (CTRL+TAB for list, or Menu button + keys or directional pads to move/resize)
|
// Navigation: Windowing (CTRL+TAB for list, or Menu button + keys or directional pads to move/resize)
|
||||||
ImGuiKeyChord ConfigNavWindowingKeyNext; // = ImGuiMod_Ctrl | ImGuiKey_Tab, for reconfiguration (see #4828)
|
ImGuiKeyChord ConfigNavWindowingKeyNext; // = ImGuiMod_Ctrl | ImGuiKey_Tab (or ImGuiMod_Super | ImGuiKey_Tab on OS X). For reconfiguration (see #4828)
|
||||||
ImGuiKeyChord ConfigNavWindowingKeyPrev; // = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab
|
ImGuiKeyChord ConfigNavWindowingKeyPrev; // = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab (or ImGuiMod_Super | ImGuiMod_Shift | ImGuiKey_Tab on OS X)
|
||||||
ImGuiWindow* NavWindowingTarget; // Target window when doing CTRL+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most!
|
ImGuiWindow* NavWindowingTarget; // Target window when doing CTRL+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most!
|
||||||
ImGuiWindow* NavWindowingTargetAnim; // Record of last valid NavWindowingTarget until DimBgRatio and NavWindowingHighlightAlpha becomes 0.0f, so the fade-out can stay on it.
|
ImGuiWindow* NavWindowingTargetAnim; // Record of last valid NavWindowingTarget until DimBgRatio and NavWindowingHighlightAlpha becomes 0.0f, so the fade-out can stay on it.
|
||||||
ImGuiWindow* NavWindowingListWindow; // Internal window actually listing the CTRL+Tab contents
|
ImGuiWindow* NavWindowingListWindow; // Internal window actually listing the CTRL+Tab contents
|
||||||
@@ -2172,6 +2156,7 @@ struct ImGuiContext
|
|||||||
ImGuiInputTextDeactivatedState InputTextDeactivatedState;
|
ImGuiInputTextDeactivatedState InputTextDeactivatedState;
|
||||||
ImFont InputTextPasswordFont;
|
ImFont InputTextPasswordFont;
|
||||||
ImGuiID TempInputId; // Temporary text input when CTRL+clicking on a slider, etc.
|
ImGuiID TempInputId; // Temporary text input when CTRL+clicking on a slider, etc.
|
||||||
|
ImGuiDataTypeStorage DataTypeZeroValue; // 0 for all data types
|
||||||
int BeginMenuDepth;
|
int BeginMenuDepth;
|
||||||
int BeginComboDepth;
|
int BeginComboDepth;
|
||||||
ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets
|
ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets
|
||||||
@@ -2184,13 +2169,14 @@ struct ImGuiContext
|
|||||||
ImGuiComboPreviewData ComboPreviewData;
|
ImGuiComboPreviewData ComboPreviewData;
|
||||||
ImRect WindowResizeBorderExpectedRect; // Expected border rect, switch to relative edit if moving
|
ImRect WindowResizeBorderExpectedRect; // Expected border rect, switch to relative edit if moving
|
||||||
bool WindowResizeRelativeMode;
|
bool WindowResizeRelativeMode;
|
||||||
|
short ScrollbarSeekMode; // 0: relative, -1/+1: prev/next page.
|
||||||
|
float ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage?
|
||||||
float SliderGrabClickOffset;
|
float SliderGrabClickOffset;
|
||||||
float SliderCurrentAccum; // Accumulated slider delta when using navigation controls.
|
float SliderCurrentAccum; // Accumulated slider delta when using navigation controls.
|
||||||
bool SliderCurrentAccumDirty; // Has the accumulated slider delta changed since last time we tried to apply it?
|
bool SliderCurrentAccumDirty; // Has the accumulated slider delta changed since last time we tried to apply it?
|
||||||
bool DragCurrentAccumDirty;
|
bool DragCurrentAccumDirty;
|
||||||
float DragCurrentAccum; // Accumulator for dragging modification. Always high-precision, not rounded by end-user precision settings
|
float DragCurrentAccum; // Accumulator for dragging modification. Always high-precision, not rounded by end-user precision settings
|
||||||
float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio
|
float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio
|
||||||
float ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage?
|
|
||||||
float DisabledAlphaBackup; // Backup for style.Alpha for BeginDisabled()
|
float DisabledAlphaBackup; // Backup for style.Alpha for BeginDisabled()
|
||||||
short DisabledStackSize;
|
short DisabledStackSize;
|
||||||
short LockMarkEdited;
|
short LockMarkEdited;
|
||||||
@@ -2268,7 +2254,7 @@ struct ImGuiContext
|
|||||||
Initialized = false;
|
Initialized = false;
|
||||||
FontAtlasOwnedByContext = shared_font_atlas ? false : true;
|
FontAtlasOwnedByContext = shared_font_atlas ? false : true;
|
||||||
Font = NULL;
|
Font = NULL;
|
||||||
FontSize = FontBaseSize = 0.0f;
|
FontSize = FontBaseSize = CurrentDpiScale = 0.0f;
|
||||||
IO.Fonts = shared_font_atlas ? shared_font_atlas : IM_NEW(ImFontAtlas)();
|
IO.Fonts = shared_font_atlas ? shared_font_atlas : IM_NEW(ImFontAtlas)();
|
||||||
Time = 0.0f;
|
Time = 0.0f;
|
||||||
FrameCount = 0;
|
FrameCount = 0;
|
||||||
@@ -2295,6 +2281,7 @@ struct ImGuiContext
|
|||||||
HoveredIdAllowOverlap = false;
|
HoveredIdAllowOverlap = false;
|
||||||
HoveredIdDisabled = false;
|
HoveredIdDisabled = false;
|
||||||
HoveredIdTimer = HoveredIdNotActiveTimer = 0.0f;
|
HoveredIdTimer = HoveredIdNotActiveTimer = 0.0f;
|
||||||
|
ItemUnclipByLog = false;
|
||||||
ActiveId = 0;
|
ActiveId = 0;
|
||||||
ActiveIdIsAlive = 0;
|
ActiveIdIsAlive = 0;
|
||||||
ActiveIdTimer = 0.0f;
|
ActiveIdTimer = 0.0f;
|
||||||
@@ -2356,8 +2343,10 @@ struct ImGuiContext
|
|||||||
NavTabbingDir = 0;
|
NavTabbingDir = 0;
|
||||||
NavTabbingCounter = 0;
|
NavTabbingCounter = 0;
|
||||||
|
|
||||||
ConfigNavWindowingKeyNext = ImGuiMod_Ctrl | ImGuiKey_Tab;
|
// All platforms use Ctrl+Tab but Ctrl<>Super are swapped on Mac...
|
||||||
ConfigNavWindowingKeyPrev = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab;
|
// FIXME: Because this value is stored, it annoyingly interfere with toggling io.ConfigMacOSXBehaviors updating this..
|
||||||
|
ConfigNavWindowingKeyNext = IO.ConfigMacOSXBehaviors ? (ImGuiMod_Super | ImGuiKey_Tab) : (ImGuiMod_Ctrl | ImGuiKey_Tab);
|
||||||
|
ConfigNavWindowingKeyPrev = IO.ConfigMacOSXBehaviors ? (ImGuiMod_Super | ImGuiMod_Shift | ImGuiKey_Tab) : (ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab);
|
||||||
NavWindowingTarget = NavWindowingTargetAnim = NavWindowingListWindow = NULL;
|
NavWindowingTarget = NavWindowingTargetAnim = NavWindowingListWindow = NULL;
|
||||||
NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f;
|
NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f;
|
||||||
NavWindowingToggleLayer = false;
|
NavWindowingToggleLayer = false;
|
||||||
@@ -2390,19 +2379,21 @@ struct ImGuiContext
|
|||||||
MouseStationaryTimer = 0.0f;
|
MouseStationaryTimer = 0.0f;
|
||||||
|
|
||||||
TempInputId = 0;
|
TempInputId = 0;
|
||||||
|
memset(&DataTypeZeroValue, 0, sizeof(DataTypeZeroValue));
|
||||||
BeginMenuDepth = BeginComboDepth = 0;
|
BeginMenuDepth = BeginComboDepth = 0;
|
||||||
ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_;
|
ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_;
|
||||||
ColorEditCurrentID = ColorEditSavedID = 0;
|
ColorEditCurrentID = ColorEditSavedID = 0;
|
||||||
ColorEditSavedHue = ColorEditSavedSat = 0.0f;
|
ColorEditSavedHue = ColorEditSavedSat = 0.0f;
|
||||||
ColorEditSavedColor = 0;
|
ColorEditSavedColor = 0;
|
||||||
WindowResizeRelativeMode = false;
|
WindowResizeRelativeMode = false;
|
||||||
|
ScrollbarSeekMode = 0;
|
||||||
|
ScrollbarClickDeltaToGrabCenter = 0.0f;
|
||||||
SliderGrabClickOffset = 0.0f;
|
SliderGrabClickOffset = 0.0f;
|
||||||
SliderCurrentAccum = 0.0f;
|
SliderCurrentAccum = 0.0f;
|
||||||
SliderCurrentAccumDirty = false;
|
SliderCurrentAccumDirty = false;
|
||||||
DragCurrentAccumDirty = false;
|
DragCurrentAccumDirty = false;
|
||||||
DragCurrentAccum = 0.0f;
|
DragCurrentAccum = 0.0f;
|
||||||
DragSpeedDefaultRatio = 1.0f / 100.0f;
|
DragSpeedDefaultRatio = 1.0f / 100.0f;
|
||||||
ScrollbarClickDeltaToGrabCenter = 0.0f;
|
|
||||||
DisabledAlphaBackup = 0.0f;
|
DisabledAlphaBackup = 0.0f;
|
||||||
DisabledStackSize = 0;
|
DisabledStackSize = 0;
|
||||||
LockMarkEdited = 0;
|
LockMarkEdited = 0;
|
||||||
@@ -2527,12 +2518,14 @@ struct IMGUI_API ImGuiWindow
|
|||||||
ImVec2 WindowPadding; // Window padding at the time of Begin().
|
ImVec2 WindowPadding; // Window padding at the time of Begin().
|
||||||
float WindowRounding; // Window rounding at the time of Begin(). May be clamped lower to avoid rendering artifacts with title bar, menu bar etc.
|
float WindowRounding; // Window rounding at the time of Begin(). May be clamped lower to avoid rendering artifacts with title bar, menu bar etc.
|
||||||
float WindowBorderSize; // Window border size at the time of Begin().
|
float WindowBorderSize; // Window border size at the time of Begin().
|
||||||
|
float TitleBarHeight, MenuBarHeight;
|
||||||
float DecoOuterSizeX1, DecoOuterSizeY1; // Left/Up offsets. Sum of non-scrolling outer decorations (X1 generally == 0.0f. Y1 generally = TitleBarHeight + MenuBarHeight). Locked during Begin().
|
float DecoOuterSizeX1, DecoOuterSizeY1; // Left/Up offsets. Sum of non-scrolling outer decorations (X1 generally == 0.0f. Y1 generally = TitleBarHeight + MenuBarHeight). Locked during Begin().
|
||||||
float DecoOuterSizeX2, DecoOuterSizeY2; // Right/Down offsets (X2 generally == ScrollbarSize.x, Y2 == ScrollbarSizes.y).
|
float DecoOuterSizeX2, DecoOuterSizeY2; // Right/Down offsets (X2 generally == ScrollbarSize.x, Y2 == ScrollbarSizes.y).
|
||||||
float DecoInnerSizeX1, DecoInnerSizeY1; // Applied AFTER/OVER InnerRect. Specialized for Tables as they use specialized form of clipping and frozen rows/columns are inside InnerRect (and not part of regular decoration sizes).
|
float DecoInnerSizeX1, DecoInnerSizeY1; // Applied AFTER/OVER InnerRect. Specialized for Tables as they use specialized form of clipping and frozen rows/columns are inside InnerRect (and not part of regular decoration sizes).
|
||||||
int NameBufLen; // Size of buffer storing Name. May be larger than strlen(Name)!
|
int NameBufLen; // Size of buffer storing Name. May be larger than strlen(Name)!
|
||||||
ImGuiID MoveId; // == window->GetID("#MOVE")
|
ImGuiID MoveId; // == window->GetID("#MOVE")
|
||||||
ImGuiID ChildId; // ID of corresponding item in parent window (for navigation to return from child window to parent window)
|
ImGuiID ChildId; // ID of corresponding item in parent window (for navigation to return from child window to parent window)
|
||||||
|
ImGuiID PopupId; // ID in the popup stack when this window is used as a popup/menu (because we use generic Name/ID for recycling)
|
||||||
ImVec2 Scroll;
|
ImVec2 Scroll;
|
||||||
ImVec2 ScrollMax;
|
ImVec2 ScrollMax;
|
||||||
ImVec2 ScrollTarget; // target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)
|
ImVec2 ScrollTarget; // target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)
|
||||||
@@ -2559,7 +2552,6 @@ struct IMGUI_API ImGuiWindow
|
|||||||
short BeginOrderWithinParent; // Begin() order within immediate parent window, if we are a child window. Otherwise 0.
|
short BeginOrderWithinParent; // Begin() order within immediate parent window, if we are a child window. Otherwise 0.
|
||||||
short BeginOrderWithinContext; // Begin() order within entire imgui context. This is mostly used for debugging submission order related issues.
|
short BeginOrderWithinContext; // Begin() order within entire imgui context. This is mostly used for debugging submission order related issues.
|
||||||
short FocusOrder; // Order within WindowsFocusOrder[], altered when windows are focused.
|
short FocusOrder; // Order within WindowsFocusOrder[], altered when windows are focused.
|
||||||
ImGuiID PopupId; // ID in the popup stack when this window is used as a popup/menu (because we use generic Name/ID for recycling)
|
|
||||||
ImS8 AutoFitFramesX, AutoFitFramesY;
|
ImS8 AutoFitFramesX, AutoFitFramesY;
|
||||||
bool AutoFitOnlyGrows;
|
bool AutoFitOnlyGrows;
|
||||||
ImGuiDir AutoPosLastDirection;
|
ImGuiDir AutoPosLastDirection;
|
||||||
@@ -2628,10 +2620,8 @@ public:
|
|||||||
// We don't use g.FontSize because the window may be != g.CurrentWindow.
|
// We don't use g.FontSize because the window may be != g.CurrentWindow.
|
||||||
ImRect Rect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }
|
ImRect Rect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }
|
||||||
float CalcFontSize() const { ImGuiContext& g = *Ctx; float scale = g.FontBaseSize * FontWindowScale; if (ParentWindow) scale *= ParentWindow->FontWindowScale; return scale; }
|
float CalcFontSize() const { ImGuiContext& g = *Ctx; float scale = g.FontBaseSize * FontWindowScale; if (ParentWindow) scale *= ParentWindow->FontWindowScale; return scale; }
|
||||||
float TitleBarHeight() const { ImGuiContext& g = *Ctx; return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0.0f : CalcFontSize() + g.Style.FramePadding.y * 2.0f; }
|
ImRect TitleBarRect() const { return ImRect(Pos, ImVec2(Pos.x + SizeFull.x, Pos.y + TitleBarHeight)); }
|
||||||
ImRect TitleBarRect() const { return ImRect(Pos, ImVec2(Pos.x + SizeFull.x, Pos.y + TitleBarHeight())); }
|
ImRect MenuBarRect() const { float y1 = Pos.y + TitleBarHeight; return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight); }
|
||||||
float MenuBarHeight() const { ImGuiContext& g = *Ctx; return (Flags & ImGuiWindowFlags_MenuBar) ? DC.MenuBarOffset.y + CalcFontSize() + g.Style.FramePadding.y * 2.0f : 0.0f; }
|
|
||||||
ImRect MenuBarRect() const { float y1 = Pos.y + TitleBarHeight(); return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight()); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -2818,8 +2808,7 @@ struct ImGuiTableInstanceData
|
|||||||
ImGuiTableInstanceData() { TableInstanceID = 0; LastOuterHeight = LastTopHeadersRowHeight = LastFrozenHeight = 0.0f; HoveredRowLast = HoveredRowNext = -1; }
|
ImGuiTableInstanceData() { TableInstanceID = 0; LastOuterHeight = LastTopHeadersRowHeight = LastFrozenHeight = 0.0f; HoveredRowLast = HoveredRowNext = -1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME-TABLE: more transient data could be stored in a stacked ImGuiTableTempData: e.g. SortSpecs, incoming RowData
|
// sizeof() ~ 592 bytes + heap allocs described in TableBeginInitMemory()
|
||||||
// sizeof() ~ 580 bytes + heap allocs described in TableBeginInitMemory()
|
|
||||||
struct IMGUI_API ImGuiTable
|
struct IMGUI_API ImGuiTable
|
||||||
{
|
{
|
||||||
ImGuiID ID;
|
ImGuiID ID;
|
||||||
@@ -2942,6 +2931,7 @@ struct IMGUI_API ImGuiTable
|
|||||||
// Transient data that are only needed between BeginTable() and EndTable(), those buffers are shared (1 per level of stacked table).
|
// Transient data that are only needed between BeginTable() and EndTable(), those buffers are shared (1 per level of stacked table).
|
||||||
// - Accessing those requires chasing an extra pointer so for very frequently used data we leave them in the main table structure.
|
// - Accessing those requires chasing an extra pointer so for very frequently used data we leave them in the main table structure.
|
||||||
// - We also leave out of this structure data that tend to be particularly useful for debugging/metrics.
|
// - We also leave out of this structure data that tend to be particularly useful for debugging/metrics.
|
||||||
|
// FIXME-TABLE: more transient data could be stored in a stacked ImGuiTableTempData: e.g. SortSpecs.
|
||||||
// sizeof() ~ 136 bytes.
|
// sizeof() ~ 136 bytes.
|
||||||
struct IMGUI_API ImGuiTableTempData
|
struct IMGUI_API ImGuiTableTempData
|
||||||
{
|
{
|
||||||
@@ -3012,7 +3002,7 @@ namespace ImGui
|
|||||||
{
|
{
|
||||||
// Windows
|
// Windows
|
||||||
// We should always have a CurrentWindow in the stack (there is an implicit "Debug" window)
|
// We should always have a CurrentWindow in the stack (there is an implicit "Debug" window)
|
||||||
// If this ever crash because g.CurrentWindow is NULL it means that either
|
// If this ever crashes because g.CurrentWindow is NULL, it means that either:
|
||||||
// - ImGui::NewFrame() has never been called, which is illegal.
|
// - ImGui::NewFrame() has never been called, which is illegal.
|
||||||
// - You are calling ImGui functions after ImGui::EndFrame()/ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal.
|
// - You are calling ImGui functions after ImGui::EndFrame()/ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal.
|
||||||
inline ImGuiWindow* GetCurrentWindowRead() { ImGuiContext& g = *GImGui; return g.CurrentWindow; }
|
inline ImGuiWindow* GetCurrentWindowRead() { ImGuiContext& g = *GImGui; return g.CurrentWindow; }
|
||||||
@@ -3064,6 +3054,7 @@ namespace ImGui
|
|||||||
// NewFrame
|
// NewFrame
|
||||||
IMGUI_API void UpdateInputEvents(bool trickle_fast_inputs);
|
IMGUI_API void UpdateInputEvents(bool trickle_fast_inputs);
|
||||||
IMGUI_API void UpdateHoveredWindowAndCaptureFlags();
|
IMGUI_API void UpdateHoveredWindowAndCaptureFlags();
|
||||||
|
IMGUI_API void FindHoveredWindowEx(const ImVec2& pos, bool find_first_and_in_any_viewport, ImGuiWindow** out_hovered_window, ImGuiWindow** out_hovered_window_under_moving_window);
|
||||||
IMGUI_API void StartMouseMovingWindow(ImGuiWindow* window);
|
IMGUI_API void StartMouseMovingWindow(ImGuiWindow* window);
|
||||||
IMGUI_API void UpdateMouseMovingWindowNewFrame();
|
IMGUI_API void UpdateMouseMovingWindowNewFrame();
|
||||||
IMGUI_API void UpdateMouseMovingWindowEndFrame();
|
IMGUI_API void UpdateMouseMovingWindowEndFrame();
|
||||||
@@ -3143,6 +3134,8 @@ namespace ImGui
|
|||||||
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled);
|
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled);
|
||||||
IMGUI_API void PopItemFlag();
|
IMGUI_API void PopItemFlag();
|
||||||
IMGUI_API const ImGuiDataVarInfo* GetStyleVarInfo(ImGuiStyleVar idx);
|
IMGUI_API const ImGuiDataVarInfo* GetStyleVarInfo(ImGuiStyleVar idx);
|
||||||
|
IMGUI_API void BeginDisabledOverrideReenable();
|
||||||
|
IMGUI_API void EndDisabledOverrideReenable();
|
||||||
|
|
||||||
// Logging/Capture
|
// Logging/Capture
|
||||||
IMGUI_API void LogBegin(ImGuiLogType type, int auto_open_depth); // -> BeginCapture() when we design v2 api, for now stay under the radar by using the old name.
|
IMGUI_API void LogBegin(ImGuiLogType type, int auto_open_depth); // -> BeginCapture() when we design v2 api, for now stay under the radar by using the old name.
|
||||||
@@ -3204,23 +3197,21 @@ namespace ImGui
|
|||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
// FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions.
|
// FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions.
|
||||||
inline bool IsNamedKey(ImGuiKey key) { return key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END; }
|
inline bool IsNamedKey(ImGuiKey key) { return key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END; }
|
||||||
inline bool IsNamedKeyOrModKey(ImGuiKey key) { return (key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END) || key == ImGuiMod_Ctrl || key == ImGuiMod_Shift || key == ImGuiMod_Alt || key == ImGuiMod_Super || key == ImGuiMod_Shortcut; }
|
inline bool IsNamedKeyOrMod(ImGuiKey key) { return (key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END) || key == ImGuiMod_Ctrl || key == ImGuiMod_Shift || key == ImGuiMod_Alt || key == ImGuiMod_Super; }
|
||||||
inline bool IsLegacyKey(ImGuiKey key) { return key >= ImGuiKey_LegacyNativeKey_BEGIN && key < ImGuiKey_LegacyNativeKey_END; }
|
inline bool IsLegacyKey(ImGuiKey key) { return key >= ImGuiKey_LegacyNativeKey_BEGIN && key < ImGuiKey_LegacyNativeKey_END; }
|
||||||
inline bool IsKeyboardKey(ImGuiKey key) { return key >= ImGuiKey_Keyboard_BEGIN && key < ImGuiKey_Keyboard_END; }
|
inline bool IsKeyboardKey(ImGuiKey key) { return key >= ImGuiKey_Keyboard_BEGIN && key < ImGuiKey_Keyboard_END; }
|
||||||
inline bool IsGamepadKey(ImGuiKey key) { return key >= ImGuiKey_Gamepad_BEGIN && key < ImGuiKey_Gamepad_END; }
|
inline bool IsGamepadKey(ImGuiKey key) { return key >= ImGuiKey_Gamepad_BEGIN && key < ImGuiKey_Gamepad_END; }
|
||||||
inline bool IsMouseKey(ImGuiKey key) { return key >= ImGuiKey_Mouse_BEGIN && key < ImGuiKey_Mouse_END; }
|
inline bool IsMouseKey(ImGuiKey key) { return key >= ImGuiKey_Mouse_BEGIN && key < ImGuiKey_Mouse_END; }
|
||||||
inline bool IsAliasKey(ImGuiKey key) { return key >= ImGuiKey_Aliases_BEGIN && key < ImGuiKey_Aliases_END; }
|
inline bool IsAliasKey(ImGuiKey key) { return key >= ImGuiKey_Aliases_BEGIN && key < ImGuiKey_Aliases_END; }
|
||||||
inline bool IsModKey(ImGuiKey key) { return key >= ImGuiKey_LeftCtrl && key <= ImGuiKey_RightSuper; }
|
inline bool IsModKey(ImGuiKey key) { return key >= ImGuiKey_LeftCtrl && key <= ImGuiKey_RightSuper; }
|
||||||
ImGuiKeyChord FixupKeyChord(ImGuiContext* ctx, ImGuiKeyChord key_chord);
|
ImGuiKeyChord FixupKeyChord(ImGuiKeyChord key_chord);
|
||||||
inline ImGuiKey ConvertSingleModFlagToKey(ImGuiContext* ctx, ImGuiKey key)
|
inline ImGuiKey ConvertSingleModFlagToKey(ImGuiKey key)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *ctx;
|
|
||||||
if (key == ImGuiMod_Ctrl) return ImGuiKey_ReservedForModCtrl;
|
if (key == ImGuiMod_Ctrl) return ImGuiKey_ReservedForModCtrl;
|
||||||
if (key == ImGuiMod_Shift) return ImGuiKey_ReservedForModShift;
|
if (key == ImGuiMod_Shift) return ImGuiKey_ReservedForModShift;
|
||||||
if (key == ImGuiMod_Alt) return ImGuiKey_ReservedForModAlt;
|
if (key == ImGuiMod_Alt) return ImGuiKey_ReservedForModAlt;
|
||||||
if (key == ImGuiMod_Super) return ImGuiKey_ReservedForModSuper;
|
if (key == ImGuiMod_Super) return ImGuiKey_ReservedForModSuper;
|
||||||
if (key == ImGuiMod_Shortcut) return (g.IO.ConfigMacOSXBehaviors ? ImGuiKey_ReservedForModSuper : ImGuiKey_ReservedForModCtrl);
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3240,7 +3231,7 @@ namespace ImGui
|
|||||||
// [EXPERIMENTAL] Low-Level: Key/Input Ownership
|
// [EXPERIMENTAL] Low-Level: Key/Input Ownership
|
||||||
// - The idea is that instead of "eating" a given input, we can link to an owner id.
|
// - The idea is that instead of "eating" a given input, we can link to an owner id.
|
||||||
// - Ownership is most often claimed as a result of reacting to a press/down event (but occasionally may be claimed ahead).
|
// - Ownership is most often claimed as a result of reacting to a press/down event (but occasionally may be claimed ahead).
|
||||||
// - Input queries can then read input by specifying ImGuiKeyOwner_Any (== 0), ImGuiKeyOwner_None (== -1) or a custom ID.
|
// - Input queries can then read input by specifying ImGuiKeyOwner_Any (== 0), ImGuiKeyOwner_NoOwner (== -1) or a custom ID.
|
||||||
// - Legacy input queries (without specifying an owner or _Any or _None) are equivalent to using ImGuiKeyOwner_Any (== 0).
|
// - Legacy input queries (without specifying an owner or _Any or _None) are equivalent to using ImGuiKeyOwner_Any (== 0).
|
||||||
// - Input ownership is automatically released on the frame after a key is released. Therefore:
|
// - Input ownership is automatically released on the frame after a key is released. Therefore:
|
||||||
// - for ownership registration happening as a result of a down/press event, the SetKeyOwner() call may be done once (common case).
|
// - for ownership registration happening as a result of a down/press event, the SetKeyOwner() call may be done once (common case).
|
||||||
@@ -3248,12 +3239,12 @@ namespace ImGui
|
|||||||
// - SetItemKeyOwner() is a shortcut for common simple case. A custom widget will probably want to call SetKeyOwner() multiple times directly based on its interaction state.
|
// - SetItemKeyOwner() is a shortcut for common simple case. A custom widget will probably want to call SetKeyOwner() multiple times directly based on its interaction state.
|
||||||
// - This is marked experimental because not all widgets are fully honoring the Set/Test idioms. We will need to move forward step by step.
|
// - This is marked experimental because not all widgets are fully honoring the Set/Test idioms. We will need to move forward step by step.
|
||||||
// Please open a GitHub Issue to submit your usage scenario or if there's a use case you need solved.
|
// Please open a GitHub Issue to submit your usage scenario or if there's a use case you need solved.
|
||||||
IMGUI_API ImGuiID GetKeyOwner(ImGuiKey key);
|
IMGUI_API ImGuiID GetKeyOwner(ImGuiKey key);
|
||||||
IMGUI_API void SetKeyOwner(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags = 0);
|
IMGUI_API void SetKeyOwner(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags = 0);
|
||||||
IMGUI_API void SetKeyOwnersForKeyChord(ImGuiKeyChord key, ImGuiID owner_id, ImGuiInputFlags flags = 0);
|
IMGUI_API void SetKeyOwnersForKeyChord(ImGuiKeyChord key, ImGuiID owner_id, ImGuiInputFlags flags = 0);
|
||||||
IMGUI_API void SetItemKeyOwner(ImGuiKey key, ImGuiInputFlags flags = 0); // Set key owner to last item if it is hovered or active. Equivalent to 'if (IsItemHovered() || IsItemActive()) { SetKeyOwner(key, GetItemID());'.
|
IMGUI_API void SetItemKeyOwner(ImGuiKey key, ImGuiInputFlags flags = 0); // Set key owner to last item if it is hovered or active. Equivalent to 'if (IsItemHovered() || IsItemActive()) { SetKeyOwner(key, GetItemID());'.
|
||||||
IMGUI_API bool TestKeyOwner(ImGuiKey key, ImGuiID owner_id); // Test that key is either not owned, either owned by 'owner_id'
|
IMGUI_API bool TestKeyOwner(ImGuiKey key, ImGuiID owner_id); // Test that key is either not owned, either owned by 'owner_id'
|
||||||
inline ImGuiKeyOwnerData* GetKeyOwnerData(ImGuiContext* ctx, ImGuiKey key) { if (key & ImGuiMod_Mask_) key = ConvertSingleModFlagToKey(ctx, key); IM_ASSERT(IsNamedKey(key)); return &ctx->KeysOwnerData[key - ImGuiKey_NamedKey_BEGIN]; }
|
inline ImGuiKeyOwnerData* GetKeyOwnerData(ImGuiContext* ctx, ImGuiKey key) { if (key & ImGuiMod_Mask_) key = ConvertSingleModFlagToKey(key); IM_ASSERT(IsNamedKey(key)); return &ctx->KeysOwnerData[key - ImGuiKey_NamedKey_BEGIN]; }
|
||||||
|
|
||||||
// [EXPERIMENTAL] High-Level: Input Access functions w/ support for Key/Input Ownership
|
// [EXPERIMENTAL] High-Level: Input Access functions w/ support for Key/Input Ownership
|
||||||
// - Important: legacy IsKeyPressed(ImGuiKey, bool repeat=true) _DEFAULTS_ to repeat, new IsKeyPressed() requires _EXPLICIT_ ImGuiInputFlags_Repeat flag.
|
// - Important: legacy IsKeyPressed(ImGuiKey, bool repeat=true) _DEFAULTS_ to repeat, new IsKeyPressed() requires _EXPLICIT_ ImGuiInputFlags_Repeat flag.
|
||||||
@@ -3261,32 +3252,32 @@ namespace ImGui
|
|||||||
// - Specifying a value for 'ImGuiID owner' will test that EITHER the key is NOT owned (UNLESS locked), EITHER the key is owned by 'owner'.
|
// - Specifying a value for 'ImGuiID owner' will test that EITHER the key is NOT owned (UNLESS locked), EITHER the key is owned by 'owner'.
|
||||||
// Legacy functions use ImGuiKeyOwner_Any meaning that they typically ignore ownership, unless a call to SetKeyOwner() explicitly used ImGuiInputFlags_LockThisFrame or ImGuiInputFlags_LockUntilRelease.
|
// Legacy functions use ImGuiKeyOwner_Any meaning that they typically ignore ownership, unless a call to SetKeyOwner() explicitly used ImGuiInputFlags_LockThisFrame or ImGuiInputFlags_LockUntilRelease.
|
||||||
// - Binding generators may want to ignore those for now, or suffix them with Ex() until we decide if this gets moved into public API.
|
// - Binding generators may want to ignore those for now, or suffix them with Ex() until we decide if this gets moved into public API.
|
||||||
IMGUI_API bool IsKeyDown(ImGuiKey key, ImGuiID owner_id);
|
IMGUI_API bool IsKeyDown(ImGuiKey key, ImGuiID owner_id);
|
||||||
IMGUI_API bool IsKeyPressed(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags = 0); // Important: when transitioning from old to new IsKeyPressed(): old API has "bool repeat = true", so would default to repeat. New API requiress explicit ImGuiInputFlags_Repeat.
|
IMGUI_API bool IsKeyPressed(ImGuiKey key, ImGuiInputFlags flags, ImGuiID owner_id = 0); // Important: when transitioning from old to new IsKeyPressed(): old API has "bool repeat = true", so would default to repeat. New API requiress explicit ImGuiInputFlags_Repeat.
|
||||||
IMGUI_API bool IsKeyReleased(ImGuiKey key, ImGuiID owner_id);
|
IMGUI_API bool IsKeyReleased(ImGuiKey key, ImGuiID owner_id);
|
||||||
IMGUI_API bool IsMouseDown(ImGuiMouseButton button, ImGuiID owner_id);
|
IMGUI_API bool IsKeyChordPressed(ImGuiKeyChord key_chord, ImGuiInputFlags flags, ImGuiID owner_id = 0);
|
||||||
IMGUI_API bool IsMouseClicked(ImGuiMouseButton button, ImGuiID owner_id, ImGuiInputFlags flags = 0);
|
IMGUI_API bool IsMouseDown(ImGuiMouseButton button, ImGuiID owner_id);
|
||||||
IMGUI_API bool IsMouseReleased(ImGuiMouseButton button, ImGuiID owner_id);
|
IMGUI_API bool IsMouseClicked(ImGuiMouseButton button, ImGuiInputFlags flags, ImGuiID owner_id = 0);
|
||||||
IMGUI_API bool IsMouseDoubleClicked(ImGuiMouseButton button, ImGuiID owner_id);
|
IMGUI_API bool IsMouseReleased(ImGuiMouseButton button, ImGuiID owner_id);
|
||||||
|
IMGUI_API bool IsMouseDoubleClicked(ImGuiMouseButton button, ImGuiID owner_id);
|
||||||
|
|
||||||
// [EXPERIMENTAL] Shortcut Routing
|
// Shortcut Testing & Routing
|
||||||
// - ImGuiKeyChord = a ImGuiKey optionally OR-red with ImGuiMod_Alt/ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Super.
|
// - Set Shortcut() and SetNextItemShortcut() in imgui.h
|
||||||
// ImGuiKey_C (accepted by functions taking ImGuiKey or ImGuiKeyChord)
|
// - When a policy (except for ImGuiInputFlags_RouteAlways *) is set, Shortcut() will register itself with SetShortcutRouting(),
|
||||||
// ImGuiKey_C | ImGuiMod_Ctrl (accepted by functions taking ImGuiKeyChord)
|
// allowing the system to decide where to route the input among other route-aware calls.
|
||||||
// ONLY ImGuiMod_XXX values are legal to 'OR' with an ImGuiKey. You CANNOT 'OR' two ImGuiKey values.
|
// (* using ImGuiInputFlags_RouteAlways is roughly equivalent to calling IsKeyChordPressed(key) and bypassing route registration and check)
|
||||||
// - When using one of the routing flags (e.g. ImGuiInputFlags_RouteFocused): routes requested ahead of time given a chord (key + modifiers) and a routing policy.
|
// - When using one of the routing option:
|
||||||
// - Routes are resolved during NewFrame(): if keyboard modifiers are matching current ones: SetKeyOwner() is called + route is granted for the frame.
|
// - The default route is ImGuiInputFlags_RouteFocused (accept inputs if window is in focus stack. Deep-most focused window takes inputs. ActiveId takes inputs over deep-most focused window.)
|
||||||
// - Route is granted to a single owner. When multiple requests are made we have policies to select the winning route.
|
// - Routes are requested given a chord (key + modifiers) and a routing policy.
|
||||||
// - Multiple read sites may use the same owner id and will all get the granted route.
|
// - Routes are resolved during NewFrame(): if keyboard modifiers are matching current ones: SetKeyOwner() is called + route is granted for the frame.
|
||||||
// - For routing: when owner_id is 0 we use the current Focus Scope ID as a default owner in order to identify our location.
|
// - Each route may be granted to a single owner. When multiple requests are made we have policies to select the winning route (e.g. deep most window).
|
||||||
// - TL;DR;
|
// - Multiple read sites may use the same owner id can all access the granted route.
|
||||||
// - IsKeyChordPressed() compares mods + call IsKeyPressed() -> function has no side-effect.
|
// - When owner_id is 0 we use the current Focus Scope ID as a owner ID in order to identify our location.
|
||||||
// - Shortcut() submits a route then if currently can be routed calls IsKeyChordPressed() -> function has (desirable) side-effects.
|
// - You can chain two unrelated windows in the focus stack using SetWindowParentWindowForFocusRoute()
|
||||||
IMGUI_API bool IsKeyChordPressed(ImGuiKeyChord key_chord, ImGuiID owner_id, ImGuiInputFlags flags = 0);
|
// e.g. if you have a tool window associated to a document, and you want document shortcuts to run when the tool is focused.
|
||||||
IMGUI_API void SetNextItemShortcut(ImGuiKeyChord key_chord);
|
IMGUI_API bool Shortcut(ImGuiKeyChord key_chord, ImGuiInputFlags flags, ImGuiID owner_id);
|
||||||
IMGUI_API bool Shortcut(ImGuiKeyChord key_chord, ImGuiID owner_id = 0, ImGuiInputFlags flags = 0);
|
IMGUI_API bool SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiInputFlags flags, ImGuiID owner_id); // owner_id needs to be explicit and cannot be 0
|
||||||
IMGUI_API bool SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id, ImGuiInputFlags flags = 0); // owner_id needs to be explicit and cannot be 0
|
IMGUI_API bool TestShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id);
|
||||||
IMGUI_API bool TestShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id);
|
|
||||||
IMGUI_API ImGuiKeyRoutingData* GetShortcutRoutingData(ImGuiKeyChord key_chord);
|
IMGUI_API ImGuiKeyRoutingData* GetShortcutRoutingData(ImGuiKeyChord key_chord);
|
||||||
|
|
||||||
// [EXPERIMENTAL] Focus Scope
|
// [EXPERIMENTAL] Focus Scope
|
||||||
@@ -3471,7 +3462,7 @@ namespace ImGui
|
|||||||
IMGUI_API const ImGuiDataTypeInfo* DataTypeGetInfo(ImGuiDataType data_type);
|
IMGUI_API const ImGuiDataTypeInfo* DataTypeGetInfo(ImGuiDataType data_type);
|
||||||
IMGUI_API int DataTypeFormatString(char* buf, int buf_size, ImGuiDataType data_type, const void* p_data, const char* format);
|
IMGUI_API int DataTypeFormatString(char* buf, int buf_size, ImGuiDataType data_type, const void* p_data, const char* format);
|
||||||
IMGUI_API void DataTypeApplyOp(ImGuiDataType data_type, int op, void* output, const void* arg_1, const void* arg_2);
|
IMGUI_API void DataTypeApplyOp(ImGuiDataType data_type, int op, void* output, const void* arg_1, const void* arg_2);
|
||||||
IMGUI_API bool DataTypeApplyFromText(const char* buf, ImGuiDataType data_type, void* p_data, const char* format);
|
IMGUI_API bool DataTypeApplyFromText(const char* buf, ImGuiDataType data_type, void* p_data, const char* format, void* p_data_when_empty = NULL);
|
||||||
IMGUI_API int DataTypeCompare(ImGuiDataType data_type, const void* arg_1, const void* arg_2);
|
IMGUI_API int DataTypeCompare(ImGuiDataType data_type, const void* arg_1, const void* arg_2);
|
||||||
IMGUI_API bool DataTypeClamp(ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max);
|
IMGUI_API bool DataTypeClamp(ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max);
|
||||||
|
|
||||||
@@ -3482,6 +3473,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const void* p_clamp_min = NULL, const void* p_clamp_max = NULL);
|
IMGUI_API bool TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const void* p_clamp_min = NULL, const void* p_clamp_max = NULL);
|
||||||
inline bool TempInputIsActive(ImGuiID id) { ImGuiContext& g = *GImGui; return (g.ActiveId == id && g.TempInputId == id); }
|
inline bool TempInputIsActive(ImGuiID id) { ImGuiContext& g = *GImGui; return (g.ActiveId == id && g.TempInputId == id); }
|
||||||
inline ImGuiInputTextState* GetInputTextState(ImGuiID id) { ImGuiContext& g = *GImGui; return (id != 0 && g.InputTextState.ID == id) ? &g.InputTextState : NULL; } // Get input text state if active
|
inline ImGuiInputTextState* GetInputTextState(ImGuiID id) { ImGuiContext& g = *GImGui; return (id != 0 && g.InputTextState.ID == id) ? &g.InputTextState : NULL; } // Get input text state if active
|
||||||
|
IMGUI_API void SetNextItemRefVal(ImGuiDataType data_type, void* p_data);
|
||||||
|
|
||||||
// Color
|
// Color
|
||||||
IMGUI_API void ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags);
|
IMGUI_API void ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags);
|
||||||
@@ -3513,6 +3505,7 @@ namespace ImGui
|
|||||||
IMGUI_API void DebugDrawCursorPos(ImU32 col = IM_COL32(255, 0, 0, 255));
|
IMGUI_API void DebugDrawCursorPos(ImU32 col = IM_COL32(255, 0, 0, 255));
|
||||||
IMGUI_API void DebugDrawLineExtents(ImU32 col = IM_COL32(255, 0, 0, 255));
|
IMGUI_API void DebugDrawLineExtents(ImU32 col = IM_COL32(255, 0, 0, 255));
|
||||||
IMGUI_API void DebugDrawItemRect(ImU32 col = IM_COL32(255, 0, 0, 255));
|
IMGUI_API void DebugDrawItemRect(ImU32 col = IM_COL32(255, 0, 0, 255));
|
||||||
|
IMGUI_API void DebugTextUnformattedWithLocateItem(const char* line_begin, const char* line_end);
|
||||||
IMGUI_API void DebugLocateItem(ImGuiID target_id); // Call sparingly: only 1 at the same time!
|
IMGUI_API void DebugLocateItem(ImGuiID target_id); // Call sparingly: only 1 at the same time!
|
||||||
IMGUI_API void DebugLocateItemOnHover(ImGuiID target_id); // Only call on reaction to a mouse Hover: because only 1 at the same time!
|
IMGUI_API void DebugLocateItemOnHover(ImGuiID target_id); // Only call on reaction to a mouse Hover: because only 1 at the same time!
|
||||||
IMGUI_API void DebugLocateItemResolveWithLastItem();
|
IMGUI_API void DebugLocateItemResolveWithLastItem();
|
||||||
@@ -3545,6 +3538,8 @@ namespace ImGui
|
|||||||
inline void SetItemUsingMouseWheel() { SetItemKeyOwner(ImGuiKey_MouseWheelY); } // Changed in 1.89
|
inline void SetItemUsingMouseWheel() { SetItemKeyOwner(ImGuiKey_MouseWheelY); } // Changed in 1.89
|
||||||
inline bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0) { return TreeNodeUpdateNextOpen(id, flags); } // Renamed in 1.89
|
inline bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0) { return TreeNodeUpdateNextOpen(id, flags); } // Renamed in 1.89
|
||||||
|
|
||||||
|
//inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { IM_ASSERT(IsNamedKey(key)); return IsKeyPressed(key, repeat); } // Removed in 1.87: Mapping from named key is always identity!
|
||||||
|
|
||||||
// Refactored focus/nav/tabbing system in 1.82 and 1.84. If you have old/custom copy-and-pasted widgets which used FocusableItemRegister():
|
// Refactored focus/nav/tabbing system in 1.82 and 1.84. If you have old/custom copy-and-pasted widgets which used FocusableItemRegister():
|
||||||
// (Old) IMGUI_VERSION_NUM < 18209: using 'ItemAdd(....)' and 'bool tab_focused = FocusableItemRegister(...)'
|
// (Old) IMGUI_VERSION_NUM < 18209: using 'ItemAdd(....)' and 'bool tab_focused = FocusableItemRegister(...)'
|
||||||
// (Old) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)' and 'bool tab_focused = (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Focused) != 0'
|
// (Old) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)' and 'bool tab_focused = (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Focused) != 0'
|
||||||
@@ -3552,9 +3547,6 @@ namespace ImGui
|
|||||||
//inline bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id) // -> pass ImGuiItemAddFlags_Inputable flag to ItemAdd()
|
//inline bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id) // -> pass ImGuiItemAddFlags_Inputable flag to ItemAdd()
|
||||||
//inline void FocusableItemUnregister(ImGuiWindow* window) // -> unnecessary: TempInputText() uses ImGuiInputTextFlags_MergedItem
|
//inline void FocusableItemUnregister(ImGuiWindow* window) // -> unnecessary: TempInputText() uses ImGuiInputTextFlags_MergedItem
|
||||||
#endif
|
#endif
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
|
||||||
inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { IM_ASSERT(IsNamedKey(key)); return IsKeyPressed(key, repeat); } // Removed in 1.87: Mapping from named key is always identity!
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace ImGui
|
} // namespace ImGui
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.90.6
|
// dear imgui, v1.90.9 WIP
|
||||||
// (tables and columns code)
|
// (tables and columns code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -320,6 +320,12 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
IM_ASSERT(inner_width >= 0.0f);
|
IM_ASSERT(inner_width >= 0.0f);
|
||||||
|
|
||||||
// If an outer size is specified ahead we will be able to early out when not visible. Exact clipping criteria may evolve.
|
// If an outer size is specified ahead we will be able to early out when not visible. Exact clipping criteria may evolve.
|
||||||
|
// FIXME: coarse clipping because access to table data causes two issues:
|
||||||
|
// - instance numbers varying/unstable. may not be a direct problem for users, but could make outside access broken or confusing, e.g. TestEngine.
|
||||||
|
// - can't implement support for ImGuiChildFlags_ResizeY as we need to somehow pull the height data from somewhere. this also needs stable instance numbers.
|
||||||
|
// The side-effects of accessing table data on coarse clip would be:
|
||||||
|
// - always reserving the pooled ImGuiTable data ahead for a fully clipped table (minor IMHO). Also the 'outer_window_is_measuring_size' criteria may already be defeating this in some situations.
|
||||||
|
// - always performing the GetOrAddByKey() O(log N) query in g.Tables.Map[].
|
||||||
const bool use_child_window = (flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) != 0;
|
const bool use_child_window = (flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) != 0;
|
||||||
const ImVec2 avail_size = GetContentRegionAvail();
|
const ImVec2 avail_size = GetContentRegionAvail();
|
||||||
const ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f);
|
const ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f);
|
||||||
@@ -328,6 +334,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
if (use_child_window && IsClippedEx(outer_rect, 0) && !outer_window_is_measuring_size)
|
if (use_child_window && IsClippedEx(outer_rect, 0) && !outer_window_is_measuring_size)
|
||||||
{
|
{
|
||||||
ItemSize(outer_rect);
|
ItemSize(outer_rect);
|
||||||
|
ItemAdd(outer_rect, id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,7 +344,6 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
|
|
||||||
// Acquire storage for the table
|
// Acquire storage for the table
|
||||||
ImGuiTable* table = g.Tables.GetOrAddByKey(id);
|
ImGuiTable* table = g.Tables.GetOrAddByKey(id);
|
||||||
const ImGuiTableFlags table_last_flags = table->Flags;
|
|
||||||
|
|
||||||
// Acquire temporary buffers
|
// Acquire temporary buffers
|
||||||
const int table_idx = g.Tables.GetIndex(table);
|
const int table_idx = g.Tables.GetIndex(table);
|
||||||
@@ -355,6 +361,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
// Initialize
|
// Initialize
|
||||||
const int previous_frame_active = table->LastFrameActive;
|
const int previous_frame_active = table->LastFrameActive;
|
||||||
const int instance_no = (previous_frame_active != g.FrameCount) ? 0 : table->InstanceCurrent + 1;
|
const int instance_no = (previous_frame_active != g.FrameCount) ? 0 : table->InstanceCurrent + 1;
|
||||||
|
const ImGuiTableFlags previous_flags = table->Flags;
|
||||||
table->ID = id;
|
table->ID = id;
|
||||||
table->Flags = flags;
|
table->Flags = flags;
|
||||||
table->LastFrameActive = g.FrameCount;
|
table->LastFrameActive = g.FrameCount;
|
||||||
@@ -401,7 +408,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
SetNextWindowContentSize(ImVec2(override_content_size.x != FLT_MAX ? override_content_size.x : 0.0f, override_content_size.y != FLT_MAX ? override_content_size.y : 0.0f));
|
SetNextWindowContentSize(ImVec2(override_content_size.x != FLT_MAX ? override_content_size.x : 0.0f, override_content_size.y != FLT_MAX ? override_content_size.y : 0.0f));
|
||||||
|
|
||||||
// Reset scroll if we are reactivating it
|
// Reset scroll if we are reactivating it
|
||||||
if ((table_last_flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) == 0)
|
if ((previous_flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) == 0)
|
||||||
SetNextWindowScroll(ImVec2(0.0f, 0.0f));
|
SetNextWindowScroll(ImVec2(0.0f, 0.0f));
|
||||||
|
|
||||||
// Create scrolling region (without border and zero window padding)
|
// Create scrolling region (without border and zero window padding)
|
||||||
@@ -430,6 +437,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
// For non-scrolling tables, WorkRect == OuterRect == InnerRect.
|
// For non-scrolling tables, WorkRect == OuterRect == InnerRect.
|
||||||
// But at this point we do NOT have a correct value for .Max.y (unless a height has been explicitly passed in). It will only be updated in EndTable().
|
// But at this point we do NOT have a correct value for .Max.y (unless a height has been explicitly passed in). It will only be updated in EndTable().
|
||||||
table->WorkRect = table->OuterRect = table->InnerRect = outer_rect;
|
table->WorkRect = table->OuterRect = table->InnerRect = outer_rect;
|
||||||
|
table->HasScrollbarYPrev = table->HasScrollbarYCurr = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push a standardized ID for both child-using and not-child-using tables
|
// Push a standardized ID for both child-using and not-child-using tables
|
||||||
@@ -514,7 +522,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
if (inner_window != outer_window) // So EndChild() within the inner window can restore the table properly.
|
if (inner_window != outer_window) // So EndChild() within the inner window can restore the table properly.
|
||||||
inner_window->DC.CurrentTableIdx = table_idx;
|
inner_window->DC.CurrentTableIdx = table_idx;
|
||||||
|
|
||||||
if ((table_last_flags & ImGuiTableFlags_Reorderable) && (flags & ImGuiTableFlags_Reorderable) == 0)
|
if ((previous_flags & ImGuiTableFlags_Reorderable) && (flags & ImGuiTableFlags_Reorderable) == 0)
|
||||||
table->IsResetDisplayOrderRequest = true;
|
table->IsResetDisplayOrderRequest = true;
|
||||||
|
|
||||||
// Mark as used to avoid GC
|
// Mark as used to avoid GC
|
||||||
@@ -1256,7 +1264,7 @@ void ImGui::TableUpdateBorders(ImGuiTable* table)
|
|||||||
// really problematic (whereas the actual visual will be displayed in EndTable() and using the current frame height).
|
// really problematic (whereas the actual visual will be displayed in EndTable() and using the current frame height).
|
||||||
// Actual columns highlight/render will be performed in EndTable() and not be affected.
|
// Actual columns highlight/render will be performed in EndTable() and not be affected.
|
||||||
ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent);
|
ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent);
|
||||||
const float hit_half_width = TABLE_RESIZE_SEPARATOR_HALF_THICKNESS;
|
const float hit_half_width = ImTrunc(TABLE_RESIZE_SEPARATOR_HALF_THICKNESS * g.CurrentDpiScale);
|
||||||
const float hit_y1 = (table->FreezeRowsCount >= 1 ? table->OuterRect.Min.y : table->WorkRect.Min.y) + table->AngledHeadersHeight;
|
const float hit_y1 = (table->FreezeRowsCount >= 1 ? table->OuterRect.Min.y : table->WorkRect.Min.y) + table->AngledHeadersHeight;
|
||||||
const float hit_y2_body = ImMax(table->OuterRect.Max.y, hit_y1 + table_instance->LastOuterHeight - table->AngledHeadersHeight);
|
const float hit_y2_body = ImMax(table->OuterRect.Max.y, hit_y1 + table_instance->LastOuterHeight - table->AngledHeadersHeight);
|
||||||
const float hit_y2_head = hit_y1 + table_instance->LastTopHeadersRowHeight;
|
const float hit_y2_head = hit_y1 + table_instance->LastTopHeadersRowHeight;
|
||||||
@@ -1433,7 +1441,7 @@ void ImGui::EndTable()
|
|||||||
if (table->ResizedColumn != -1 && table->InstanceCurrent == table->InstanceInteracted)
|
if (table->ResizedColumn != -1 && table->InstanceCurrent == table->InstanceInteracted)
|
||||||
{
|
{
|
||||||
ImGuiTableColumn* column = &table->Columns[table->ResizedColumn];
|
ImGuiTableColumn* column = &table->Columns[table->ResizedColumn];
|
||||||
const float new_x2 = (g.IO.MousePos.x - g.ActiveIdClickOffset.x + TABLE_RESIZE_SEPARATOR_HALF_THICKNESS);
|
const float new_x2 = (g.IO.MousePos.x - g.ActiveIdClickOffset.x + ImTrunc(TABLE_RESIZE_SEPARATOR_HALF_THICKNESS * g.CurrentDpiScale));
|
||||||
const float new_width = ImTrunc(new_x2 - column->MinX - table->CellSpacingX1 - table->CellPaddingX * 2.0f);
|
const float new_width = ImTrunc(new_x2 - column->MinX - table->CellSpacingX1 - table->CellPaddingX * 2.0f);
|
||||||
table->ResizedColumnNextWidth = new_width;
|
table->ResizedColumnNextWidth = new_width;
|
||||||
}
|
}
|
||||||
@@ -1462,7 +1470,10 @@ void ImGui::EndTable()
|
|||||||
// CursorPosPrevLine and CursorMaxPos manually. That should be a more general layout feature, see same problem e.g. #3414)
|
// CursorPosPrevLine and CursorMaxPos manually. That should be a more general layout feature, see same problem e.g. #3414)
|
||||||
if (inner_window != outer_window)
|
if (inner_window != outer_window)
|
||||||
{
|
{
|
||||||
|
short backup_nav_layers_active_mask = inner_window->DC.NavLayersActiveMask;
|
||||||
|
inner_window->DC.NavLayersActiveMask |= 1 << ImGuiNavLayer_Main; // So empty table don't appear to navigate differently.
|
||||||
EndChild();
|
EndChild();
|
||||||
|
inner_window->DC.NavLayersActiveMask = backup_nav_layers_active_mask;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1480,9 +1491,13 @@ void ImGui::EndTable()
|
|||||||
}
|
}
|
||||||
else if (temp_data->UserOuterSize.x <= 0.0f)
|
else if (temp_data->UserOuterSize.x <= 0.0f)
|
||||||
{
|
{
|
||||||
const float decoration_size = table->TempData->AngledHeadersExtraWidth + ((table->Flags & ImGuiTableFlags_ScrollX) ? inner_window->ScrollbarSizes.x : 0.0f);
|
// Some references for this: #7651 + tests "table_reported_size", "table_reported_size_outer" equivalent Y block
|
||||||
outer_window->DC.IdealMaxPos.x = ImMax(outer_window->DC.IdealMaxPos.x, table->OuterRect.Min.x + table->ColumnsAutoFitWidth + decoration_size - temp_data->UserOuterSize.x);
|
// - Checking for ImGuiTableFlags_ScrollX/ScrollY flag makes us a frame ahead when disabling those flags.
|
||||||
outer_window->DC.CursorMaxPos.x = ImMax(backup_outer_max_pos.x, ImMin(table->OuterRect.Max.x, table->OuterRect.Min.x + table->ColumnsAutoFitWidth));
|
// - FIXME-TABLE: Would make sense to pre-compute expected scrollbar visibility/sizes to generally save a frame of feedback.
|
||||||
|
const float inner_content_max_x = table->OuterRect.Min.x + table->ColumnsAutoFitWidth; // Slightly misleading name but used for code symmetry with inner_content_max_y
|
||||||
|
const float decoration_size = table->TempData->AngledHeadersExtraWidth + ((table->Flags & ImGuiTableFlags_ScrollY) ? inner_window->ScrollbarSizes.x : 0.0f);
|
||||||
|
outer_window->DC.IdealMaxPos.x = ImMax(outer_window->DC.IdealMaxPos.x, inner_content_max_x + decoration_size - temp_data->UserOuterSize.x);
|
||||||
|
outer_window->DC.CursorMaxPos.x = ImMax(backup_outer_max_pos.x, ImMin(table->OuterRect.Max.x, inner_content_max_x + decoration_size));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1490,9 +1505,9 @@ void ImGui::EndTable()
|
|||||||
}
|
}
|
||||||
if (temp_data->UserOuterSize.y <= 0.0f)
|
if (temp_data->UserOuterSize.y <= 0.0f)
|
||||||
{
|
{
|
||||||
const float decoration_size = (table->Flags & ImGuiTableFlags_ScrollY) ? inner_window->ScrollbarSizes.y : 0.0f;
|
const float decoration_size = (table->Flags & ImGuiTableFlags_ScrollX) ? inner_window->ScrollbarSizes.y : 0.0f;
|
||||||
outer_window->DC.IdealMaxPos.y = ImMax(outer_window->DC.IdealMaxPos.y, inner_content_max_y + decoration_size - temp_data->UserOuterSize.y);
|
outer_window->DC.IdealMaxPos.y = ImMax(outer_window->DC.IdealMaxPos.y, inner_content_max_y + decoration_size - temp_data->UserOuterSize.y);
|
||||||
outer_window->DC.CursorMaxPos.y = ImMax(backup_outer_max_pos.y, ImMin(table->OuterRect.Max.y, inner_content_max_y));
|
outer_window->DC.CursorMaxPos.y = ImMax(backup_outer_max_pos.y, ImMin(table->OuterRect.Max.y, inner_content_max_y + decoration_size));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1963,7 +1978,8 @@ void ImGui::TableEndRow(ImGuiTable* table)
|
|||||||
cell_bg_rect.ClipWith(table->BgClipRect);
|
cell_bg_rect.ClipWith(table->BgClipRect);
|
||||||
cell_bg_rect.Min.x = ImMax(cell_bg_rect.Min.x, column->ClipRect.Min.x); // So that first column after frozen one gets clipped when scrolling
|
cell_bg_rect.Min.x = ImMax(cell_bg_rect.Min.x, column->ClipRect.Min.x); // So that first column after frozen one gets clipped when scrolling
|
||||||
cell_bg_rect.Max.x = ImMin(cell_bg_rect.Max.x, column->MaxX);
|
cell_bg_rect.Max.x = ImMin(cell_bg_rect.Max.x, column->MaxX);
|
||||||
window->DrawList->AddRectFilled(cell_bg_rect.Min, cell_bg_rect.Max, cell_data->BgColor);
|
if (cell_bg_rect.Min.y < cell_bg_rect.Max.y)
|
||||||
|
window->DrawList->AddRectFilled(cell_bg_rect.Min, cell_bg_rect.Max, cell_data->BgColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2784,7 +2800,7 @@ ImGuiTableSortSpecs* ImGui::TableGetSortSpecs()
|
|||||||
static inline ImGuiSortDirection TableGetColumnAvailSortDirection(ImGuiTableColumn* column, int n)
|
static inline ImGuiSortDirection TableGetColumnAvailSortDirection(ImGuiTableColumn* column, int n)
|
||||||
{
|
{
|
||||||
IM_ASSERT(n < column->SortDirectionsAvailCount);
|
IM_ASSERT(n < column->SortDirectionsAvailCount);
|
||||||
return (column->SortDirectionsAvailList >> (n << 1)) & 0x03;
|
return (ImGuiSortDirection)((column->SortDirectionsAvailList >> (n << 1)) & 0x03);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix sort direction if currently set on a value which is unavailable (e.g. activating NoSortAscending/NoSortDescending)
|
// Fix sort direction if currently set on a value which is unavailable (e.g. activating NoSortAscending/NoSortDescending)
|
||||||
@@ -2925,6 +2941,7 @@ void ImGui::TableSortSpecsBuild(ImGuiTable* table)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write output
|
// Write output
|
||||||
|
// May be able to move all SortSpecs data from table (48 bytes) to ImGuiTableTempData if we decide to write it back on every BeginTable()
|
||||||
ImGuiTableColumnSortSpecs* sort_specs = (table->SortSpecsCount == 0) ? NULL : (table->SortSpecsCount == 1) ? &table->SortSpecsSingle : table->SortSpecsMulti.Data;
|
ImGuiTableColumnSortSpecs* sort_specs = (table->SortSpecsCount == 0) ? NULL : (table->SortSpecsCount == 1) ? &table->SortSpecsSingle : table->SortSpecsMulti.Data;
|
||||||
if (dirty && sort_specs != NULL)
|
if (dirty && sort_specs != NULL)
|
||||||
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
||||||
@@ -2937,7 +2954,7 @@ void ImGui::TableSortSpecsBuild(ImGuiTable* table)
|
|||||||
sort_spec->ColumnUserID = column->UserID;
|
sort_spec->ColumnUserID = column->UserID;
|
||||||
sort_spec->ColumnIndex = (ImGuiTableColumnIdx)column_n;
|
sort_spec->ColumnIndex = (ImGuiTableColumnIdx)column_n;
|
||||||
sort_spec->SortOrder = (ImGuiTableColumnIdx)column->SortOrder;
|
sort_spec->SortOrder = (ImGuiTableColumnIdx)column->SortOrder;
|
||||||
sort_spec->SortDirection = column->SortDirection;
|
sort_spec->SortDirection = (ImGuiSortDirection)column->SortDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
table->SortSpecs.Specs = sort_specs;
|
table->SortSpecs.Specs = sort_specs;
|
||||||
@@ -2985,7 +3002,7 @@ float ImGui::TableGetHeaderAngledMaxLabelWidth()
|
|||||||
|
|
||||||
// [Public] This is a helper to output TableHeader() calls based on the column names declared in TableSetupColumn().
|
// [Public] This is a helper to output TableHeader() calls based on the column names declared in TableSetupColumn().
|
||||||
// The intent is that advanced users willing to create customized headers would not need to use this helper
|
// The intent is that advanced users willing to create customized headers would not need to use this helper
|
||||||
// and can create their own! For example: TableHeader() may be preceeded by Checkbox() or other custom widgets.
|
// and can create their own! For example: TableHeader() may be preceded by Checkbox() or other custom widgets.
|
||||||
// See 'Demo->Tables->Custom headers' for a demonstration of implementing a custom version of this.
|
// See 'Demo->Tables->Custom headers' for a demonstration of implementing a custom version of this.
|
||||||
// This code is constructed to not make much use of internal functions, as it is intended to be a template to copy.
|
// This code is constructed to not make much use of internal functions, as it is intended to be a template to copy.
|
||||||
// FIXME-TABLE: TableOpenContextMenu() and TableGetHeaderRowHeight() are not public.
|
// FIXME-TABLE: TableOpenContextMenu() and TableGetHeaderRowHeight() are not public.
|
||||||
@@ -3302,7 +3319,7 @@ void ImGui::TableAngledHeadersRowEx(ImGuiID row_id, float angle, float max_label
|
|||||||
|
|
||||||
// FIXME: Individual line clipping for right-most column is broken for negative angles.
|
// FIXME: Individual line clipping for right-most column is broken for negative angles.
|
||||||
ImVec2 label_size = CalcTextSize(label_name, label_name_eol);
|
ImVec2 label_size = CalcTextSize(label_name, label_name_eol);
|
||||||
float clip_width = max_label_width - padding.y; // Using padding.y*2.0f would be symetrical but hide more text.
|
float clip_width = max_label_width - padding.y; // Using padding.y*2.0f would be symmetrical but hide more text.
|
||||||
float clip_height = ImMin(label_size.y, column->ClipRect.Max.x - column->WorkMinX - line_off_curr_x);
|
float clip_height = ImMin(label_size.y, column->ClipRect.Max.x - column->WorkMinX - line_off_curr_x);
|
||||||
ImRect clip_r(window->ClipRect.Min, window->ClipRect.Min + ImVec2(clip_width, clip_height));
|
ImRect clip_r(window->ClipRect.Min, window->ClipRect.Min + ImVec2(clip_width, clip_height));
|
||||||
int vtx_idx_begin = draw_list->_VtxCurrentIdx;
|
int vtx_idx_begin = draw_list->_VtxCurrentIdx;
|
||||||
@@ -4040,7 +4057,7 @@ float ImGui::GetColumnNormFromOffset(const ImGuiOldColumns* columns, float offse
|
|||||||
return offset / (columns->OffMaxX - columns->OffMinX);
|
return offset / (columns->OffMaxX - columns->OffMinX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const float COLUMNS_HIT_RECT_HALF_WIDTH = 4.0f;
|
static const float COLUMNS_HIT_RECT_HALF_THICKNESS = 4.0f;
|
||||||
|
|
||||||
static float GetDraggedColumnOffset(ImGuiOldColumns* columns, int column_index)
|
static float GetDraggedColumnOffset(ImGuiOldColumns* columns, int column_index)
|
||||||
{
|
{
|
||||||
@@ -4051,7 +4068,7 @@ static float GetDraggedColumnOffset(ImGuiOldColumns* columns, int column_index)
|
|||||||
IM_ASSERT(column_index > 0); // We are not supposed to drag column 0.
|
IM_ASSERT(column_index > 0); // We are not supposed to drag column 0.
|
||||||
IM_ASSERT(g.ActiveId == columns->ID + ImGuiID(column_index));
|
IM_ASSERT(g.ActiveId == columns->ID + ImGuiID(column_index));
|
||||||
|
|
||||||
float x = g.IO.MousePos.x - g.ActiveIdClickOffset.x + COLUMNS_HIT_RECT_HALF_WIDTH - window->Pos.x;
|
float x = g.IO.MousePos.x - g.ActiveIdClickOffset.x + ImTrunc(COLUMNS_HIT_RECT_HALF_THICKNESS * g.CurrentDpiScale) - window->Pos.x;
|
||||||
x = ImMax(x, ImGui::GetColumnOffset(column_index - 1) + g.Style.ColumnsMinSpacing);
|
x = ImMax(x, ImGui::GetColumnOffset(column_index - 1) + g.Style.ColumnsMinSpacing);
|
||||||
if ((columns->Flags & ImGuiOldColumnFlags_NoPreserveWidths))
|
if ((columns->Flags & ImGuiOldColumnFlags_NoPreserveWidths))
|
||||||
x = ImMin(x, ImGui::GetColumnOffset(column_index + 1) - g.Style.ColumnsMinSpacing);
|
x = ImMin(x, ImGui::GetColumnOffset(column_index + 1) - g.Style.ColumnsMinSpacing);
|
||||||
@@ -4366,7 +4383,7 @@ void ImGui::EndColumns()
|
|||||||
ImGuiOldColumnData* column = &columns->Columns[n];
|
ImGuiOldColumnData* column = &columns->Columns[n];
|
||||||
float x = window->Pos.x + GetColumnOffset(n);
|
float x = window->Pos.x + GetColumnOffset(n);
|
||||||
const ImGuiID column_id = columns->ID + ImGuiID(n);
|
const ImGuiID column_id = columns->ID + ImGuiID(n);
|
||||||
const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH;
|
const float column_hit_hw = ImTrunc(COLUMNS_HIT_RECT_HALF_THICKNESS * g.CurrentDpiScale);
|
||||||
const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));
|
const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));
|
||||||
if (!ItemAdd(column_hit_rect, column_id, NULL, ImGuiItemFlags_NoNav))
|
if (!ItemAdd(column_hit_rect, column_id, NULL, ImGuiItemFlags_NoNav))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.90.6
|
// dear imgui, v1.90.9 WIP
|
||||||
// (widgets code)
|
// (widgets code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -488,7 +488,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
|
|
||||||
// Default only reacts to left mouse button
|
// Default only reacts to left mouse button
|
||||||
if ((flags & ImGuiButtonFlags_MouseButtonMask_) == 0)
|
if ((flags & ImGuiButtonFlags_MouseButtonMask_) == 0)
|
||||||
flags |= ImGuiButtonFlags_MouseButtonDefault_;
|
flags |= ImGuiButtonFlags_MouseButtonLeft;
|
||||||
|
|
||||||
// Default behavior requires click + release inside bounding box
|
// Default behavior requires click + release inside bounding box
|
||||||
if ((flags & ImGuiButtonFlags_PressedOnMask_) == 0)
|
if ((flags & ImGuiButtonFlags_PressedOnMask_) == 0)
|
||||||
@@ -547,7 +547,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
for (int button = 0; button < 3; button++)
|
for (int button = 0; button < 3; button++)
|
||||||
if (flags & (ImGuiButtonFlags_MouseButtonLeft << button)) // Handle ImGuiButtonFlags_MouseButtonRight and ImGuiButtonFlags_MouseButtonMiddle here.
|
if (flags & (ImGuiButtonFlags_MouseButtonLeft << button)) // Handle ImGuiButtonFlags_MouseButtonRight and ImGuiButtonFlags_MouseButtonMiddle here.
|
||||||
{
|
{
|
||||||
if (IsMouseClicked(button, test_owner_id) && mouse_button_clicked == -1) { mouse_button_clicked = button; }
|
if (IsMouseClicked(button, ImGuiInputFlags_None, test_owner_id) && mouse_button_clicked == -1) { mouse_button_clicked = button; }
|
||||||
if (IsMouseReleased(button, test_owner_id) && mouse_button_released == -1) { mouse_button_released = button; }
|
if (IsMouseReleased(button, test_owner_id) && mouse_button_released == -1) { mouse_button_released = button; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,7 +595,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
// 'Repeat' mode acts when held regardless of _PressedOn flags (see table above).
|
// 'Repeat' mode acts when held regardless of _PressedOn flags (see table above).
|
||||||
// Relies on repeat logic of IsMouseClicked() but we may as well do it ourselves if we end up exposing finer RepeatDelay/RepeatRate settings.
|
// Relies on repeat logic of IsMouseClicked() but we may as well do it ourselves if we end up exposing finer RepeatDelay/RepeatRate settings.
|
||||||
if (g.ActiveId == id && (item_flags & ImGuiItemFlags_ButtonRepeat))
|
if (g.ActiveId == id && (item_flags & ImGuiItemFlags_ButtonRepeat))
|
||||||
if (g.IO.MouseDownDuration[g.ActiveIdMouseButton] > 0.0f && IsMouseClicked(g.ActiveIdMouseButton, test_owner_id, ImGuiInputFlags_Repeat))
|
if (g.IO.MouseDownDuration[g.ActiveIdMouseButton] > 0.0f && IsMouseClicked(g.ActiveIdMouseButton, ImGuiInputFlags_Repeat, test_owner_id))
|
||||||
pressed = true;
|
pressed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -719,12 +719,22 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags
|
|||||||
|
|
||||||
// Render
|
// Render
|
||||||
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
||||||
|
#ifdef WIN98
|
||||||
|
const ImU32 fill_col = GetColorU32(ImGuiCol_WindowBg);
|
||||||
|
window->DrawList->AddRectFilled(bb.Min, bb.Max, fill_col, 0.0f);
|
||||||
|
|
||||||
|
WinAddRect(bb.Min, bb.Max, (held && hovered));
|
||||||
|
PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||||
|
RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb);
|
||||||
|
PopStyleColor();
|
||||||
|
#else
|
||||||
RenderNavHighlight(bb, id);
|
RenderNavHighlight(bb, id);
|
||||||
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
||||||
|
|
||||||
if (g.LogEnabled)
|
if (g.LogEnabled)
|
||||||
LogSetNextTextDecoration("[", "]");
|
LogSetNextTextDecoration("[", "]");
|
||||||
RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb);
|
RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Automatically close popups
|
// Automatically close popups
|
||||||
//if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup))
|
//if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup))
|
||||||
@@ -818,7 +828,11 @@ bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos)
|
|||||||
|
|
||||||
// Tweak 1: Shrink hit-testing area if button covers an abnormally large proportion of the visible region. That's in order to facilitate moving the window away. (#3825)
|
// Tweak 1: Shrink hit-testing area if button covers an abnormally large proportion of the visible region. That's in order to facilitate moving the window away. (#3825)
|
||||||
// This may better be applied as a general hit-rect reduction mechanism for all widgets to ensure the area to move window is always accessible?
|
// This may better be applied as a general hit-rect reduction mechanism for all widgets to ensure the area to move window is always accessible?
|
||||||
|
#ifdef WIN98 // close button size
|
||||||
|
const ImRect bb(pos, pos + ImVec2(16.0f, 14.0f));
|
||||||
|
#else
|
||||||
const ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize));
|
const ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize));
|
||||||
|
#endif
|
||||||
ImRect bb_interact = bb;
|
ImRect bb_interact = bb;
|
||||||
const float area_to_visible_ratio = window->OuterRectClipped.GetArea() / bb.GetArea();
|
const float area_to_visible_ratio = window->OuterRectClipped.GetArea() / bb.GetArea();
|
||||||
if (area_to_visible_ratio < 1.5f)
|
if (area_to_visible_ratio < 1.5f)
|
||||||
@@ -837,14 +851,28 @@ bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos)
|
|||||||
// FIXME: Clarify this mess
|
// FIXME: Clarify this mess
|
||||||
ImU32 col = GetColorU32(held ? ImGuiCol_ButtonActive : ImGuiCol_ButtonHovered);
|
ImU32 col = GetColorU32(held ? ImGuiCol_ButtonActive : ImGuiCol_ButtonHovered);
|
||||||
ImVec2 center = bb.GetCenter();
|
ImVec2 center = bb.GetCenter();
|
||||||
|
|
||||||
|
#ifdef WIN98 // close button
|
||||||
|
IM_UNUSED(col);
|
||||||
|
const ImU32 fill_col = GetColorU32(ImGuiCol_WindowBg);
|
||||||
|
window->DrawList->AddRectFilled(bb.Min, bb.Max, fill_col, 0.0f);
|
||||||
|
WinAddRect(bb.Min, bb.Max, hovered && held);
|
||||||
|
#else
|
||||||
if (hovered)
|
if (hovered)
|
||||||
window->DrawList->AddCircleFilled(center, ImMax(2.0f, g.FontSize * 0.5f + 1.0f), col);
|
window->DrawList->AddCircleFilled(center, ImMax(2.0f, g.FontSize * 0.5f + 1.0f), col);
|
||||||
|
#endif
|
||||||
|
|
||||||
float cross_extent = g.FontSize * 0.5f * 0.7071f - 1.0f;
|
float cross_extent = g.FontSize * 0.5f * 0.7071f - 1.0f;
|
||||||
ImU32 cross_col = GetColorU32(ImGuiCol_Text);
|
ImU32 cross_col = GetColorU32(ImGuiCol_Text);
|
||||||
center -= ImVec2(0.5f, 0.5f);
|
center -= ImVec2(0.5f, 0.5f);
|
||||||
|
#ifdef WIN98 // close button icon
|
||||||
|
IM_UNUSED(cross_col);
|
||||||
|
IM_UNUSED(cross_extent);
|
||||||
|
RenderText(bb.Min + ImVec2(2.0f, 2.0f), "\xC3\x97");
|
||||||
|
#else
|
||||||
window->DrawList->AddLine(center + ImVec2(+cross_extent, +cross_extent), center + ImVec2(-cross_extent, -cross_extent), cross_col, 1.0f);
|
window->DrawList->AddLine(center + ImVec2(+cross_extent, +cross_extent), center + ImVec2(-cross_extent, -cross_extent), cross_col, 1.0f);
|
||||||
window->DrawList->AddLine(center + ImVec2(+cross_extent, -cross_extent), center + ImVec2(-cross_extent, +cross_extent), cross_col, 1.0f);
|
window->DrawList->AddLine(center + ImVec2(+cross_extent, -cross_extent), center + ImVec2(-cross_extent, +cross_extent), cross_col, 1.0f);
|
||||||
|
#endif
|
||||||
|
|
||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
@@ -854,7 +882,11 @@ bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos)
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
|
|
||||||
|
#ifdef WIN98 // collapse button size
|
||||||
|
ImRect bb(pos, pos + ImVec2(16.0f, 14.0f));
|
||||||
|
#else
|
||||||
ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize));
|
ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize));
|
||||||
|
#endif
|
||||||
bool is_clipped = !ItemAdd(bb, id);
|
bool is_clipped = !ItemAdd(bb, id);
|
||||||
bool hovered, held;
|
bool hovered, held;
|
||||||
bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_None);
|
bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_None);
|
||||||
@@ -864,9 +896,20 @@ bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos)
|
|||||||
// Render
|
// Render
|
||||||
ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
||||||
ImU32 text_col = GetColorU32(ImGuiCol_Text);
|
ImU32 text_col = GetColorU32(ImGuiCol_Text);
|
||||||
|
#ifdef WIN98 // collapse button
|
||||||
|
IM_UNUSED(bg_col);
|
||||||
|
IM_UNUSED(text_col);
|
||||||
|
const ImU32 fill_col = GetColorU32(ImGuiCol_WindowBg);
|
||||||
|
window->DrawList->AddRectFilled(bb.Min, bb.Max, fill_col, 0.0f);
|
||||||
|
WinAddRect(bb.Min, bb.Max, hovered && held);
|
||||||
|
|
||||||
|
// collapse icon
|
||||||
|
RenderText(bb.Min + ImVec2(2.0f, 2.0f), "\xC3\x98");
|
||||||
|
#else
|
||||||
if (hovered || held)
|
if (hovered || held)
|
||||||
window->DrawList->AddCircleFilled(bb.GetCenter() + ImVec2(0.0f, -0.5f), g.FontSize * 0.5f + 1.0f, bg_col);
|
window->DrawList->AddCircleFilled(bb.GetCenter() + ImVec2(0.0f, -0.5f), g.FontSize * 0.5f + 1.0f, bg_col);
|
||||||
RenderArrow(window->DrawList, bb.Min, text_col, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f);
|
RenderArrow(window->DrawList, bb.Min, text_col, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Switch to moving the window after mouse is moved beyond the initial drag threshold
|
// Switch to moving the window after mouse is moved beyond the initial drag threshold
|
||||||
if (IsItemActive() && IsMouseDragging(0))
|
if (IsItemActive() && IsMouseDragging(0))
|
||||||
@@ -916,10 +959,10 @@ void ImGui::Scrollbar(ImGuiAxis axis)
|
|||||||
if (!window->ScrollbarX)
|
if (!window->ScrollbarX)
|
||||||
rounding_corners |= ImDrawFlags_RoundCornersBottomRight;
|
rounding_corners |= ImDrawFlags_RoundCornersBottomRight;
|
||||||
}
|
}
|
||||||
float size_avail = window->InnerRect.Max[axis] - window->InnerRect.Min[axis];
|
float size_visible = window->InnerRect.Max[axis] - window->InnerRect.Min[axis];
|
||||||
float size_contents = window->ContentSize[axis] + window->WindowPadding[axis] * 2.0f;
|
float size_contents = window->ContentSize[axis] + window->WindowPadding[axis] * 2.0f;
|
||||||
ImS64 scroll = (ImS64)window->Scroll[axis];
|
ImS64 scroll = (ImS64)window->Scroll[axis];
|
||||||
ScrollbarEx(bb, id, axis, &scroll, (ImS64)size_avail, (ImS64)size_contents, rounding_corners);
|
ScrollbarEx(bb, id, axis, &scroll, (ImS64)size_visible, (ImS64)size_contents, rounding_corners);
|
||||||
window->Scroll[axis] = (float)scroll;
|
window->Scroll[axis] = (float)scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -929,7 +972,7 @@ void ImGui::Scrollbar(ImGuiAxis axis)
|
|||||||
// - We store values as normalized ratio and in a form that allows the window content to change while we are holding on a scrollbar
|
// - We store values as normalized ratio and in a form that allows the window content to change while we are holding on a scrollbar
|
||||||
// - We handle both horizontal and vertical scrollbars, which makes the terminology not ideal.
|
// - We handle both horizontal and vertical scrollbars, which makes the terminology not ideal.
|
||||||
// Still, the code should probably be made simpler..
|
// Still, the code should probably be made simpler..
|
||||||
bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS64* p_scroll_v, ImS64 size_avail_v, ImS64 size_contents_v, ImDrawFlags flags)
|
bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS64* p_scroll_v, ImS64 size_visible_v, ImS64 size_contents_v, ImDrawFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
@@ -951,17 +994,28 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6
|
|||||||
const ImGuiStyle& style = g.Style;
|
const ImGuiStyle& style = g.Style;
|
||||||
const bool allow_interaction = (alpha >= 1.0f);
|
const bool allow_interaction = (alpha >= 1.0f);
|
||||||
|
|
||||||
|
#ifdef WIN98
|
||||||
|
IM_UNUSED(flags);
|
||||||
|
ImRect bb = bb_frame;
|
||||||
|
float button_size = (axis == ImGuiAxis_X) ? bb.GetHeight() : bb.GetWidth();
|
||||||
|
ImVec2 button_size_rect(button_size, button_size);
|
||||||
|
ImVec2 main_axis((axis == ImGuiAxis_X) ? 1.0f : 0.0f, (axis == ImGuiAxis_X) ? 0.0f : 1.0f);
|
||||||
|
ImVec2 main_axis_button_size = main_axis * button_size;
|
||||||
|
|
||||||
|
bb.Expand(main_axis * -button_size);
|
||||||
|
#else
|
||||||
ImRect bb = bb_frame;
|
ImRect bb = bb_frame;
|
||||||
bb.Expand(ImVec2(-ImClamp(IM_TRUNC((bb_frame_width - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp(IM_TRUNC((bb_frame_height - 2.0f) * 0.5f), 0.0f, 3.0f)));
|
bb.Expand(ImVec2(-ImClamp(IM_TRUNC((bb_frame_width - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp(IM_TRUNC((bb_frame_height - 2.0f) * 0.5f), 0.0f, 3.0f)));
|
||||||
|
#endif
|
||||||
|
|
||||||
// V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)
|
// V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)
|
||||||
const float scrollbar_size_v = (axis == ImGuiAxis_X) ? bb.GetWidth() : bb.GetHeight();
|
const float scrollbar_size_v = (axis == ImGuiAxis_X) ? bb.GetWidth() : bb.GetHeight();
|
||||||
|
|
||||||
// Calculate the height of our grabbable box. It generally represent the amount visible (vs the total scrollable amount)
|
// Calculate the height of our grabbable box. It generally represent the amount visible (vs the total scrollable amount)
|
||||||
// But we maintain a minimum size in pixel to allow for the user to still aim inside.
|
// But we maintain a minimum size in pixel to allow for the user to still aim inside.
|
||||||
IM_ASSERT(ImMax(size_contents_v, size_avail_v) > 0.0f); // Adding this assert to check if the ImMax(XXX,1.0f) is still needed. PLEASE CONTACT ME if this triggers.
|
IM_ASSERT(ImMax(size_contents_v, size_visible_v) > 0.0f); // Adding this assert to check if the ImMax(XXX,1.0f) is still needed. PLEASE CONTACT ME if this triggers.
|
||||||
const ImS64 win_size_v = ImMax(ImMax(size_contents_v, size_avail_v), (ImS64)1);
|
const ImS64 win_size_v = ImMax(ImMax(size_contents_v, size_visible_v), (ImS64)1);
|
||||||
const float grab_h_pixels = ImClamp(scrollbar_size_v * ((float)size_avail_v / (float)win_size_v), style.GrabMinSize, scrollbar_size_v);
|
const float grab_h_pixels = ImClamp(scrollbar_size_v * ((float)size_visible_v / (float)win_size_v), style.GrabMinSize, scrollbar_size_v);
|
||||||
const float grab_h_norm = grab_h_pixels / scrollbar_size_v;
|
const float grab_h_norm = grab_h_pixels / scrollbar_size_v;
|
||||||
|
|
||||||
// Handle input right away. None of the code of Begin() is relying on scrolling position before calling Scrollbar().
|
// Handle input right away. None of the code of Begin() is relying on scrolling position before calling Scrollbar().
|
||||||
@@ -970,7 +1024,7 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6
|
|||||||
ItemAdd(bb_frame, id, NULL, ImGuiItemFlags_NoNav);
|
ItemAdd(bb_frame, id, NULL, ImGuiItemFlags_NoNav);
|
||||||
ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_NoNavFocus);
|
ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_NoNavFocus);
|
||||||
|
|
||||||
const ImS64 scroll_max = ImMax((ImS64)1, size_contents_v - size_avail_v);
|
const ImS64 scroll_max = ImMax((ImS64)1, size_contents_v - size_visible_v);
|
||||||
float scroll_ratio = ImSaturate((float)*p_scroll_v / (float)scroll_max);
|
float scroll_ratio = ImSaturate((float)*p_scroll_v / (float)scroll_max);
|
||||||
float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v; // Grab position in normalized space
|
float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v; // Grab position in normalized space
|
||||||
if (held && allow_interaction && grab_h_norm < 1.0f)
|
if (held && allow_interaction && grab_h_norm < 1.0f)
|
||||||
@@ -981,32 +1035,69 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6
|
|||||||
// Click position in scrollbar normalized space (0.0f->1.0f)
|
// Click position in scrollbar normalized space (0.0f->1.0f)
|
||||||
const float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v);
|
const float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v);
|
||||||
|
|
||||||
bool seek_absolute = false;
|
const int held_dir = (clicked_v_norm < grab_v_norm) ? -1 : (clicked_v_norm > grab_v_norm + grab_h_norm) ? +1 : 0;
|
||||||
if (g.ActiveIdIsJustActivated)
|
if (g.ActiveIdIsJustActivated)
|
||||||
{
|
{
|
||||||
// On initial click calculate the distance between mouse and the center of the grab
|
// On initial click calculate the distance between mouse and the center of the grab
|
||||||
seek_absolute = (clicked_v_norm < grab_v_norm || clicked_v_norm > grab_v_norm + grab_h_norm);
|
g.ScrollbarSeekMode = (short)held_dir;
|
||||||
if (seek_absolute)
|
g.ScrollbarClickDeltaToGrabCenter = (g.ScrollbarSeekMode == 0.0f) ? clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f : 0.0f;
|
||||||
g.ScrollbarClickDeltaToGrabCenter = 0.0f;
|
|
||||||
else
|
|
||||||
g.ScrollbarClickDeltaToGrabCenter = clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply scroll (p_scroll_v will generally point on one member of window->Scroll)
|
// Apply scroll (p_scroll_v will generally point on one member of window->Scroll)
|
||||||
// It is ok to modify Scroll here because we are being called in Begin() after the calculation of ContentSize and before setting up our starting position
|
// It is ok to modify Scroll here because we are being called in Begin() after the calculation of ContentSize and before setting up our starting position
|
||||||
const float scroll_v_norm = ImSaturate((clicked_v_norm - g.ScrollbarClickDeltaToGrabCenter - grab_h_norm * 0.5f) / (1.0f - grab_h_norm));
|
if (g.ScrollbarSeekMode == 0)
|
||||||
*p_scroll_v = (ImS64)(scroll_v_norm * scroll_max);
|
{
|
||||||
|
// Absolute seeking
|
||||||
|
const float scroll_v_norm = ImSaturate((clicked_v_norm - g.ScrollbarClickDeltaToGrabCenter - grab_h_norm * 0.5f) / (1.0f - grab_h_norm));
|
||||||
|
*p_scroll_v = (ImS64)(scroll_v_norm * scroll_max);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Page by page
|
||||||
|
if (IsMouseClicked(ImGuiMouseButton_Left, ImGuiInputFlags_Repeat) && held_dir == g.ScrollbarSeekMode)
|
||||||
|
{
|
||||||
|
float page_dir = (g.ScrollbarSeekMode > 0.0f) ? +1.0f : -1.0f;
|
||||||
|
*p_scroll_v = ImClamp(*p_scroll_v + (ImS64)(page_dir * size_visible_v), (ImS64)0, scroll_max);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update values for rendering
|
// Update values for rendering
|
||||||
scroll_ratio = ImSaturate((float)*p_scroll_v / (float)scroll_max);
|
scroll_ratio = ImSaturate((float)*p_scroll_v / (float)scroll_max);
|
||||||
grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;
|
grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;
|
||||||
|
|
||||||
// Update distance to grab now that we have seeked and saturated
|
// Update distance to grab now that we have seek'ed and saturated
|
||||||
if (seek_absolute)
|
//if (seek_absolute)
|
||||||
g.ScrollbarClickDeltaToGrabCenter = clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f;
|
// g.ScrollbarClickDeltaToGrabCenter = clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
|
#ifdef WIN98 // scrollbar
|
||||||
|
|
||||||
|
ImRect grab_rect;
|
||||||
|
if (axis == ImGuiAxis_X) {
|
||||||
|
grab_rect = ImRect(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y, ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, bb.Max.y);
|
||||||
|
} else {
|
||||||
|
grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels);
|
||||||
|
}
|
||||||
|
WinAddRect(grab_rect.Min, grab_rect.Max, false);
|
||||||
|
{
|
||||||
|
const ImGuiID up_id = window->GetID("##scrollup");
|
||||||
|
ImRect button_bounds(bb_frame.Min, bb_frame.Min + button_size_rect);
|
||||||
|
bool held_up = false;
|
||||||
|
bool hovered_up = false;
|
||||||
|
/*bool pressed_up = */ ButtonBehavior(button_bounds, up_id, &hovered_up, &held_up, 0);
|
||||||
|
WinAddRect(button_bounds.Min, button_bounds.Max, (held_up && hovered_up));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const ImGuiID down_id = window->GetID("##scrolldown");
|
||||||
|
ImVec2 pos = bb_frame.Min + main_axis * (((axis == ImGuiAxis_X) ? bb_frame.GetWidth() : bb_frame.GetHeight()) - button_size);
|
||||||
|
ImRect button_bounds(pos, pos + button_size_rect);
|
||||||
|
bool held_down = false;
|
||||||
|
bool hovered_down = false;
|
||||||
|
/*bool pressed_down =*/ ButtonBehavior(button_bounds, down_id, &hovered_down, &held_down, 0);
|
||||||
|
WinAddRect(button_bounds.Min, button_bounds.Max, (held_down && hovered_down));
|
||||||
|
}
|
||||||
|
#else
|
||||||
const ImU32 bg_col = GetColorU32(ImGuiCol_ScrollbarBg);
|
const ImU32 bg_col = GetColorU32(ImGuiCol_ScrollbarBg);
|
||||||
const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab, alpha);
|
const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab, alpha);
|
||||||
window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, bg_col, window->WindowRounding, flags);
|
window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, bg_col, window->WindowRounding, flags);
|
||||||
@@ -1016,6 +1107,7 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6
|
|||||||
else
|
else
|
||||||
grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels);
|
grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels);
|
||||||
window->DrawList->AddRectFilled(grab_rect.Min, grab_rect.Max, grab_col, style.ScrollbarRounding);
|
window->DrawList->AddRectFilled(grab_rect.Min, grab_rect.Max, grab_col, style.ScrollbarRounding);
|
||||||
|
#endif
|
||||||
|
|
||||||
return held;
|
return held;
|
||||||
}
|
}
|
||||||
@@ -1942,28 +2034,30 @@ bool ImGui::Combo(const char* label, int* current_item, const char* (*getter)(vo
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Display items
|
// Display items
|
||||||
// FIXME-OPT: Use clipper (but we need to disable it on the appearing frame to make sure our call to SetItemDefaultFocus() is processed)
|
|
||||||
bool value_changed = false;
|
bool value_changed = false;
|
||||||
for (int i = 0; i < items_count; i++)
|
ImGuiListClipper clipper;
|
||||||
{
|
clipper.Begin(items_count);
|
||||||
const char* item_text = getter(user_data, i);
|
clipper.IncludeItemByIndex(*current_item);
|
||||||
if (item_text == NULL)
|
while (clipper.Step())
|
||||||
item_text = "*Unknown item*";
|
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
|
||||||
|
|
||||||
PushID(i);
|
|
||||||
const bool item_selected = (i == *current_item);
|
|
||||||
if (Selectable(item_text, item_selected) && *current_item != i)
|
|
||||||
{
|
{
|
||||||
value_changed = true;
|
const char* item_text = getter(user_data, i);
|
||||||
*current_item = i;
|
if (item_text == NULL)
|
||||||
|
item_text = "*Unknown item*";
|
||||||
|
|
||||||
|
PushID(i);
|
||||||
|
const bool item_selected = (i == *current_item);
|
||||||
|
if (Selectable(item_text, item_selected) && *current_item != i)
|
||||||
|
{
|
||||||
|
value_changed = true;
|
||||||
|
*current_item = i;
|
||||||
|
}
|
||||||
|
if (item_selected)
|
||||||
|
SetItemDefaultFocus();
|
||||||
|
PopID();
|
||||||
}
|
}
|
||||||
if (item_selected)
|
|
||||||
SetItemDefaultFocus();
|
|
||||||
PopID();
|
|
||||||
}
|
|
||||||
|
|
||||||
EndCombo();
|
EndCombo();
|
||||||
|
|
||||||
if (value_changed)
|
if (value_changed)
|
||||||
MarkItemEdited(g.LastItemData.ID);
|
MarkItemEdited(g.LastItemData.ID);
|
||||||
|
|
||||||
@@ -2129,17 +2223,24 @@ void ImGui::DataTypeApplyOp(ImGuiDataType data_type, int op, void* output, const
|
|||||||
|
|
||||||
// User can input math operators (e.g. +100) to edit a numerical values.
|
// User can input math operators (e.g. +100) to edit a numerical values.
|
||||||
// NB: This is _not_ a full expression evaluator. We should probably add one and replace this dumb mess..
|
// NB: This is _not_ a full expression evaluator. We should probably add one and replace this dumb mess..
|
||||||
bool ImGui::DataTypeApplyFromText(const char* buf, ImGuiDataType data_type, void* p_data, const char* format)
|
bool ImGui::DataTypeApplyFromText(const char* buf, ImGuiDataType data_type, void* p_data, const char* format, void* p_data_when_empty)
|
||||||
{
|
{
|
||||||
|
// Copy the value in an opaque buffer so we can compare at the end of the function if it changed at all.
|
||||||
|
const ImGuiDataTypeInfo* type_info = DataTypeGetInfo(data_type);
|
||||||
|
ImGuiDataTypeStorage data_backup;
|
||||||
|
memcpy(&data_backup, p_data, type_info->Size);
|
||||||
|
|
||||||
while (ImCharIsBlankA(*buf))
|
while (ImCharIsBlankA(*buf))
|
||||||
buf++;
|
buf++;
|
||||||
if (!buf[0])
|
if (!buf[0])
|
||||||
|
{
|
||||||
|
if (p_data_when_empty != NULL)
|
||||||
|
{
|
||||||
|
memcpy(p_data, p_data_when_empty, type_info->Size);
|
||||||
|
return memcmp(&data_backup, p_data, type_info->Size) != 0;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
// Copy the value in an opaque buffer so we can compare at the end of the function if it changed at all.
|
|
||||||
const ImGuiDataTypeInfo* type_info = DataTypeGetInfo(data_type);
|
|
||||||
ImGuiDataTypeTempStorage data_backup;
|
|
||||||
memcpy(&data_backup, p_data, type_info->Size);
|
|
||||||
|
|
||||||
// Sanitize format
|
// Sanitize format
|
||||||
// - For float/double we have to ignore format with precision (e.g. "%.2f") because sscanf doesn't take them in, so force them into %f and %lf
|
// - For float/double we have to ignore format with precision (e.g. "%.2f") because sscanf doesn't take them in, so force them into %f and %lf
|
||||||
@@ -2309,7 +2410,7 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const
|
|||||||
const int decimal_precision = is_floating_point ? ImParseFormatPrecision(format, 3) : 0;
|
const int decimal_precision = is_floating_point ? ImParseFormatPrecision(format, 3) : 0;
|
||||||
const bool tweak_slow = IsKeyDown((g.NavInputSource == ImGuiInputSource_Gamepad) ? ImGuiKey_NavGamepadTweakSlow : ImGuiKey_NavKeyboardTweakSlow);
|
const bool tweak_slow = IsKeyDown((g.NavInputSource == ImGuiInputSource_Gamepad) ? ImGuiKey_NavGamepadTweakSlow : ImGuiKey_NavKeyboardTweakSlow);
|
||||||
const bool tweak_fast = IsKeyDown((g.NavInputSource == ImGuiInputSource_Gamepad) ? ImGuiKey_NavGamepadTweakFast : ImGuiKey_NavKeyboardTweakFast);
|
const bool tweak_fast = IsKeyDown((g.NavInputSource == ImGuiInputSource_Gamepad) ? ImGuiKey_NavGamepadTweakFast : ImGuiKey_NavKeyboardTweakFast);
|
||||||
const float tweak_factor = tweak_slow ? 1.0f / 1.0f : tweak_fast ? 10.0f : 1.0f;
|
const float tweak_factor = tweak_slow ? 1.0f / 10.0f : tweak_fast ? 10.0f : 1.0f;
|
||||||
adjust_delta = GetNavTweakPressedAmount(axis) * tweak_factor;
|
adjust_delta = GetNavTweakPressedAmount(axis) * tweak_factor;
|
||||||
v_speed = ImMax(v_speed, GetMinimumStepAtDecimalPrecision(decimal_precision));
|
v_speed = ImMax(v_speed, GetMinimumStepAtDecimalPrecision(decimal_precision));
|
||||||
}
|
}
|
||||||
@@ -2468,7 +2569,7 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data,
|
|||||||
if (!temp_input_is_active)
|
if (!temp_input_is_active)
|
||||||
{
|
{
|
||||||
// Tabbing or CTRL-clicking on Drag turns it into an InputText
|
// Tabbing or CTRL-clicking on Drag turns it into an InputText
|
||||||
const bool clicked = hovered && IsMouseClicked(0, id);
|
const bool clicked = hovered && IsMouseClicked(0, ImGuiInputFlags_None, id);
|
||||||
const bool double_clicked = (hovered && g.IO.MouseClickedCount[0] == 2 && TestKeyOwner(ImGuiKey_MouseLeft, id));
|
const bool double_clicked = (hovered && g.IO.MouseClickedCount[0] == 2 && TestKeyOwner(ImGuiKey_MouseLeft, id));
|
||||||
const bool make_active = (clicked || double_clicked || g.NavActivateId == id);
|
const bool make_active = (clicked || double_clicked || g.NavActivateId == id);
|
||||||
if (make_active && (clicked || double_clicked))
|
if (make_active && (clicked || double_clicked))
|
||||||
@@ -3059,7 +3160,7 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat
|
|||||||
if (!temp_input_is_active)
|
if (!temp_input_is_active)
|
||||||
{
|
{
|
||||||
// Tabbing or CTRL-clicking on Slider turns it into an input box
|
// Tabbing or CTRL-clicking on Slider turns it into an input box
|
||||||
const bool clicked = hovered && IsMouseClicked(0, id);
|
const bool clicked = hovered && IsMouseClicked(0, ImGuiInputFlags_None, id);
|
||||||
const bool make_active = (clicked || g.NavActivateId == id);
|
const bool make_active = (clicked || g.NavActivateId == id);
|
||||||
if (make_active && clicked)
|
if (make_active && clicked)
|
||||||
SetKeyOwner(ImGuiKey_MouseLeft, id);
|
SetKeyOwner(ImGuiKey_MouseLeft, id);
|
||||||
@@ -3221,7 +3322,7 @@ bool ImGui::VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType d
|
|||||||
format = DataTypeGetInfo(data_type)->PrintFmt;
|
format = DataTypeGetInfo(data_type)->PrintFmt;
|
||||||
|
|
||||||
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags);
|
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags);
|
||||||
const bool clicked = hovered && IsMouseClicked(0, id);
|
const bool clicked = hovered && IsMouseClicked(0, ImGuiInputFlags_None, id);
|
||||||
if (clicked || g.NavActivateId == id)
|
if (clicked || g.NavActivateId == id)
|
||||||
{
|
{
|
||||||
if (clicked)
|
if (clicked)
|
||||||
@@ -3459,11 +3560,11 @@ bool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImG
|
|||||||
{
|
{
|
||||||
// Backup old value
|
// Backup old value
|
||||||
size_t data_type_size = type_info->Size;
|
size_t data_type_size = type_info->Size;
|
||||||
ImGuiDataTypeTempStorage data_backup;
|
ImGuiDataTypeStorage data_backup;
|
||||||
memcpy(&data_backup, p_data, data_type_size);
|
memcpy(&data_backup, p_data, data_type_size);
|
||||||
|
|
||||||
// Apply new value (or operations) then clamp
|
// Apply new value (or operations) then clamp
|
||||||
DataTypeApplyFromText(data_buf, data_type, p_data, format);
|
DataTypeApplyFromText(data_buf, data_type, p_data, format, NULL);
|
||||||
if (p_clamp_min || p_clamp_max)
|
if (p_clamp_min || p_clamp_max)
|
||||||
{
|
{
|
||||||
if (p_clamp_min && p_clamp_max && DataTypeCompare(data_type, p_clamp_min, p_clamp_max) > 0)
|
if (p_clamp_min && p_clamp_max && DataTypeCompare(data_type, p_clamp_min, p_clamp_max) > 0)
|
||||||
@@ -3479,6 +3580,13 @@ bool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImG
|
|||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImGui::SetNextItemRefVal(ImGuiDataType data_type, void* p_data)
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
g.NextItemData.Flags |= ImGuiNextItemDataFlags_HasRefVal;
|
||||||
|
memcpy(&g.NextItemData.RefVal, p_data, DataTypeGetInfo(data_type)->Size);
|
||||||
|
}
|
||||||
|
|
||||||
// Note: p_data, p_step, p_step_fast are _pointers_ to a memory address holding the data. For an Input widget, p_step and p_step_fast are optional.
|
// Note: p_data, p_step, p_step_fast are _pointers_ to a memory address holding the data. For an Input widget, p_step and p_step_fast are optional.
|
||||||
// Read code of e.g. InputFloat(), InputInt() etc. or examples in 'Demo->Widgets->Data Types' to understand how to use this function directly.
|
// Read code of e.g. InputFloat(), InputInt() etc. or examples in 'Demo->Widgets->Data Types' to understand how to use this function directly.
|
||||||
bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_step, const void* p_step_fast, const char* format, ImGuiInputTextFlags flags)
|
bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_step, const void* p_step_fast, const char* format, ImGuiInputTextFlags flags)
|
||||||
@@ -3493,8 +3601,13 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data
|
|||||||
if (format == NULL)
|
if (format == NULL)
|
||||||
format = DataTypeGetInfo(data_type)->PrintFmt;
|
format = DataTypeGetInfo(data_type)->PrintFmt;
|
||||||
|
|
||||||
|
void* p_data_default = (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasRefVal) ? &g.NextItemData.RefVal : &g.DataTypeZeroValue;
|
||||||
|
|
||||||
char buf[64];
|
char buf[64];
|
||||||
DataTypeFormatString(buf, IM_ARRAYSIZE(buf), data_type, p_data, format);
|
if ((flags & ImGuiInputTextFlags_DisplayEmptyRefVal) && DataTypeCompare(data_type, p_data, p_data_default) == 0)
|
||||||
|
buf[0] = 0;
|
||||||
|
else
|
||||||
|
DataTypeFormatString(buf, IM_ARRAYSIZE(buf), data_type, p_data, format);
|
||||||
|
|
||||||
flags |= ImGuiInputTextFlags_AutoSelectAll | (ImGuiInputTextFlags)ImGuiInputTextFlags_NoMarkEdited; // We call MarkItemEdited() ourselves by comparing the actual data rather than the string.
|
flags |= ImGuiInputTextFlags_AutoSelectAll | (ImGuiInputTextFlags)ImGuiInputTextFlags_NoMarkEdited; // We call MarkItemEdited() ourselves by comparing the actual data rather than the string.
|
||||||
flags |= (ImGuiInputTextFlags)ImGuiInputTextFlags_LocalizeDecimalPoint;
|
flags |= (ImGuiInputTextFlags)ImGuiInputTextFlags_LocalizeDecimalPoint;
|
||||||
@@ -3503,7 +3616,7 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data
|
|||||||
if (p_step == NULL)
|
if (p_step == NULL)
|
||||||
{
|
{
|
||||||
if (InputText(label, buf, IM_ARRAYSIZE(buf), flags))
|
if (InputText(label, buf, IM_ARRAYSIZE(buf), flags))
|
||||||
value_changed = DataTypeApplyFromText(buf, data_type, p_data, format);
|
value_changed = DataTypeApplyFromText(buf, data_type, p_data, format, (flags & ImGuiInputTextFlags_ParseEmptyRefVal) ? p_data_default : NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -3513,7 +3626,7 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data
|
|||||||
PushID(label);
|
PushID(label);
|
||||||
SetNextItemWidth(ImMax(1.0f, CalcItemWidth() - (button_size + style.ItemInnerSpacing.x) * 2));
|
SetNextItemWidth(ImMax(1.0f, CalcItemWidth() - (button_size + style.ItemInnerSpacing.x) * 2));
|
||||||
if (InputText("", buf, IM_ARRAYSIZE(buf), flags)) // PushId(label) + "" gives us the expected ID from outside point of view
|
if (InputText("", buf, IM_ARRAYSIZE(buf), flags)) // PushId(label) + "" gives us the expected ID from outside point of view
|
||||||
value_changed = DataTypeApplyFromText(buf, data_type, p_data, format);
|
value_changed = DataTypeApplyFromText(buf, data_type, p_data, format, (flags & ImGuiInputTextFlags_ParseEmptyRefVal) ? p_data_default : NULL);
|
||||||
IMGUI_TEST_ENGINE_ITEM_INFO(g.LastItemData.ID, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Inputable);
|
IMGUI_TEST_ENGINE_ITEM_INFO(g.LastItemData.ID, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Inputable);
|
||||||
|
|
||||||
// Step buttons
|
// Step buttons
|
||||||
@@ -4309,6 +4422,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
SetKeyOwner(ImGuiKey_PageUp, id);
|
SetKeyOwner(ImGuiKey_PageUp, id);
|
||||||
SetKeyOwner(ImGuiKey_PageDown, id);
|
SetKeyOwner(ImGuiKey_PageDown, id);
|
||||||
}
|
}
|
||||||
|
// FIXME: May be a problem to always steal Alt on OSX, would ideally still allow an uninterrupted Alt down-up to toggle menu
|
||||||
if (is_osx)
|
if (is_osx)
|
||||||
SetKeyOwner(ImGuiMod_Alt, id);
|
SetKeyOwner(ImGuiMod_Alt, id);
|
||||||
}
|
}
|
||||||
@@ -4441,7 +4555,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
// (For Tab and Enter: Win32/SFML/Allegro are sending both keys and chars, GLFW and SDL are only sending keys. For Space they all send all threes)
|
// (For Tab and Enter: Win32/SFML/Allegro are sending both keys and chars, GLFW and SDL are only sending keys. For Space they all send all threes)
|
||||||
if ((flags & ImGuiInputTextFlags_AllowTabInput) && !is_readonly)
|
if ((flags & ImGuiInputTextFlags_AllowTabInput) && !is_readonly)
|
||||||
{
|
{
|
||||||
if (Shortcut(ImGuiKey_Tab, id, ImGuiInputFlags_Repeat))
|
if (Shortcut(ImGuiKey_Tab, ImGuiInputFlags_Repeat, id))
|
||||||
{
|
{
|
||||||
unsigned int c = '\t'; // Insert TAB
|
unsigned int c = '\t'; // Insert TAB
|
||||||
if (InputTextFilterCharacter(&g, &c, flags, callback, callback_user_data))
|
if (InputTextFilterCharacter(&g, &c, flags, callback, callback_user_data))
|
||||||
@@ -4449,7 +4563,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
}
|
}
|
||||||
// FIXME: Implement Shift+Tab
|
// FIXME: Implement Shift+Tab
|
||||||
/*
|
/*
|
||||||
if (Shortcut(ImGuiKey_Tab | ImGuiMod_Shift, id, ImGuiInputFlags_Repeat))
|
if (Shortcut(ImGuiKey_Tab | ImGuiMod_Shift, ImGuiInputFlags_Repeat, id))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -4457,7 +4571,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
|
|
||||||
// Process regular text input (before we check for Return because using some IME will effectively send a Return?)
|
// Process regular text input (before we check for Return because using some IME will effectively send a Return?)
|
||||||
// We ignore CTRL inputs, but need to allow ALT+CTRL as some keyboards (e.g. German) use AltGR (which _is_ Alt+Ctrl) to input certain characters.
|
// We ignore CTRL inputs, but need to allow ALT+CTRL as some keyboards (e.g. German) use AltGR (which _is_ Alt+Ctrl) to input certain characters.
|
||||||
const bool ignore_char_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeySuper);
|
const bool ignore_char_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeyCtrl);
|
||||||
if (io.InputQueueCharacters.Size > 0)
|
if (io.InputQueueCharacters.Size > 0)
|
||||||
{
|
{
|
||||||
if (!ignore_char_inputs && !is_readonly && !input_requested_by_nav)
|
if (!ignore_char_inputs && !is_readonly && !input_requested_by_nav)
|
||||||
@@ -4487,25 +4601,26 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
|
|
||||||
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_wordmove_key_down = is_osx ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl
|
const bool is_wordmove_key_down = is_osx ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl
|
||||||
const bool is_startend_key_down = is_osx && 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 = is_osx && io.KeyCtrl && !io.KeySuper && !io.KeyAlt; // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End
|
||||||
|
|
||||||
// Using Shortcut() with ImGuiInputFlags_RouteFocused (default policy) to allow routing operations for other code (e.g. calling window trying to use CTRL+A and CTRL+B: formet would be handled by InputText)
|
// Using Shortcut() with ImGuiInputFlags_RouteFocused (default policy) to allow routing operations for other code (e.g. calling window trying to use CTRL+A and CTRL+B: formet would be handled by InputText)
|
||||||
// Otherwise we could simply assume that we own the keys as we are active.
|
// Otherwise we could simply assume that we own the keys as we are active.
|
||||||
const ImGuiInputFlags f_repeat = ImGuiInputFlags_Repeat;
|
const ImGuiInputFlags f_repeat = ImGuiInputFlags_Repeat;
|
||||||
const bool is_cut = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_X, id, f_repeat) || Shortcut(ImGuiMod_Shift | ImGuiKey_Delete, id, f_repeat)) && !is_readonly && !is_password && (!is_multiline || state->HasSelection());
|
const bool is_cut = (Shortcut(ImGuiMod_Ctrl | ImGuiKey_X, f_repeat, id) || Shortcut(ImGuiMod_Shift | ImGuiKey_Delete, f_repeat, id)) && !is_readonly && !is_password && (!is_multiline || state->HasSelection());
|
||||||
const bool is_copy = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_C, id) || Shortcut(ImGuiMod_Ctrl | ImGuiKey_Insert, id)) && !is_password && (!is_multiline || state->HasSelection());
|
const bool is_copy = (Shortcut(ImGuiMod_Ctrl | ImGuiKey_C, 0, id) || Shortcut(ImGuiMod_Ctrl | ImGuiKey_Insert, 0, id)) && !is_password && (!is_multiline || state->HasSelection());
|
||||||
const bool is_paste = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_V, id, f_repeat) || Shortcut(ImGuiMod_Shift | ImGuiKey_Insert, id, f_repeat)) && !is_readonly;
|
const bool is_paste = (Shortcut(ImGuiMod_Ctrl | ImGuiKey_V, f_repeat, id) || Shortcut(ImGuiMod_Shift | ImGuiKey_Insert, f_repeat, id)) && !is_readonly;
|
||||||
const bool is_undo = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_Z, id, f_repeat)) && !is_readonly && is_undoable;
|
const bool is_undo = (Shortcut(ImGuiMod_Ctrl | ImGuiKey_Z, f_repeat, id)) && !is_readonly && is_undoable;
|
||||||
const bool is_redo = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_Y, id, f_repeat) || (is_osx && Shortcut(ImGuiMod_Shortcut | ImGuiMod_Shift | ImGuiKey_Z, id, f_repeat))) && !is_readonly && is_undoable;
|
const bool is_redo = (Shortcut(ImGuiMod_Ctrl | ImGuiKey_Y, f_repeat, id) || (is_osx && Shortcut(ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Z, f_repeat, id))) && !is_readonly && is_undoable;
|
||||||
const bool is_select_all = Shortcut(ImGuiMod_Shortcut | ImGuiKey_A, id);
|
const bool is_select_all = Shortcut(ImGuiMod_Ctrl | ImGuiKey_A, 0, id);
|
||||||
|
|
||||||
// We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful.
|
// We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful.
|
||||||
const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
|
const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
|
||||||
const bool is_enter_pressed = IsKeyPressed(ImGuiKey_Enter, true) || IsKeyPressed(ImGuiKey_KeypadEnter, true);
|
const bool is_enter_pressed = IsKeyPressed(ImGuiKey_Enter, true) || IsKeyPressed(ImGuiKey_KeypadEnter, true);
|
||||||
const bool is_gamepad_validate = nav_gamepad_active && (IsKeyPressed(ImGuiKey_NavGamepadActivate, false) || IsKeyPressed(ImGuiKey_NavGamepadInput, false));
|
const bool is_gamepad_validate = nav_gamepad_active && (IsKeyPressed(ImGuiKey_NavGamepadActivate, false) || IsKeyPressed(ImGuiKey_NavGamepadInput, false));
|
||||||
const bool is_cancel = Shortcut(ImGuiKey_Escape, id, f_repeat) || (nav_gamepad_active && Shortcut(ImGuiKey_NavGamepadCancel, id, f_repeat));
|
const bool is_cancel = Shortcut(ImGuiKey_Escape, f_repeat, id) || (nav_gamepad_active && Shortcut(ImGuiKey_NavGamepadCancel, f_repeat, id));
|
||||||
|
|
||||||
// FIXME: Should use more Shortcut() and reduce IsKeyPressed()+SetKeyOwner(), but requires modifiers combination to be taken account of.
|
// FIXME: Should use more Shortcut() and reduce IsKeyPressed()+SetKeyOwner(), but requires modifiers combination to be taken account of.
|
||||||
|
// FIXME-OSX: Missing support for Alt(option)+Right/Left = go to end of line, or next line if already in end of line.
|
||||||
if (IsKeyPressed(ImGuiKey_LeftArrow)) { 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 (IsKeyPressed(ImGuiKey_LeftArrow)) { 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 (IsKeyPressed(ImGuiKey_RightArrow)) { 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 (IsKeyPressed(ImGuiKey_RightArrow)) { 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 (IsKeyPressed(ImGuiKey_UpArrow) && is_multiline) { if (io.KeyCtrl) SetScrollY(draw_window, ImMax(draw_window->Scroll.y - g.FontSize, 0.0f)); else state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTSTART : STB_TEXTEDIT_K_UP) | k_mask); }
|
else if (IsKeyPressed(ImGuiKey_UpArrow) && is_multiline) { if (io.KeyCtrl) SetScrollY(draw_window, ImMax(draw_window->Scroll.y - g.FontSize, 0.0f)); else state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTSTART : STB_TEXTEDIT_K_UP) | k_mask); }
|
||||||
@@ -4530,7 +4645,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
{
|
{
|
||||||
if (is_wordmove_key_down)
|
if (is_wordmove_key_down)
|
||||||
state->OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT | STB_TEXTEDIT_K_SHIFT);
|
state->OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT | STB_TEXTEDIT_K_SHIFT);
|
||||||
else if (is_osx && io.KeySuper && !io.KeyAlt && !io.KeyCtrl)
|
else if (is_osx && io.KeyCtrl && !io.KeyAlt && !io.KeySuper)
|
||||||
state->OnKeyPressed(STB_TEXTEDIT_K_LINESTART | STB_TEXTEDIT_K_SHIFT);
|
state->OnKeyPressed(STB_TEXTEDIT_K_LINESTART | STB_TEXTEDIT_K_SHIFT);
|
||||||
}
|
}
|
||||||
state->OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask);
|
state->OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask);
|
||||||
@@ -4700,7 +4815,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
// The reason we specify the usage semantic (Completion/History) is that Completion needs to disable keyboard TABBING at the moment.
|
// The reason we specify the usage semantic (Completion/History) is that Completion needs to disable keyboard TABBING at the moment.
|
||||||
ImGuiInputTextFlags event_flag = 0;
|
ImGuiInputTextFlags event_flag = 0;
|
||||||
ImGuiKey event_key = ImGuiKey_None;
|
ImGuiKey event_key = ImGuiKey_None;
|
||||||
if ((flags & ImGuiInputTextFlags_CallbackCompletion) != 0 && Shortcut(ImGuiKey_Tab, id))
|
if ((flags & ImGuiInputTextFlags_CallbackCompletion) != 0 && Shortcut(ImGuiKey_Tab, 0, id))
|
||||||
{
|
{
|
||||||
event_flag = ImGuiInputTextFlags_CallbackCompletion;
|
event_flag = ImGuiInputTextFlags_CallbackCompletion;
|
||||||
event_key = ImGuiKey_Tab;
|
event_key = ImGuiKey_Tab;
|
||||||
@@ -6483,7 +6598,7 @@ void ImGui::SetNextItemOpen(bool is_open, ImGuiCond cond)
|
|||||||
return;
|
return;
|
||||||
g.NextItemData.Flags |= ImGuiNextItemDataFlags_HasOpen;
|
g.NextItemData.Flags |= ImGuiNextItemDataFlags_HasOpen;
|
||||||
g.NextItemData.OpenVal = is_open;
|
g.NextItemData.OpenVal = is_open;
|
||||||
g.NextItemData.OpenCond = cond ? cond : ImGuiCond_Always;
|
g.NextItemData.OpenCond = (ImU8)(cond ? cond : ImGuiCond_Always);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CollapsingHeader returns true when opened but do not indent nor push into the ID stack (because of the ImGuiTreeNodeFlags_NoTreePushOnOpen flag).
|
// CollapsingHeader returns true when opened but do not indent nor push into the ID stack (because of the ImGuiTreeNodeFlags_NoTreePushOnOpen flag).
|
||||||
@@ -6525,6 +6640,10 @@ bool ImGui::CollapsingHeader(const char* label, bool* p_visible, ImGuiTreeNodeFl
|
|||||||
float button_size = g.FontSize;
|
float button_size = g.FontSize;
|
||||||
float button_x = ImMax(g.LastItemData.Rect.Min.x, g.LastItemData.Rect.Max.x - g.Style.FramePadding.x - button_size);
|
float button_x = ImMax(g.LastItemData.Rect.Min.x, g.LastItemData.Rect.Max.x - g.Style.FramePadding.x - button_size);
|
||||||
float button_y = g.LastItemData.Rect.Min.y + g.Style.FramePadding.y;
|
float button_y = g.LastItemData.Rect.Min.y + g.Style.FramePadding.y;
|
||||||
|
#ifdef WIN98
|
||||||
|
button_x -= 4;
|
||||||
|
button_y -= 1;
|
||||||
|
#endif
|
||||||
ImGuiID close_button_id = GetIDWithSeed("#CLOSE", NULL, id);
|
ImGuiID close_button_id = GetIDWithSeed("#CLOSE", NULL, id);
|
||||||
if (CloseButton(close_button_id, ImVec2(button_x, button_y)))
|
if (CloseButton(close_button_id, ImVec2(button_x, button_y)))
|
||||||
*p_visible = false;
|
*p_visible = false;
|
||||||
@@ -6767,7 +6886,7 @@ ImGuiTypingSelectRequest* ImGui::GetTypingSelectRequest(ImGuiTypingSelectFlags f
|
|||||||
g.IO.InputQueueCharacters.resize(0);
|
g.IO.InputQueueCharacters.resize(0);
|
||||||
|
|
||||||
// Handle backspace
|
// Handle backspace
|
||||||
if ((flags & ImGuiTypingSelectFlags_AllowBackspace) && IsKeyPressed(ImGuiKey_Backspace, 0, ImGuiInputFlags_Repeat))
|
if ((flags & ImGuiTypingSelectFlags_AllowBackspace) && IsKeyPressed(ImGuiKey_Backspace, ImGuiInputFlags_Repeat))
|
||||||
{
|
{
|
||||||
char* p = (char*)(void*)ImTextFindPreviousUtf8Codepoint(data->SearchBuffer, data->SearchBuffer + buffer_len);
|
char* p = (char*)(void*)ImTextFindPreviousUtf8Codepoint(data->SearchBuffer, data->SearchBuffer + buffer_len);
|
||||||
*p = 0;
|
*p = 0;
|
||||||
@@ -6999,6 +7118,7 @@ bool ImGui::ListBox(const char* label, int* current_item, const char* (*getter)(
|
|||||||
bool value_changed = false;
|
bool value_changed = false;
|
||||||
ImGuiListClipper clipper;
|
ImGuiListClipper clipper;
|
||||||
clipper.Begin(items_count, GetTextLineHeightWithSpacing()); // We know exactly our line height here so we pass it as a minor optimization, but generally you don't need to.
|
clipper.Begin(items_count, GetTextLineHeightWithSpacing()); // We know exactly our line height here so we pass it as a minor optimization, but generally you don't need to.
|
||||||
|
clipper.IncludeItemByIndex(*current_item);
|
||||||
while (clipper.Step())
|
while (clipper.Step())
|
||||||
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
|
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
|
||||||
{
|
{
|
||||||
@@ -7517,7 +7637,7 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled)
|
|||||||
// Menu inside an horizontal menu bar
|
// Menu inside an horizontal menu bar
|
||||||
// Selectable extend their highlight by half ItemSpacing in each direction.
|
// Selectable extend their highlight by half ItemSpacing in each direction.
|
||||||
// For ChildMenu, the popup position will be overwritten by the call to FindBestWindowPosForPopup() in Begin()
|
// For ChildMenu, the popup position will be overwritten by the call to FindBestWindowPosForPopup() in Begin()
|
||||||
popup_pos = ImVec2(pos.x - 1.0f - IM_TRUNC(style.ItemSpacing.x * 0.5f), pos.y - style.FramePadding.y + window->MenuBarHeight());
|
popup_pos = ImVec2(pos.x - 1.0f - IM_TRUNC(style.ItemSpacing.x * 0.5f), pos.y - style.FramePadding.y + window->MenuBarHeight);
|
||||||
window->DC.CursorPos.x += IM_TRUNC(style.ItemSpacing.x * 0.5f);
|
window->DC.CursorPos.x += IM_TRUNC(style.ItemSpacing.x * 0.5f);
|
||||||
PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y));
|
PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y));
|
||||||
float w = label_size.x;
|
float w = label_size.x;
|
||||||
@@ -8283,7 +8403,7 @@ ImGuiTabItem* ImGui::TabBarFindTabByOrder(ImGuiTabBar* tab_bar, int order)
|
|||||||
|
|
||||||
ImGuiTabItem* ImGui::TabBarGetCurrentTab(ImGuiTabBar* tab_bar)
|
ImGuiTabItem* ImGui::TabBarGetCurrentTab(ImGuiTabBar* tab_bar)
|
||||||
{
|
{
|
||||||
if (tab_bar->LastTabItemIdx <= 0 || tab_bar->LastTabItemIdx >= tab_bar->Tabs.Size)
|
if (tab_bar->LastTabItemIdx < 0 || tab_bar->LastTabItemIdx >= tab_bar->Tabs.Size)
|
||||||
return NULL;
|
return NULL;
|
||||||
return &tab_bar->Tabs[tab_bar->LastTabItemIdx];
|
return &tab_bar->Tabs[tab_bar->LastTabItemIdx];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
// 1.13 (2019-02-07) fix bug in undo size management
|
// 1.13 (2019-02-07) fix bug in undo size management
|
||||||
// 1.12 (2018-01-29) user can change STB_TEXTEDIT_KEYTYPE, fix redo to avoid crash
|
// 1.12 (2018-01-29) user can change STB_TEXTEDIT_KEYTYPE, fix redo to avoid crash
|
||||||
// 1.11 (2017-03-03) fix HOME on last line, dragging off single-line textfield
|
// 1.11 (2017-03-03) fix HOME on last line, dragging off single-line textfield
|
||||||
// 1.10 (2016-10-25) supress warnings about casting away const with -Wcast-qual
|
// 1.10 (2016-10-25) suppress warnings about casting away const with -Wcast-qual
|
||||||
// 1.9 (2016-08-27) customizable move-by-word
|
// 1.9 (2016-08-27) customizable move-by-word
|
||||||
// 1.8 (2016-04-02) better keyboard handling when mouse button is down
|
// 1.8 (2016-04-02) better keyboard handling when mouse button is down
|
||||||
// 1.7 (2015-09-13) change y range handling in case baseline is non-0
|
// 1.7 (2015-09-13) change y range handling in case baseline is non-0
|
||||||
|
|||||||
@@ -656,7 +656,7 @@ STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h
|
|||||||
STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *spc, int skip);
|
STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *spc, int skip);
|
||||||
// If skip != 0, this tells stb_truetype to skip any codepoints for which
|
// If skip != 0, this tells stb_truetype to skip any codepoints for which
|
||||||
// there is no corresponding glyph. If skip=0, which is the default, then
|
// there is no corresponding glyph. If skip=0, which is the default, then
|
||||||
// codepoints without a glyph recived the font's "missing character" glyph,
|
// codepoints without a glyph received the font's "missing character" glyph,
|
||||||
// typically an empty box by convention.
|
// typically an empty box by convention.
|
||||||
|
|
||||||
STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, // same data as above
|
STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, // same data as above
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
// 2023/01/04: fixed a packing issue which in some occurrences would prevent large amount of glyphs from being packed correctly.
|
// 2023/01/04: fixed a packing issue which in some occurrences would prevent large amount of glyphs from being packed correctly.
|
||||||
// 2021/08/23: fixed crash when FT_Render_Glyph() fails to render a glyph and returns NULL.
|
// 2021/08/23: fixed crash when FT_Render_Glyph() fails to render a glyph and returns NULL.
|
||||||
// 2021/03/05: added ImGuiFreeTypeBuilderFlags_Bitmap to load bitmap glyphs.
|
// 2021/03/05: added ImGuiFreeTypeBuilderFlags_Bitmap to load bitmap glyphs.
|
||||||
// 2021/03/02: set 'atlas->TexPixelsUseColors = true' to help some backends with deciding of a prefered texture format.
|
// 2021/03/02: set 'atlas->TexPixelsUseColors = true' to help some backends with deciding of a preferred texture format.
|
||||||
// 2021/01/28: added support for color-layered glyphs via ImGuiFreeTypeBuilderFlags_LoadColor (require Freetype 2.10+).
|
// 2021/01/28: added support for color-layered glyphs via ImGuiFreeTypeBuilderFlags_LoadColor (require Freetype 2.10+).
|
||||||
// 2021/01/26: simplified integration by using '#define IMGUI_ENABLE_FREETYPE'. renamed ImGuiFreeType::XXX flags to ImGuiFreeTypeBuilderFlags_XXX for consistency with other API. removed ImGuiFreeType::BuildFontAtlas().
|
// 2021/01/26: simplified integration by using '#define IMGUI_ENABLE_FREETYPE'. renamed ImGuiFreeType::XXX flags to ImGuiFreeTypeBuilderFlags_XXX for consistency with other API. removed ImGuiFreeType::BuildFontAtlas().
|
||||||
// 2020/06/04: fix for rare case where FT_Get_Char_Index() succeed but FT_Load_Glyph() fails.
|
// 2020/06/04: fix for rare case where FT_Get_Char_Index() succeed but FT_Load_Glyph() fails.
|
||||||
|
|||||||
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
Reference in New Issue
Block a user