mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 07:40:22 +01:00
Fix more typos in sources and docs (#5681)
This commit is contained in:
parent
44e3ba115a
commit
2b1d8e3eaf
@ -196,7 +196,7 @@ 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.
|
||||||
Elements that are typically not clickable (such as calls to the Text functions) don't need an ID.
|
Elements that are typically not clickable (such as calls to the Text functions) don't need an ID.
|
||||||
Interactive widgets (such as calls to Button buttons) need an unique ID.
|
Interactive widgets (such as calls to Button buttons) need a unique ID.
|
||||||
|
|
||||||
**Unique IDs are used internally to track active widgets and occasionally associate state to widgets.<BR>
|
**Unique IDs are used internally to track active widgets and occasionally associate state to widgets.<BR>
|
||||||
Unique IDs are implicitly built from the hash of multiple elements that identify the "path" to the UI element.**
|
Unique IDs are implicitly built from the hash of multiple elements that identify the "path" to the UI element.**
|
||||||
@ -486,7 +486,7 @@ ImGui::End();
|
|||||||
|
|
||||||
### Q: How should I handle DPI in my application?
|
### Q: How should I handle DPI in my application?
|
||||||
|
|
||||||
The short answer is: obtain the desired DPI scale, load your fonts resized with that scale (always round down fonts size to nearest integer), and scale your Style structure accordingly using `style.ScaleAllSizes()`.
|
The short answer is: obtain the desired DPI scale, load your fonts resized with that scale (always round down fonts size to the nearest integer), and scale your Style structure accordingly using `style.ScaleAllSizes()`.
|
||||||
|
|
||||||
Your application may want to detect DPI change and reload the fonts and reset style between frames.
|
Your application may want to detect DPI change and reload the fonts and reset style between frames.
|
||||||
|
|
||||||
@ -564,7 +564,7 @@ io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8()
|
|||||||
ImFontConfig config;
|
ImFontConfig config;
|
||||||
config.OversampleH = 2;
|
config.OversampleH = 2;
|
||||||
config.OversampleV = 1;
|
config.OversampleV = 1;
|
||||||
config.GlyphOffset.y -= 1.0f; // Move everything by 1 pixels up
|
config.GlyphOffset.y -= 1.0f; // Move everything by 1 pixel up
|
||||||
config.GlyphExtraSpacing.x = 1.0f; // Increase spacing between characters
|
config.GlyphExtraSpacing.x = 1.0f; // Increase spacing between characters
|
||||||
io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels, &config);
|
io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels, &config);
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -152,7 +152,7 @@ void tick()
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -143,7 +143,7 @@
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -130,7 +130,7 @@ static void main_loop(void* arg)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -166,7 +166,7 @@ static void main_loop(void* window)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -115,7 +115,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -94,7 +94,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -115,7 +115,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -495,7 +495,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -38,7 +38,7 @@ void my_display_code()
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -28,7 +28,7 @@ int main(int, char**)
|
|||||||
{
|
{
|
||||||
// Setup SDL
|
// Setup SDL
|
||||||
// (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
|
// (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
|
||||||
// depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to latest version of SDL is recommended!)
|
// depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to the latest version of SDL is recommended!)
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
|
||||||
{
|
{
|
||||||
printf("Error: %s\n", SDL_GetError());
|
printf("Error: %s\n", SDL_GetError());
|
||||||
@ -120,7 +120,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -123,7 +123,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -19,7 +19,7 @@ int main(int, char**)
|
|||||||
{
|
{
|
||||||
// Setup SDL
|
// Setup SDL
|
||||||
// (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
|
// (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
|
||||||
// depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to latest version of SDL is recommended!)
|
// depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to the latest version of SDL is recommended!)
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
|
||||||
{
|
{
|
||||||
printf("Error: %s\n", SDL_GetError());
|
printf("Error: %s\n", SDL_GetError());
|
||||||
@ -101,7 +101,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -19,7 +19,7 @@ int main(int, char**)
|
|||||||
{
|
{
|
||||||
// Setup SDL
|
// Setup SDL
|
||||||
// (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
|
// (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
|
||||||
// depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to latest version of SDL is recommended!)
|
// depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to the latest version of SDL is recommended!)
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
|
||||||
{
|
{
|
||||||
printf("Error: %s\n", SDL_GetError());
|
printf("Error: %s\n", SDL_GetError());
|
||||||
@ -123,7 +123,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||||
|
|
||||||
// Important to understand: SDL_Renderer is an _optional_ component of SDL. We do not recommend you use SDL_Renderer
|
// Important to understand: SDL_Renderer is an _optional_ component of SDL. We do not recommend you use SDL_Renderer
|
||||||
// because it provide a rather limited API to the end-user. We provide this backend for the sake of completeness.
|
// because it provides a rather limited API to the end-user. We provide this backend for the sake of completeness.
|
||||||
// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
|
// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
@ -22,7 +22,7 @@ int main(int, char**)
|
|||||||
{
|
{
|
||||||
// Setup SDL
|
// Setup SDL
|
||||||
// (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
|
// (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
|
||||||
// depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to latest version of SDL is recommended!)
|
// depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to the latest version of SDL is recommended!)
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
|
||||||
{
|
{
|
||||||
printf("Error: %s\n", SDL_GetError());
|
printf("Error: %s\n", SDL_GetError());
|
||||||
@ -107,7 +107,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -496,7 +496,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -103,7 +103,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -103,7 +103,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -141,7 +141,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
@ -101,7 +101,7 @@ int main(int, char**)
|
|||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
48
imgui.cpp
48
imgui.cpp
@ -898,7 +898,7 @@ CODE
|
|||||||
#if defined(_MSC_VER) && _MSC_VER >= 1922 // MSVC 2019 16.2 or later
|
#if defined(_MSC_VER) && _MSC_VER >= 1922 // MSVC 2019 16.2 or later
|
||||||
#pragma warning (disable: 5054) // operator '|': deprecated between enumerations of different types
|
#pragma warning (disable: 5054) // operator '|': deprecated between enumerations of different types
|
||||||
#endif
|
#endif
|
||||||
#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).
|
#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to an 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).
|
||||||
#pragma warning (disable: 26495) // [Static Analyzer] Variable 'XXX' is uninitialized. Always initialize a member variable (type.6).
|
#pragma warning (disable: 26495) // [Static Analyzer] Variable 'XXX' is uninitialized. Always initialize a member variable (type.6).
|
||||||
#pragma warning (disable: 26812) // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).
|
#pragma warning (disable: 26812) // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).
|
||||||
#endif
|
#endif
|
||||||
@ -3519,7 +3519,7 @@ void ImGui::KeepAliveID(ImGuiID id)
|
|||||||
void ImGui::MarkItemEdited(ImGuiID id)
|
void ImGui::MarkItemEdited(ImGuiID id)
|
||||||
{
|
{
|
||||||
// This marking is solely to be able to provide info for IsItemDeactivatedAfterEdit().
|
// This marking is solely to be able to provide info for IsItemDeactivatedAfterEdit().
|
||||||
// ActiveId might have been released by the time we call this (as in the typical press/release button behavior) but still need need to fill the data.
|
// ActiveId might have been released by the time we call this (as in the typical press/release button behavior) but still need to fill the data.
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
IM_ASSERT(g.ActiveId == id || g.ActiveId == 0 || g.DragDropActive);
|
IM_ASSERT(g.ActiveId == id || g.ActiveId == 0 || g.DragDropActive);
|
||||||
IM_UNUSED(id); // Avoid unused variable warnings when asserts are compiled out.
|
IM_UNUSED(id); // Avoid unused variable warnings when asserts are compiled out.
|
||||||
@ -4627,7 +4627,7 @@ void ImGui::NewFrame()
|
|||||||
|
|
||||||
// Create implicit/fallback window - which we will only render it if the user has added something to it.
|
// Create implicit/fallback window - which we will only render it if the user has added something to it.
|
||||||
// We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags.
|
// We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags.
|
||||||
// This fallback is particularly important as it avoid ImGui:: calls from crashing.
|
// This fallback is particularly important as it prevents ImGui:: calls from crashing.
|
||||||
g.WithinFrameScopeWithImplicitWindow = true;
|
g.WithinFrameScopeWithImplicitWindow = true;
|
||||||
SetNextWindowSize(ImVec2(400, 400), ImGuiCond_FirstUseEver);
|
SetNextWindowSize(ImVec2(400, 400), ImGuiCond_FirstUseEver);
|
||||||
Begin("Debug##Default");
|
Begin("Debug##Default");
|
||||||
@ -5358,7 +5358,7 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
|
|||||||
ImVec2 size = ImFloor(size_arg);
|
ImVec2 size = ImFloor(size_arg);
|
||||||
const int auto_fit_axises = ((size.x == 0.0f) ? (1 << ImGuiAxis_X) : 0x00) | ((size.y == 0.0f) ? (1 << ImGuiAxis_Y) : 0x00);
|
const int auto_fit_axises = ((size.x == 0.0f) ? (1 << ImGuiAxis_X) : 0x00) | ((size.y == 0.0f) ? (1 << ImGuiAxis_Y) : 0x00);
|
||||||
if (size.x <= 0.0f)
|
if (size.x <= 0.0f)
|
||||||
size.x = ImMax(content_avail.x + size.x, 4.0f); // Arbitrary minimum child size (0.0f causing too much issues)
|
size.x = ImMax(content_avail.x + size.x, 4.0f); // Arbitrary minimum child size (0.0f causing too many issues)
|
||||||
if (size.y <= 0.0f)
|
if (size.y <= 0.0f)
|
||||||
size.y = ImMax(content_avail.y + size.y, 4.0f);
|
size.y = ImMax(content_avail.y + size.y, 4.0f);
|
||||||
SetNextWindowSize(size);
|
SetNextWindowSize(size);
|
||||||
@ -5762,7 +5762,7 @@ ImGuiID ImGui::GetWindowResizeBorderID(ImGuiWindow* window, ImGuiDir dir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle resize for: Resize Grips, Borders, Gamepad
|
// Handle resize for: Resize Grips, Borders, Gamepad
|
||||||
// Return true when using auto-fit (double click on resize grip)
|
// Return true when using auto-fit (double-click on resize grip)
|
||||||
static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect& visibility_rect)
|
static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect& visibility_rect)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
@ -5770,7 +5770,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
|
|||||||
|
|
||||||
if ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0)
|
if ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0)
|
||||||
return false;
|
return false;
|
||||||
if (window->WasActive == false) // Early out to avoid running this code for e.g. an hidden implicit/fallback Debug window.
|
if (window->WasActive == false) // Early out to avoid running this code for e.g. a hidden implicit/fallback Debug window.
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool ret_auto_fit = false;
|
bool ret_auto_fit = false;
|
||||||
@ -5949,7 +5949,7 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar
|
|||||||
window->SkipItems = false;
|
window->SkipItems = false;
|
||||||
|
|
||||||
// Draw window + handle manual resize
|
// Draw window + handle manual resize
|
||||||
// As we highlight the title bar when want_focus is set, multiple reappearing windows will have have their title bar highlighted on their reappearing frame.
|
// As we highlight the title bar when want_focus is set, multiple reappearing windows will have their title bar highlighted on their reappearing frame.
|
||||||
const float window_rounding = window->WindowRounding;
|
const float window_rounding = window->WindowRounding;
|
||||||
const float window_border_size = window->WindowBorderSize;
|
const float window_border_size = window->WindowBorderSize;
|
||||||
if (window->Collapsed)
|
if (window->Collapsed)
|
||||||
@ -6571,7 +6571,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UPDATE RECTANGLES (1- THOSE NOT AFFECTED BY SCROLLING)
|
// UPDATE RECTANGLES (1- THOSE NOT AFFECTED BY SCROLLING)
|
||||||
// Update various regions. Variables they depends on should be set above in this function.
|
// Update various regions. Variables they depend on should be set above in this function.
|
||||||
// We set this up after processing the resize grip so that our rectangles doesn't lag by a frame.
|
// We set this up after processing the resize grip so that our rectangles doesn't lag by a frame.
|
||||||
|
|
||||||
// Outer rectangle
|
// Outer rectangle
|
||||||
@ -7593,7 +7593,7 @@ void ImGui::SetItemDefaultFocus()
|
|||||||
g.NavInitResultRectRel = WindowRectAbsToRel(window, g.LastItemData.Rect);
|
g.NavInitResultRectRel = WindowRectAbsToRel(window, g.LastItemData.Rect);
|
||||||
NavUpdateAnyRequestFlag();
|
NavUpdateAnyRequestFlag();
|
||||||
|
|
||||||
// Scroll could be done in NavInitRequestApplyResult() via a opt-in flag (we however don't want regular init requests to scroll)
|
// Scroll could be done in NavInitRequestApplyResult() via an opt-in flag (we however don't want regular init requests to scroll)
|
||||||
if (!IsItemVisible())
|
if (!IsItemVisible())
|
||||||
ScrollToRectEx(window, g.LastItemData.Rect, ImGuiScrollFlags_None);
|
ScrollToRectEx(window, g.LastItemData.Rect, ImGuiScrollFlags_None);
|
||||||
}
|
}
|
||||||
@ -7846,7 +7846,7 @@ int ImGui::GetKeyPressedAmount(ImGuiKey key, float repeat_delay, float repeat_ra
|
|||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
const ImGuiKeyData* key_data = GetKeyData(key);
|
const ImGuiKeyData* key_data = GetKeyData(key);
|
||||||
if (!key_data->Down) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitate eating mechanism (until we finish work on input ownership)
|
if (!key_data->Down) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on input ownership)
|
||||||
return 0;
|
return 0;
|
||||||
const float t = key_data->DownDuration;
|
const float t = key_data->DownDuration;
|
||||||
return CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, repeat_delay, repeat_rate);
|
return CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, repeat_delay, repeat_rate);
|
||||||
@ -7880,7 +7880,7 @@ bool ImGui::IsKeyPressed(ImGuiKey key, bool repeat)
|
|||||||
bool ImGui::IsKeyPressedEx(ImGuiKey key, ImGuiInputFlags flags)
|
bool ImGui::IsKeyPressedEx(ImGuiKey key, ImGuiInputFlags flags)
|
||||||
{
|
{
|
||||||
const ImGuiKeyData* key_data = GetKeyData(key);
|
const ImGuiKeyData* key_data = GetKeyData(key);
|
||||||
if (!key_data->Down) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitate eating mechanism (until we finish work on input ownership)
|
if (!key_data->Down) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on input ownership)
|
||||||
return false;
|
return false;
|
||||||
const float t = key_data->DownDuration;
|
const float t = key_data->DownDuration;
|
||||||
if (t < 0.0f)
|
if (t < 0.0f)
|
||||||
@ -7918,7 +7918,7 @@ bool ImGui::IsMouseClicked(ImGuiMouseButton button, bool repeat)
|
|||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
||||||
if (!g.IO.MouseDown[button]) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitate eating mechanism (until we finish work on input ownership)
|
if (!g.IO.MouseDown[button]) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on input ownership)
|
||||||
return false;
|
return false;
|
||||||
const float t = g.IO.MouseDownDuration[button];
|
const float t = g.IO.MouseDownDuration[button];
|
||||||
if (t == 0.0f)
|
if (t == 0.0f)
|
||||||
@ -8955,7 +8955,7 @@ void ImGui::EndGroup()
|
|||||||
ItemAdd(group_bb, 0, NULL, ImGuiItemFlags_NoTabStop);
|
ItemAdd(group_bb, 0, NULL, ImGuiItemFlags_NoTabStop);
|
||||||
|
|
||||||
// If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive(), IsItemDeactivated() etc. will be functional on the entire group.
|
// If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive(), IsItemDeactivated() etc. will be functional on the entire group.
|
||||||
// It would be be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but would put a little more burden on individual widgets.
|
// It would be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but would put a little more burden on individual widgets.
|
||||||
// Also if you grep for LastItemId you'll notice it is only used in that context.
|
// Also if you grep for LastItemId you'll notice it is only used in that context.
|
||||||
// (The two tests not the same because ActiveIdIsAlive is an ID itself, in order to be able to handle ActiveId being overwritten during the frame.)
|
// (The two tests not the same because ActiveIdIsAlive is an ID itself, in order to be able to handle ActiveId being overwritten during the frame.)
|
||||||
const bool group_contains_curr_active_id = (group_data.BackupActiveIdIsAlive != g.ActiveId) && (g.ActiveIdIsAlive == g.ActiveId) && g.ActiveId;
|
const bool group_contains_curr_active_id = (group_data.BackupActiveIdIsAlive != g.ActiveId) && (g.ActiveIdIsAlive == g.ActiveId) && g.ActiveId;
|
||||||
@ -9174,7 +9174,7 @@ void ImGui::SetScrollY(float scroll_y)
|
|||||||
// - local_pos = (absolution_pos - window->Pos)
|
// - local_pos = (absolution_pos - window->Pos)
|
||||||
// - So local_x/local_y are 0.0f for a position at the upper-left corner of a window,
|
// - So local_x/local_y are 0.0f for a position at the upper-left corner of a window,
|
||||||
// and generally local_x/local_y are >(padding+decoration) && <(size-padding-decoration) when in the visible area.
|
// and generally local_x/local_y are >(padding+decoration) && <(size-padding-decoration) when in the visible area.
|
||||||
// - They mostly exists because of legacy API.
|
// - They mostly exist because of legacy API.
|
||||||
// Following the rules above, when trying to work with scrolling code, consider that:
|
// Following the rules above, when trying to work with scrolling code, consider that:
|
||||||
// - SetScrollFromPosY(0.0f) == SetScrollY(0.0f + scroll.y) == has no effect!
|
// - SetScrollFromPosY(0.0f) == SetScrollY(0.0f + scroll.y) == has no effect!
|
||||||
// - SetScrollFromPosY(-scroll.y) == SetScrollY(-scroll.y + scroll.y) == SetScrollY(0.0f) == reset scroll. Of course writing SetScrollY(0.0f) directly then makes more sense
|
// - SetScrollFromPosY(-scroll.y) == SetScrollY(-scroll.y + scroll.y) == SetScrollY(0.0f) == reset scroll. Of course writing SetScrollY(0.0f) directly then makes more sense
|
||||||
@ -9755,7 +9755,7 @@ ImVec2 ImGui::FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& s
|
|||||||
const float avail_w = (dir == ImGuiDir_Left ? r_avoid.Min.x : r_outer.Max.x) - (dir == ImGuiDir_Right ? r_avoid.Max.x : r_outer.Min.x);
|
const float avail_w = (dir == ImGuiDir_Left ? r_avoid.Min.x : r_outer.Max.x) - (dir == ImGuiDir_Right ? r_avoid.Max.x : r_outer.Min.x);
|
||||||
const float avail_h = (dir == ImGuiDir_Up ? r_avoid.Min.y : r_outer.Max.y) - (dir == ImGuiDir_Down ? r_avoid.Max.y : r_outer.Min.y);
|
const float avail_h = (dir == ImGuiDir_Up ? r_avoid.Min.y : r_outer.Max.y) - (dir == ImGuiDir_Down ? r_avoid.Max.y : r_outer.Min.y);
|
||||||
|
|
||||||
// If there not enough room on one axis, there's no point in positioning on a side on this axis (e.g. when not enough width, use a top/bottom position to maximize available width)
|
// If there's not enough room on one axis, there's no point in positioning on a side on this axis (e.g. when not enough width, use a top/bottom position to maximize available width)
|
||||||
if (avail_w < size.x && (dir == ImGuiDir_Left || dir == ImGuiDir_Right))
|
if (avail_w < size.x && (dir == ImGuiDir_Left || dir == ImGuiDir_Right))
|
||||||
continue;
|
continue;
|
||||||
if (avail_h < size.y && (dir == ImGuiDir_Up || dir == ImGuiDir_Down))
|
if (avail_h < size.y && (dir == ImGuiDir_Up || dir == ImGuiDir_Down))
|
||||||
@ -9947,7 +9947,7 @@ static bool ImGui::NavScoreItem(ImGuiNavItemData* result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We perform scoring on items bounding box clipped by the current clipping rectangle on the other axis (clipping on our movement axis would give us equal scores for all clipped items)
|
// We perform scoring on items bounding box clipped by the current clipping rectangle on the other axis (clipping on our movement axis would give us equal scores for all clipped items)
|
||||||
// For example, this ensure that items in one column are not reached when moving vertically from items in another column.
|
// For example, this ensures that items in one column are not reached when moving vertically from items in another column.
|
||||||
NavClampRectToVisibleAreaForMoveDir(g.NavMoveClipDir, cand, window->ClipRect);
|
NavClampRectToVisibleAreaForMoveDir(g.NavMoveClipDir, cand, window->ClipRect);
|
||||||
|
|
||||||
// Compute distance between boxes
|
// Compute distance between boxes
|
||||||
@ -10011,7 +10011,7 @@ static bool ImGui::NavScoreItem(ImGuiNavItemData* result)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Is it in the quadrant we're interesting in moving to?
|
// Is it in the quadrant we're interested in moving to?
|
||||||
bool new_best = false;
|
bool new_best = false;
|
||||||
const ImGuiDir move_dir = g.NavMoveDir;
|
const ImGuiDir move_dir = g.NavMoveDir;
|
||||||
if (quadrant == move_dir)
|
if (quadrant == move_dir)
|
||||||
@ -10636,7 +10636,7 @@ void ImGui::NavUpdateCreateMoveRequest()
|
|||||||
if (g.NavMoveDir != ImGuiDir_None)
|
if (g.NavMoveDir != ImGuiDir_None)
|
||||||
NavMoveRequestSubmit(g.NavMoveDir, g.NavMoveClipDir, g.NavMoveFlags, g.NavMoveScrollFlags);
|
NavMoveRequestSubmit(g.NavMoveDir, g.NavMoveClipDir, g.NavMoveFlags, g.NavMoveScrollFlags);
|
||||||
|
|
||||||
// Moving with no reference triggers a init request (will be used as a fallback if the direction fails to find a match)
|
// Moving with no reference triggers an init request (will be used as a fallback if the direction fails to find a match)
|
||||||
if (g.NavMoveSubmitted && g.NavId == 0)
|
if (g.NavMoveSubmitted && g.NavId == 0)
|
||||||
{
|
{
|
||||||
IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from move, window \"%s\", layer=%d\n", window ? window->Name : "<NULL>", g.NavLayer);
|
IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from move, window \"%s\", layer=%d\n", window ? window->Name : "<NULL>", g.NavLayer);
|
||||||
@ -10646,7 +10646,7 @@ void ImGui::NavUpdateCreateMoveRequest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// When using gamepad, we project the reference nav bounding box into window visible area.
|
// When using gamepad, we project the reference nav bounding box into window visible area.
|
||||||
// This is to allow resuming navigation inside the visible area after doing a large amount of scrolling, since with gamepad every movements are relative
|
// This is to allow resuming navigation inside the visible area after doing a large amount of scrolling, since with gamepad all movements are relative
|
||||||
// (can't focus a visible object like we can with the mouse).
|
// (can't focus a visible object like we can with the mouse).
|
||||||
if (g.NavMoveSubmitted && g.NavInputSource == ImGuiInputSource_Gamepad && g.NavLayer == ImGuiNavLayer_Main && window != NULL)// && (g.NavMoveFlags & ImGuiNavMoveFlags_Forwarded))
|
if (g.NavMoveSubmitted && g.NavInputSource == ImGuiInputSource_Gamepad && g.NavLayer == ImGuiNavLayer_Main && window != NULL)// && (g.NavMoveFlags & ImGuiNavMoveFlags_Forwarded))
|
||||||
{
|
{
|
||||||
@ -10676,7 +10676,7 @@ void ImGui::NavUpdateCreateMoveRequest()
|
|||||||
scoring_rect.TranslateY(scoring_rect_offset_y);
|
scoring_rect.TranslateY(scoring_rect_offset_y);
|
||||||
scoring_rect.Min.x = ImMin(scoring_rect.Min.x + 1.0f, scoring_rect.Max.x);
|
scoring_rect.Min.x = ImMin(scoring_rect.Min.x + 1.0f, scoring_rect.Max.x);
|
||||||
scoring_rect.Max.x = scoring_rect.Min.x;
|
scoring_rect.Max.x = scoring_rect.Min.x;
|
||||||
IM_ASSERT(!scoring_rect.IsInverted()); // Ensure if we have a finite, non-inverted bounding box here will allows us to remove extraneous ImFabs() calls in NavScoreItem().
|
IM_ASSERT(!scoring_rect.IsInverted()); // Ensure if we have a finite, non-inverted bounding box here will allow us to remove extraneous ImFabs() calls in NavScoreItem().
|
||||||
//GetForegroundDrawList()->AddRect(scoring_rect.Min, scoring_rect.Max, IM_COL32(255,200,0,255)); // [DEBUG]
|
//GetForegroundDrawList()->AddRect(scoring_rect.Min, scoring_rect.Max, IM_COL32(255,200,0,255)); // [DEBUG]
|
||||||
//if (!g.NavScoringNoClipRect.IsInverted()) { GetForegroundDrawList()->AddRect(g.NavScoringNoClipRect.Min, g.NavScoringNoClipRect.Max, IM_COL32(255, 200, 0, 255)); } // [DEBUG]
|
//if (!g.NavScoringNoClipRect.IsInverted()) { GetForegroundDrawList()->AddRect(g.NavScoringNoClipRect.Min, g.NavScoringNoClipRect.Max, IM_COL32(255, 200, 0, 255)); } // [DEBUG]
|
||||||
}
|
}
|
||||||
@ -10725,7 +10725,7 @@ void ImGui::NavMoveRequestApplyResult()
|
|||||||
if ((g.NavTabbingCounter == 1 || g.NavTabbingDir == 0) && g.NavTabbingResultFirst.ID)
|
if ((g.NavTabbingCounter == 1 || g.NavTabbingDir == 0) && g.NavTabbingResultFirst.ID)
|
||||||
result = &g.NavTabbingResultFirst;
|
result = &g.NavTabbingResultFirst;
|
||||||
|
|
||||||
// In a situation when there is no results but NavId != 0, re-enable the Navigation highlight (because g.NavId is not considered as a possible result)
|
// In a situation when there are no results but NavId != 0, re-enable the Navigation highlight (because g.NavId is not considered as a possible result)
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
{
|
{
|
||||||
if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing)
|
if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing)
|
||||||
@ -11488,7 +11488,7 @@ bool ImGui::BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We don't use BeginDragDropTargetCustom() and duplicate its code because:
|
// We don't use BeginDragDropTargetCustom() and duplicate its code because:
|
||||||
// 1) we use LastItemRectHoveredRect which handles items that pushes a temporarily clip rectangle in their code. Calling BeginDragDropTargetCustom(LastItemRect) would not handle them.
|
// 1) we use LastItemRectHoveredRect which handles items that push a temporarily clip rectangle in their code. Calling BeginDragDropTargetCustom(LastItemRect) would not handle them.
|
||||||
// 2) and it's faster. as this code may be very frequently called, we want to early out as fast as we can.
|
// 2) and it's faster. as this code may be very frequently called, we want to early out as fast as we can.
|
||||||
// Also note how the HoveredWindow test is positioned differently in both functions (in both functions we optimize for the cheapest early out case)
|
// Also note how the HoveredWindow test is positioned differently in both functions (in both functions we optimize for the cheapest early out case)
|
||||||
bool ImGui::BeginDragDropTarget()
|
bool ImGui::BeginDragDropTarget()
|
||||||
@ -11552,7 +11552,7 @@ const ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDrop
|
|||||||
// Render default drop visuals
|
// Render default drop visuals
|
||||||
// FIXME-DRAGDROP: Settle on a proper default visuals for drop target.
|
// FIXME-DRAGDROP: Settle on a proper default visuals for drop target.
|
||||||
payload.Preview = was_accepted_previously;
|
payload.Preview = was_accepted_previously;
|
||||||
flags |= (g.DragDropSourceFlags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect); // Source can also inhibit the preview (useful for external sources that lives for 1 frame)
|
flags |= (g.DragDropSourceFlags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect); // Source can also inhibit the preview (useful for external sources that live for 1 frame)
|
||||||
if (!(flags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect) && payload.Preview)
|
if (!(flags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect) && payload.Preview)
|
||||||
window->DrawList->AddRect(r.Min - ImVec2(3.5f,3.5f), r.Max + ImVec2(3.5f, 3.5f), GetColorU32(ImGuiCol_DragDropTarget), 0.0f, 0, 2.0f);
|
window->DrawList->AddRect(r.Min - ImVec2(3.5f,3.5f), r.Max + ImVec2(3.5f, 3.5f), GetColorU32(ImGuiCol_DragDropTarget), 0.0f, 0, 2.0f);
|
||||||
|
|
||||||
@ -13502,7 +13502,7 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat
|
|||||||
ImGuiStackTool* tool = &g.DebugStackTool;
|
ImGuiStackTool* tool = &g.DebugStackTool;
|
||||||
|
|
||||||
// Step 0: stack query
|
// Step 0: stack query
|
||||||
// This assume that the ID was computed with the current ID stack, which tends to be the case for our widget.
|
// This assumes that the ID was computed with the current ID stack, which tends to be the case for our widget.
|
||||||
if (tool->StackLevel == -1)
|
if (tool->StackLevel == -1)
|
||||||
{
|
{
|
||||||
tool->StackLevel++;
|
tool->StackLevel++;
|
||||||
|
@ -94,7 +94,7 @@ Index of this file:
|
|||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning (disable: 4127) // condition expression is constant
|
#pragma warning (disable: 4127) // condition expression is constant
|
||||||
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
||||||
#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).
|
#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to an 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2).
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Clang/GCC warnings with -Weverything
|
// Clang/GCC warnings with -Weverything
|
||||||
@ -1008,7 +1008,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
// Note that characters values are preserved even by InputText() if the font cannot be displayed,
|
// Note that characters values are preserved even by InputText() if the font cannot be displayed,
|
||||||
// so you can safely copy & paste garbled characters into another application.
|
// so you can safely copy & paste garbled characters into another application.
|
||||||
ImGui::TextWrapped(
|
ImGui::TextWrapped(
|
||||||
"CJK text will only appears if the font was loaded with the appropriate CJK character ranges. "
|
"CJK text will only appear if the font was loaded with the appropriate CJK character ranges. "
|
||||||
"Call io.Fonts->AddFontFromFileTTF() manually to load extra character ranges. "
|
"Call io.Fonts->AddFontFromFileTTF() manually to load extra character ranges. "
|
||||||
"Read docs/FONTS.md for details.");
|
"Read docs/FONTS.md for details.");
|
||||||
ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)"); // Normally we would use u8"blah blah" with the proper characters directly in the string.
|
ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)"); // Normally we would use u8"blah blah" with the proper characters directly in the string.
|
||||||
@ -1471,7 +1471,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
static char buf3[64];
|
static char buf3[64];
|
||||||
static int edit_count = 0;
|
static int edit_count = 0;
|
||||||
ImGui::InputText("Edit", buf3, 64, ImGuiInputTextFlags_CallbackEdit, Funcs::MyCallback, (void*)&edit_count);
|
ImGui::InputText("Edit", buf3, 64, ImGuiInputTextFlags_CallbackEdit, Funcs::MyCallback, (void*)&edit_count);
|
||||||
ImGui::SameLine(); HelpMarker("Here we toggle the casing of the first character on every edits + count edits.");
|
ImGui::SameLine(); HelpMarker("Here we toggle the casing of the first character on every edit + count edits.");
|
||||||
ImGui::SameLine(); ImGui::Text("(%d)", edit_count);
|
ImGui::SameLine(); ImGui::Text("(%d)", edit_count);
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
@ -2041,7 +2041,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
ImGui::Text("Drags:");
|
ImGui::Text("Drags:");
|
||||||
ImGui::Checkbox("Clamp integers to 0..50", &drag_clamp);
|
ImGui::Checkbox("Clamp integers to 0..50", &drag_clamp);
|
||||||
ImGui::SameLine(); HelpMarker(
|
ImGui::SameLine(); HelpMarker(
|
||||||
"As with every widgets in dear imgui, we never modify values unless there is a user interaction.\n"
|
"As with every widget in dear imgui, we never modify values unless there is a user interaction.\n"
|
||||||
"You can override the clamping limits by using CTRL+Click to input a value.");
|
"You can override the clamping limits by using CTRL+Click to input a value.");
|
||||||
ImGui::DragScalar("drag s8", ImGuiDataType_S8, &s8_v, drag_speed, drag_clamp ? &s8_zero : NULL, drag_clamp ? &s8_fifty : NULL);
|
ImGui::DragScalar("drag s8", ImGuiDataType_S8, &s8_v, drag_speed, drag_clamp ? &s8_zero : NULL, drag_clamp ? &s8_fifty : NULL);
|
||||||
ImGui::DragScalar("drag u8", ImGuiDataType_U8, &u8_v, drag_speed, drag_clamp ? &u8_zero : NULL, drag_clamp ? &u8_fifty : NULL, "%u ms");
|
ImGui::DragScalar("drag u8", ImGuiDataType_U8, &u8_v, drag_speed, drag_clamp ? &u8_zero : NULL, drag_clamp ? &u8_fifty : NULL, "%u ms");
|
||||||
@ -3860,7 +3860,7 @@ static void ShowDemoWindowTables()
|
|||||||
// as TableNextColumn() will automatically wrap around and create new rows as needed.
|
// as TableNextColumn() will automatically wrap around and create new rows as needed.
|
||||||
// This is generally more convenient when your cells all contains the same type of data.
|
// This is generally more convenient when your cells all contains the same type of data.
|
||||||
HelpMarker(
|
HelpMarker(
|
||||||
"Only using TableNextColumn(), which tends to be convenient for tables where every cells contains the same type of contents.\n"
|
"Only using TableNextColumn(), which tends to be convenient for tables where every cell contains the same type of contents.\n"
|
||||||
"This is also more similar to the old NextColumn() function of the Columns API, and provided to facilitate the Columns->Tables API transition.");
|
"This is also more similar to the old NextColumn() function of the Columns API, and provided to facilitate the Columns->Tables API transition.");
|
||||||
if (ImGui::BeginTable("table3", 3))
|
if (ImGui::BeginTable("table3", 3))
|
||||||
{
|
{
|
||||||
@ -3912,7 +3912,7 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::SameLine(); ImGui::RadioButton("Text", &contents_type, CT_Text);
|
ImGui::SameLine(); ImGui::RadioButton("Text", &contents_type, CT_Text);
|
||||||
ImGui::SameLine(); ImGui::RadioButton("FillButton", &contents_type, CT_FillButton);
|
ImGui::SameLine(); ImGui::RadioButton("FillButton", &contents_type, CT_FillButton);
|
||||||
ImGui::Checkbox("Display headers", &display_headers);
|
ImGui::Checkbox("Display headers", &display_headers);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appears in Headers");
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appear in Headers");
|
||||||
PopStyleCompact();
|
PopStyleCompact();
|
||||||
|
|
||||||
if (ImGui::BeginTable("table1", 3, flags))
|
if (ImGui::BeginTable("table1", 3, flags))
|
||||||
@ -4074,7 +4074,7 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::CheckboxFlags("ImGuiTableFlags_Reorderable", &flags, ImGuiTableFlags_Reorderable);
|
ImGui::CheckboxFlags("ImGuiTableFlags_Reorderable", &flags, ImGuiTableFlags_Reorderable);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_Hideable", &flags, ImGuiTableFlags_Hideable);
|
ImGui::CheckboxFlags("ImGuiTableFlags_Hideable", &flags, ImGuiTableFlags_Hideable);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody);
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBodyUntilResize", &flags, ImGuiTableFlags_NoBordersInBodyUntilResize); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers)");
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBodyUntilResize", &flags, ImGuiTableFlags_NoBordersInBodyUntilResize); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body until hovered for resize (borders will always appear in Headers)");
|
||||||
PopStyleCompact();
|
PopStyleCompact();
|
||||||
|
|
||||||
if (ImGui::BeginTable("table1", 3, flags))
|
if (ImGui::BeginTable("table1", 3, flags))
|
||||||
@ -4132,7 +4132,7 @@ static void ShowDemoWindowTables()
|
|||||||
"- any form of row selection\n"
|
"- any form of row selection\n"
|
||||||
"Because of this, activating BorderOuterV sets the default to PadOuterX. Using PadOuterX or NoPadOuterX you can override the default.\n\n"
|
"Because of this, activating BorderOuterV sets the default to PadOuterX. Using PadOuterX or NoPadOuterX you can override the default.\n\n"
|
||||||
"Actual padding values are using style.CellPadding.\n\n"
|
"Actual padding values are using style.CellPadding.\n\n"
|
||||||
"In this demo we don't show horizontal borders to emphasis how they don't affect default horizontal padding.");
|
"In this demo we don't show horizontal borders to emphasize how they don't affect default horizontal padding.");
|
||||||
|
|
||||||
static ImGuiTableFlags flags1 = ImGuiTableFlags_BordersV;
|
static ImGuiTableFlags flags1 = ImGuiTableFlags_BordersV;
|
||||||
PushStyleCompact();
|
PushStyleCompact();
|
||||||
@ -4601,7 +4601,7 @@ static void ShowDemoWindowTables()
|
|||||||
IMGUI_DEMO_MARKER("Tables/Nested tables");
|
IMGUI_DEMO_MARKER("Tables/Nested tables");
|
||||||
if (ImGui::TreeNode("Nested tables"))
|
if (ImGui::TreeNode("Nested tables"))
|
||||||
{
|
{
|
||||||
HelpMarker("This demonstrate embedding a table into another table cell.");
|
HelpMarker("This demonstrates embedding a table into another table cell.");
|
||||||
|
|
||||||
if (ImGui::BeginTable("table_nested1", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
|
if (ImGui::BeginTable("table_nested1", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
|
||||||
{
|
{
|
||||||
@ -4646,7 +4646,7 @@ static void ShowDemoWindowTables()
|
|||||||
IMGUI_DEMO_MARKER("Tables/Row height");
|
IMGUI_DEMO_MARKER("Tables/Row height");
|
||||||
if (ImGui::TreeNode("Row height"))
|
if (ImGui::TreeNode("Row height"))
|
||||||
{
|
{
|
||||||
HelpMarker("You can pass a 'min_row_height' to TableNextRow().\n\nRows are padded with 'style.CellPadding.y' on top and bottom, so effectively the minimum row height will always be >= 'style.CellPadding.y * 2.0f'.\n\nWe cannot honor a _maximum_ row height as that would requires a unique clipping rectangle per row.");
|
HelpMarker("You can pass a 'min_row_height' to TableNextRow().\n\nRows are padded with 'style.CellPadding.y' on top and bottom, so effectively the minimum row height will always be >= 'style.CellPadding.y * 2.0f'.\n\nWe cannot honor a _maximum_ row height as that would require a unique clipping rectangle per row.");
|
||||||
if (ImGui::BeginTable("table_row_height", 1, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersInnerV))
|
if (ImGui::BeginTable("table_row_height", 1, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersInnerV))
|
||||||
{
|
{
|
||||||
for (int row = 0; row < 10; row++)
|
for (int row = 0; row < 10; row++)
|
||||||
@ -5208,7 +5208,7 @@ static void ShowDemoWindowTables()
|
|||||||
static bool show_headers = true;
|
static bool show_headers = true;
|
||||||
static bool show_wrapped_text = false;
|
static bool show_wrapped_text = false;
|
||||||
//static ImGuiTextFilter filter;
|
//static ImGuiTextFilter filter;
|
||||||
//ImGui::SetNextItemOpen(true, ImGuiCond_Once); // FIXME-TABLE: Enabling this results in initial clipped first pass on table which tend to affects column sizing
|
//ImGui::SetNextItemOpen(true, ImGuiCond_Once); // FIXME-TABLE: Enabling this results in initial clipped first pass on table which tend to affect column sizing
|
||||||
if (ImGui::TreeNode("Options"))
|
if (ImGui::TreeNode("Options"))
|
||||||
{
|
{
|
||||||
// Make the UI compact because there are so many fields
|
// Make the UI compact because there are so many fields
|
||||||
@ -5235,8 +5235,8 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersH", &flags, ImGuiTableFlags_BordersH);
|
ImGui::CheckboxFlags("ImGuiTableFlags_BordersH", &flags, ImGuiTableFlags_BordersH);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuterH", &flags, ImGuiTableFlags_BordersOuterH);
|
ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuterH", &flags, ImGuiTableFlags_BordersOuterH);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersInnerH", &flags, ImGuiTableFlags_BordersInnerH);
|
ImGui::CheckboxFlags("ImGuiTableFlags_BordersInnerH", &flags, ImGuiTableFlags_BordersInnerH);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appears in Headers");
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appear in Headers");
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBodyUntilResize", &flags, ImGuiTableFlags_NoBordersInBodyUntilResize); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers)");
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBodyUntilResize", &flags, ImGuiTableFlags_NoBordersInBodyUntilResize); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body until hovered for resize (borders will always appear in Headers)");
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5299,7 +5299,7 @@ static void ShowDemoWindowTables()
|
|||||||
HelpMarker("If scrolling is disabled (ScrollX and ScrollY not set):\n"
|
HelpMarker("If scrolling is disabled (ScrollX and ScrollY not set):\n"
|
||||||
"- The table is output directly in the parent window.\n"
|
"- The table is output directly in the parent window.\n"
|
||||||
"- OuterSize.x < 0.0f will right-align the table.\n"
|
"- OuterSize.x < 0.0f will right-align the table.\n"
|
||||||
"- OuterSize.x = 0.0f will narrow fit the table unless there are any Stretch column.\n"
|
"- OuterSize.x = 0.0f will narrow fit the table unless there are any Stretch columns.\n"
|
||||||
"- OuterSize.y then becomes the minimum size for the table, which will extend vertically if there are more rows (unless NoHostExtendY is set).");
|
"- OuterSize.y then becomes the minimum size for the table, which will extend vertically if there are more rows (unless NoHostExtendY is set).");
|
||||||
|
|
||||||
// From a user point of view we will tend to use 'inner_width' differently depending on whether our table is embedding scrolling.
|
// From a user point of view we will tend to use 'inner_width' differently depending on whether our table is embedding scrolling.
|
||||||
@ -7472,7 +7472,7 @@ static void ShowExampleAppFullscreen(bool* p_open)
|
|||||||
// [SECTION] Example App: Manipulating Window Titles / ShowExampleAppWindowTitles()
|
// [SECTION] Example App: Manipulating Window Titles / ShowExampleAppWindowTitles()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Demonstrate using of "##" and "###" in identifiers to manipulate ID generation.
|
// Demonstrate the use of "##" and "###" in identifiers to manipulate ID generation.
|
||||||
// This applies to all regular items as well.
|
// This applies to all regular items as well.
|
||||||
// Read FAQ section "How can I have multiple widgets with the same label?" for details.
|
// Read FAQ section "How can I have multiple widgets with the same label?" for details.
|
||||||
static void ShowExampleAppWindowTitles(bool*)
|
static void ShowExampleAppWindowTitles(bool*)
|
||||||
|
Loading…
Reference in New Issue
Block a user