Revision 932a86a1
Added by david.sorber over 1 year ago
| src/imgui/imgui.cpp | ||
|---|---|---|
|
// dear imgui, v1.90.2 WIP
|
||
|
// dear imgui, v1.91.5
|
||
|
// (main code and documentation)
|
||
|
|
||
|
// Help:
|
||
| ... | ... | |
|
// - Read top of imgui.cpp for more details, links and comments.
|
||
|
|
||
|
// Resources:
|
||
|
// - FAQ https://dearimgui.com/faq
|
||
|
// - Getting Started https://dearimgui.com/getting-started
|
||
|
// - Homepage https://github.com/ocornut/imgui
|
||
|
// - Releases & changelog https://github.com/ocornut/imgui/releases
|
||
|
// - Gallery https://github.com/ocornut/imgui/issues/6897 (please post your screenshots/video there!)
|
||
|
// - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there)
|
||
|
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
||
|
// - Issues & support https://github.com/ocornut/imgui/issues
|
||
|
// - Tests & Automation https://github.com/ocornut/imgui_test_engine
|
||
|
// - FAQ ........................ https://dearimgui.com/faq (in repository as docs/FAQ.md)
|
||
|
// - Homepage ................... https://github.com/ocornut/imgui
|
||
|
// - Releases & changelog ....... https://github.com/ocornut/imgui/releases
|
||
|
// - Gallery .................... https://github.com/ocornut/imgui/issues?q=label%3Agallery (please post your screenshots/video there!)
|
||
|
// - Wiki ....................... https://github.com/ocornut/imgui/wiki (lots of good stuff there)
|
||
|
// - Getting Started https://github.com/ocornut/imgui/wiki/Getting-Started (how to integrate in an existing app by adding ~25 lines of code)
|
||
|
// - Third-party Extensions https://github.com/ocornut/imgui/wiki/Useful-Extensions (ImPlot & many more)
|
||
|
// - Bindings/Backends https://github.com/ocornut/imgui/wiki/Bindings (language bindings, backends for various tech/engines)
|
||
|
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
||
|
// - Debug Tools https://github.com/ocornut/imgui/wiki/Debug-Tools
|
||
|
// - Software using Dear ImGui https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui
|
||
|
// - Issues & support ........... https://github.com/ocornut/imgui/issues
|
||
|
// - Test Engine & Automation ... https://github.com/ocornut/imgui_test_engine (test suite, test engine to automate your apps)
|
||
|
|
||
|
// For first-time users having issues compiling/linking/running/loading fonts:
|
||
|
// please post in https://github.com/ocornut/imgui/discussions if you cannot find a solution in resources above.
|
||
| ... | ... | |
|
// See LICENSE.txt for copyright and licensing details (standard MIT License).
|
||
|
// This library is free but needs your support to sustain development and maintenance.
|
||
|
// Businesses: you can support continued development via B2B invoiced technical support, maintenance and sponsoring contracts.
|
||
|
// PLEASE reach out at omar AT dearimgui DOT com. See https://github.com/ocornut/imgui/wiki/Sponsors
|
||
|
// PLEASE reach out at omar AT dearimgui DOT com. See https://github.com/ocornut/imgui/wiki/Funding
|
||
|
// Businesses: you can also purchase licenses for the Dear ImGui Automation/Test Engine.
|
||
|
|
||
|
// It is recommended that you don't modify imgui.cpp! It will become difficult for you to update the library.
|
||
| ... | ... | |
|
// [SECTION] INCLUDES
|
||
|
// [SECTION] FORWARD DECLARATIONS
|
||
|
// [SECTION] CONTEXT AND MEMORY ALLOCATORS
|
||
|
// [SECTION] USER FACING STRUCTURES (ImGuiStyle, ImGuiIO)
|
||
|
// [SECTION] USER FACING STRUCTURES (ImGuiStyle, ImGuiIO, ImGuiPlatformIO)
|
||
|
// [SECTION] MISC HELPERS/UTILITIES (Geometry functions)
|
||
|
// [SECTION] MISC HELPERS/UTILITIES (String, Format, Hash functions)
|
||
|
// [SECTION] MISC HELPERS/UTILITIES (File functions)
|
||
| ... | ... | |
|
// [SECTION] RENDER HELPERS
|
||
|
// [SECTION] INITIALIZATION, SHUTDOWN
|
||
|
// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!)
|
||
|
// [SECTION] ID STACK
|
||
|
// [SECTION] INPUTS
|
||
|
// [SECTION] ERROR CHECKING
|
||
|
// [SECTION] ERROR CHECKING, STATE RECOVERY
|
||
|
// [SECTION] ITEM SUBMISSION
|
||
|
// [SECTION] LAYOUT
|
||
|
// [SECTION] SCROLLING
|
||
| ... | ... | |
|
- CTRL+X, CTRL+C, CTRL+V: Use OS clipboard.
|
||
|
- CTRL+Z, CTRL+Y: Undo, Redo.
|
||
|
- ESCAPE: Revert text to its original value.
|
||
|
- On OSX, controls are automatically adjusted to match standard OSX text editing shortcuts and behaviors.
|
||
|
- On OSX, controls are automatically adjusted to match standard OSX text editing 2ts and behaviors.
|
||
|
|
||
|
- KEYBOARD CONTROLS
|
||
|
- Basic:
|
||
| ... | ... | |
|
- Set 'io.BackendFlags |= ImGuiBackendFlags_HasGamepad' + call io.AddKeyEvent/AddKeyAnalogEvent() with ImGuiKey_Gamepad_XXX keys.
|
||
|
- For analog values (0.0f to 1.0f), backend is responsible to handling a dead-zone and rescaling inputs accordingly.
|
||
|
Backend code will probably need to transform your raw inputs (such as e.g. remapping your 0.2..0.9 raw input range to 0.0..1.0 imgui range, etc.).
|
||
|
- BEFORE 1.87, BACKENDS USED TO WRITE TO io.NavInputs[]. This is now obsolete. Please call io functions instead!
|
||
|
- If you need to share inputs between your game and the Dear ImGui interface, the easiest approach is to go all-or-nothing,
|
||
|
with a buttons combo to toggle the target. Please reach out if you think the game vs navigation input sharing could be improved.
|
||
|
|
||
| ... | ... | |
|
- Consoles/Tablet/Phone users: Consider using a Synergy 1.x server (on your PC) + run examples/libs/synergy/uSynergy.c (on your console/tablet/phone app)
|
||
|
in order to share your PC mouse/keyboard.
|
||
|
- See https://github.com/ocornut/imgui/wiki/Useful-Extensions#remoting for other remoting solutions.
|
||
|
- On a TV/console system where readability may be lower or mouse inputs may be awkward, you may want to set the ImGuiConfigFlags_NavEnableSetMousePos flag.
|
||
|
Enabling ImGuiConfigFlags_NavEnableSetMousePos + ImGuiBackendFlags_HasSetMousePos instructs Dear ImGui to move your mouse cursor along with navigation movements.
|
||
|
- On a TV/console system where readability may be lower or mouse inputs may be awkward, you may want to set the io.ConfigNavMoveSetMousePos flag.
|
||
|
Enabling io.ConfigNavMoveSetMousePos + ImGuiBackendFlags_HasSetMousePos instructs Dear ImGui to move your mouse cursor along with navigation movements.
|
||
|
When enabled, the NewFrame() function may alter 'io.MousePos' and set 'io.WantSetMousePos' to notify you that it wants the mouse cursor to be moved.
|
||
|
When that happens your backend NEEDS to move the OS or underlying mouse cursor on the next frame. Some of the backends in examples/ do that.
|
||
|
(If you set the NavEnableSetMousePos flag but don't honor 'io.WantSetMousePos' properly, Dear ImGui will misbehave as it will see your mouse moving back & forth!)
|
||
| ... | ... | |
|
When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
||
|
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||
|
|
||
|
- 2024/11/06 (1.91.5) - commented/obsoleted out pre-1.87 IO system (equivalent to using IMGUI_DISABLE_OBSOLETE_KEYIO or IMGUI_DISABLE_OBSOLETE_FUNCTIONS before)
|
||
|
- io.KeyMap[] and io.KeysDown[] are removed (obsoleted February 2022).
|
||
|
- io.NavInputs[] and ImGuiNavInput are removed (obsoleted July 2022).
|
||
|
- pre-1.87 backends are not supported:
|
||
|
- backends need to call io.AddKeyEvent(), io.AddMouseEvent() instead of writing to io.KeysDown[], io.MouseDown[] fields.
|
||
|
- backends need to call io.AddKeyAnalogEvent() for gamepad values instead of writing to io.NavInputs[] fields.
|
||
|
- for more reference:
|
||
|
- read 1.87 and 1.88 part of this section or read Changelog for 1.87 and 1.88.
|
||
|
- read https://github.com/ocornut/imgui/issues/4921
|
||
|
- if you have trouble updating a very old codebase using legacy backend-specific key codes: consider updating to 1.91.4 first, then #define IMGUI_DISABLE_OBSOLETE_KEYIO, then update to latest.
|
||
|
- obsoleted ImGuiKey_COUNT (it is unusually error-prone/misleading since valid keys don't start at 0). probably use ImGuiKey_NamedKey_BEGIN/ImGuiKey_NamedKey_END?
|
||
|
- fonts: removed const qualifiers from most font functions in prevision for upcoming font improvements.
|
||
|
- 2024/10/18 (1.91.4) - renamed ImGuiCol_NavHighlight to ImGuiCol_NavCursor (for consistency with newly exposed and reworked features). Kept inline redirection enum (will obsolete).
|
||
|
- 2024/10/14 (1.91.4) - moved ImGuiConfigFlags_NavEnableSetMousePos to standalone io.ConfigNavMoveSetMousePos bool.
|
||
|
moved ImGuiConfigFlags_NavNoCaptureKeyboard to standalone io.ConfigNavCaptureKeyboard bool (note the inverted value!).
|
||
|
kept legacy names (will obsolete) + code that copies settings once the first time. Dynamically changing the old value won't work. Switch to using the new value!
|
||
|
- 2024/10/10 (1.91.4) - the typedef for ImTextureID now defaults to ImU64 instead of void*. (#1641)
|
||
|
this removes the requirement to redefine it for backends which are e.g. storing descriptor sets or other 64-bits structures when building on 32-bits archs. It therefore simplify various building scripts/helpers.
|
||
|
you may have compile-time issues if you were casting to 'void*' instead of 'ImTextureID' when passing your types to functions taking ImTextureID values, e.g. ImGui::Image().
|
||
|
in doubt it is almost always better to do an intermediate intptr_t cast, since it allows casting any pointer/integer type without warning:
|
||
|
- May warn: ImGui::Image((void*)MyTextureData, ...);
|
||
|
- May warn: ImGui::Image((void*)(intptr_t)MyTextureData, ...);
|
||
|
- Won't warn: ImGui::Image((ImTextureID)(intptr_t)MyTextureData), ...);
|
||
|
- note that you can always define ImTextureID to be your own high-level structures (with dedicated constructors) if you like.
|
||
|
- 2024/10/03 (1.91.3) - drags: treat v_min==v_max as a valid clamping range when != 0.0f. Zero is a still special value due to legacy reasons, unless using ImGuiSliderFlags_ClampZeroRange. (#7968, #3361, #76)
|
||
|
- drags: extended behavior of ImGuiSliderFlags_AlwaysClamp to include _ClampZeroRange. It considers v_min==v_max==0.0f as a valid clamping range (aka edits not allowed).
|
||
|
although unlikely, it you wish to only clamp on text input but want v_min==v_max==0.0f to mean unclamped drags, you can use _ClampOnInput instead of _AlwaysClamp. (#7968, #3361, #76)
|
||
|
- 2024/09/10 (1.91.2) - internals: using multiple overlayed ButtonBehavior() with same ID will now have io.ConfigDebugHighlightIdConflicts=true feature emit a warning. (#8030)
|
||
|
it was one of the rare case where using same ID is legal. workarounds: (1) use single ButtonBehavior() call with multiple _MouseButton flags, or (2) surround the calls with PushItemFlag(ImGuiItemFlags_AllowDuplicateId, true); ... PopItemFlag()
|
||
|
- 2024/08/23 (1.91.1) - renamed ImGuiChildFlags_Border to ImGuiChildFlags_Borders for consistency. kept inline redirection flag.
|
||
|
- 2024/08/22 (1.91.1) - moved some functions from ImGuiIO to ImGuiPlatformIO structure:
|
||
|
- io.GetClipboardTextFn -> platform_io.Platform_GetClipboardTextFn + changed 'void* user_data' to 'ImGuiContext* ctx'. Pull your user data from platform_io.ClipboardUserData.
|
||
|
- io.SetClipboardTextFn -> platform_io.Platform_SetClipboardTextFn + same as above line.
|
||
|
- io.PlatformOpenInShellFn -> platform_io.Platform_OpenInShellFn (#7660)
|
||
|
- io.PlatformSetImeDataFn -> platform_io.Platform_SetImeDataFn
|
||
|
- io.PlatformLocaleDecimalPoint -> platform_io.Platform_LocaleDecimalPoint (#7389, #6719, #2278)
|
||
|
- access those via GetPlatformIO() instead of GetIO().
|
||
|
some were introduced very recently and often automatically setup by core library and backends, so for those we are exceptionally not maintaining a legacy redirection symbol.
|
||
|
- commented the old ImageButton() signature obsoleted in 1.89 (~August 2022). As a reminder:
|
||
|
- old ImageButton() before 1.89 used ImTextureId as item id (created issue with e.g. multiple buttons in same scope, transient texture id values, opaque computation of ID)
|
||
|
- new ImageButton() since 1.89 requires an explicit 'const char* str_id'
|
||
|
- old ImageButton() before 1.89 had frame_padding' override argument.
|
||
|
- new ImageButton() since 1.89 always use style.FramePadding, which you can freely override with PushStyleVar()/PopStyleVar().
|
||
|
- 2024/07/25 (1.91.0) - obsoleted GetContentRegionMax(), GetWindowContentRegionMin() and GetWindowContentRegionMax(). (see #7838 on GitHub for more info)
|
||
|
you should never need those functions. you can do everything with GetCursorScreenPos() and GetContentRegionAvail() in a more simple way.
|
||
|
- instead of: GetWindowContentRegionMax().x - GetCursorPos().x
|
||
|
- you can use: GetContentRegionAvail().x
|
||
|
- instead of: GetWindowContentRegionMax().x + GetWindowPos().x
|
||
|
- you can use: GetCursorScreenPos().x + GetContentRegionAvail().x // when called from left edge of window
|
||
|
- instead of: GetContentRegionMax()
|
||
|
- you can use: GetContentRegionAvail() + GetCursorScreenPos() - GetWindowPos() // right edge in local coordinates
|
||
|
- instead of: GetWindowContentRegionMax().x - GetWindowContentRegionMin().x
|
||
|
- you can use: GetContentRegionAvail() // when called from left edge of window
|
||
|
- 2024/07/15 (1.91.0) - renamed ImGuiSelectableFlags_DontClosePopups to ImGuiSelectableFlags_NoAutoClosePopups. (#1379, #1468, #2200, #4936, #5216, #7302, #7573)
|
||
|
(internals: also renamed ImGuiItemFlags_SelectableDontClosePopup into ImGuiItemFlags_AutoClosePopups with inverted behaviors)
|
||
|
- 2024/07/15 (1.91.0) - obsoleted PushButtonRepeat()/PopButtonRepeat() in favor of using new PushItemFlag(ImGuiItemFlags_ButtonRepeat, ...)/PopItemFlag().
|
||
|
- 2024/07/02 (1.91.0) - commented out obsolete ImGuiModFlags (renamed to ImGuiKeyChord in 1.89). (#4921, #456)
|
||
|
- commented out obsolete ImGuiModFlags_XXX values (renamed to ImGuiMod_XXX in 1.89). (#4921, #456)
|
||
|
- ImGuiModFlags_Ctrl -> ImGuiMod_Ctrl, ImGuiModFlags_Shift -> ImGuiMod_Shift etc.
|
||
|
- 2024/07/02 (1.91.0) - IO, IME: renamed platform IME hook and added explicit context for consistency and future-proofness.
|
||
|
- old: io.SetPlatformImeDataFn(ImGuiViewport* viewport, ImGuiPlatformImeData* data);
|
||
|
- new: io.PlatformSetImeDataFn(ImGuiContext* ctx, ImGuiViewport* viewport, ImGuiPlatformImeData* data);
|
||
|
- 2024/06/21 (1.90.9) - BeginChild: added ImGuiChildFlags_NavFlattened as a replacement for the window flag ImGuiWindowFlags_NavFlattened: the feature only ever made sense for BeginChild() anyhow.
|
||
|
- old: BeginChild("Name", size, 0, ImGuiWindowFlags_NavFlattened);
|
||
|
- new: BeginChild("Name", size, ImGuiChildFlags_NavFlattened, 0);
|
||
|
- 2024/06/21 (1.90.9) - io: ClearInputKeys() (first exposed in 1.89.8) doesn't clear mouse data, newly added ClearInputMouse() does.
|
||
|
- 2024/06/20 (1.90.9) - renamed ImGuiDragDropFlags_SourceAutoExpirePayload to ImGuiDragDropFlags_PayloadAutoExpire.
|
||
|
- 2024/06/18 (1.90.9) - style: renamed ImGuiCol_TabActive -> ImGuiCol_TabSelected, ImGuiCol_TabUnfocused -> ImGuiCol_TabDimmed, ImGuiCol_TabUnfocusedActive -> ImGuiCol_TabDimmedSelected.
|
||
|
- 2024/06/10 (1.90.9) - removed old nested structure: renaming ImGuiStorage::ImGuiStoragePair type to ImGuiStoragePair (simpler for many languages).
|
||
|
- 2024/06/06 (1.90.8) - reordered ImGuiInputTextFlags values. This should not be breaking unless you are using generated headers that have values not matching the main library.
|
||
|
- 2024/06/06 (1.90.8) - removed 'ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft', was mostly unused and misleading.
|
||
|
- 2024/05/27 (1.90.7) - commented out obsolete symbols marked obsolete in 1.88 (May 2022):
|
||
|
- old: CaptureKeyboardFromApp(bool)
|
||
|
- new: SetNextFrameWantCaptureKeyboard(bool)
|
||
|
- old: CaptureMouseFromApp(bool)
|
||
|
- new: SetNextFrameWantCaptureMouse(bool)
|
||
|
- 2024/05/22 (1.90.7) - inputs (internals): renamed ImGuiKeyOwner_None to ImGuiKeyOwner_NoOwner, to make use more explicit and reduce confusion with the default it is a non-zero value and cannot be the default value (never made public, but disclosing as I expect a few users caught on owner-aware inputs).
|
||
|
- inputs (internals): renamed ImGuiInputFlags_RouteGlobalLow -> ImGuiInputFlags_RouteGlobal, ImGuiInputFlags_RouteGlobal -> ImGuiInputFlags_RouteGlobalOverFocused, ImGuiInputFlags_RouteGlobalHigh -> ImGuiInputFlags_RouteGlobalHighest.
|
||
|
- inputs (internals): Shortcut(), SetShortcutRouting(): swapped last two parameters order in function signatures:
|
||
|
- old: Shortcut(ImGuiKeyChord key_chord, ImGuiID owner_id = 0, ImGuiInputFlags flags = 0);
|
||
|
- new: 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.
|
||
|
- old: IsKeyPressed(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags = 0);
|
||
|
- new: IsKeyPressed(ImGuiKey key, ImGuiInputFlags flags, ImGuiID owner_id = 0);
|
||
|
- old: IsMouseClicked(ImGuiMouseButton button, ImGuiID owner_id, ImGuiInputFlags flags = 0);
|
||
|
- new: IsMouseClicked(ImGuiMouseButton button, ImGuiInputFlags flags, ImGuiID owner_id = 0);
|
||
|
for various reasons those changes makes sense. They are being made because 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.
|
||
|
- 2024/05/16 (1.90.7) - 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.
|
||
|
- it shouldn't really affect you unless you had custom shortcut swapping in place for macOS X apps.
|
||
|
- removed ImGuiMod_Shortcut which was previously dynamically remapping to Ctrl or Cmd/Super. It is now unnecessary to specific cross-platform idiomatic shortcuts. (#2343, #4084, #5923, #456)
|
||
|
- 2024/05/14 (1.90.7) - backends: SDL_Renderer2 and SDL_Renderer3 backend now take a SDL_Renderer* in their RenderDrawData() functions.
|
||
|
- 2024/04/18 (1.90.6) - TreeNode: Fixed a layout inconsistency when using an empty/hidden label followed by a SameLine() call. (#7505, #282)
|
||
|
- old: TreeNode("##Hidden"); SameLine(); Text("Hello"); // <-- This was actually incorrect! BUT appeared to look ok with the default style where ItemSpacing.x == FramePadding.x * 2 (it didn't look aligned otherwise).
|
||
|
- new: TreeNode("##Hidden"); SameLine(0, 0); Text("Hello"); // <-- This is correct for all styles values.
|
||
|
with the fix, IF you were successfully using TreeNode("")+SameLine(); you will now have extra spacing between your TreeNode and the following item.
|
||
|
You'll need to change the SameLine() call to SameLine(0,0) to remove this extraneous spacing. This seemed like the more sensible fix that's not making things less consistent.
|
||
|
(Note: when using this idiom you are likely to also use ImGuiTreeNodeFlags_SpanAvailWidth).
|
||
|
- 2024/03/18 (1.90.5) - merged the radius_x/radius_y parameters in ImDrawList::AddEllipse(), AddEllipseFilled() and PathEllipticalArcTo() into a single ImVec2 parameter. Exceptionally, because those functions were added in 1.90, we are not adding inline redirection functions. The transition is easy and should affect few users. (#2743, #7417)
|
||
|
- 2024/03/08 (1.90.5) - inputs: more formally obsoleted GetKeyIndex() when IMGUI_DISABLE_OBSOLETE_FUNCTIONS is set. It has been unnecessary and a no-op since 1.87 (it returns the same value as passed when used with a 1.87+ backend using io.AddKeyEvent() function). (#4921)
|
||
|
- IsKeyPressed(GetKeyIndex(ImGuiKey_XXX)) -> use IsKeyPressed(ImGuiKey_XXX)
|
||
|
- 2024/01/15 (1.90.2) - commented out obsolete ImGuiIO::ImeWindowHandle marked obsolete in 1.87, favor of writing to 'void* ImGuiViewport::PlatformHandleRaw'.
|
||
|
- 2023/12/19 (1.90.1) - commented out obsolete ImGuiKey_KeyPadEnter redirection to ImGuiKey_KeypadEnter.
|
||
|
- 2023/11/06 (1.90.1) - removed CalcListClipping() marked obsolete in 1.86. Prefer using ImGuiListClipper which can return non-contiguous ranges.
|
||
| ... | ... | |
|
- new: BeginChild("Name", size, ImGuiChildFlags_Border)
|
||
|
- old: BeginChild("Name", size, false)
|
||
|
- new: BeginChild("Name", size) or BeginChild("Name", 0) or BeginChild("Name", size, ImGuiChildFlags_None)
|
||
|
**AMEND FROM THE FUTURE: from 1.91.1, 'ImGuiChildFlags_Border' is called 'ImGuiChildFlags_Borders'**
|
||
|
- 2023/11/02 (1.90.0) - BeginChild: added child-flag ImGuiChildFlags_AlwaysUseWindowPadding as a replacement for the window-flag ImGuiWindowFlags_AlwaysUseWindowPadding: the feature only ever made sense for BeginChild() anyhow.
|
||
|
- old: BeginChild("Name", size, 0, ImGuiWindowFlags_AlwaysUseWindowPadding);
|
||
|
- new: BeginChild("Name", size, ImGuiChildFlags_AlwaysUseWindowPadding, 0);
|
||
| ... | ... | |
|
- Backend writing to io.MouseHoveredViewport -> backend should call io.AddMouseViewportEvent() [Docking branch w/ multi-viewports only]
|
||
|
note: for all calls to IO new functions, the Dear ImGui context should be bound/current.
|
||
|
read https://github.com/ocornut/imgui/issues/4921 for details.
|
||
|
- 2022/01/10 (1.87) - inputs: reworked keyboard IO. Removed io.KeyMap[], io.KeysDown[] in favor of calling io.AddKeyEvent(). Removed GetKeyIndex(), now unecessary. All IsKeyXXX() functions now take ImGuiKey values. All features are still functional until IMGUI_DISABLE_OBSOLETE_KEYIO is defined. Read Changelog and Release Notes for details.
|
||
|
- 2022/01/10 (1.87) - inputs: reworked keyboard IO. Removed io.KeyMap[], io.KeysDown[] in favor of calling io.AddKeyEvent(). Removed GetKeyIndex(), now unnecessary. All IsKeyXXX() functions now take ImGuiKey values. All features are still functional until IMGUI_DISABLE_OBSOLETE_KEYIO is defined. Read Changelog and Release Notes for details.
|
||
|
- IsKeyPressed(MY_NATIVE_KEY_XXX) -> use IsKeyPressed(ImGuiKey_XXX)
|
||
|
- IsKeyPressed(GetKeyIndex(ImGuiKey_XXX)) -> use IsKeyPressed(ImGuiKey_XXX)
|
||
|
- Backend writing to io.KeyMap[],io.KeysDown[] -> backend should call io.AddKeyEvent() (+ call io.SetKeyEventNativeData() if you want legacy user code to stil function with legacy key codes).
|
||
| ... | ... | |
|
Q: How can I easily use icons in my application?
|
||
|
Q: How can I load multiple fonts?
|
||
|
Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic?
|
||
|
>> See https://www.dearimgui.com/faq and https://github.com/ocornut/imgui/edit/master/docs/FONTS.md
|
||
|
>> See https://www.dearimgui.com/faq and https://github.com/ocornut/imgui/blob/master/docs/FONTS.md
|
||
|
|
||
|
Q&A: Concerns
|
||
|
=============
|
||
| ... | ... | |
|
A: - Businesses: please reach out to "omar AT dearimgui DOT com" if you work in a place using Dear ImGui!
|
||
|
We can discuss ways for your company to fund development via invoiced technical support, maintenance or sponsoring contacts.
|
||
|
This is among the most useful thing you can do for Dear ImGui. With increased funding, we sustain and grow work on this project.
|
||
|
Also see https://github.com/ocornut/imgui/wiki/Sponsors
|
||
|
>>> See https://github.com/ocornut/imgui/wiki/Funding
|
||
|
- Businesses: you can also purchase licenses for the Dear ImGui Automation/Test Engine.
|
||
|
- If you are experienced with Dear ImGui and C++, look at the GitHub issues, look at the Wiki, and see how you want to help and can help!
|
||
|
- Disclose your usage of Dear ImGui via a dev blog post, a tweet, a screenshot, a mention somewhere etc.
|
||
| ... | ... | |
|
#endif
|
||
|
|
||
|
// [Windows] OS specific includes (optional)
|
||
|
#if defined(_WIN32) && defined(IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS) && defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) && defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
|
||
|
#if defined(_WIN32) && defined(IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS) && defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) && defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS) && defined(IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
|
||
|
#define IMGUI_DISABLE_WIN32_FUNCTIONS
|
||
|
#endif
|
||
|
#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
|
||
| ... | ... | |
|
#else
|
||
|
#include <windows.h>
|
||
|
#endif
|
||
|
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) // UWP doesn't have all Win32 functions
|
||
|
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP || WINAPI_FAMILY == WINAPI_FAMILY_GAMES)
|
||
|
// The UWP and GDK Win32 API subsets don't support clipboard nor IME functions
|
||
|
#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS
|
||
|
#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS
|
||
|
#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
|
||
|
#endif
|
||
|
#endif
|
||
|
|
||
| ... | ... | |
|
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // warning: zero as null pointer constant // some standard header variations use #define NULL 0
|
||
|
#pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.
|
||
|
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision
|
||
|
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage" // warning: 'xxx' is an unsafe pointer used for buffer access
|
||
|
#pragma clang diagnostic ignored "-Wnontrivial-memaccess" // warning: first argument in call to 'memset' is a pointer to non-trivially copyable type
|
||
|
#elif defined(__GNUC__)
|
||
|
// We disable -Wpragmas because GCC doesn't provide a has_warning equivalent and some forks/patches may not follow the warning/version association.
|
||
|
#pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
|
||
|
#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
|
||
|
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size
|
||
|
#pragma GCC diagnostic ignored "-Wformat" // warning: format '%p' expects argument of type 'void*', but argument 6 has type 'ImGuiWindow*'
|
||
|
#pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function
|
||
|
#pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value
|
||
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral" // warning: format not a string literal, format string not checked
|
||
|
#pragma GCC diagnostic ignored "-Wstrict-overflow" // warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false
|
||
|
#pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead
|
||
|
#pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
|
||
|
#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
|
||
|
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size
|
||
|
#pragma GCC diagnostic ignored "-Wformat" // warning: format '%p' expects argument of type 'void*', but argument 6 has type 'ImGuiWindow*'
|
||
|
#pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function
|
||
|
#pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value
|
||
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral" // warning: format not a string literal, format string not checked
|
||
|
#pragma GCC diagnostic ignored "-Wstrict-overflow" // warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false
|
||
|
#pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead
|
||
|
#endif
|
||
|
|
||
|
// Debug options
|
||
|
#define IMGUI_DEBUG_NAV_SCORING 0 // Display navigation scoring preview when hovering items. Display last moving direction matches when holding CTRL
|
||
|
#define IMGUI_DEBUG_NAV_SCORING 0 // Display navigation scoring preview when hovering items. Hold CTRL to display for all candidates. CTRL+Arrow to change last direction.
|
||
|
#define IMGUI_DEBUG_NAV_RECTS 0 // Display the reference navigation rectangle for each window
|
||
|
|
||
|
// When using CTRL+TAB (or Gamepad Square+L/R) we delay the visual a little in order to reduce visual noise doing a fast switch.
|
||
| ... | ... | |
|
static const float WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER = 0.70f; // Lock scrolled window (so it doesn't pick child windows that are scrolling through) for a certain time, unless mouse moved.
|
||
|
|
||
|
// Tooltip offset
|
||
|
static const ImVec2 TOOLTIP_DEFAULT_OFFSET = ImVec2(16, 10); // Multiplied by g.Style.MouseCursorScale
|
||
|
static const ImVec2 TOOLTIP_DEFAULT_OFFSET_MOUSE = ImVec2(16, 10); // Multiplied by g.Style.MouseCursorScale
|
||
|
static const ImVec2 TOOLTIP_DEFAULT_OFFSET_TOUCH = ImVec2(0, -20); // Multiplied by g.Style.MouseCursorScale
|
||
|
static const ImVec2 TOOLTIP_DEFAULT_PIVOT_TOUCH = ImVec2(0.5f, 1.0f); // Multiplied by g.Style.MouseCursorScale
|
||
|
|
||
|
//-------------------------------------------------------------------------
|
||
|
// [SECTION] FORWARD DECLARATIONS
|
||
|
//-------------------------------------------------------------------------
|
||
|
|
||
|
static void SetCurrentWindow(ImGuiWindow* window);
|
||
|
static void FindHoveredWindow();
|
||
|
static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags);
|
||
|
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window);
|
||
|
|
||
| ... | ... | |
|
static void WindowSettingsHandler_ApplyAll(ImGuiContext*, ImGuiSettingsHandler*);
|
||
|
static void WindowSettingsHandler_WriteAll(ImGuiContext*, ImGuiSettingsHandler*, ImGuiTextBuffer* buf);
|
||
|
|
||
|
// Platform Dependents default implementation for IO functions
|
||
|
static const char* GetClipboardTextFn_DefaultImpl(void* user_data_ctx);
|
||
|
static void SetClipboardTextFn_DefaultImpl(void* user_data_ctx, const char* text);
|
||
|
static void SetPlatformImeDataFn_DefaultImpl(ImGuiViewport* viewport, ImGuiPlatformImeData* data);
|
||
|
// Platform Dependents default implementation for ImGuiPlatformIO functions
|
||
|
static const char* Platform_GetClipboardTextFn_DefaultImpl(ImGuiContext* ctx);
|
||
|
static void Platform_SetClipboardTextFn_DefaultImpl(ImGuiContext* ctx, const char* text);
|
||
|
static void Platform_SetImeDataFn_DefaultImpl(ImGuiContext* ctx, ImGuiViewport* viewport, ImGuiPlatformImeData* data);
|
||
|
static bool Platform_OpenInShellFn_DefaultImpl(ImGuiContext* ctx, const char* path);
|
||
|
|
||
|
namespace ImGui
|
||
|
{
|
||
|
// Item
|
||
|
static void ItemHandleShortcut(ImGuiID id);
|
||
|
|
||
|
// Navigation
|
||
|
static void NavUpdate();
|
||
|
static void NavUpdateWindowing();
|
||
| ... | ... | |
|
static void NavApplyItemToResult(ImGuiNavItemData* result);
|
||
|
static void NavProcessItem();
|
||
|
static void NavProcessItemForTabbingRequest(ImGuiID id, ImGuiItemFlags item_flags, ImGuiNavMoveFlags move_flags);
|
||
|
static ImGuiInputSource NavCalcPreferredRefPosSource();
|
||
|
static ImVec2 NavCalcPreferredRefPos();
|
||
|
static void NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window);
|
||
|
static ImGuiWindow* NavRestoreLastChildNavWindow(ImGuiWindow* window);
|
||
| ... | ... | |
|
// Error Checking and Debug Tools
|
||
|
static void ErrorCheckNewFrameSanityChecks();
|
||
|
static void ErrorCheckEndFrameSanityChecks();
|
||
|
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||
|
static void UpdateDebugToolItemPicker();
|
||
|
static void UpdateDebugToolStackQueries();
|
||
|
static void UpdateDebugToolFlashStyleColor();
|
||
|
#endif
|
||
|
|
||
|
// Inputs
|
||
|
static void UpdateKeyboardInputs();
|
||
| ... | ... | |
|
static void RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& title_bar_rect, const char* name, bool* p_open);
|
||
|
static void RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32 col);
|
||
|
static void RenderDimmedBackgrounds();
|
||
|
static void SetLastItemDataForWindow(ImGuiWindow* window, const ImRect& rect);
|
||
|
|
||
|
// Viewports
|
||
|
const ImGuiID IMGUI_VIEWPORT_DEFAULT_ID = 0x11111111; // Using an arbitrary constant instead of e.g. ImHashStr("ViewportDefault", 0); so it's easier to spot in the debugger. The exact value doesn't matter.
|
||
|
static void UpdateViewportsNewFrame();
|
||
|
|
||
|
}
|
||
| ... | ... | |
|
static void* GImAllocatorUserData = NULL;
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
// [SECTION] USER FACING STRUCTURES (ImGuiStyle, ImGuiIO)
|
||
|
// [SECTION] USER FACING STRUCTURES (ImGuiStyle, ImGuiIO, ImGuiPlatformIO)
|
||
|
//-----------------------------------------------------------------------------
|
||
|
|
||
|
ImGuiStyle::ImGuiStyle()
|
||
|
{
|
||
|
Alpha = 1.0f; // Global alpha applies to everything in Dear ImGui.
|
||
|
DisabledAlpha = 0.60f; // Additional alpha multiplier applied by BeginDisabled(). Multiply over current value of Alpha.
|
||
|
WindowPadding = ImVec2(8,8); // Padding within a window
|
||
|
WindowRounding = 0.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows. Large values tend to lead to variety of artifacts and are not recommended.
|
||
|
WindowBorderSize = 1.0f; // Thickness of border around windows. Generally set to 0.0f or 1.0f. Other values not well tested.
|
||
|
WindowMinSize = ImVec2(32,32); // Minimum window size
|
||
|
WindowTitleAlign = ImVec2(0.0f,0.5f);// Alignment for title bar text
|
||
|
WindowMenuButtonPosition= ImGuiDir_Left; // Position of the collapsing/docking button in the title bar (left/right). Defaults to ImGuiDir_Left.
|
||
|
ChildRounding = 0.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows
|
||
|
ChildBorderSize = 1.0f; // Thickness of border around child windows. Generally set to 0.0f or 1.0f. Other values not well tested.
|
||
|
PopupRounding = 0.0f; // Radius of popup window corners rounding. Set to 0.0f to have rectangular child windows
|
||
|
PopupBorderSize = 1.0f; // Thickness of border around popup or tooltip windows. Generally set to 0.0f or 1.0f. Other values not well tested.
|
||
|
FramePadding = ImVec2(4,3); // Padding within a framed rectangle (used by most widgets)
|
||
|
FrameRounding = 0.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).
|
||
|
FrameBorderSize = 0.0f; // Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested.
|
||
|
ItemSpacing = ImVec2(8,4); // Horizontal and vertical spacing between widgets/lines
|
||
|
ItemInnerSpacing = ImVec2(4,4); // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
||
|
CellPadding = ImVec2(4,2); // Padding within a table cell. CellPadding.y may be altered between different rows.
|
||
|
TouchExtraPadding = ImVec2(0,0); // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
|
||
|
IndentSpacing = 21.0f; // Horizontal spacing when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).
|
||
|
ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).
|
||
|
ScrollbarSize = 14.0f; // Width of the vertical scrollbar, Height of the horizontal scrollbar
|
||
|
ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar
|
||
|
GrabMinSize = 12.0f; // Minimum width/height of a grab box for slider/scrollbar
|
||
|
GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
|
||
|
LogSliderDeadzone = 4.0f; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
|
||
|
TabRounding = 4.0f; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
|
||
|
TabBorderSize = 0.0f; // Thickness of border around tabs.
|
||
|
TabMinWidthForCloseButton = 0.0f; // Minimum width for close button to appear on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
|
||
|
TabBarBorderSize = 1.0f; // Thickness of tab-bar separator, which takes on the tab active color to denote focus.
|
||
|
TableAngledHeadersAngle = 35.0f * (IM_PI / 180.0f); // Angle of angled headers (supported values range from -50 degrees to +50 degrees).
|
||
|
ColorButtonPosition = ImGuiDir_Right; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right.
|
||
|
ButtonTextAlign = ImVec2(0.5f,0.5f);// Alignment of button text when button is larger than text.
|
||
|
SelectableTextAlign = ImVec2(0.0f,0.0f);// Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line.
|
||
|
SeparatorTextBorderSize = 3.0f; // Thickkness of border in SeparatorText()
|
||
|
SeparatorTextAlign = ImVec2(0.0f,0.5f);// Alignment of text within the separator. Defaults to (0.0f, 0.5f) (left aligned, center).
|
||
|
SeparatorTextPadding = ImVec2(20.0f,3.f);// Horizontal offset of text from each edge of the separator + spacing on other axis. Generally small values. .y is recommended to be == FramePadding.y.
|
||
|
DisplayWindowPadding = ImVec2(19,19); // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows.
|
||
|
DisplaySafeAreaPadding = ImVec2(3,3); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
|
||
|
MouseCursorScale = 1.0f; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later.
|
||
|
AntiAliasedLines = true; // Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU.
|
||
|
AntiAliasedLinesUseTex = true; // Enable anti-aliased lines/borders using textures where possible. Require backend to render with bilinear filtering (NOT point/nearest filtering).
|
||
|
AntiAliasedFill = true; // Enable anti-aliased filled shapes (rounded rectangles, circles, etc.).
|
||
|
CurveTessellationTol = 1.25f; // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
|
||
|
CircleTessellationMaxError = 0.30f; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry.
|
||
|
Alpha = 1.0f; // Global alpha applies to everything in Dear ImGui.
|
||
|
DisabledAlpha = 0.60f; // Additional alpha multiplier applied by BeginDisabled(). Multiply over current value of Alpha.
|
||
|
WindowPadding = ImVec2(8,8); // Padding within a window
|
||
|
WindowRounding = 0.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows. Large values tend to lead to variety of artifacts and are not recommended.
|
||
|
WindowBorderSize = 1.0f; // Thickness of border around windows. Generally set to 0.0f or 1.0f. Other values not well tested.
|
||
|
WindowMinSize = ImVec2(32,32); // Minimum window size
|
||
|
WindowTitleAlign = ImVec2(0.0f,0.5f);// Alignment for title bar text
|
||
|
WindowMenuButtonPosition = ImGuiDir_Left; // Position of the collapsing/docking button in the title bar (left/right). Defaults to ImGuiDir_Left.
|
||
|
ChildRounding = 0.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows
|
||
|
ChildBorderSize = 1.0f; // Thickness of border around child windows. Generally set to 0.0f or 1.0f. Other values not well tested.
|
||
|
PopupRounding = 0.0f; // Radius of popup window corners rounding. Set to 0.0f to have rectangular child windows
|
||
|
PopupBorderSize = 1.0f; // Thickness of border around popup or tooltip windows. Generally set to 0.0f or 1.0f. Other values not well tested.
|
||
|
FramePadding = ImVec2(4,3); // Padding within a framed rectangle (used by most widgets)
|
||
|
FrameRounding = 0.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).
|
||
|
FrameBorderSize = 0.0f; // Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested.
|
||
|
ItemSpacing = ImVec2(8,4); // Horizontal and vertical spacing between widgets/lines
|
||
|
ItemInnerSpacing = ImVec2(4,4); // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
||
|
CellPadding = ImVec2(4,2); // Padding within a table cell. Cellpadding.x is locked for entire table. CellPadding.y may be altered between different rows.
|
||
|
TouchExtraPadding = ImVec2(0,0); // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
|
||
|
IndentSpacing = 21.0f; // Horizontal spacing when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).
|
||
|
ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).
|
||
|
ScrollbarSize = 14.0f; // Width of the vertical scrollbar, Height of the horizontal scrollbar
|
||
|
ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar
|
||
|
GrabMinSize = 12.0f; // Minimum width/height of a grab box for slider/scrollbar
|
||
|
GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
|
||
|
LogSliderDeadzone = 4.0f; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
|
||
|
TabRounding = 4.0f; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
|
||
|
TabBorderSize = 0.0f; // Thickness of border around tabs.
|
||
|
TabMinWidthForCloseButton = 0.0f; // Minimum width for close button to appear on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
|
||
|
TabBarBorderSize = 1.0f; // Thickness of tab-bar separator, which takes on the tab active color to denote focus.
|
||
|
TabBarOverlineSize = 2.0f; // Thickness of tab-bar overline, which highlights the selected tab-bar.
|
||
|
TableAngledHeadersAngle = 35.0f * (IM_PI / 180.0f); // Angle of angled headers (supported values range from -50 degrees to +50 degrees).
|
||
|
TableAngledHeadersTextAlign = ImVec2(0.5f,0.0f);// Alignment of angled headers within the cell
|
||
|
ColorButtonPosition = ImGuiDir_Right; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right.
|
||
|
ButtonTextAlign = ImVec2(0.5f,0.5f);// Alignment of button text when button is larger than text.
|
||
|
SelectableTextAlign = ImVec2(0.0f,0.0f);// Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line.
|
||
|
SeparatorTextBorderSize = 3.0f; // Thickness of border in SeparatorText()
|
||
|
SeparatorTextAlign = ImVec2(0.0f,0.5f);// Alignment of text within the separator. Defaults to (0.0f, 0.5f) (left aligned, center).
|
||
|
SeparatorTextPadding = ImVec2(20.0f,3.f);// Horizontal offset of text from each edge of the separator + spacing on other axis. Generally small values. .y is recommended to be == FramePadding.y.
|
||
|
DisplayWindowPadding = ImVec2(19,19); // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows.
|
||
|
DisplaySafeAreaPadding = ImVec2(3,3); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
|
||
|
MouseCursorScale = 1.0f; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later.
|
||
|
AntiAliasedLines = true; // Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU.
|
||
|
AntiAliasedLinesUseTex = true; // Enable anti-aliased lines/borders using textures where possible. Require backend to render with bilinear filtering (NOT point/nearest filtering).
|
||
|
AntiAliasedFill = true; // Enable anti-aliased filled shapes (rounded rectangles, circles, etc.).
|
||
|
CurveTessellationTol = 1.25f; // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
|
||
|
CircleTessellationMaxError = 0.30f; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry.
|
||
|
|
||
|
// Behaviors
|
||
|
HoverStationaryDelay = 0.15f; // Delay for IsItemHovered(ImGuiHoveredFlags_Stationary). Time required to consider mouse stationary.
|
||
|
HoverDelayShort = 0.15f; // Delay for IsItemHovered(ImGuiHoveredFlags_DelayShort). Usually used along with HoverStationaryDelay.
|
||
|
HoverDelayNormal = 0.40f; // Delay for IsItemHovered(ImGuiHoveredFlags_DelayNormal). "
|
||
|
HoverFlagsForTooltipMouse = ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort | ImGuiHoveredFlags_AllowWhenDisabled; // Default flags when using IsItemHovered(ImGuiHoveredFlags_ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using mouse.
|
||
|
HoverFlagsForTooltipNav = ImGuiHoveredFlags_NoSharedDelay | ImGuiHoveredFlags_DelayNormal | ImGuiHoveredFlags_AllowWhenDisabled; // Default flags when using IsItemHovered(ImGuiHoveredFlags_ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using keyboard/gamepad.
|
||
|
HoverStationaryDelay = 0.15f; // Delay for IsItemHovered(ImGuiHoveredFlags_Stationary). Time required to consider mouse stationary.
|
||
|
HoverDelayShort = 0.15f; // Delay for IsItemHovered(ImGuiHoveredFlags_DelayShort). Usually used along with HoverStationaryDelay.
|
||
|
HoverDelayNormal = 0.40f; // Delay for IsItemHovered(ImGuiHoveredFlags_DelayNormal). "
|
||
|
HoverFlagsForTooltipMouse = ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort | ImGuiHoveredFlags_AllowWhenDisabled; // Default flags when using IsItemHovered(ImGuiHoveredFlags_ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using mouse.
|
||
|
HoverFlagsForTooltipNav = ImGuiHoveredFlags_NoSharedDelay | ImGuiHoveredFlags_DelayNormal | ImGuiHoveredFlags_AllowWhenDisabled; // Default flags when using IsItemHovered(ImGuiHoveredFlags_ForTooltip) or BeginItemTooltip()/SetItemTooltip() while using keyboard/gamepad.
|
||
|
|
||
|
// Default theme
|
||
|
ImGui::StyleColorsDark(this);
|
||
| ... | ... | |
|
LogSliderDeadzone = ImTrunc(LogSliderDeadzone * scale_factor);
|
||
|
TabRounding = ImTrunc(TabRounding * scale_factor);
|
||
|
TabMinWidthForCloseButton = (TabMinWidthForCloseButton != FLT_MAX) ? ImTrunc(TabMinWidthForCloseButton * scale_factor) : FLT_MAX;
|
||
|
TabBarOverlineSize = ImTrunc(TabBarOverlineSize * scale_factor);
|
||
|
SeparatorTextPadding = ImTrunc(SeparatorTextPadding * scale_factor);
|
||
|
DisplayWindowPadding = ImTrunc(DisplayWindowPadding * scale_factor);
|
||
|
DisplaySafeAreaPadding = ImTrunc(DisplaySafeAreaPadding * scale_factor);
|
||
| ... | ... | |
|
IniSavingRate = 5.0f;
|
||
|
IniFilename = "imgui.ini"; // Important: "imgui.ini" is relative to current working dir, most apps will want to lock this to an absolute path (e.g. same path as executables).
|
||
|
LogFilename = "imgui_log.txt";
|
||
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||
|
for (int i = 0; i < ImGuiKey_COUNT; i++)
|
||
|
KeyMap[i] = -1;
|
||
|
#endif
|
||
|
UserData = NULL;
|
||
|
|
||
|
Fonts = NULL;
|
||
| ... | ... | |
|
FontAllowUserScaling = false;
|
||
|
DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
|
||
|
|
||
|
MouseDoubleClickTime = 0.30f;
|
||
|
MouseDoubleClickMaxDist = 6.0f;
|
||
|
MouseDragThreshold = 6.0f;
|
||
|
KeyRepeatDelay = 0.275f;
|
||
|
KeyRepeatRate = 0.050f;
|
||
|
// Keyboard/Gamepad Navigation options
|
||
|
ConfigNavSwapGamepadButtons = false;
|
||
|
ConfigNavMoveSetMousePos = false;
|
||
|
ConfigNavCaptureKeyboard = true;
|
||
|
ConfigNavEscapeClearFocusItem = true;
|
||
|
ConfigNavEscapeClearFocusWindow = false;
|
||
|
ConfigNavCursorVisibleAuto = true;
|
||
|
ConfigNavCursorVisibleAlways = false;
|
||
|
|
||
|
// Miscellaneous options
|
||
|
MouseDrawCursor = false;
|
||
| ... | ... | |
|
ConfigDragClickToInputText = false;
|
||
|
ConfigWindowsResizeFromEdges = true;
|
||
|
ConfigWindowsMoveFromTitleBarOnly = false;
|
||
|
ConfigWindowsCopyContentsWithCtrlC = false;
|
||
|
ConfigScrollbarScrollByPage = true;
|
||
|
ConfigMemoryCompactTimer = 60.0f;
|
||
|
ConfigDebugIsDebuggerPresent = false;
|
||
|
ConfigDebugHighlightIdConflicts = true;
|
||
|
ConfigDebugBeginReturnValueOnce = false;
|
||
|
ConfigDebugBeginReturnValueLoop = false;
|
||
|
|
||
|
ConfigErrorRecovery = true;
|
||
|
ConfigErrorRecoveryEnableAssert = true;
|
||
|
ConfigErrorRecoveryEnableDebugLog = true;
|
||
|
ConfigErrorRecoveryEnableTooltip = true;
|
||
|
|
||
|
// Inputs Behaviors
|
||
|
MouseDoubleClickTime = 0.30f;
|
||
|
MouseDoubleClickMaxDist = 6.0f;
|
||
|
MouseDragThreshold = 6.0f;
|
||
|
KeyRepeatDelay = 0.275f;
|
||
|
KeyRepeatRate = 0.050f;
|
||
|
|
||
|
// Platform Functions
|
||
|
// Note: Initialize() will setup default clipboard/ime handlers.
|
||
|
BackendPlatformName = BackendRendererName = NULL;
|
||
|
BackendPlatformUserData = BackendRendererUserData = BackendLanguageUserData = NULL;
|
||
|
PlatformLocaleDecimalPoint = '.';
|
||
|
|
||
|
// Input (NB: we already have memset zero the entire structure!)
|
||
|
MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
||
| ... | ... | |
|
for (int i = 0; i < IM_ARRAYSIZE(MouseDownDuration); i++) MouseDownDuration[i] = MouseDownDurationPrev[i] = -1.0f;
|
||
|
for (int i = 0; i < IM_ARRAYSIZE(KeysData); i++) { KeysData[i].DownDuration = KeysData[i].DownDurationPrev = -1.0f; }
|
||
|
AppAcceptingEvents = true;
|
||
|
BackendUsingLegacyKeyArrays = (ImS8)-1;
|
||
|
BackendUsingLegacyNavInputArray = true; // assume using legacy array until proven wrong
|
||
|
}
|
||
|
|
||
|
// Pass in translated ASCII characters for text input.
|
||
| ... | ... | |
|
g.InputEventsQueue.clear();
|
||
|
}
|
||
|
|
||
|
// Clear current keyboard/mouse/gamepad state + current frame text input buffer. Equivalent to releasing all keys/buttons.
|
||
|
// Clear current keyboard/gamepad state + current frame text input buffer. Equivalent to releasing all keys/buttons.
|
||
|
void ImGuiIO::ClearInputKeys()
|
||
|
{
|
||
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||
|
memset(KeysDown, 0, sizeof(KeysDown));
|
||
|
#endif
|
||
|
for (int n = 0; n < IM_ARRAYSIZE(KeysData); n++)
|
||
|
ImGuiContext& g = *Ctx;
|
||
|
for (int key = ImGuiKey_NamedKey_BEGIN; key < ImGuiKey_NamedKey_END; key++)
|
||
|
{
|
||
|
KeysData[n].Down = false;
|
||
|
KeysData[n].DownDuration = -1.0f;
|
||
|
KeysData[n].DownDurationPrev = -1.0f;
|
||
|
if (ImGui::IsMouseKey((ImGuiKey)key))
|
||
|
continue;
|
||
|
ImGuiKeyData* key_data = &g.IO.KeysData[key - ImGuiKey_NamedKey_BEGIN];
|
||
|
key_data->Down = false;
|
||
|
key_data->DownDuration = -1.0f;
|
||
|
key_data->DownDurationPrev = -1.0f;
|
||
|
}
|
||
|
KeyCtrl = KeyShift = KeyAlt = KeySuper = false;
|
||
|
KeyMods = ImGuiMod_None;
|
||
|
InputQueueCharacters.resize(0); // Behavior of old ClearInputCharacters().
|
||
|
}
|
||
|
|
||
|
void ImGuiIO::ClearInputMouse()
|
||
|
{
|
||
|
for (ImGuiKey key = ImGuiKey_Mouse_BEGIN; key < ImGuiKey_Mouse_END; key = (ImGuiKey)(key + 1))
|
||
|
{
|
||
|
ImGuiKeyData* key_data = &KeysData[key - ImGuiKey_NamedKey_BEGIN];
|
||
|
key_data->Down = false;
|
||
|
key_data->DownDuration = -1.0f;
|
||
|
key_data->DownDurationPrev = -1.0f;
|
||
|
}
|
||
|
MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
||
|
for (int n = 0; n < IM_ARRAYSIZE(MouseDown); n++)
|
||
|
{
|
||
| ... | ... | |
|
MouseDownDuration[n] = MouseDownDurationPrev[n] = -1.0f;
|
||
|
}
|
||
|
MouseWheel = MouseWheelH = 0.0f;
|
||
|
InputQueueCharacters.resize(0); // Behavior of old ClearInputCharacters().
|
||
|
}
|
||
|
|
||
|
// Removed this as it is ambiguous/misleading and generally incorrect to use with the existence of a higher-level input queue.
|
||
| ... | ... | |
|
// - bool down: Is the key down? use false to signify a key release.
|
||
|
// - float analog_value: 0.0f..1.0f
|
||
|
// IMPORTANT: THIS FUNCTION AND OTHER "ADD" GRABS THE CONTEXT FROM OUR INSTANCE.
|
||
|
// WE NEED TO ENSURE THAT ALL FUNCTION CALLS ARE FULLFILLING THIS, WHICH IS WHY GetKeyData() HAS AN EXPLICIT CONTEXT.
|
||
|
// WE NEED TO ENSURE THAT ALL FUNCTION CALLS ARE FULFILLING THIS, WHICH IS WHY GetKeyData() HAS AN EXPLICIT CONTEXT.
|
||
|
void ImGuiIO::AddKeyAnalogEvent(ImGuiKey key, bool down, float analog_value)
|
||
|
{
|
||
|
//if (e->Down) { IMGUI_DEBUG_LOG_IO("AddKeyEvent() Key='%s' %d, NativeKeycode = %d, NativeScancode = %d\n", ImGui::GetKeyName(e->Key), e->Down, e->NativeKeycode, e->NativeScancode); }
|
||
| ... | ... | |
|
if (key == ImGuiKey_None || !AppAcceptingEvents)
|
||
|
return;
|
||
|
ImGuiContext& g = *Ctx;
|
||
|
IM_ASSERT(ImGui::IsNamedKeyOrModKey(key)); // Backend needs to pass a valid ImGuiKey_ constant. 0..511 values are legacy native key codes which are not accepted by this API.
|
||
|
IM_ASSERT(ImGui::IsNamedKeyOrMod(key)); // Backend needs to pass a valid ImGuiKey_ constant. 0..511 values are legacy native key codes which are not accepted by this API.
|
||
|
IM_ASSERT(ImGui::IsAliasKey(key) == false); // Backend cannot submit ImGuiKey_MouseXXX values they are automatically inferred from AddMouseXXX() events.
|
||
|
IM_ASSERT(key != ImGuiMod_Shortcut); // We could easily support the translation here but it seems saner to not accept it (TestEngine perform a translation itself)
|
||
|
|
||
|
// Verify that backend isn't mixing up using new io.AddKeyEvent() api and old io.KeysDown[] + io.KeyMap[] data.
|
||
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||
|
IM_ASSERT((BackendUsingLegacyKeyArrays == -1 || BackendUsingLegacyKeyArrays == 0) && "Backend needs to either only use io.AddKeyEvent(), either only fill legacy io.KeysDown[] + io.KeyMap[]. Not both!");
|
||
|
if (BackendUsingLegacyKeyArrays == -1)
|
||
|
for (int n = ImGuiKey_NamedKey_BEGIN; n < ImGuiKey_NamedKey_END; n++)
|
||
|
IM_ASSERT(KeyMap[n] == -1 && "Backend needs to either only use io.AddKeyEvent(), either only fill legacy io.KeysDown[] + io.KeyMap[]. Not both!");
|
||
|
BackendUsingLegacyKeyArrays = 0;
|
||
|
#endif
|
||
|
if (ImGui::IsGamepadKey(key))
|
||
|
BackendUsingLegacyNavInputArray = false;
|
||
|
|
||
|
// MacOS: swap Cmd(Super) and Ctrl
|
||
|
if (g.IO.ConfigMacOSXBehaviors)
|
||
|
{
|
||
|
if (key == ImGuiMod_Super) { key = ImGuiMod_Ctrl; }
|
||
|
else if (key == ImGuiMod_Ctrl) { key = ImGuiMod_Super; }
|
||
|
else if (key == ImGuiKey_LeftSuper) { key = ImGuiKey_LeftCtrl; }
|
||
|
else if (key == ImGuiKey_RightSuper){ key = ImGuiKey_RightCtrl; }
|
||
|
else if (key == ImGuiKey_LeftCtrl) { key = ImGuiKey_LeftSuper; }
|
||
|
else if (key == ImGuiKey_RightCtrl) { key = ImGuiKey_RightSuper; }
|
||
|
}
|
||
|
|
||
|
// Filter duplicate (in particular: key mods and gamepad analog values are commonly spammed)
|
||
|
const ImGuiInputEvent* latest_event = FindLatestInputEvent(&g, ImGuiInputEventType_Key, (int)key);
|
||
| ... | ... | |
|
return;
|
||
|
IM_ASSERT(ImGui::IsNamedKey(key)); // >= 512
|
||
|
IM_ASSERT(native_legacy_index == -1 || ImGui::IsLegacyKey((ImGuiKey)native_legacy_index)); // >= 0 && <= 511
|
||
|
IM_UNUSED(native_keycode); // Yet unused
|
||
|
IM_UNUSED(native_scancode); // Yet unused
|
||
|
|
||
|
// Build native->imgui map so old user code can still call key functions with native 0..511 values.
|
||
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||
|
const int legacy_key = (native_legacy_index != -1) ? native_legacy_index : native_keycode;
|
||
|
if (!ImGui::IsLegacyKey((ImGuiKey)legacy_key))
|
||
|
return;
|
||
|
KeyMap[legacy_key] = key;
|
||
|
KeyMap[key] = legacy_key;
|
||
|
#else
|
||
|
IM_UNUSED(key);
|
||
|
IM_UNUSED(native_legacy_index);
|
||
|
#endif
|
||
|
IM_UNUSED(key); // Yet unused
|
||
|
IM_UNUSED(native_keycode); // Yet unused
|
||
|
IM_UNUSED(native_scancode); // Yet unused
|
||
|
IM_UNUSED(native_legacy_index); // Yet unused
|
||
|
}
|
||
|
|
||
|
// Set master flag for accepting key/mouse/text events (default to true). Useful if you have native dialog boxes that are interrupting your application loop/refresh, and you want to disable events being queued while your app is frozen.
|
||
| ... | ... | |
|
if (!AppAcceptingEvents)
|
||
|
return;
|
||
|
|
||
|
// On MacOS X: Convert Ctrl(Super)+Left click into Right-click: handle held button.
|
||
|
if (ConfigMacOSXBehaviors && mouse_button == 0 && MouseCtrlLeftAsRightClick)
|
||
|
{
|
||
|
// Order of both statements matterns: this event will still release mouse button 1
|
||
|
mouse_button = 1;
|
||
|
if (!down)
|
||
|
MouseCtrlLeftAsRightClick = false;
|
||
|
}
|
||
|
|
||
|
// Filter duplicate
|
||
|
const ImGuiInputEvent* latest_event = FindLatestInputEvent(&g, ImGuiInputEventType_MouseButton, (int)mouse_button);
|
||
|
const bool latest_button_down = latest_event ? latest_event->MouseButton.Down : g.IO.MouseDown[mouse_button];
|
||
|
if (latest_button_down == down)
|
||
|
return;
|
||
|
|
||
|
// On MacOS X: Convert Ctrl(Super)+Left click into Right-click.
|
||
|
// - Note that this is actual physical Ctrl which is ImGuiMod_Super for us.
|
||
|
// - At this point we want from !down to down, so this is handling the initial press.
|
||
|
if (ConfigMacOSXBehaviors && mouse_button == 0 && down)
|
||
|
{
|
||
|
const ImGuiInputEvent* latest_super_event = FindLatestInputEvent(&g, ImGuiInputEventType_Key, (int)ImGuiMod_Super);
|
||
|
if (latest_super_event ? latest_super_event->Key.Down : g.IO.KeySuper)
|
||
|
{
|
||
|
IMGUI_DEBUG_LOG_IO("[io] Super+Left Click aliased into Right Click\n");
|
||
|
MouseCtrlLeftAsRightClick = true;
|
||
|
AddMouseButtonEvent(1, true); // This is just quicker to write that passing through, as we need to filter duplicate again.
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
ImGuiInputEvent e;
|
||
|
e.Type = ImGuiInputEventType_MouseButton;
|
||
|
e.Source = ImGuiInputSource_Mouse;
|
||
| ... | ... | |
|
g.InputEventsQueue.push_back(e);
|
||
|
}
|
||
|
|
||
|
ImGuiPlatformIO::ImGuiPlatformIO()
|
||
|
{
|
||
|
// Most fields are initialized with zero
|
||
|
memset(this, 0, sizeof(*this));
|
||
|
Platform_LocaleDecimalPoint = '.';
|
||
|
}
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
// [SECTION] MISC HELPERS/UTILITIES (Geometry functions)
|
||
|
//-----------------------------------------------------------------------------
|
||
| ... | ... | |
|
return p ? p : str_end;
|
||
|
}
|
||
|
|
||
|
const ImWchar* ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* buf_begin) // find beginning-of-line
|
||
|
const char* ImStrbol(const char* buf_mid_line, const char* buf_begin) // find beginning-of-line
|
||
|
{
|
||
|
while (buf_mid_line > buf_begin && buf_mid_line[-1] != '\n')
|
||
|
buf_mid_line--;
|
||
| ... | ... | |
|
va_end(args);
|
||
|
}
|
||
|
|
||
|
// FIXME: Should rework API toward allowing multiple in-flight temp buffers (easier and safer for caller)
|
||
|
// by making the caller acquire a temp buffer token, with either explicit or destructor release, e.g.
|
||
|
// ImGuiTempBufferToken token;
|
||
|
// ImFormatStringToTempBuffer(token, ...);
|
||
|
void ImFormatStringToTempBufferV(const char** out_buf, const char** out_buf_end, const char* fmt, va_list args)
|
||
|
{
|
||
|
ImGuiContext& g = *GImGui;
|
||
| ... | ... | |
|
// Previously we used ImTextCountCharsFromUtf8/ImTextStrFromUtf8 here but we now need to support ImWchar16 and ImWchar32!
|
||
|
const int filename_wsize = ::MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0);
|
||
|
const int mode_wsize = ::MultiByteToWideChar(CP_UTF8, 0, mode, -1, NULL, 0);
|
||
|
ImGuiContext& g = *GImGui;
|
||
|
g.TempBuffer.reserve((filename_wsize + mode_wsize) * sizeof(wchar_t));
|
||
|
wchar_t* buf = (wchar_t*)(void*)g.TempBuffer.Data;
|
||
|
::MultiByteToWideChar(CP_UTF8, 0, filename, -1, (wchar_t*)&buf[0], filename_wsize);
|
||
|
::MultiByteToWideChar(CP_UTF8, 0, mode, -1, (wchar_t*)&buf[filename_wsize], mode_wsize);
|
||
|
return ::_wfopen((const wchar_t*)&buf[0], (const wchar_t*)&buf[filename_wsize]);
|
||
|
|
||
|
// Use stack buffer if possible, otherwise heap buffer. Sizes include zero terminator.
|
||
|
// We don't rely on current ImGuiContext as this is implied to be a helper function which doesn't depend on it (see #7314).
|
||
|
wchar_t local_temp_stack[FILENAME_MAX];
|
||
|
ImVector<wchar_t> local_temp_heap;
|
||
|
if (filename_wsize + mode_wsize > IM_ARRAYSIZE(local_temp_stack))
|
||
|
local_temp_heap.resize(filename_wsize + mode_wsize);
|
||
|
wchar_t* filename_wbuf = local_temp_heap.Data ? local_temp_heap.Data : local_temp_stack;
|
||
|
wchar_t* mode_wbuf = filename_wbuf + filename_wsize;
|
||
|
::MultiByteToWideChar(CP_UTF8, 0, filename, -1, filename_wbuf, filename_wsize);
|
||
|
::MultiByteToWideChar(CP_UTF8, 0, mode, -1, mode_wbuf, mode_wsize);
|
||
|
return ::_wfopen(filename_wbuf, mode_wbuf);
|
||
|
#else
|
||
|
return fopen(filename, mode);
|
||
|
#endif
|
||
| ... | ... | |
|
return in_text_start;
|
||
|
}
|
||
|
|
||
|
int ImTextCountLines(const char* in_text, const char* in_text_end)
|
||
|
{
|
||
|
if (in_text_end == NULL)
|
||
|
in_text_end = in_text + strlen(in_text); // FIXME-OPT: Not optimal approach, discourage use for now.
|
||
|
int count = 0;
|
||
|
while (in_text < in_text_end)
|
||
|
{
|
||
|
const char* line_end = (const char*)memchr(in_text, '\n', in_text_end - in_text);
|
||
|
in_text = line_end ? line_end + 1 : in_text_end;
|
||
|
count++;
|
||
|
}
|
||
|
return count;
|
||
|
}
|
||
|
|
||
|
IM_MSVC_RUNTIME_CHECKS_RESTORE
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
| ... | ... | |
|
//-----------------------------------------------------------------------------
|
||
|
|
||
|
// std::lower_bound but without the bullshit
|
||
|
static ImGuiStorage::ImGuiStoragePair* LowerBound(ImVector<ImGuiStorage::ImGuiStoragePair>& data, ImGuiID key)
|
||
|
ImGuiStoragePair* ImLowerBound(ImGuiStoragePair* in_begin, ImGuiStoragePair* in_end, ImGuiID key)
|
||
|
{
|
||
|
ImGuiStorage::ImGuiStoragePair* first = data.Data;
|
||
|
ImGuiStorage::ImGuiStoragePair* last = data.Data + data.Size;
|
||
|
size_t count = (size_t)(last - first);
|
||
|
while (count > 0)
|
||
|
ImGuiStoragePair* in_p = in_begin;
|
||
|
for (size_t count = (size_t)(in_end - in_p); count > 0; )
|
||
|
{
|
||
|
size_t count2 = count >> 1;
|
||
|
ImGuiStorage::ImGuiStoragePair* mid = first + count2;
|
||
|
ImGuiStoragePair* mid = in_p + count2;
|
||
|
if (mid->key < key)
|
||
|
{
|
||
|
first = ++mid;
|
||
|
in_p = ++mid;
|
||
|
count -= count2 + 1;
|
||
|
}
|
||
|
else
|
||
| ... | ... | |
|
count = count2;
|
||
|
}
|
||
|
}
|
||
|
return first;
|
||
|
return in_p;
|
||
|
}
|
||
|
|
||
|
IM_MSVC_RUNTIME_CHECKS_OFF
|
||
|
static int IMGUI_CDECL PairComparerByID(const void* lhs, const void* rhs)
|
||
|
{
|
||
|
// We can't just do a subtraction because qsort uses signed integers and subtracting our ID doesn't play well with that.
|
||
|
ImGuiID lhs_v = ((const ImGuiStoragePair*)lhs)->key;
|
||
|
ImGuiID rhs_v = ((const ImGuiStoragePair*)rhs)->key;
|
||
|
return (lhs_v > rhs_v ? +1 : lhs_v < rhs_v ? -1 : 0);
|
||
|
}
|
||
|
|
||
|
// For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.
|
||
|
void ImGuiStorage::BuildSortByKey()
|
||
|
{
|
||
|
struct StaticFunc
|
||
|
{
|
||
|
static int IMGUI_CDECL PairComparerByID(const void* lhs, const void* rhs)
|
||
|
{
|
||
|
// We can't just do a subtraction because qsort uses signed integers and subtracting our ID doesn't play well with that.
|
||
|
if (((const ImGuiStoragePair*)lhs)->key > ((const ImGuiStoragePair*)rhs)->key) return +1;
|
||
|
if (((const ImGuiStoragePair*)lhs)->key < ((const ImGuiStoragePair*)rhs)->key) return -1;
|
||
|
return 0;
|
||
|
}
|
||
|
};
|
||
|
ImQsort(Data.Data, (size_t)Data.Size, sizeof(ImGuiStoragePair), StaticFunc::PairComparerByID);
|
||
|
ImQsort(Data.Data, (size_t)Data.Size, sizeof(ImGuiStoragePair), PairComparerByID);
|
||
|
}
|
||
|
|
||
|
int ImGuiStorage::GetInt(ImGuiID key, int default_val) const
|
||
|
{
|
||
|
ImGuiStoragePair* it = LowerBound(const_cast<ImVector<ImGuiStoragePair>&>(Data), key);
|
||
|
if (it == Data.end() || it->key != key)
|
||
|
ImGuiStoragePair* it = ImLowerBound(const_cast<ImGuiStoragePair*>(Data.Data), const_cast<ImGuiStoragePair*>(Data.Data + Data.Size), key);
|
||
|
if (it == Data.Data + Data.Size || it->key != key)
|
||
|
return default_val;
|
||
|
return it->val_i;
|
||
|
}
|
||
| ... | ... | |
|
|
||
|
float ImGuiStorage::GetFloat(ImGuiID key, float default_val) const
|
||
|
{
|
||
|
ImGuiStoragePair* it = LowerBound(const_cast<ImVector<ImGuiStoragePair>&>(Data), key);
|
||
|
if (it == Data.end() || it->key != key)
|
||
|
ImGuiStoragePair* it = ImLowerBound(const_cast<ImGuiStoragePair*>(Data.Data), const_cast<ImGuiStoragePair*>(Data.Data + Data.Size), key);
|
||
|
if (it == Data.Data + Data.Size || it->key != key)
|
||
|
return default_val;
|
||
|
return it->val_f;
|
||
|
}
|
||
|
|
||
|
void* ImGuiStorage::GetVoidPtr(ImGuiID key) const
|
||
|
{
|
||
|
ImGuiStoragePair* it = LowerBound(const_cast<ImVector<ImGuiStoragePair>&>(Data), key);
|
||
|
if (it == Data.end() || it->key != key)
|
||
|
ImGuiStoragePair* it = ImLowerBound(const_cast<ImGuiStoragePair*>(Data.Data), const_cast<ImGuiStoragePair*>(Data.Data + Data.Size), key);
|
||
|
if (it == Data.Data + Data.Size || it->key != key)
|
||
|
return NULL;
|
||
|
return it->val_p;
|
||
|
}
|
||
| ... | ... | |
|
// References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer.
|
||
|
int* ImGuiStorage::GetIntRef(ImGuiID key, int default_val)
|
||
|
{
|
||
|
ImGuiStoragePair* it = LowerBound(Data, key);
|
||
|
if (it == Data.end() || it->key != key)
|
||
|
ImGuiStoragePair* it = ImLowerBound(Data.Data, Data.Data + Data.Size, key);
|
||
|
if (it == Data.Data + Data.Size || it->key != key)
|
||
|
it = Data.insert(it, ImGuiStoragePair(key, default_val));
|
||
|
return &it->val_i;
|
||
|
}
|
||
| ... | ... | |
|
|
||
|
float* ImGuiStorage::GetFloatRef(ImGuiID key, float default_val)
|
||
|
{
|
||
|
ImGuiStoragePair* it = LowerBound(Data, key);
|
||
|
if (it == Data.end() || it->key != key)
|
||
|
ImGuiStoragePair* it = ImLowerBound(Data.Data, Data.Data + Data.Size, key);
|
||
|
if (it == Data.Data + Data.Size || it->key != key)
|
||
|
it = Data.insert(it, ImGuiStoragePair(key, default_val));
|
||
|
return &it->val_f;
|
||
|
}
|
||
|
|
||
|
void** ImGuiStorage::GetVoidPtrRef(ImGuiID key, void* default_val)
|
||
|
{
|
||
|
ImGuiStoragePair* it = LowerBound(Data, key);
|
||
|
if (it == Data.end() || it->key != key)
|
||
|
ImGuiStoragePair* it = ImLowerBound(Data.Data, Data.Data + Data.Size, key);
|
||
|
if (it == Data.Data + Data.Size || it->key != key)
|
||
|
it = Data.insert(it, ImGuiStoragePair(key, default_val));
|
||
|
return &it->val_p;
|
||
|
}
|
||
| ... | ... | |
|
// FIXME-OPT: Need a way to reuse the result of lower_bound when doing GetInt()/SetInt() - not too bad because it only happens on explicit interaction (maximum one a frame)
|
||
|
void ImGuiStorage::SetInt(ImGuiID key, int val)
|
||
|
{
|
||
|
ImGuiStoragePair* it = LowerBound(Data, key);
|
||
|
if (it == Data.end() || it->key != key)
|
||
|
ImGuiStoragePair* it = ImLowerBound(Data.Data, Data.Data + Data.Size, key);
|
||
|
if (it == Data.Data + Data.Size || it->key != key)
|
||
|
Data.insert(it, ImGuiStoragePair(key, val));
|
||
|
else
|
||
|
it->val_i = val;
|
||
| ... | ... | |
|
|
||
|
void ImGuiStorage::SetFloat(ImGuiID key, float val)
|
||
|
{
|
||
|
ImGuiStoragePair* it = LowerBound(Data, key);
|
||
|
if (it == Data.end() || it->key != key)
|
||
|
ImGuiStoragePair* it = ImLowerBound(Data.Data, Data.Data + Data.Size, key);
|
||
|
if (it == Data.Data + Data.Size || it->key != key)
|
||
|
Data.insert(it, ImGuiStoragePair(key, val));
|
||
|
else
|
||
|
it->val_f = val;
|
||
| ... | ... | |
|
|
||
|
void ImGuiStorage::SetVoidPtr(ImGuiID key, void* val)
|
||
|
{
|
||
|
ImGuiStoragePair* it = LowerBound(Data, key);
|
||
|
if (it == Data.end() || it->key != key)
|
||
|
ImGuiStoragePair* it = ImLowerBound(Data.Data, Data.Data + Data.Size, key);
|
||
|
if (it == Data.Data + Data.Size || it->key != key)
|
||
|
Data.insert(it, ImGuiStoragePair(key, val));
|
||
|
else
|
||
|
it->val_p = val;
|
||
| ... | ... | |
|
for (int i = 0; i < Data.Size; i++)
|
||
|
Data[i].val_i = v;
|
||
|
}
|
||
|
IM_MSVC_RUNTIME_CHECKS_RESTORE
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
// [SECTION] ImGuiTextFilter
|
||
| ... | ... | |
|
|
||
|
bool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const
|
||
|
{
|
||
|
if (Filters.empty())
|
||
|
if (Filters.Size == 0)
|
||
|
return true;
|
||
|
|
||
|
if (text == NULL)
|
||
|
text = "";
|
||
|
text = text_end = "";
|
||
|
|
||
|
for (const ImGuiTextRange& f : Filters)
|
||
|
{
|
||
|
if (f.empty())
|
||
|
if (f.b == f.e)
|
||
|
continue;
|
||
|
if (f.b[0] == '-')
|
||
|
{
|
||
| ... | ... | |
|
}
|
||
|
}
|
||
|
|
||
|
static void ImGuiListClipper_SeekCursorForItem(ImGuiListClipper* clipper, int item_n)
|
||
|
{
|
||
|
// StartPosY starts from ItemsFrozen hence the subtraction
|
||
|
// Perform the add and multiply with double to allow seeking through larger ranges
|
||
|
ImGuiListClipperData* data = (ImGuiListClipperData*)clipper->TempData;
|
||
|
float pos_y = (float)((double)clipper->StartPosY + data->LossynessOffset + (double)(item_n - data->ItemsFrozen) * clipper->ItemsHeight);
|
||
|
ImGuiListClipper_SeekCursorAndSetupPrevLine(pos_y, clipper->ItemsHeight);
|
||
|
}
|
||
|
|
||
|
ImGuiListClipper::ImGuiListClipper()
|
||
|
{
|
||
|
memset(this, 0, sizeof(*this));
|
||
| ... | ... | |
|
data->Reset(this);
|
||
|
data->LossynessOffset = window->DC.CursorStartPosLossyness.y;
|
||
|
TempData = data;
|
||
|
StartSeekOffsetY = data->LossynessOffset;
|
||
|
}
|
||
|
|
||
|
void ImGuiListClipper::End()
|
||
| ... | ... | |
|
ImGuiContext& g = *Ctx;
|
||
|
IMGUI_DEBUG_LOG_CLIPPER("Clipper: End() in '%s'\n", g.CurrentWindow->Name);
|
||
|
if (ItemsCount >= 0 && ItemsCount < INT_MAX && DisplayStart >= 0)
|
||
|
ImGuiListClipper_SeekCursorForItem(this, ItemsCount);
|
||
|
SeekCursorForItem(ItemsCount);
|
||
|
|
||
|
// Restore temporary buffer and fix back pointers which may be invalidated when nesting
|
||
|
IM_ASSERT(data->ListClipper == this);
|
||
| ... | ... | |
|
data->Ranges.push_back(ImGuiListClipperRange::FromIndices(item_begin, item_end));
|
||
|
}
|
||
|
|
||
|
// This is already called while stepping.
|
||
|
// The ONLY reason you may want to call this is if you passed INT_MAX to ImGuiListClipper::Begin() because you couldn't step item count beforehand.
|
||
|
void ImGuiListClipper::SeekCursorForItem(int item_n)
|
||
|
{
|
||
|
// - Perform the add and multiply with double to allow seeking through larger ranges.
|
||
|
// - StartPosY starts from ItemsFrozen, by adding SeekOffsetY we generally cancel that out (SeekOffsetY == LossynessOffset - ItemsFrozen * ItemsHeight).
|
||
|
// - The reason we store SeekOffsetY instead of inferring it, is because we want to allow user to perform Seek after the last step, where ImGuiListClipperData is already done.
|
||
|
float pos_y = (float)((double)StartPosY + StartSeekOffsetY + (double)item_n * ItemsHeight);
|
||
|
ImGuiListClipper_SeekCursorAndSetupPrevLine(pos_y, ItemsHeight);
|
||
|
}
|
||
|
|
||
|
static bool ImGuiListClipper_StepInternal(ImGuiListClipper* clipper)
|
||
|
{
|
||
|
ImGuiContext& g = *clipper->Ctx;
|
||
| ... | ... | |
|
bool affected_by_floating_point_precision = ImIsFloatAboveGuaranteedIntegerPrecision(clipper->StartPosY) || ImIsFloatAboveGuaranteedIntegerPrecision(window->DC.CursorPos.y);
|
||
|
if (affected_by_floating_point_precision)
|
||
|
clipper->ItemsHeight = window->DC.PrevLineSize.y + g.Style.ItemSpacing.y; // FIXME: Technically wouldn't allow multi-line entries.
|
||
|
|
||
|
if (clipper->ItemsHeight == 0.0f && clipper->ItemsCount == INT_MAX) // Accept that no item have been submitted if in indeterminate mode.
|
||
|
return false;
|
||
|
IM_ASSERT(clipper->ItemsHeight > 0.0f && "Unable to calculate item height! First item hasn't moved the cursor vertically!");
|
||
|
calc_clipping = true; // If item height had to be calculated, calculate clipping afterwards.
|
||
|
}
|
||
| ... | ... | |
|
const int already_submitted = clipper->DisplayEnd;
|
||
|
if (calc_clipping)
|
||
|
{
|
||
|
// Record seek offset, this is so ImGuiListClipper::Seek() can be called after ImGuiListClipperData is done
|
||
|
clipper->StartSeekOffsetY = (double)data->LossynessOffset - data->ItemsFrozen * (double)clipper->ItemsHeight;
|
||
|
|
||
|
if (g.LogEnabled)
|
||
|
{
|
||
|
// If logging is active, do not perform any clipping
|
||
| ... | ... | |
|
data->Ranges.push_back(ImGuiListClipperRange::FromPositions(nav_rect_abs.Min.y, nav_rect_abs.Max.y, 0, 0));
|
||
|
|
||
|
// Add visible range
|
||
|
float min_y = window->ClipRect.Min.y;
|
||
|
float max_y = window->ClipRect.Max.y;
|
||
|
|
||
|
// Add box selection range
|
||
|
ImGuiBoxSelectState* bs = &g.BoxSelectState;
|
||
|
if (bs->IsActive && bs->Window == window)
|
||
|
{
|
||
|
// FIXME: Selectable() use of half-ItemSpacing isn't consistent in matter of layout, as ItemAdd(bb) stray above ItemSize()'s CursorPos.
|
||
|
// RangeSelect's BoxSelect relies on comparing overlap of previous and current rectangle and is sensitive to that.
|
||
|
// As a workaround we currently half ItemSpacing worth on each side.
|
||
|
min_y -= g.Style.ItemSpacing.y;
|
||
|
max_y += g.Style.ItemSpacing.y;
|
||
|
|
||
|
// Box-select on 2D area requires different clipping.
|
||
|
if (bs->UnclipMode)
|
||
|
data->Ranges.push_back(ImGuiListClipperRange::FromPositions(bs->UnclipRect.Min.y, bs->UnclipRect.Max.y, 0, 0));
|
||
|
}
|
||
|
|
||
|
const int off_min = (is_nav_request && g.NavMoveClipDir == ImGuiDir_Up) ? -1 : 0;
|
||
|
const int off_max = (is_nav_request && g.NavMoveClipDir == ImGuiDir_Down) ? 1 : 0;
|
||
|
data->Ranges.push_back(ImGuiListClipperRange::FromPositions(window->ClipRect.Min.y, window->ClipRect.Max.y, off_min, off_max));
|
||
|
data->Ranges.push_back(ImGuiListClipperRange::FromPositions(min_y, max_y, off_min, off_max));
|
||
|
}
|
||
|
|
||
|
// Convert position ranges to item index ranges
|
||
| ... | ... | |
|
clipper->DisplayStart = ImMax(data->Ranges[data->StepNo].Min, already_submitted);
|
||
|
clipper->DisplayEnd = ImMin(data->Ranges[data->StepNo].Max, clipper->ItemsCount);
|
||
|
if (clipper->DisplayStart > already_submitted) //-V1051
|
||
|
ImGuiListClipper_SeekCursorForItem(clipper, clipper->DisplayStart);
|
||
|
clipper->SeekCursorForItem(clipper->DisplayStart);
|
||
|
data->StepNo++;
|
||
|
if (clipper->DisplayStart == clipper->DisplayEnd && data->StepNo < data->Ranges.Size)
|
||
|
continue;
|
||
| ... | ... | |
|
// After the last step: Let the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd),
|
||
|
// Advance the cursor to the end of the list and then returns 'false' to end the loop.
|
||
|
if (clipper->ItemsCount < INT_MAX)
|
||
|
ImGuiListClipper_SeekCursorForItem(clipper, clipper->ItemsCount);
|
||
|
clipper->SeekCursorForItem(clipper->ItemsCount);
|
||
|
|
||
|
return false;
|
||
|
}
|
||
| ... | ... | |
|
return style.Colors[idx];
|
||
|
}
|
||
|
|
||
|
ImU32 ImGui::GetColorU32(ImU32 col)
|
||
|
ImU32 ImGui::GetColorU32(ImU32 col, float alpha_mul)
|
||
|
{
|
||
|
ImGuiStyle& style = GImGui->Style;
|
||
|
if (style.Alpha >= 1.0f)
|
||
|
alpha_mul *= style.Alpha;
|
||
|
if (alpha_mul >= 1.0f)
|
||
|
return col;
|
||
|
ImU32 a = (col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT;
|
||
|
a = (ImU32)(a * style.Alpha); // We don't need to clamp 0..255 because Style.Alpha is in 0..1 range.
|
||
|
a = (ImU32)(a * alpha_mul); // We don't need to clamp 0..255 because alpha is in 0..1 range.
|
||
|
return (col & ~IM_COL32_A_MASK) | (a << IM_COL32_A_SHIFT);
|
||
|
}
|
||
|
|
||
| ... | ... | |
|
ImGuiContext& g = *GImGui;
|
||
|
if (g.ColorStack.Size < count)
|
||
|
{
|
||
|
IM_ASSERT_USER_ERROR(g.ColorStack.Size > count, "Calling PopStyleColor() too many times!");
|
||
|
IM_ASSERT_USER_ERROR(0, "Calling PopStyleColor() too many times!");
|
||
|
count = g.ColorStack.Size;
|
||
|
}
|
||
|
while (count > 0)
|
||
| ... | ... | |
|
|
||
|
static const ImGuiDataVarInfo GStyleVarInfo[] =
|
||
|
{
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, Alpha) }, // ImGuiStyleVar_Alpha
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, DisabledAlpha) }, // ImGuiStyleVar_DisabledAlpha
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, WindowPadding) }, // ImGuiStyleVar_WindowPadding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, WindowRounding) }, // ImGuiStyleVar_WindowRounding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, WindowBorderSize) }, // ImGuiStyleVar_WindowBorderSize
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, WindowMinSize) }, // ImGuiStyleVar_WindowMinSize
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, WindowTitleAlign) }, // ImGuiStyleVar_WindowTitleAlign
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, ChildRounding) }, // ImGuiStyleVar_ChildRounding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, ChildBorderSize) }, // ImGuiStyleVar_ChildBorderSize
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, PopupRounding) }, // ImGuiStyleVar_PopupRounding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, PopupBorderSize) }, // ImGuiStyleVar_PopupBorderSize
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, FramePadding) }, // ImGuiStyleVar_FramePadding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, FrameRounding) }, // ImGuiStyleVar_FrameRounding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, FrameBorderSize) }, // ImGuiStyleVar_FrameBorderSize
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, ItemSpacing) }, // ImGuiStyleVar_ItemSpacing
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, ItemInnerSpacing) }, // ImGuiStyleVar_ItemInnerSpacing
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, IndentSpacing) }, // ImGuiStyleVar_IndentSpacing
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, CellPadding) }, // ImGuiStyleVar_CellPadding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, ScrollbarSize) }, // ImGuiStyleVar_ScrollbarSize
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, ScrollbarRounding) }, // ImGuiStyleVar_ScrollbarRounding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, GrabMinSize) }, // ImGuiStyleVar_GrabMinSize
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, GrabRounding) }, // ImGuiStyleVar_GrabRounding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, TabRounding) }, // ImGuiStyleVar_TabRounding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, TabBarBorderSize) }, // ImGuiStyleVar_TabBarBorderSize
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, ButtonTextAlign) }, // ImGuiStyleVar_ButtonTextAlign
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, SelectableTextAlign) }, // ImGuiStyleVar_SelectableTextAlign
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, SeparatorTextBorderSize)},// ImGuiStyleVar_SeparatorTextBorderSize
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, SeparatorTextAlign) }, // ImGuiStyleVar_SeparatorTextAlign
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, SeparatorTextPadding) }, // ImGuiStyleVar_SeparatorTextPadding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, Alpha) }, // ImGuiStyleVar_Alpha
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, DisabledAlpha) }, // ImGuiStyleVar_DisabledAlpha
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, WindowPadding) }, // ImGuiStyleVar_WindowPadding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, WindowRounding) }, // ImGuiStyleVar_WindowRounding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, WindowBorderSize) }, // ImGuiStyleVar_WindowBorderSize
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, WindowMinSize) }, // ImGuiStyleVar_WindowMinSize
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, WindowTitleAlign) }, // ImGuiStyleVar_WindowTitleAlign
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, ChildRounding) }, // ImGuiStyleVar_ChildRounding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, ChildBorderSize) }, // ImGuiStyleVar_ChildBorderSize
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, PopupRounding) }, // ImGuiStyleVar_PopupRounding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, PopupBorderSize) }, // ImGuiStyleVar_PopupBorderSize
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, FramePadding) }, // ImGuiStyleVar_FramePadding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, FrameRounding) }, // ImGuiStyleVar_FrameRounding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, FrameBorderSize) }, // ImGuiStyleVar_FrameBorderSize
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, ItemSpacing) }, // ImGuiStyleVar_ItemSpacing
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, ItemInnerSpacing) }, // ImGuiStyleVar_ItemInnerSpacing
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, IndentSpacing) }, // ImGuiStyleVar_IndentSpacing
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, CellPadding) }, // ImGuiStyleVar_CellPadding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, ScrollbarSize) }, // ImGuiStyleVar_ScrollbarSize
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, ScrollbarRounding) }, // ImGuiStyleVar_ScrollbarRounding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, GrabMinSize) }, // ImGuiStyleVar_GrabMinSize
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, GrabRounding) }, // ImGuiStyleVar_GrabRounding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, TabRounding) }, // ImGuiStyleVar_TabRounding
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, TabBorderSize) }, // ImGuiStyleVar_TabBorderSize
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, TabBarBorderSize) }, // ImGuiStyleVar_TabBarBorderSize
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, TabBarOverlineSize) }, // ImGuiStyleVar_TabBarOverlineSize
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, TableAngledHeadersAngle)}, // ImGuiStyleVar_TableAngledHeadersAngle
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, TableAngledHeadersTextAlign)},// ImGuiStyleVar_TableAngledHeadersTextAlign
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, ButtonTextAlign) }, // ImGuiStyleVar_ButtonTextAlign
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, SelectableTextAlign) }, // ImGuiStyleVar_SelectableTextAlign
|
||
|
{ ImGuiDataType_Float, 1, (ImU32)offsetof(ImGuiStyle, SeparatorTextBorderSize)}, // ImGuiStyleVar_SeparatorTextBorderSize
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, SeparatorTextAlign) }, // ImGuiStyleVar_SeparatorTextAlign
|
||
|
{ ImGuiDataType_Float, 2, (ImU32)offsetof(ImGuiStyle, SeparatorTextPadding) }, // ImGuiStyleVar_SeparatorTextPadding
|
||
|
};
|
||
|
|
||
|
const ImGuiDataVarInfo* ImGui::GetStyleVarInfo(ImGuiStyleVar idx)
|
||
| ... | ... | |
|
{
|
||
|
ImGuiContext& g = *GImGui;
|
||
|
const ImGuiDataVarInfo* var_info = GetStyleVarInfo(idx);
|
||
|
if (var_info->Type == ImGuiDataType_Float && var_info->Count == 1)
|
||
|
if (var_info->Type != ImGuiDataType_Float || var_info->Count != 1)
|
||
|
{
|
||
|
IM_ASSERT_USER_ERROR(0, "Calling PushStyleVar() variant with wrong type!");
|
||
|
return;
|
||
|
}
|
||
|
float* pvar = (float*)var_info->GetVarPtr(&g.Style);
|
||
|
g.StyleVarStack.push_back(ImGuiStyleMod(idx, *pvar));
|
||
|
*pvar = val;
|
||
|
}
|
||
|
|
||
|
void ImGui::PushStyleVarX(ImGuiStyleVar idx, float val_x)
|
||
|
{
|
||
|
ImGuiContext& g = *GImGui;
|
||
|
const ImGuiDataVarInfo* var_info = GetStyleVarInfo(idx);
|
||
|
if (var_info->Type != ImGuiDataType_Float || var_info->Count != 2)
|
||
|
{
|
||
|
IM_ASSERT_USER_ERROR(0, "Calling PushStyleVar() variant with wrong type!");
|
||
|
return;
|
||
|
}
|
||
|
ImVec2* pvar = (ImVec2*)var_info->GetVarPtr(&g.Style);
|
||
|
g.StyleVarStack.push_back(ImGuiStyleMod(idx, *pvar));
|
||
|
pvar->x = val_x;
|
||
|
}
|
||
|
|
||
|
void ImGui::PushStyleVarY(ImGuiStyleVar idx, float val_y)
|
||
|
{
|
||
|
ImGuiContext& g = *GImGui;
|
||
|
const ImGuiDataVarInfo* var_info = GetStyleVarInfo(idx);
|
||
|
if (var_info->Type != ImGuiDataType_Float || var_info->Count != 2)
|
||
|
{
|
||
|
float* pvar = (float*)var_info->GetVarPtr(&g.Style);
|
||
|
g.StyleVarStack.push_back(ImGuiStyleMod(idx, *pvar));
|
||
|
*pvar = val;
|
||
|
IM_ASSERT_USER_ERROR(0, "Calling PushStyleVar() variant with wrong type!");
|
||
|
return;
|
||
|
}
|
||
|
IM_ASSERT_USER_ERROR(0, "Calling PushStyleVar() variant with wrong type!");
|
||
|
ImVec2* pvar = (ImVec2*)var_info->GetVarPtr(&g.Style);
|
||
|
g.StyleVarStack.push_back(ImGuiStyleMod(idx, *pvar));
|
||
|
pvar->y = val_y;
|
||
|
}
|
||
|
|
||
|
void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val)
|
||
|
{
|
||
|
ImGuiContext& g = *GImGui;
|
||
|
const ImGuiDataVarInfo* var_info = GetStyleVarInfo(idx);
|
||
|
if (var_info->Type == ImGuiDataType_Float && var_info->Count == 2)
|
||
|
if (var_info->Type != ImGuiDataType_Float || var_info->Count != 2)
|
||
|
{
|
||
|
ImVec2* pvar = (ImVec2*)var_info->GetVarPtr(&g.Style);
|
||
|
g.StyleVarStack.push_back(ImGuiStyleMod(idx, *pvar));
|
||
|
*pvar = val;
|
||
|
IM_ASSERT_USER_ERROR(0, "Calling PushStyleVar() variant with wrong type!");
|
||
|
return;
|
||
|
}
|
||
|
IM_ASSERT_USER_ERROR(0, "Calling PushStyleVar() variant with wrong type!");
|
||
|
ImVec2* pvar = (ImVec2*)var_info->GetVarPtr(&g.Style);
|
||
|
g.StyleVarStack.push_back(ImGuiStyleMod(idx, *pvar));
|
||
|
*pvar = val;
|
||
|
}
|
||
|
|
||
|
void ImGui::PopStyleVar(int count)
|
||
| ... | ... | |
|
ImGuiContext& g = *GImGui;
|
||
|
if (g.StyleVarStack.Size < count)
|
||
|
{
|
||
|
IM_ASSERT_USER_ERROR(g.StyleVarStack.Size > count, "Calling PopStyleVar() too many times!");
|
||
|
IM_ASSERT_USER_ERROR(0, "Calling PopStyleVar() too many times!");
|
||
|
count = g.StyleVarStack.Size;
|
||
|
}
|
||
|
while (count > 0)
|
||
| ... | ... | |
|
case ImGuiCol_ResizeGrip: return "ResizeGrip";
|
||
|
case ImGuiCol_ResizeGripHovered: return "ResizeGripHovered";
|
||
|
case ImGuiCol_ResizeGripActive: return "ResizeGripActive";
|
||
|
case ImGuiCol_Tab: return "Tab";
|
||
|
case ImGuiCol_TabHovered: return "TabHovered";
|
||
|
case ImGuiCol_TabActive: return "TabActive";
|
||
|
case ImGuiCol_TabUnfocused: return "TabUnfocused";
|
||
|
case ImGuiCol_TabUnfocusedActive: return "TabUnfocusedActive";
|
||
|
case ImGuiCol_Tab: return "Tab";
|
||
|
case ImGuiCol_TabSelected: return "TabSelected";
|
||
|
case ImGuiCol_TabSelectedOverline: return "TabSelectedOverline";
|
||
|
case ImGuiCol_TabDimmed: return "TabDimmed";
|
||
|
case ImGuiCol_TabDimmedSelected: return "TabDimmedSelected";
|
||
|
case ImGuiCol_TabDimmedSelectedOverline: return "TabDimmedSelectedOverline";
|
||
|
case ImGuiCol_PlotLines: return "PlotLines";
|
||
|
case ImGuiCol_PlotLinesHovered: return "PlotLinesHovered";
|
||
|
case ImGuiCol_PlotHistogram: return "PlotHistogram";
|
||
| ... | ... | |
|
case ImGuiCol_TableBorderLight: return "TableBorderLight";
|
||
|
case ImGuiCol_TableRowBg: return "TableRowBg";
|
||
|
case ImGuiCol_TableRowBgAlt: return "TableRowBgAlt";
|
||
|
case ImGuiCol_TextLink: return "TextLink";
|
||
|
case ImGuiCol_TextSelectedBg: return "TextSelectedBg";
|
||
|
case ImGuiCol_DragDropTarget: return "DragDropTarget";
|
||
|
case ImGuiCol_NavHighlight: return "NavHighlight";
|
||
|
case ImGuiCol_NavCursor: return "NavCursor";
|
||
|
case ImGuiCol_NavWindowingHighlight: return "NavWindowingHighlight";
|
||
|
case ImGuiCol_NavWindowingDimBg: return "NavWindowingDimBg";
|
||
|
case ImGuiCol_ModalWindowDimBg: return "ModalWindowDimBg";
|
||
| ... | ... | |
|
// min max ellipsis_max
|
||
|
// <-> this is generally some padding value
|
||
|
|
||
|
const ImFont* font = draw_list->_Data->Font;
|
||
|
ImFont* font = draw_list->_Data->Font;
|
||
|
const float font_size = draw_list->_Data->FontSize;
|
||
|
const float font_scale = font_size / font->FontSize;
|
||
|
const float font_scale = draw_list->_Data->FontScale;
|
||
|
const char* text_end_ellipsis = NULL;
|
||
|
const float ellipsis_width = font->EllipsisWidth * font_scale;
|
||
|
|
||
| ... | ... | |
|
}
|
||
|
|
||
|
// Render a rectangle shaped with optional rounding and borders
|
||
|
void ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border, float rounding)
|
||
|
void ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool borders, float rounding)
|
||
|
{
|
||
|
ImGuiContext& g = *GImGui;
|
||
|
ImGuiWindow* window = g.CurrentWindow;
|
||
|
window->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding);
|
||
|
const float border_size = g.Style.FrameBorderSize;
|
||
|
if (border && border_size > 0.0f)
|
||
|
if (borders && border_size > 0.0f)
|
||
|
{
|
||
|
window->DrawList->AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), GetColorU32(ImGuiCol_BorderShadow), rounding, 0, border_size);
|
||
|
window->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding, 0, border_size);
|
||
| ... | ... | |
|
}
|
||
|
}
|
||
|
|
||
|
void ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFlags flags)
|
||
|
void ImGui::RenderNavCursor(const ImRect& bb, ImGuiID id, ImGuiNavRenderCursorFlags flags)
|
||
|
{
|
||
|
ImGuiContext& g = *GImGui;
|
||
|
if (id != g.NavId)
|
||
|
return;
|
||
|
if (g.NavDisableHighlight && !(flags & ImGuiNavHighlightFlags_AlwaysDraw))
|
||
|
if (!g.NavCursorVisible && !(flags & ImGuiNavRenderCursorFlags_AlwaysDraw))
|
||
|
return;
|
||
|
if (id == g.LastItemData.ID && (g.LastItemData.ItemFlags & ImGuiItemFlags_NoNav))
|
||
|
return;
|
||
|
ImGuiWindow* window = g.CurrentWindow;
|
||
|
if (window->DC.NavHideHighlightOneFrame)
|
||
|
return;
|
||
|
|
||
|
float rounding = (flags & ImGuiNavHighlightFlags_NoRounding) ? 0.0f : g.Style.FrameRounding;
|
||
|
float rounding = (flags & ImGuiNavRenderCursorFlags_NoRounding) ? 0.0f : g.Style.FrameRounding;
|
||
|
ImRect display_rect = bb;
|
||
|
display_rect.ClipWith(window->ClipRect);
|
||
|
const float thickness = 2.0f;
|
||
|
if (flags & ImGuiNavHighlightFlags_Compact)
|
||
|
if (flags & ImGuiNavRenderCursorFlags_Compact)
|
||
|
{
|
||
|
window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavHighlight), rounding, 0, thickness);
|
||
|
window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavCursor), rounding, 0, thickness);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
| ... | ... | |
|
bool fully_visible = window->ClipRect.Contains(display_rect);
|
||
|
if (!fully_visible)
|
||
|
window->DrawList->PushClipRect(display_rect.Min, display_rect.Max);
|
||
|
window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavHighlight), rounding, 0, thickness);
|
||
|
window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavCursor), rounding, 0, thickness);
|
||
|
if (!fully_visible)
|
||
|
window->DrawList->PopClipRect();
|
||
|
}
|
||
| ... | ... | |
|
void ImGui::RenderMouseCursor(ImVec2 base_pos, float base_scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow)
|
||
|
{
|
||
|
ImGuiContext& g = *GImGui;
|
||
|
IM_ASSERT(mouse_cursor > ImGuiMouseCursor_None && mouse_cursor < ImGuiMouseCursor_COUNT);
|
||
|
if (mouse_cursor <= ImGuiMouseCursor_None || mouse_cursor >= ImGuiMouseCursor_COUNT) // We intentionally accept out of bound values.
|
||
|
mouse_cursor = ImGuiMouseCursor_Arrow;
|
||
|
ImFontAtlas* font_atlas = g.DrawListSharedData.Font->ContainerAtlas;
|
||
|
for (ImGuiViewportP* viewport : g.Viewports)
|
||
|
{
|
||
| ... | ... | |
|
IM_DELETE(ctx);
|
||
|
}
|
||
|
|
||
|
// IMPORTANT: ###xxx suffixes must be same in ALL languages
|
||
|
// IMPORTANT: interactive elements requires a fixed ###xxx suffix, it must be same in ALL languages to allow for automation.
|
||
|
static const ImGuiLocEntry GLocalizationEntriesEnUS[] =
|
||
|
{
|
||
|
{ ImGuiLocKey_VersionStr, "Dear ImGui " IMGUI_VERSION " (" IM_STRINGIFY(IMGUI_VERSION_NUM) ")" },
|
||
| ... | ... | |
|
{ ImGuiLocKey_WindowingMainMenuBar, "(Main menu bar)" },
|
||
|
{ ImGuiLocKey_WindowingPopup, "(Popup)" },
|
||
|
{ ImGuiLocKey_WindowingUntitled, "(Untitled)" },
|
||
|
{ ImGuiLocKey_OpenLink_s, "Open '%s'" },
|
||
|
{ ImGuiLocKey_CopyLink, "Copy Link###CopyLink" },
|
||
|
};
|
||
|
|
||
|
ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
|
||
|
{
|
||
|
IO.Ctx = this;
|
||
|
InputTextState.Ctx = this;
|
||
|
|
||
|
Initialized = false;
|
||
|
FontAtlasOwnedByContext = shared_font_atlas ? false : true;
|
||
|
Font = NULL;
|
||
|
FontSize = FontBaseSize = FontScale = CurrentDpiScale = 0.0f;
|
||
|
IO.Fonts = shared_font_atlas ? shared_font_atlas : IM_NEW(ImFontAtlas)();
|
||
|
Time = 0.0f;
|
||
|
FrameCount = 0;
|
||
|
FrameCountEnded = FrameCountRendered = -1;
|
||
|
WithinFrameScope = WithinFrameScopeWithImplicitWindow = WithinEndChild = false;
|
||
|
GcCompactAll = false;
|
||
|
TestEngineHookItems = false;
|
||
|
TestEngine = NULL;
|
||
|
memset(ContextName, 0, sizeof(ContextName));
|
||
|
|
||
|
InputEventsNextMouseSource = ImGuiMouseSource_Mouse;
|
||
|
InputEventsNextEventId = 1;
|
||
|
|
||
|
WindowsActiveCount = 0;
|
||
|
CurrentWindow = NULL;
|
||
|
HoveredWindow = NULL;
|
||
|
HoveredWindowUnderMovingWindow = NULL;
|
||
|
HoveredWindowBeforeClear = NULL;
|
||
|
MovingWindow = NULL;
|
||
|
WheelingWindow = NULL;
|
||
|
WheelingWindowStartFrame = WheelingWindowScrolledFrame = -1;
|
||
|
WheelingWindowReleaseTimer = 0.0f;
|
||
|
|
||
|
DebugDrawIdConflicts = 0;
|
||
|
DebugHookIdInfo = 0;
|
||
|
HoveredId = HoveredIdPreviousFrame = 0;
|
||
|
HoveredIdPreviousFrameItemCount = 0;
|
||
|
HoveredIdAllowOverlap = false;
|
||
|
HoveredIdIsDisabled = false;
|
||
|
HoveredIdTimer = HoveredIdNotActiveTimer = 0.0f;
|
||
|
ItemUnclipByLog = false;
|
||
|
ActiveId = 0;
|
||
|
ActiveIdIsAlive = 0;
|
||
|
ActiveIdTimer = 0.0f;
|
||
|
ActiveIdIsJustActivated = false;
|
||
|
ActiveIdAllowOverlap = false;
|
||
|
ActiveIdNoClearOnFocusLoss = false;
|
||
|
ActiveIdHasBeenPressedBefore = false;
|
||
|
ActiveIdHasBeenEditedBefore = false;
|
||
|
ActiveIdHasBeenEditedThisFrame = false;
|
||
|
ActiveIdFromShortcut = false;
|
||
|
ActiveIdClickOffset = ImVec2(-1, -1);
|
||
|
ActiveIdWindow = NULL;
|
||
|
ActiveIdSource = ImGuiInputSource_None;
|
||
|
ActiveIdMouseButton = -1;
|
||
|
ActiveIdPreviousFrame = 0;
|
||
|
ActiveIdPreviousFrameIsAlive = false;
|
||
|
ActiveIdPreviousFrameHasBeenEditedBefore = false;
|
||
|
ActiveIdPreviousFrameWindow = NULL;
|
||
|
LastActiveId = 0;
|
||
|
LastActiveIdTimer = 0.0f;
|
||
|
|
||
|
LastKeyboardKeyPressTime = LastKeyModsChangeTime = LastKeyModsChangeFromNoneTime = -1.0;
|
||
|
|
||
|
ActiveIdUsingNavDirMask = 0x00;
|
||
|
ActiveIdUsingAllKeyboardKeys = false;
|
||
|
|
||
|
CurrentFocusScopeId = 0;
|
||
|
CurrentItemFlags = ImGuiItemFlags_None;
|
||
|
DebugShowGroupRects = false;
|
||
|
|
||
|
NavCursorVisible = false;
|
||
|
NavHighlightItemUnderNav = false;
|
||
|
NavMousePosDirty = false;
|
||
|
NavIdIsAlive = false;
|
||
|
NavId = 0;
|
||
|
NavWindow = NULL;
|
||
|
NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = 0;
|
||
|
NavLayer = ImGuiNavLayer_Main;
|
||
|
NavNextActivateId = 0;
|
||
|
NavActivateFlags = NavNextActivateFlags = ImGuiActivateFlags_None;
|
||
|
NavHighlightActivatedId = 0;
|
||
|
NavHighlightActivatedTimer = 0.0f;
|
||
|
NavInputSource = ImGuiInputSource_Keyboard;
|
||
|
NavLastValidSelectionUserData = ImGuiSelectionUserData_Invalid;
|
||
|
NavCursorHideFrames = 0;
|
||
|
|
||
|
NavAnyRequest = false;
|
||
|
NavInitRequest = false;
|
||
|
NavInitRequestFromMove = false;
|
||
|
NavMoveSubmitted = false;
|
||
|
NavMoveScoringItems = false;
|
||
|
NavMoveForwardToNextFrame = false;
|
||
|
NavMoveFlags = ImGuiNavMoveFlags_None;
|
||
|
NavMoveScrollFlags = ImGuiScrollFlags_None;
|
||
|
NavMoveKeyMods = ImGuiMod_None;
|
||
|
NavMoveDir = NavMoveDirForDebug = NavMoveClipDir = ImGuiDir_None;
|
||
|
NavScoringDebugCount = 0;
|
||
|
NavTabbingDir = 0;
|
||
|
NavTabbingCounter = 0;
|
||
|
|
||
|
NavJustMovedFromFocusScopeId = NavJustMovedToId = NavJustMovedToFocusScopeId = 0;
|
||
|
NavJustMovedToKeyMods = ImGuiMod_None;
|
||
Update Dear ImGui to v1.91.5.