Compare commits
3 Commits
02d60643fd
...
b098952613
Author | SHA1 | Date |
---|---|---|
Rekai Nyangadzayi Musuka | b098952613 | |
Rekai Nyangadzayi Musuka | 22510e6071 | |
Rekai Nyangadzayi Musuka | 8b8f962beb |
|
@ -1,4 +1,4 @@
|
||||||
# zgui v0.9.5 - dear imgui bindings
|
# zgui v0.9.4 - dear imgui bindings
|
||||||
|
|
||||||
Easy to use, hand-crafted API with default arguments, named parameters and Zig style text formatting. For a test application please see [here](https://github.com/michal-z/zig-gamedev/tree/main/samples/gui_test_wgpu).
|
Easy to use, hand-crafted API with default arguments, named parameters and Zig style text formatting. For a test application please see [here](https://github.com/michal-z/zig-gamedev/tree/main/samples/gui_test_wgpu).
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2014-2023 Omar Cornut
|
Copyright (c) 2014-2022 Omar Cornut
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2023-01-04: Inputs: Fixed mods state on Linux when using Alt-GR text input (e.g. German keyboard layout), could lead to broken text input. Revert a 2022/01/17 change were we resumed using mods provided by GLFW, turns out they were faulty.
|
|
||||||
// 2022-11-22: Perform a dummy glfwGetError() read to cancel missing names with glfwGetKeyName(). (#5908)
|
// 2022-11-22: Perform a dummy glfwGetError() read to cancel missing names with glfwGetKeyName(). (#5908)
|
||||||
// 2022-10-18: Perform a dummy glfwGetError() read to cancel missing mouse cursors errors. Using GLFW_VERSION_COMBINED directly. (#5785)
|
// 2022-10-18: Perform a dummy glfwGetError() read to cancel missing mouse cursors errors. Using GLFW_VERSION_COMBINED directly. (#5785)
|
||||||
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
|
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
|
||||||
|
@ -283,16 +282,26 @@ static ImGuiKey ImGui_ImplGlfw_KeyToImGuiKey(int key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// X11 does not include current pressed/released modifier key in 'mods' flags submitted by GLFW
|
static int ImGui_ImplGlfw_KeyToModifier(int key)
|
||||||
// See https://github.com/ocornut/imgui/issues/6034 and https://github.com/glfw/glfw/issues/1630
|
{
|
||||||
static void ImGui_ImplGlfw_UpdateKeyModifiers()
|
if (key == GLFW_KEY_LEFT_CONTROL || key == GLFW_KEY_RIGHT_CONTROL)
|
||||||
|
return GLFW_MOD_CONTROL;
|
||||||
|
if (key == GLFW_KEY_LEFT_SHIFT || key == GLFW_KEY_RIGHT_SHIFT)
|
||||||
|
return GLFW_MOD_SHIFT;
|
||||||
|
if (key == GLFW_KEY_LEFT_ALT || key == GLFW_KEY_RIGHT_ALT)
|
||||||
|
return GLFW_MOD_ALT;
|
||||||
|
if (key == GLFW_KEY_LEFT_SUPER || key == GLFW_KEY_RIGHT_SUPER)
|
||||||
|
return GLFW_MOD_SUPER;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ImGui_ImplGlfw_UpdateKeyModifiers(int mods)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
io.AddKeyEvent(ImGuiMod_Ctrl, (mods & GLFW_MOD_CONTROL) != 0);
|
||||||
io.AddKeyEvent(ImGuiMod_Ctrl, (glfwGetKey(bd->Window, GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS) || (glfwGetKey(bd->Window, GLFW_KEY_RIGHT_CONTROL) == GLFW_PRESS));
|
io.AddKeyEvent(ImGuiMod_Shift, (mods & GLFW_MOD_SHIFT) != 0);
|
||||||
io.AddKeyEvent(ImGuiMod_Shift, (glfwGetKey(bd->Window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS) || (glfwGetKey(bd->Window, GLFW_KEY_RIGHT_SHIFT) == GLFW_PRESS));
|
io.AddKeyEvent(ImGuiMod_Alt, (mods & GLFW_MOD_ALT) != 0);
|
||||||
io.AddKeyEvent(ImGuiMod_Alt, (glfwGetKey(bd->Window, GLFW_KEY_LEFT_ALT) == GLFW_PRESS) || (glfwGetKey(bd->Window, GLFW_KEY_RIGHT_ALT) == GLFW_PRESS));
|
io.AddKeyEvent(ImGuiMod_Super, (mods & GLFW_MOD_SUPER) != 0);
|
||||||
io.AddKeyEvent(ImGuiMod_Super, (glfwGetKey(bd->Window, GLFW_KEY_LEFT_SUPER) == GLFW_PRESS) || (glfwGetKey(bd->Window, GLFW_KEY_RIGHT_SUPER) == GLFW_PRESS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods)
|
void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods)
|
||||||
|
@ -301,7 +310,7 @@ void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int acti
|
||||||
if (bd->PrevUserCallbackMousebutton != nullptr && window == bd->Window)
|
if (bd->PrevUserCallbackMousebutton != nullptr && window == bd->Window)
|
||||||
bd->PrevUserCallbackMousebutton(window, button, action, mods);
|
bd->PrevUserCallbackMousebutton(window, button, action, mods);
|
||||||
|
|
||||||
ImGui_ImplGlfw_UpdateKeyModifiers();
|
ImGui_ImplGlfw_UpdateKeyModifiers(mods);
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
if (button >= 0 && button < ImGuiMouseButton_COUNT)
|
if (button >= 0 && button < ImGuiMouseButton_COUNT)
|
||||||
|
@ -360,7 +369,10 @@ void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int keycode, int scancode, i
|
||||||
if (action != GLFW_PRESS && action != GLFW_RELEASE)
|
if (action != GLFW_PRESS && action != GLFW_RELEASE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ImGui_ImplGlfw_UpdateKeyModifiers();
|
// Workaround: X11 does not include current pressed/released modifier key in 'mods' flags. https://github.com/glfw/glfw/issues/1630
|
||||||
|
if (int keycode_to_mod = ImGui_ImplGlfw_KeyToModifier(keycode))
|
||||||
|
mods = (action == GLFW_PRESS) ? (mods | keycode_to_mod) : (mods & ~keycode_to_mod);
|
||||||
|
ImGui_ImplGlfw_UpdateKeyModifiers(mods);
|
||||||
|
|
||||||
keycode = ImGui_ImplGlfw_TranslateUntranslatedKey(keycode, scancode);
|
keycode = ImGui_ImplGlfw_TranslateUntranslatedKey(keycode, scancode);
|
||||||
|
|
||||||
|
|
1565
libs/imgui/imgui.cpp
1565
libs/imgui/imgui.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.89.2
|
// dear imgui, v1.89.1
|
||||||
// (headers)
|
// (headers)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
|
@ -22,8 +22,8 @@
|
||||||
|
|
||||||
// Library Version
|
// Library Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345')
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345')
|
||||||
#define IMGUI_VERSION "1.89.2"
|
#define IMGUI_VERSION "1.89.1 WIP"
|
||||||
#define IMGUI_VERSION_NUM 18920
|
#define IMGUI_VERSION_NUM 18910
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -255,8 +255,8 @@ struct ImVec2
|
||||||
float x, y;
|
float x, y;
|
||||||
constexpr ImVec2() : x(0.0f), y(0.0f) { }
|
constexpr ImVec2() : x(0.0f), y(0.0f) { }
|
||||||
constexpr ImVec2(float _x, float _y) : x(_x), y(_y) { }
|
constexpr ImVec2(float _x, float _y) : x(_x), y(_y) { }
|
||||||
float operator[] (size_t idx) const { IM_ASSERT(idx == 0 || idx == 1); return (&x)[idx]; } // We very rarely use this [] operator, the assert overhead is fine.
|
float operator[] (size_t idx) const { IM_ASSERT(idx <= 1); return (&x)[idx]; } // We very rarely use this [] operator, the assert overhead is fine.
|
||||||
float& operator[] (size_t idx) { IM_ASSERT(idx == 0 || idx == 1); return (&x)[idx]; } // We very rarely use this [] operator, the assert overhead is fine.
|
float& operator[] (size_t idx) { IM_ASSERT(idx <= 1); return (&x)[idx]; } // We very rarely use this [] operator, the assert overhead is fine.
|
||||||
#ifdef IM_VEC2_CLASS_EXTRA
|
#ifdef IM_VEC2_CLASS_EXTRA
|
||||||
IM_VEC2_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec2.
|
IM_VEC2_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec2.
|
||||||
#endif
|
#endif
|
||||||
|
@ -419,7 +419,7 @@ namespace ImGui
|
||||||
IMGUI_API void PopTextWrapPos();
|
IMGUI_API void PopTextWrapPos();
|
||||||
|
|
||||||
// Style read access
|
// Style read access
|
||||||
// - Use the ShowStyleEditor() function to interactively see/edit the colors.
|
// - Use the style editor (ShowStyleEditor() function) to interactively see what the colors are)
|
||||||
IMGUI_API ImFont* GetFont(); // get current font
|
IMGUI_API ImFont* GetFont(); // get current font
|
||||||
IMGUI_API float GetFontSize(); // get current font size (= height in pixels) of current font with current scale applied
|
IMGUI_API float GetFontSize(); // get current font size (= height in pixels) of current font with current scale applied
|
||||||
IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
|
IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
|
||||||
|
@ -782,7 +782,6 @@ namespace ImGui
|
||||||
IMGUI_API int GetColumnsCount();
|
IMGUI_API int GetColumnsCount();
|
||||||
|
|
||||||
// Tab Bars, Tabs
|
// Tab Bars, Tabs
|
||||||
// - Note: Tabs are automatically created by the docking system (when in 'docking' branch). Use this to create tab bars/tabs yourself.
|
|
||||||
IMGUI_API bool BeginTabBar(const char* str_id, ImGuiTabBarFlags flags = 0); // create and append into a TabBar
|
IMGUI_API bool BeginTabBar(const char* str_id, ImGuiTabBarFlags flags = 0); // create and append into a TabBar
|
||||||
IMGUI_API void EndTabBar(); // only call EndTabBar() if BeginTabBar() returns true!
|
IMGUI_API void EndTabBar(); // only call EndTabBar() if BeginTabBar() returns true!
|
||||||
IMGUI_API bool BeginTabItem(const char* label, bool* p_open = NULL, ImGuiTabItemFlags flags = 0); // create a Tab. Returns true if the Tab is selected.
|
IMGUI_API bool BeginTabItem(const char* label, bool* p_open = NULL, ImGuiTabItemFlags flags = 0); // create a Tab. Returns true if the Tab is selected.
|
||||||
|
@ -846,7 +845,6 @@ namespace ImGui
|
||||||
IMGUI_API bool IsAnyItemHovered(); // is any item hovered?
|
IMGUI_API bool IsAnyItemHovered(); // is any item hovered?
|
||||||
IMGUI_API bool IsAnyItemActive(); // is any item active?
|
IMGUI_API bool IsAnyItemActive(); // is any item active?
|
||||||
IMGUI_API bool IsAnyItemFocused(); // is any item focused?
|
IMGUI_API bool IsAnyItemFocused(); // is any item focused?
|
||||||
IMGUI_API ImGuiID GetItemID(); // get ID of last item (~~ often same ImGui::GetID(label) beforehand)
|
|
||||||
IMGUI_API ImVec2 GetItemRectMin(); // get upper-left bounding rectangle of the last item (screen space)
|
IMGUI_API ImVec2 GetItemRectMin(); // get upper-left bounding rectangle of the last item (screen space)
|
||||||
IMGUI_API ImVec2 GetItemRectMax(); // get lower-right bounding rectangle of the last item (screen space)
|
IMGUI_API ImVec2 GetItemRectMax(); // get lower-right bounding rectangle of the last item (screen space)
|
||||||
IMGUI_API ImVec2 GetItemRectSize(); // get size of last item
|
IMGUI_API ImVec2 GetItemRectSize(); // get size of last item
|
||||||
|
@ -883,11 +881,12 @@ namespace ImGui
|
||||||
IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v);
|
IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v);
|
||||||
IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);
|
IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);
|
||||||
|
|
||||||
// Inputs Utilities: Keyboard/Mouse/Gamepad
|
// Inputs Utilities: Keyboard
|
||||||
// - the ImGuiKey enum contains all possible keyboard, mouse and gamepad inputs (e.g. ImGuiKey_A, ImGuiKey_MouseLeft, ImGuiKey_GamepadDpadUp...).
|
// Without IMGUI_DISABLE_OBSOLETE_KEYIO: (legacy support)
|
||||||
// - before v1.87, we used ImGuiKey to carry native/user indices as defined by each backends. About use of those legacy ImGuiKey values:
|
// - For 'ImGuiKey key' you can still use your legacy native/user indices according to how your backend/engine stored them in io.KeysDown[].
|
||||||
// - without IMGUI_DISABLE_OBSOLETE_KEYIO (legacy support): you can still use your legacy native/user indices (< 512) according to how your backend/engine stored them in io.KeysDown[], but need to cast them to ImGuiKey.
|
// With IMGUI_DISABLE_OBSOLETE_KEYIO: (this is the way forward)
|
||||||
// - with IMGUI_DISABLE_OBSOLETE_KEYIO (this is the way forward): any use of ImGuiKey will assert with key < 512. GetKeyIndex() is pass-through and therefore deprecated (gone if IMGUI_DISABLE_OBSOLETE_KEYIO is defined).
|
// - Any use of 'ImGuiKey' will assert when key < 512 will be passed, previously reserved as native/user keys indices
|
||||||
|
// - GetKeyIndex() is pass-through and therefore deprecated (gone if IMGUI_DISABLE_OBSOLETE_KEYIO is defined)
|
||||||
IMGUI_API bool IsKeyDown(ImGuiKey key); // is key being held.
|
IMGUI_API bool IsKeyDown(ImGuiKey key); // is key being held.
|
||||||
IMGUI_API bool IsKeyPressed(ImGuiKey key, bool repeat = true); // was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate
|
IMGUI_API bool IsKeyPressed(ImGuiKey key, bool repeat = true); // was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate
|
||||||
IMGUI_API bool IsKeyReleased(ImGuiKey key); // was key released (went from Down to !Down)?
|
IMGUI_API bool IsKeyReleased(ImGuiKey key); // was key released (went from Down to !Down)?
|
||||||
|
@ -895,7 +894,7 @@ namespace ImGui
|
||||||
IMGUI_API const char* GetKeyName(ImGuiKey key); // [DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared.
|
IMGUI_API const char* GetKeyName(ImGuiKey key); // [DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared.
|
||||||
IMGUI_API void SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard); // Override io.WantCaptureKeyboard flag next frame (said flag is left for your application to handle, typically when true it instructs your app to ignore inputs). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard"; after the next NewFrame() call.
|
IMGUI_API void SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard); // Override io.WantCaptureKeyboard flag next frame (said flag is left for your application to handle, typically when true it instructs your app to ignore inputs). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard"; after the next NewFrame() call.
|
||||||
|
|
||||||
// Inputs Utilities: Mouse specific
|
// Inputs Utilities: Mouse
|
||||||
// - To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right.
|
// - To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right.
|
||||||
// - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.
|
// - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.
|
||||||
// - Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold')
|
// - Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold')
|
||||||
|
@ -1012,7 +1011,7 @@ enum ImGuiInputTextFlags_
|
||||||
ImGuiInputTextFlags_CharsScientific = 1 << 17, // Allow 0123456789.+-*/eE (Scientific notation input)
|
ImGuiInputTextFlags_CharsScientific = 1 << 17, // Allow 0123456789.+-*/eE (Scientific notation input)
|
||||||
ImGuiInputTextFlags_CallbackResize = 1 << 18, // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)
|
ImGuiInputTextFlags_CallbackResize = 1 << 18, // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)
|
||||||
ImGuiInputTextFlags_CallbackEdit = 1 << 19, // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)
|
ImGuiInputTextFlags_CallbackEdit = 1 << 19, // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)
|
||||||
ImGuiInputTextFlags_EscapeClearsAll = 1 << 20, // Escape key clears content if not empty, and deactivate otherwise (contrast to default behavior of Escape to revert)
|
ImGuiInputTextFlags_EscapeClearsAll = 1 << 20, // Escape key clears content if not empty, and deactivate otherwise (constrast to default behavior of Escape to revert)
|
||||||
|
|
||||||
// Obsolete names (will be removed soon)
|
// Obsolete names (will be removed soon)
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
@ -1296,7 +1295,7 @@ enum ImGuiDragDropFlags_
|
||||||
{
|
{
|
||||||
ImGuiDragDropFlags_None = 0,
|
ImGuiDragDropFlags_None = 0,
|
||||||
// BeginDragDropSource() flags
|
// BeginDragDropSource() flags
|
||||||
ImGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0, // Disable preview tooltip. By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disables this behavior.
|
ImGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0, // By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disables this behavior.
|
||||||
ImGuiDragDropFlags_SourceNoDisableHover = 1 << 1, // By default, when dragging we clear data so that IsItemHovered() will return false, to avoid subsequent user code submitting tooltips. This flag disables this behavior so you can still call IsItemHovered() on the source item.
|
ImGuiDragDropFlags_SourceNoDisableHover = 1 << 1, // By default, when dragging we clear data so that IsItemHovered() will return false, to avoid subsequent user code submitting tooltips. This flag disables this behavior so you can still call IsItemHovered() on the source item.
|
||||||
ImGuiDragDropFlags_SourceNoHoldToOpenOthers = 1 << 2, // Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item.
|
ImGuiDragDropFlags_SourceNoHoldToOpenOthers = 1 << 2, // Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item.
|
||||||
ImGuiDragDropFlags_SourceAllowNullID = 1 << 3, // Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit.
|
ImGuiDragDropFlags_SourceAllowNullID = 1 << 3, // Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit.
|
||||||
|
@ -1348,10 +1347,9 @@ enum ImGuiSortDirection_
|
||||||
ImGuiSortDirection_Descending = 2 // Descending = 9->0, Z->A etc.
|
ImGuiSortDirection_Descending = 2 // Descending = 9->0, Z->A etc.
|
||||||
};
|
};
|
||||||
|
|
||||||
// A key identifier (ImGuiKey_XXX or ImGuiMod_XXX value): can represent Keyboard, Mouse and Gamepad values.
|
// A key identifier (ImGuiKey_XXX or ImGuiMod_XXX value)
|
||||||
// All our named keys are >= 512. Keys value 0 to 511 are left unused as legacy native/opaque key values (< 1.87).
|
// All our named keys are >= 512. Keys value 0 to 511 are left unused as legacy native/opaque key values (< 1.87)
|
||||||
// Since >= 1.89 we increased typing (went from int to enum), some legacy code may need a cast to ImGuiKey.
|
// Since >= 1.89 we increased typing (went from int to enum), some legacy code may need a cast to ImGuiKey.
|
||||||
// Read details about the 1.87 and 1.89 transition : https://github.com/ocornut/imgui/issues/4921
|
|
||||||
enum ImGuiKey : int
|
enum ImGuiKey : int
|
||||||
{
|
{
|
||||||
// Keyboard
|
// Keyboard
|
||||||
|
@ -1406,7 +1404,7 @@ enum ImGuiKey : int
|
||||||
ImGuiKey_KeypadEnter,
|
ImGuiKey_KeypadEnter,
|
||||||
ImGuiKey_KeypadEqual,
|
ImGuiKey_KeypadEqual,
|
||||||
|
|
||||||
// Gamepad (some of those are analog values, 0.0f to 1.0f) // NAVIGATION ACTION
|
// Gamepad (some of those are analog values, 0.0f to 1.0f) // GAME NAVIGATION ACTION
|
||||||
// (download controller mapping PNG/PSD at http://dearimgui.org/controls_sheets)
|
// (download controller mapping PNG/PSD at http://dearimgui.org/controls_sheets)
|
||||||
ImGuiKey_GamepadStart, // Menu (Xbox) + (Switch) Start/Options (PS)
|
ImGuiKey_GamepadStart, // Menu (Xbox) + (Switch) Start/Options (PS)
|
||||||
ImGuiKey_GamepadBack, // View (Xbox) - (Switch) Share (PS)
|
ImGuiKey_GamepadBack, // View (Xbox) - (Switch) Share (PS)
|
||||||
|
@ -1433,7 +1431,7 @@ enum ImGuiKey : int
|
||||||
ImGuiKey_GamepadRStickUp, // [Analog]
|
ImGuiKey_GamepadRStickUp, // [Analog]
|
||||||
ImGuiKey_GamepadRStickDown, // [Analog]
|
ImGuiKey_GamepadRStickDown, // [Analog]
|
||||||
|
|
||||||
// Aliases: Mouse Buttons (auto-submitted from AddMouseButtonEvent() calls)
|
// Mouse Buttons (auto-submitted from AddMouseButtonEvent() calls)
|
||||||
// - This is mirroring the data also written to io.MouseDown[], io.MouseWheel, in a format allowing them to be accessed via standard key API.
|
// - This is mirroring the data also written to io.MouseDown[], io.MouseWheel, in a format allowing them to be accessed via standard key API.
|
||||||
ImGuiKey_MouseLeft, ImGuiKey_MouseRight, ImGuiKey_MouseMiddle, ImGuiKey_MouseX1, ImGuiKey_MouseX2, ImGuiKey_MouseWheelX, ImGuiKey_MouseWheelY,
|
ImGuiKey_MouseLeft, ImGuiKey_MouseRight, ImGuiKey_MouseMiddle, ImGuiKey_MouseX1, ImGuiKey_MouseX2, ImGuiKey_MouseWheelX, ImGuiKey_MouseWheelY,
|
||||||
|
|
||||||
|
@ -1450,12 +1448,16 @@ enum ImGuiKey : int
|
||||||
// In practice: it's complicated; mods are often provided from different sources. Keyboard layout, IME, sticky keys and
|
// In practice: it's complicated; mods are often provided from different sources. Keyboard layout, IME, sticky keys and
|
||||||
// backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user...
|
// backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user...
|
||||||
ImGuiMod_None = 0,
|
ImGuiMod_None = 0,
|
||||||
ImGuiMod_Ctrl = 1 << 12, // Ctrl
|
ImGuiMod_Ctrl = 1 << 12,
|
||||||
ImGuiMod_Shift = 1 << 13, // Shift
|
ImGuiMod_Shift = 1 << 13,
|
||||||
ImGuiMod_Alt = 1 << 14, // Option/Menu
|
ImGuiMod_Alt = 1 << 14, // Option/Menu
|
||||||
ImGuiMod_Super = 1 << 15, // Cmd/Super/Windows
|
ImGuiMod_Super = 1 << 15, // Cmd/Super/Windows
|
||||||
ImGuiMod_Shortcut = 1 << 11, // Alias for Ctrl (non-macOS) _or_ Super (macOS).
|
ImGuiMod_Mask_ = 0xF000,
|
||||||
ImGuiMod_Mask_ = 0xF800, // 5-bits
|
#if defined(__APPLE__)
|
||||||
|
ImGuiMod_Shortcut = ImGuiMod_Super,
|
||||||
|
#else
|
||||||
|
ImGuiMod_Shortcut = ImGuiMod_Ctrl,
|
||||||
|
#endif
|
||||||
|
|
||||||
// [Internal] Prior to 1.87 we required user to fill io.KeysDown[512] using their own native index + the io.KeyMap[] array.
|
// [Internal] Prior to 1.87 we required user to fill io.KeysDown[512] using their own native index + the io.KeyMap[] array.
|
||||||
// We are ditching this method but keeping a legacy path for user code doing e.g. IsKeyPressed(MY_NATIVE_KEY_CODE)
|
// We are ditching this method but keeping a legacy path for user code doing e.g. IsKeyPressed(MY_NATIVE_KEY_CODE)
|
||||||
|
@ -1913,7 +1915,7 @@ struct ImGuiIO
|
||||||
float KeyRepeatRate; // = 0.050f // When holding a key/button, rate at which it repeats, in seconds.
|
float KeyRepeatRate; // = 0.050f // When holding a key/button, rate at which it repeats, in seconds.
|
||||||
float HoverDelayNormal; // = 0.30 sec // Delay on hovering before IsItemHovered(ImGuiHoveredFlags_DelayNormal) returns true.
|
float HoverDelayNormal; // = 0.30 sec // Delay on hovering before IsItemHovered(ImGuiHoveredFlags_DelayNormal) returns true.
|
||||||
float HoverDelayShort; // = 0.10 sec // Delay on hovering before IsItemHovered(ImGuiHoveredFlags_DelayShort) returns true.
|
float HoverDelayShort; // = 0.10 sec // Delay on hovering before IsItemHovered(ImGuiHoveredFlags_DelayShort) returns true.
|
||||||
void* UserData; // = NULL // Store your own data.
|
void* UserData; // = NULL // Store your own data for retrieval by callbacks.
|
||||||
|
|
||||||
ImFontAtlas*Fonts; // <auto> // Font atlas: load, rasterize and pack one or more fonts into a single texture.
|
ImFontAtlas*Fonts; // <auto> // Font atlas: load, rasterize and pack one or more fonts into a single texture.
|
||||||
float FontGlobalScale; // = 1.0f // Global scale all fonts
|
float FontGlobalScale; // = 1.0f // Global scale all fonts
|
||||||
|
@ -2026,7 +2028,7 @@ struct ImGuiIO
|
||||||
bool KeySuper; // Keyboard modifier down: Cmd/Super/Windows
|
bool KeySuper; // Keyboard modifier down: Cmd/Super/Windows
|
||||||
|
|
||||||
// Other state maintained from data above + IO function calls
|
// Other state maintained from data above + IO function calls
|
||||||
ImGuiKeyChord KeyMods; // Key mods flags (any of ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Alt/ImGuiMod_Super flags, same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags. DOES NOT CONTAINS ImGuiMod_Shortcut which is pretranslated). Read-only, updated by NewFrame()
|
ImGuiKeyChord KeyMods; // Key mods flags (any of ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Alt/ImGuiMod_Super flags, same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags). Read-only, updated by NewFrame()
|
||||||
ImGuiKeyData KeysData[ImGuiKey_KeysData_SIZE]; // Key state for all known keys. Use IsKeyXXX() functions to access this.
|
ImGuiKeyData KeysData[ImGuiKey_KeysData_SIZE]; // Key state for all known keys. Use IsKeyXXX() functions to access this.
|
||||||
bool WantCaptureMouseUnlessPopupClose; // Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup.
|
bool WantCaptureMouseUnlessPopupClose; // Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup.
|
||||||
ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
|
ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
|
||||||
|
@ -2810,7 +2812,6 @@ struct ImFontAtlas
|
||||||
int TexDesiredWidth; // Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height.
|
int TexDesiredWidth; // Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height.
|
||||||
int TexGlyphPadding; // Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method doesn't rely on bilinear filtering you may set this to 0 (will also need to set AntiAliasedLinesUseTex = false).
|
int TexGlyphPadding; // Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method doesn't rely on bilinear filtering you may set this to 0 (will also need to set AntiAliasedLinesUseTex = false).
|
||||||
bool Locked; // Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert.
|
bool Locked; // Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert.
|
||||||
void* UserData; // Store your own atlas related user-data (if e.g. you have multiple font atlas).
|
|
||||||
|
|
||||||
// [Internal]
|
// [Internal]
|
||||||
// NB: Access texture data via GetTexData*() calls! Which will setup a default font for you.
|
// NB: Access texture data via GetTexData*() calls! Which will setup a default font for you.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.89.2
|
// dear imgui, v1.89.1
|
||||||
// (demo code)
|
// (demo code)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
|
@ -3438,14 +3438,11 @@ static void ShowDemoWindowPopups()
|
||||||
// and BeginPopupContextItem() will use the last item ID as the popup ID.
|
// and BeginPopupContextItem() will use the last item ID as the popup ID.
|
||||||
{
|
{
|
||||||
const char* names[5] = { "Label1", "Label2", "Label3", "Label4", "Label5" };
|
const char* names[5] = { "Label1", "Label2", "Label3", "Label4", "Label5" };
|
||||||
static int selected = -1;
|
|
||||||
for (int n = 0; n < 5; n++)
|
for (int n = 0; n < 5; n++)
|
||||||
{
|
{
|
||||||
if (ImGui::Selectable(names[n], selected == n))
|
ImGui::Selectable(names[n]);
|
||||||
selected = n;
|
|
||||||
if (ImGui::BeginPopupContextItem()) // <-- use last item id as popup id
|
if (ImGui::BeginPopupContextItem()) // <-- use last item id as popup id
|
||||||
{
|
{
|
||||||
selected = n;
|
|
||||||
ImGui::Text("This a popup for \"%s\"!", names[n]);
|
ImGui::Text("This a popup for \"%s\"!", names[n]);
|
||||||
if (ImGui::Button("Close"))
|
if (ImGui::Button("Close"))
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
|
@ -5046,23 +5043,18 @@ static void ShowDemoWindowTables()
|
||||||
if (ImGui::TreeNode("Synced instances"))
|
if (ImGui::TreeNode("Synced instances"))
|
||||||
{
|
{
|
||||||
HelpMarker("Multiple tables with the same identifier will share their settings, width, visibility, order etc.");
|
HelpMarker("Multiple tables with the same identifier will share their settings, width, visibility, order etc.");
|
||||||
|
|
||||||
static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoSavedSettings;
|
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_ScrollY", &flags, ImGuiTableFlags_ScrollY);
|
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_SizingFixedFit", &flags, ImGuiTableFlags_SizingFixedFit);
|
|
||||||
for (int n = 0; n < 3; n++)
|
for (int n = 0; n < 3; n++)
|
||||||
{
|
{
|
||||||
char buf[32];
|
char buf[32];
|
||||||
sprintf(buf, "Synced Table %d", n);
|
sprintf(buf, "Synced Table %d", n);
|
||||||
bool open = ImGui::CollapsingHeader(buf, ImGuiTreeNodeFlags_DefaultOpen);
|
bool open = ImGui::CollapsingHeader(buf, ImGuiTreeNodeFlags_DefaultOpen);
|
||||||
if (open && ImGui::BeginTable("Table", 3, flags, ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 5)))
|
if (open && ImGui::BeginTable("Table", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoSavedSettings))
|
||||||
{
|
{
|
||||||
ImGui::TableSetupColumn("One");
|
ImGui::TableSetupColumn("One");
|
||||||
ImGui::TableSetupColumn("Two");
|
ImGui::TableSetupColumn("Two");
|
||||||
ImGui::TableSetupColumn("Three");
|
ImGui::TableSetupColumn("Three");
|
||||||
ImGui::TableHeadersRow();
|
ImGui::TableHeadersRow();
|
||||||
const int cell_count = (n == 1) ? 27 : 9; // Make second table have a scrollbar to verify that additional decoration is not affecting column positions.
|
for (int cell = 0; cell < 9; cell++)
|
||||||
for (int cell = 0; cell < cell_count; cell++)
|
|
||||||
{
|
{
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Text("this cell %d", cell);
|
ImGui::Text("this cell %d", cell);
|
||||||
|
@ -5694,89 +5686,46 @@ namespace ImGui { extern ImGuiKeyData* GetKeyData(ImGuiKey key); }
|
||||||
|
|
||||||
static void ShowDemoWindowInputs()
|
static void ShowDemoWindowInputs()
|
||||||
{
|
{
|
||||||
IMGUI_DEMO_MARKER("Inputs & Focus");
|
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus");
|
||||||
if (ImGui::CollapsingHeader("Inputs & Focus"))
|
if (ImGui::CollapsingHeader("Inputs, Navigation & Focus"))
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
// Display inputs submitted to ImGuiIO
|
|
||||||
IMGUI_DEMO_MARKER("Inputs & Focus/Inputs");
|
|
||||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
|
||||||
if (ImGui::TreeNode("Inputs"))
|
|
||||||
{
|
|
||||||
HelpMarker(
|
|
||||||
"This is a simplified view. See more detailed input state:\n"
|
|
||||||
"- in 'Tools->Metrics/Debugger->Inputs'.\n"
|
|
||||||
"- in 'Tools->Debug Log->IO'.");
|
|
||||||
if (ImGui::IsMousePosValid())
|
|
||||||
ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y);
|
|
||||||
else
|
|
||||||
ImGui::Text("Mouse pos: <INVALID>");
|
|
||||||
ImGui::Text("Mouse delta: (%g, %g)", io.MouseDelta.x, io.MouseDelta.y);
|
|
||||||
ImGui::Text("Mouse down:");
|
|
||||||
for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseDown(i)) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); }
|
|
||||||
ImGui::Text("Mouse wheel: %.1f", io.MouseWheel);
|
|
||||||
|
|
||||||
// We iterate both legacy native range and named ImGuiKey ranges, which is a little odd but this allows displaying the data for old/new backends.
|
|
||||||
// User code should never have to go through such hoops: old code may use native keycodes, new code may use ImGuiKey codes.
|
|
||||||
#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO
|
|
||||||
struct funcs { static bool IsLegacyNativeDupe(ImGuiKey) { return false; } };
|
|
||||||
#else
|
|
||||||
struct funcs { static bool IsLegacyNativeDupe(ImGuiKey key) { return key < 512 && ImGui::GetIO().KeyMap[key] != -1; } }; // Hide Native<>ImGuiKey duplicates when both exists in the array
|
|
||||||
#endif
|
|
||||||
ImGui::Text("Keys down:"); for (ImGuiKey key = ImGuiKey_KeysData_OFFSET; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key) || !ImGui::IsKeyDown(key)) continue; ImGui::SameLine(); ImGui::Text((key < ImGuiKey_NamedKey_BEGIN) ? "\"%s\"" : "\"%s\" %d", ImGui::GetKeyName(key), key); ImGui::SameLine(); ImGui::Text("(%.02f)", ImGui::GetKeyData(key)->DownDuration); }
|
|
||||||
ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : "");
|
|
||||||
ImGui::Text("Chars queue:"); for (int i = 0; i < io.InputQueueCharacters.Size; i++) { ImWchar c = io.InputQueueCharacters[i]; ImGui::SameLine(); ImGui::Text("\'%c\' (0x%04X)", (c > ' ' && c <= 255) ? (char)c : '?', c); } // FIXME: We should convert 'c' to UTF-8 here but the functions are not public.
|
|
||||||
|
|
||||||
ImGui::TreePop();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Display ImGuiIO output flags
|
// Display ImGuiIO output flags
|
||||||
IMGUI_DEMO_MARKER("Inputs & Focus/Outputs");
|
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Output");
|
||||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||||
if (ImGui::TreeNode("Outputs"))
|
if (ImGui::TreeNode("Output"))
|
||||||
{
|
{
|
||||||
HelpMarker(
|
|
||||||
"The value of io.WantCaptureMouse and io.WantCaptureKeyboard are normally set by Dear ImGui "
|
|
||||||
"to instruct your application of how to route inputs. Typically, when a value is true, it means "
|
|
||||||
"Dear ImGui wants the corresponding inputs and we expect the underlying application to ignore them.\n\n"
|
|
||||||
"The most typical case is: when hovering a window, Dear ImGui set io.WantCaptureMouse to true, "
|
|
||||||
"and underlying application should ignore mouse inputs (in practice there are many and more subtle "
|
|
||||||
"rules leading to how those flags are set).");
|
|
||||||
ImGui::Text("io.WantCaptureMouse: %d", io.WantCaptureMouse);
|
ImGui::Text("io.WantCaptureMouse: %d", io.WantCaptureMouse);
|
||||||
ImGui::Text("io.WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose);
|
ImGui::Text("io.WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose);
|
||||||
ImGui::Text("io.WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
ImGui::Text("io.WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
||||||
ImGui::Text("io.WantTextInput: %d", io.WantTextInput);
|
ImGui::Text("io.WantTextInput: %d", io.WantTextInput);
|
||||||
ImGui::Text("io.WantSetMousePos: %d", io.WantSetMousePos);
|
ImGui::Text("io.WantSetMousePos: %d", io.WantSetMousePos);
|
||||||
ImGui::Text("io.NavActive: %d, io.NavVisible: %d", io.NavActive, io.NavVisible);
|
ImGui::Text("io.NavActive: %d, io.NavVisible: %d", io.NavActive, io.NavVisible);
|
||||||
|
|
||||||
IMGUI_DEMO_MARKER("Inputs & Focus/Outputs/WantCapture override");
|
|
||||||
if (ImGui::TreeNode("WantCapture override"))
|
|
||||||
{
|
|
||||||
HelpMarker(
|
|
||||||
"Hovering the colored canvas will override io.WantCaptureXXX fields.\n"
|
|
||||||
"Notice how normally (when set to none), the value of io.WantCaptureKeyboard would be false when hovering and true when clicking.");
|
|
||||||
static int capture_override_mouse = -1;
|
|
||||||
static int capture_override_keyboard = -1;
|
|
||||||
const char* capture_override_desc[] = { "None", "Set to false", "Set to true" };
|
|
||||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15);
|
|
||||||
ImGui::SliderInt("SetNextFrameWantCaptureMouse() on hover", &capture_override_mouse, -1, +1, capture_override_desc[capture_override_mouse + 1], ImGuiSliderFlags_AlwaysClamp);
|
|
||||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15);
|
|
||||||
ImGui::SliderInt("SetNextFrameWantCaptureKeyboard() on hover", &capture_override_keyboard, -1, +1, capture_override_desc[capture_override_keyboard + 1], ImGuiSliderFlags_AlwaysClamp);
|
|
||||||
|
|
||||||
ImGui::ColorButton("##panel", ImVec4(0.7f, 0.1f, 0.7f, 1.0f), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoDragDrop, ImVec2(128.0f, 96.0f)); // Dummy item
|
|
||||||
if (ImGui::IsItemHovered() && capture_override_mouse != -1)
|
|
||||||
ImGui::SetNextFrameWantCaptureMouse(capture_override_mouse == 1);
|
|
||||||
if (ImGui::IsItemHovered() && capture_override_keyboard != -1)
|
|
||||||
ImGui::SetNextFrameWantCaptureKeyboard(capture_override_keyboard == 1);
|
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Display Mouse state
|
||||||
|
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Mouse State");
|
||||||
|
if (ImGui::TreeNode("Mouse State"))
|
||||||
|
{
|
||||||
|
if (ImGui::IsMousePosValid())
|
||||||
|
ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y);
|
||||||
|
else
|
||||||
|
ImGui::Text("Mouse pos: <INVALID>");
|
||||||
|
ImGui::Text("Mouse delta: (%g, %g)", io.MouseDelta.x, io.MouseDelta.y);
|
||||||
|
|
||||||
|
int count = IM_ARRAYSIZE(io.MouseDown);
|
||||||
|
ImGui::Text("Mouse down:"); for (int i = 0; i < count; i++) if (ImGui::IsMouseDown(i)) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); }
|
||||||
|
ImGui::Text("Mouse clicked:"); for (int i = 0; i < count; i++) if (ImGui::IsMouseClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d (%d)", i, ImGui::GetMouseClickedCount(i)); }
|
||||||
|
ImGui::Text("Mouse released:"); for (int i = 0; i < count; i++) if (ImGui::IsMouseReleased(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); }
|
||||||
|
ImGui::Text("Mouse wheel: %.1f", io.MouseWheel);
|
||||||
|
ImGui::Text("Pen Pressure: %.1f", io.PenPressure); // Note: currently unused
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display mouse cursors
|
// Display mouse cursors
|
||||||
IMGUI_DEMO_MARKER("Inputs & Focus/Mouse Cursors");
|
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Mouse Cursors");
|
||||||
if (ImGui::TreeNode("Mouse Cursors"))
|
if (ImGui::TreeNode("Mouse Cursors"))
|
||||||
{
|
{
|
||||||
const char* mouse_cursors_names[] = { "Arrow", "TextInput", "ResizeAll", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE", "Hand", "NotAllowed" };
|
const char* mouse_cursors_names[] = { "Arrow", "TextInput", "ResizeAll", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE", "Hand", "NotAllowed" };
|
||||||
|
@ -5804,7 +5753,113 @@ static void ShowDemoWindowInputs()
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
IMGUI_DEMO_MARKER("Inputs & Focus/Tabbing");
|
// Display Keyboard/Mouse state
|
||||||
|
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Keyboard, Gamepad & Navigation State");
|
||||||
|
if (ImGui::TreeNode("Keyboard, Gamepad & Navigation State"))
|
||||||
|
{
|
||||||
|
// We iterate both legacy native range and named ImGuiKey ranges, which is a little odd but this allows displaying the data for old/new backends.
|
||||||
|
// User code should never have to go through such hoops: old code may use native keycodes, new code may use ImGuiKey codes.
|
||||||
|
#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||||
|
struct funcs { static bool IsLegacyNativeDupe(ImGuiKey) { return false; } };
|
||||||
|
const ImGuiKey key_first = (ImGuiKey)ImGuiKey_NamedKey_BEGIN;
|
||||||
|
#else
|
||||||
|
struct funcs { static bool IsLegacyNativeDupe(ImGuiKey key) { return key < 512 && ImGui::GetIO().KeyMap[key] != -1; } }; // Hide Native<>ImGuiKey duplicates when both exists in the array
|
||||||
|
const ImGuiKey key_first = (ImGuiKey)0;
|
||||||
|
//ImGui::Text("Legacy raw:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key++) { if (io.KeysDown[key]) { ImGui::SameLine(); ImGui::Text("\"%s\" %d", ImGui::GetKeyName(key), key); } }
|
||||||
|
#endif
|
||||||
|
ImGui::Text("Keys down:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key)) continue; if (ImGui::IsKeyDown(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d (%.02f)", ImGui::GetKeyName(key), key, ImGui::GetKeyData(key)->DownDuration); } }
|
||||||
|
ImGui::Text("Keys pressed:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key)) continue; if (ImGui::IsKeyPressed(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d", ImGui::GetKeyName(key), key); } }
|
||||||
|
ImGui::Text("Keys released:"); for (ImGuiKey key = key_first; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key)) continue; if (ImGui::IsKeyReleased(key)) { ImGui::SameLine(); ImGui::Text("\"%s\" %d", ImGui::GetKeyName(key), key); } }
|
||||||
|
ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : "");
|
||||||
|
ImGui::Text("Chars queue:"); for (int i = 0; i < io.InputQueueCharacters.Size; i++) { ImWchar c = io.InputQueueCharacters[i]; ImGui::SameLine(); ImGui::Text("\'%c\' (0x%04X)", (c > ' ' && c <= 255) ? (char)c : '?', c); } // FIXME: We should convert 'c' to UTF-8 here but the functions are not public.
|
||||||
|
|
||||||
|
// Draw an arbitrary US keyboard layout to visualize translated keys
|
||||||
|
{
|
||||||
|
const ImVec2 key_size = ImVec2(35.0f, 35.0f);
|
||||||
|
const float key_rounding = 3.0f;
|
||||||
|
const ImVec2 key_face_size = ImVec2(25.0f, 25.0f);
|
||||||
|
const ImVec2 key_face_pos = ImVec2(5.0f, 3.0f);
|
||||||
|
const float key_face_rounding = 2.0f;
|
||||||
|
const ImVec2 key_label_pos = ImVec2(7.0f, 4.0f);
|
||||||
|
const ImVec2 key_step = ImVec2(key_size.x - 1.0f, key_size.y - 1.0f);
|
||||||
|
const float key_row_offset = 9.0f;
|
||||||
|
|
||||||
|
ImVec2 board_min = ImGui::GetCursorScreenPos();
|
||||||
|
ImVec2 board_max = ImVec2(board_min.x + 3 * key_step.x + 2 * key_row_offset + 10.0f, board_min.y + 3 * key_step.y + 10.0f);
|
||||||
|
ImVec2 start_pos = ImVec2(board_min.x + 5.0f - key_step.x, board_min.y);
|
||||||
|
|
||||||
|
struct KeyLayoutData { int Row, Col; const char* Label; ImGuiKey Key; };
|
||||||
|
const KeyLayoutData keys_to_display[] =
|
||||||
|
{
|
||||||
|
{ 0, 0, "", ImGuiKey_Tab }, { 0, 1, "Q", ImGuiKey_Q }, { 0, 2, "W", ImGuiKey_W }, { 0, 3, "E", ImGuiKey_E }, { 0, 4, "R", ImGuiKey_R },
|
||||||
|
{ 1, 0, "", ImGuiKey_CapsLock }, { 1, 1, "A", ImGuiKey_A }, { 1, 2, "S", ImGuiKey_S }, { 1, 3, "D", ImGuiKey_D }, { 1, 4, "F", ImGuiKey_F },
|
||||||
|
{ 2, 0, "", ImGuiKey_LeftShift },{ 2, 1, "Z", ImGuiKey_Z }, { 2, 2, "X", ImGuiKey_X }, { 2, 3, "C", ImGuiKey_C }, { 2, 4, "V", ImGuiKey_V }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Elements rendered manually via ImDrawList API are not clipped automatically.
|
||||||
|
// While not strictly necessary, here IsItemVisible() is used to avoid rendering these shapes when they are out of view.
|
||||||
|
ImGui::Dummy(ImVec2(board_max.x - board_min.x, board_max.y - board_min.y));
|
||||||
|
if (ImGui::IsItemVisible())
|
||||||
|
{
|
||||||
|
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||||
|
draw_list->PushClipRect(board_min, board_max, true);
|
||||||
|
for (int n = 0; n < IM_ARRAYSIZE(keys_to_display); n++)
|
||||||
|
{
|
||||||
|
const KeyLayoutData* key_data = &keys_to_display[n];
|
||||||
|
ImVec2 key_min = ImVec2(start_pos.x + key_data->Col * key_step.x + key_data->Row * key_row_offset, start_pos.y + key_data->Row * key_step.y);
|
||||||
|
ImVec2 key_max = ImVec2(key_min.x + key_size.x, key_min.y + key_size.y);
|
||||||
|
draw_list->AddRectFilled(key_min, key_max, IM_COL32(204, 204, 204, 255), key_rounding);
|
||||||
|
draw_list->AddRect(key_min, key_max, IM_COL32(24, 24, 24, 255), key_rounding);
|
||||||
|
ImVec2 face_min = ImVec2(key_min.x + key_face_pos.x, key_min.y + key_face_pos.y);
|
||||||
|
ImVec2 face_max = ImVec2(face_min.x + key_face_size.x, face_min.y + key_face_size.y);
|
||||||
|
draw_list->AddRect(face_min, face_max, IM_COL32(193, 193, 193, 255), key_face_rounding, ImDrawFlags_None, 2.0f);
|
||||||
|
draw_list->AddRectFilled(face_min, face_max, IM_COL32(252, 252, 252, 255), key_face_rounding);
|
||||||
|
ImVec2 label_min = ImVec2(key_min.x + key_label_pos.x, key_min.y + key_label_pos.y);
|
||||||
|
draw_list->AddText(label_min, IM_COL32(64, 64, 64, 255), key_data->Label);
|
||||||
|
if (ImGui::IsKeyDown(key_data->Key))
|
||||||
|
draw_list->AddRectFilled(key_min, key_max, IM_COL32(255, 0, 0, 128), key_rounding);
|
||||||
|
}
|
||||||
|
draw_list->PopClipRect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::TreeNode("Capture override"))
|
||||||
|
{
|
||||||
|
HelpMarker(
|
||||||
|
"The value of io.WantCaptureMouse and io.WantCaptureKeyboard are normally set by Dear ImGui "
|
||||||
|
"to instruct your application of how to route inputs. Typically, when a value is true, it means "
|
||||||
|
"Dear ImGui wants the corresponding inputs and we expect the underlying application to ignore them.\n\n"
|
||||||
|
"The most typical case is: when hovering a window, Dear ImGui set io.WantCaptureMouse to true, "
|
||||||
|
"and underlying application should ignore mouse inputs (in practice there are many and more subtle "
|
||||||
|
"rules leading to how those flags are set).");
|
||||||
|
|
||||||
|
ImGui::Text("io.WantCaptureMouse: %d", io.WantCaptureMouse);
|
||||||
|
ImGui::Text("io.WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose);
|
||||||
|
ImGui::Text("io.WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
||||||
|
|
||||||
|
HelpMarker(
|
||||||
|
"Hovering the colored canvas will override io.WantCaptureXXX fields.\n"
|
||||||
|
"Notice how normally (when set to none), the value of io.WantCaptureKeyboard would be false when hovering and true when clicking.");
|
||||||
|
static int capture_override_mouse = -1;
|
||||||
|
static int capture_override_keyboard = -1;
|
||||||
|
const char* capture_override_desc[] = { "None", "Set to false", "Set to true" };
|
||||||
|
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15);
|
||||||
|
ImGui::SliderInt("SetNextFrameWantCaptureMouse()", &capture_override_mouse, -1, +1, capture_override_desc[capture_override_mouse + 1], ImGuiSliderFlags_AlwaysClamp);
|
||||||
|
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15);
|
||||||
|
ImGui::SliderInt("SetNextFrameWantCaptureKeyboard()", &capture_override_keyboard, -1, +1, capture_override_desc[capture_override_keyboard + 1], ImGuiSliderFlags_AlwaysClamp);
|
||||||
|
|
||||||
|
ImGui::ColorButton("##panel", ImVec4(0.7f, 0.1f, 0.7f, 1.0f), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoDragDrop, ImVec2(256.0f, 192.0f)); // Dummy item
|
||||||
|
if (ImGui::IsItemHovered() && capture_override_mouse != -1)
|
||||||
|
ImGui::SetNextFrameWantCaptureMouse(capture_override_mouse == 1);
|
||||||
|
if (ImGui::IsItemHovered() && capture_override_keyboard != -1)
|
||||||
|
ImGui::SetNextFrameWantCaptureKeyboard(capture_override_keyboard == 1);
|
||||||
|
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
|
||||||
|
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Tabbing");
|
||||||
if (ImGui::TreeNode("Tabbing"))
|
if (ImGui::TreeNode("Tabbing"))
|
||||||
{
|
{
|
||||||
ImGui::Text("Use TAB/SHIFT+TAB to cycle through keyboard editable fields.");
|
ImGui::Text("Use TAB/SHIFT+TAB to cycle through keyboard editable fields.");
|
||||||
|
@ -5820,7 +5875,7 @@ static void ShowDemoWindowInputs()
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
IMGUI_DEMO_MARKER("Inputs & Focus/Focus from code");
|
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Focus from code");
|
||||||
if (ImGui::TreeNode("Focus from code"))
|
if (ImGui::TreeNode("Focus from code"))
|
||||||
{
|
{
|
||||||
bool focus_1 = ImGui::Button("Focus on 1"); ImGui::SameLine();
|
bool focus_1 = ImGui::Button("Focus on 1"); ImGui::SameLine();
|
||||||
|
@ -5862,7 +5917,7 @@ static void ShowDemoWindowInputs()
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
IMGUI_DEMO_MARKER("Inputs & Focus/Dragging");
|
IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Dragging");
|
||||||
if (ImGui::TreeNode("Dragging"))
|
if (ImGui::TreeNode("Dragging"))
|
||||||
{
|
{
|
||||||
ImGui::TextWrapped("You can use ImGui::GetMouseDragDelta(0) to query for the dragged amount on any widget.");
|
ImGui::TextWrapped("You can use ImGui::GetMouseDragDelta(0) to query for the dragged amount on any widget.");
|
||||||
|
@ -7032,7 +7087,7 @@ static void ShowExampleAppLayout(bool* p_open)
|
||||||
{
|
{
|
||||||
if (ImGui::BeginMenu("File"))
|
if (ImGui::BeginMenu("File"))
|
||||||
{
|
{
|
||||||
if (ImGui::MenuItem("Close", "Ctrl+W")) { *p_open = false; }
|
if (ImGui::MenuItem("Close")) *p_open = false;
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
ImGui::EndMenuBar();
|
ImGui::EndMenuBar();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.89.2
|
// dear imgui, v1.89.1
|
||||||
// (drawing and font code)
|
// (drawing and font code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -447,13 +447,11 @@ void ImDrawList::AddDrawCmd()
|
||||||
// Note that this leaves the ImDrawList in a state unfit for further commands, as most code assume that CmdBuffer.Size > 0 && CmdBuffer.back().UserCallback == NULL
|
// Note that this leaves the ImDrawList in a state unfit for further commands, as most code assume that CmdBuffer.Size > 0 && CmdBuffer.back().UserCallback == NULL
|
||||||
void ImDrawList::_PopUnusedDrawCmd()
|
void ImDrawList::_PopUnusedDrawCmd()
|
||||||
{
|
{
|
||||||
while (CmdBuffer.Size > 0)
|
if (CmdBuffer.Size == 0)
|
||||||
{
|
return;
|
||||||
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
if (curr_cmd->ElemCount != 0 || curr_cmd->UserCallback != NULL)
|
if (curr_cmd->ElemCount == 0 && curr_cmd->UserCallback == NULL)
|
||||||
return;// break;
|
|
||||||
CmdBuffer.pop_back();
|
CmdBuffer.pop_back();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data)
|
void ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data)
|
||||||
|
@ -3567,18 +3565,17 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im
|
||||||
while (y + line_height < clip_rect.y && s < text_end)
|
while (y + line_height < clip_rect.y && s < text_end)
|
||||||
{
|
{
|
||||||
const char* line_end = (const char*)memchr(s, '\n', text_end - s);
|
const char* line_end = (const char*)memchr(s, '\n', text_end - s);
|
||||||
const char* line_next = line_end ? line_end + 1 : text_end;
|
|
||||||
if (word_wrap_enabled)
|
if (word_wrap_enabled)
|
||||||
{
|
{
|
||||||
// FIXME-OPT: This is not optimal as do first do a search for \n before calling CalcWordWrapPositionA().
|
// FIXME-OPT: This is not optimal as do first do a search for \n before calling CalcWordWrapPositionA().
|
||||||
// If the specs for CalcWordWrapPositionA() were reworked to optionally return on \n we could combine both.
|
// If the specs for CalcWordWrapPositionA() were reworked to optionally return on \n we could combine both.
|
||||||
// However it is still better than nothing performing the fast-forward!
|
// However it is still better than nothing performing the fast-forward!
|
||||||
s = CalcWordWrapPositionA(scale, s, line_next, wrap_width);
|
s = CalcWordWrapPositionA(scale, s, line_end, wrap_width);
|
||||||
s = CalcWordWrapNextLineStartA(s, text_end);
|
s = CalcWordWrapNextLineStartA(s, text_end);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s = line_next;
|
s = line_end ? line_end + 1 : text_end;
|
||||||
}
|
}
|
||||||
y += line_height;
|
y += line_height;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.89.2
|
// dear imgui, v1.89.1
|
||||||
// (internal structures/api)
|
// (internal structures/api)
|
||||||
|
|
||||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||||
|
@ -56,7 +56,7 @@ Index of this file:
|
||||||
#include <limits.h> // INT_MIN, INT_MAX
|
#include <limits.h> // INT_MIN, INT_MAX
|
||||||
|
|
||||||
// Enable SSE intrinsics if available
|
// Enable SSE intrinsics if available
|
||||||
#if (defined __SSE__ || defined __x86_64__ || defined _M_X64 || (defined(_M_IX86_FP) && (_M_IX86_FP >= 1))) && !defined(IMGUI_DISABLE_SSE)
|
#if (defined __SSE__ || defined __x86_64__ || defined _M_X64) && !defined(IMGUI_DISABLE_SSE)
|
||||||
#define IMGUI_ENABLE_SSE
|
#define IMGUI_ENABLE_SSE
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -206,16 +206,12 @@ namespace ImStb
|
||||||
#ifndef IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
|
#ifndef IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
|
||||||
#define IMGUI_DEBUG_PRINTF(_FMT,...) printf(_FMT, __VA_ARGS__)
|
#define IMGUI_DEBUG_PRINTF(_FMT,...) printf(_FMT, __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define IMGUI_DEBUG_PRINTF(_FMT,...) ((void)0)
|
#define IMGUI_DEBUG_PRINTF(_FMT,...)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Debug Logging for ShowDebugLogWindow(). This is designed for relatively rare events so please don't spam.
|
// Debug Logging for ShowDebugLogWindow(). This is designed for relatively rare events so please don't spam.
|
||||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
|
||||||
#define IMGUI_DEBUG_LOG(...) ImGui::DebugLog(__VA_ARGS__)
|
#define IMGUI_DEBUG_LOG(...) ImGui::DebugLog(__VA_ARGS__)
|
||||||
#else
|
|
||||||
#define IMGUI_DEBUG_LOG(...) ((void)0)
|
|
||||||
#endif
|
|
||||||
#define IMGUI_DEBUG_LOG_ACTIVEID(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventActiveId) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
#define IMGUI_DEBUG_LOG_ACTIVEID(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventActiveId) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
||||||
#define IMGUI_DEBUG_LOG_FOCUS(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventFocus) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
#define IMGUI_DEBUG_LOG_FOCUS(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventFocus) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
||||||
#define IMGUI_DEBUG_LOG_POPUP(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventPopup) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
#define IMGUI_DEBUG_LOG_POPUP(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventPopup) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0)
|
||||||
|
@ -477,7 +473,6 @@ static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a)
|
||||||
static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }
|
static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }
|
||||||
static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }
|
static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }
|
||||||
static inline bool ImIsFloatAboveGuaranteedIntegerPrecision(float f) { return f <= -16777216 || f >= 16777216; }
|
static inline bool ImIsFloatAboveGuaranteedIntegerPrecision(float f) { return f <= -16777216 || f >= 16777216; }
|
||||||
static inline float ImExponentialMovingAverage(float avg, float sample, int n) { avg -= avg / n; avg += sample / n; return avg; }
|
|
||||||
IM_MSVC_RUNTIME_CHECKS_RESTORE
|
IM_MSVC_RUNTIME_CHECKS_RESTORE
|
||||||
|
|
||||||
// Helpers: Geometry
|
// Helpers: Geometry
|
||||||
|
@ -891,9 +886,10 @@ enum ImGuiSelectableFlagsPrivate_
|
||||||
ImGuiSelectableFlags_SelectOnClick = 1 << 22, // Override button behavior to react on Click (default is Click+Release)
|
ImGuiSelectableFlags_SelectOnClick = 1 << 22, // Override button behavior to react on Click (default is Click+Release)
|
||||||
ImGuiSelectableFlags_SelectOnRelease = 1 << 23, // Override button behavior to react on Release (default is Click+Release)
|
ImGuiSelectableFlags_SelectOnRelease = 1 << 23, // Override button behavior to react on Release (default is Click+Release)
|
||||||
ImGuiSelectableFlags_SpanAvailWidth = 1 << 24, // Span all avail width even if we declared less for layout purpose. FIXME: We may be able to remove this (added in 6251d379, 2bcafc86 for menus)
|
ImGuiSelectableFlags_SpanAvailWidth = 1 << 24, // Span all avail width even if we declared less for layout purpose. FIXME: We may be able to remove this (added in 6251d379, 2bcafc86 for menus)
|
||||||
ImGuiSelectableFlags_SetNavIdOnHover = 1 << 25, // Set Nav/Focus ID on mouse hover (used by MenuItem)
|
ImGuiSelectableFlags_DrawHoveredWhenHeld = 1 << 25, // Always show active when held, even is not hovered. This concept could probably be renamed/formalized somehow.
|
||||||
ImGuiSelectableFlags_NoPadWithHalfSpacing = 1 << 26, // Disable padding each side with ItemSpacing * 0.5f
|
ImGuiSelectableFlags_SetNavIdOnHover = 1 << 26, // Set Nav/Focus ID on mouse hover (used by MenuItem)
|
||||||
ImGuiSelectableFlags_NoSetKeyOwner = 1 << 27, // Don't set key/input owner on the initial click (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
|
ImGuiSelectableFlags_NoPadWithHalfSpacing = 1 << 27, // Disable padding each side with ItemSpacing * 0.5f
|
||||||
|
ImGuiSelectableFlags_NoSetKeyOwner = 1 << 28, // Don't set key/input owner on the initial click (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Extend ImGuiTreeNodeFlags_
|
// Extend ImGuiTreeNodeFlags_
|
||||||
|
@ -1050,7 +1046,6 @@ struct IMGUI_API ImGuiMenuColumns
|
||||||
// For a given item ID, access with ImGui::GetInputTextState()
|
// For a given item ID, access with ImGui::GetInputTextState()
|
||||||
struct IMGUI_API ImGuiInputTextState
|
struct IMGUI_API ImGuiInputTextState
|
||||||
{
|
{
|
||||||
ImGuiContext* Ctx; // parent dear imgui context
|
|
||||||
ImGuiID ID; // widget id owning the text state
|
ImGuiID ID; // widget id owning the text state
|
||||||
int CurLenW, CurLenA; // we need to maintain our buffer length in both UTF-8 and wchar format. UTF-8 length is valid even if TextA is not.
|
int CurLenW, CurLenA; // we need to maintain our buffer length in both UTF-8 and wchar format. UTF-8 length is valid even if TextA is not.
|
||||||
ImVector<ImWchar> TextW; // edit buffer, we need to persist but can't guarantee the persistence of the user-provided buffer. so we copy into own buffer.
|
ImVector<ImWchar> TextW; // edit buffer, we need to persist but can't guarantee the persistence of the user-provided buffer. so we copy into own buffer.
|
||||||
|
@ -1066,7 +1061,7 @@ struct IMGUI_API ImGuiInputTextState
|
||||||
bool Edited; // edited this frame
|
bool Edited; // edited this frame
|
||||||
ImGuiInputTextFlags Flags; // copy of InputText() flags. may be used to check if e.g. ImGuiInputTextFlags_Password is set.
|
ImGuiInputTextFlags Flags; // copy of InputText() flags. may be used to check if e.g. ImGuiInputTextFlags_Password is set.
|
||||||
|
|
||||||
ImGuiInputTextState(ImGuiContext* ctx) { memset(this, 0, sizeof(*this)); Ctx = ctx;}
|
ImGuiInputTextState() { memset(this, 0, sizeof(*this)); }
|
||||||
void ClearText() { CurLenW = CurLenA = 0; TextW[0] = 0; TextA[0] = 0; CursorClamp(); }
|
void ClearText() { CurLenW = CurLenA = 0; TextW[0] = 0; TextA[0] = 0; CursorClamp(); }
|
||||||
void ClearFreeMemory() { TextW.clear(); TextA.clear(); InitialTextA.clear(); }
|
void ClearFreeMemory() { TextW.clear(); TextA.clear(); InitialTextA.clear(); }
|
||||||
int GetUndoAvailCount() const { return Stb.undostate.undo_point; }
|
int GetUndoAvailCount() const { return Stb.undostate.undo_point; }
|
||||||
|
@ -1296,7 +1291,7 @@ typedef ImS16 ImGuiKeyRoutingIndex;
|
||||||
struct ImGuiKeyRoutingData
|
struct ImGuiKeyRoutingData
|
||||||
{
|
{
|
||||||
ImGuiKeyRoutingIndex NextEntryIndex;
|
ImGuiKeyRoutingIndex NextEntryIndex;
|
||||||
ImU16 Mods; // Technically we'd only need 4-bits but for simplify we store ImGuiMod_ values which need 16-bits. ImGuiMod_Shortcut is already translated to Ctrl/Super.
|
ImU16 Mods; // Technically we'd only need 4 bits but for simplify we store ImGuiMod_ values which need 16 bits.
|
||||||
ImU8 RoutingNextScore; // Lower is better (0: perfect score)
|
ImU8 RoutingNextScore; // Lower is better (0: perfect score)
|
||||||
ImGuiID RoutingCurr;
|
ImGuiID RoutingCurr;
|
||||||
ImGuiID RoutingNext;
|
ImGuiID RoutingNext;
|
||||||
|
@ -1765,10 +1760,7 @@ struct ImGuiContext
|
||||||
ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actual window that is moved is generally MovingWindow->RootWindow.
|
ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actual window that is moved is generally MovingWindow->RootWindow.
|
||||||
ImGuiWindow* WheelingWindow; // Track the window we started mouse-wheeling on. Until a timer elapse or mouse has moved, generally keep scrolling the same window even if during the course of scrolling the mouse ends up hovering a child window.
|
ImGuiWindow* WheelingWindow; // Track the window we started mouse-wheeling on. Until a timer elapse or mouse has moved, generally keep scrolling the same window even if during the course of scrolling the mouse ends up hovering a child window.
|
||||||
ImVec2 WheelingWindowRefMousePos;
|
ImVec2 WheelingWindowRefMousePos;
|
||||||
int WheelingWindowStartFrame; // This may be set one frame before WheelingWindow is != NULL
|
|
||||||
float WheelingWindowReleaseTimer;
|
float WheelingWindowReleaseTimer;
|
||||||
ImVec2 WheelingWindowWheelRemainder;
|
|
||||||
ImVec2 WheelingAxisAvg;
|
|
||||||
|
|
||||||
// Item/widgets state and tracking information
|
// Item/widgets state and tracking information
|
||||||
ImGuiID DebugHookIdInfo; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
|
ImGuiID DebugHookIdInfo; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
|
||||||
|
@ -2014,7 +2006,6 @@ struct ImGuiContext
|
||||||
ImVector<char> TempBuffer; // Temporary text buffer
|
ImVector<char> TempBuffer; // Temporary text buffer
|
||||||
|
|
||||||
ImGuiContext(ImFontAtlas* shared_font_atlas)
|
ImGuiContext(ImFontAtlas* shared_font_atlas)
|
||||||
: InputTextState(this)
|
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
FontAtlasOwnedByContext = shared_font_atlas ? false : true;
|
FontAtlasOwnedByContext = shared_font_atlas ? false : true;
|
||||||
|
@ -2035,7 +2026,6 @@ struct ImGuiContext
|
||||||
HoveredWindowUnderMovingWindow = NULL;
|
HoveredWindowUnderMovingWindow = NULL;
|
||||||
MovingWindow = NULL;
|
MovingWindow = NULL;
|
||||||
WheelingWindow = NULL;
|
WheelingWindow = NULL;
|
||||||
WheelingWindowStartFrame = -1;
|
|
||||||
WheelingWindowReleaseTimer = 0.0f;
|
WheelingWindowReleaseTimer = 0.0f;
|
||||||
|
|
||||||
DebugHookIdInfo = 0;
|
DebugHookIdInfo = 0;
|
||||||
|
@ -2247,9 +2237,6 @@ struct IMGUI_API ImGuiWindow
|
||||||
ImVec2 WindowPadding; // Window padding at the time of Begin().
|
ImVec2 WindowPadding; // Window padding at the time of Begin().
|
||||||
float WindowRounding; // Window rounding at the time of Begin(). May be clamped lower to avoid rendering artifacts with title bar, menu bar etc.
|
float WindowRounding; // Window rounding at the time of Begin(). May be clamped lower to avoid rendering artifacts with title bar, menu bar etc.
|
||||||
float WindowBorderSize; // Window border size at the time of Begin().
|
float WindowBorderSize; // Window border size at the time of Begin().
|
||||||
float DecoOuterSizeX1, DecoOuterSizeY1; // Left/Up offsets. Sum of non-scrolling outer decorations (X1 generally == 0.0f. Y1 generally = TitleBarHeight + MenuBarHeight). Locked during Begin().
|
|
||||||
float DecoOuterSizeX2, DecoOuterSizeY2; // Right/Down offsets (X2 generally == ScrollbarSize.x, Y2 == ScrollbarSizes.y).
|
|
||||||
float DecoInnerSizeX1, DecoInnerSizeY1; // Applied AFTER/OVER InnerRect. Specialized for Tables as they use specialized form of clipping and frozen rows/columns are inside InnerRect (and not part of regular decoration sizes).
|
|
||||||
int NameBufLen; // Size of buffer storing Name. May be larger than strlen(Name)!
|
int NameBufLen; // Size of buffer storing Name. May be larger than strlen(Name)!
|
||||||
ImGuiID MoveId; // == window->GetID("#MOVE")
|
ImGuiID MoveId; // == window->GetID("#MOVE")
|
||||||
ImGuiID ChildId; // ID of corresponding item in parent window (for navigation to return from child window to parent window)
|
ImGuiID ChildId; // ID of corresponding item in parent window (for navigation to return from child window to parent window)
|
||||||
|
@ -2518,14 +2505,13 @@ struct ImGuiTableCellData
|
||||||
// Per-instance data that needs preserving across frames (seemingly most others do not need to be preserved aside from debug needs, does that needs they could be moved to ImGuiTableTempData ?)
|
// Per-instance data that needs preserving across frames (seemingly most others do not need to be preserved aside from debug needs, does that needs they could be moved to ImGuiTableTempData ?)
|
||||||
struct ImGuiTableInstanceData
|
struct ImGuiTableInstanceData
|
||||||
{
|
{
|
||||||
float LastOuterHeight; // Outer height from last frame
|
float LastOuterHeight; // Outer height from last frame // FIXME: multi-instance issue (#3955)
|
||||||
float LastFirstRowHeight; // Height of first row from last frame (FIXME: this is used as "header height" and may be reworked)
|
float LastFirstRowHeight; // Height of first row from last frame // FIXME: possible multi-instance issue?
|
||||||
float LastFrozenHeight; // Height of frozen section from last frame
|
|
||||||
|
|
||||||
ImGuiTableInstanceData() { LastOuterHeight = LastFirstRowHeight = LastFrozenHeight = 0.0f; }
|
ImGuiTableInstanceData() { LastOuterHeight = LastFirstRowHeight = 0.0f; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME-TABLE: more transient data could be stored in a stacked ImGuiTableTempData: e.g. SortSpecs, incoming RowData
|
// FIXME-TABLE: more transient data could be stored in a per-stacked table structure: DrawSplitter, SortSpecs, incoming RowData
|
||||||
struct IMGUI_API ImGuiTable
|
struct IMGUI_API ImGuiTable
|
||||||
{
|
{
|
||||||
ImGuiID ID;
|
ImGuiID ID;
|
||||||
|
@ -2630,8 +2616,6 @@ struct IMGUI_API ImGuiTable
|
||||||
bool IsResetDisplayOrderRequest;
|
bool IsResetDisplayOrderRequest;
|
||||||
bool IsUnfrozenRows; // Set when we got past the frozen row.
|
bool IsUnfrozenRows; // Set when we got past the frozen row.
|
||||||
bool IsDefaultSizingPolicy; // Set if user didn't explicitly set a sizing policy in BeginTable()
|
bool IsDefaultSizingPolicy; // Set if user didn't explicitly set a sizing policy in BeginTable()
|
||||||
bool HasScrollbarYCurr; // Whether ANY instance of this table had a vertical scrollbar during the current frame.
|
|
||||||
bool HasScrollbarYPrev; // Whether ANY instance of this table had a vertical scrollbar during the previous.
|
|
||||||
bool MemoryCompacted;
|
bool MemoryCompacted;
|
||||||
bool HostSkipItems; // Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis
|
bool HostSkipItems; // Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis
|
||||||
|
|
||||||
|
@ -2795,6 +2779,7 @@ namespace ImGui
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
// Basic Accessors
|
// Basic Accessors
|
||||||
|
inline ImGuiID GetItemID() { ImGuiContext& g = *GImGui; return g.LastItemData.ID; } // Get ID of last item (~~ often same ImGui::GetID(label) beforehand)
|
||||||
inline ImGuiItemStatusFlags GetItemStatusFlags(){ ImGuiContext& g = *GImGui; return g.LastItemData.StatusFlags; }
|
inline ImGuiItemStatusFlags GetItemStatusFlags(){ ImGuiContext& g = *GImGui; return g.LastItemData.StatusFlags; }
|
||||||
inline ImGuiItemFlags GetItemFlags() { ImGuiContext& g = *GImGui; return g.LastItemData.InFlags; }
|
inline ImGuiItemFlags GetItemFlags() { ImGuiContext& g = *GImGui; return g.LastItemData.InFlags; }
|
||||||
inline ImGuiID GetActiveID() { ImGuiContext& g = *GImGui; return g.ActiveId; }
|
inline ImGuiID GetActiveID() { ImGuiContext& g = *GImGui; return g.ActiveId; }
|
||||||
|
@ -2875,21 +2860,18 @@ namespace ImGui
|
||||||
// Inputs
|
// Inputs
|
||||||
// FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions.
|
// FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions.
|
||||||
inline bool IsNamedKey(ImGuiKey key) { return key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END; }
|
inline bool IsNamedKey(ImGuiKey key) { return key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END; }
|
||||||
inline bool IsNamedKeyOrModKey(ImGuiKey key) { return (key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END) || key == ImGuiMod_Ctrl || key == ImGuiMod_Shift || key == ImGuiMod_Alt || key == ImGuiMod_Super || key == ImGuiMod_Shortcut; }
|
inline bool IsNamedKeyOrModKey(ImGuiKey key) { return (key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END) || key == ImGuiMod_Ctrl || key == ImGuiMod_Shift || key == ImGuiMod_Alt || key == ImGuiMod_Super; }
|
||||||
inline bool IsLegacyKey(ImGuiKey key) { return key >= ImGuiKey_LegacyNativeKey_BEGIN && key < ImGuiKey_LegacyNativeKey_END; }
|
inline bool IsLegacyKey(ImGuiKey key) { return key >= ImGuiKey_LegacyNativeKey_BEGIN && key < ImGuiKey_LegacyNativeKey_END; }
|
||||||
inline bool IsKeyboardKey(ImGuiKey key) { return key >= ImGuiKey_Keyboard_BEGIN && key < ImGuiKey_Keyboard_END; }
|
inline bool IsKeyboardKey(ImGuiKey key) { return key >= ImGuiKey_Keyboard_BEGIN && key < ImGuiKey_Keyboard_END; }
|
||||||
inline bool IsGamepadKey(ImGuiKey key) { return key >= ImGuiKey_Gamepad_BEGIN && key < ImGuiKey_Gamepad_END; }
|
inline bool IsGamepadKey(ImGuiKey key) { return key >= ImGuiKey_Gamepad_BEGIN && key < ImGuiKey_Gamepad_END; }
|
||||||
inline bool IsMouseKey(ImGuiKey key) { return key >= ImGuiKey_Mouse_BEGIN && key < ImGuiKey_Mouse_END; }
|
inline bool IsMouseKey(ImGuiKey key) { return key >= ImGuiKey_Mouse_BEGIN && key < ImGuiKey_Mouse_END; }
|
||||||
inline bool IsAliasKey(ImGuiKey key) { return key >= ImGuiKey_Aliases_BEGIN && key < ImGuiKey_Aliases_END; }
|
inline bool IsAliasKey(ImGuiKey key) { return key >= ImGuiKey_Aliases_BEGIN && key < ImGuiKey_Aliases_END; }
|
||||||
inline ImGuiKeyChord ConvertShortcutMod(ImGuiKeyChord key_chord) { ImGuiContext& g = *GImGui; IM_ASSERT_PARANOID(key_chord & ImGuiMod_Shortcut); return (key_chord & ~ImGuiMod_Shortcut) | (g.IO.ConfigMacOSXBehaviors ? ImGuiMod_Super : ImGuiMod_Ctrl); }
|
|
||||||
inline ImGuiKey ConvertSingleModFlagToKey(ImGuiKey key)
|
inline ImGuiKey ConvertSingleModFlagToKey(ImGuiKey key)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
|
||||||
if (key == ImGuiMod_Ctrl) return ImGuiKey_ReservedForModCtrl;
|
if (key == ImGuiMod_Ctrl) return ImGuiKey_ReservedForModCtrl;
|
||||||
if (key == ImGuiMod_Shift) return ImGuiKey_ReservedForModShift;
|
if (key == ImGuiMod_Shift) return ImGuiKey_ReservedForModShift;
|
||||||
if (key == ImGuiMod_Alt) return ImGuiKey_ReservedForModAlt;
|
if (key == ImGuiMod_Alt) return ImGuiKey_ReservedForModAlt;
|
||||||
if (key == ImGuiMod_Super) return ImGuiKey_ReservedForModSuper;
|
if (key == ImGuiMod_Super) return ImGuiKey_ReservedForModSuper;
|
||||||
if (key == ImGuiMod_Shortcut) return (g.IO.ConfigMacOSXBehaviors ? ImGuiKey_ReservedForModSuper : ImGuiKey_ReservedForModCtrl);
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2897,7 +2879,7 @@ namespace ImGui
|
||||||
IMGUI_API void GetKeyChordName(ImGuiKeyChord key_chord, char* out_buf, int out_buf_size);
|
IMGUI_API void GetKeyChordName(ImGuiKeyChord key_chord, char* out_buf, int out_buf_size);
|
||||||
inline ImGuiKey MouseButtonToKey(ImGuiMouseButton button) { IM_ASSERT(button >= 0 && button < ImGuiMouseButton_COUNT); return (ImGuiKey)(ImGuiKey_MouseLeft + button); }
|
inline ImGuiKey MouseButtonToKey(ImGuiMouseButton button) { IM_ASSERT(button >= 0 && button < ImGuiMouseButton_COUNT); return (ImGuiKey)(ImGuiKey_MouseLeft + button); }
|
||||||
IMGUI_API bool IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold = -1.0f);
|
IMGUI_API bool IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold = -1.0f);
|
||||||
IMGUI_API ImVec2 GetKeyMagnitude2d(ImGuiKey key_left, ImGuiKey key_right, ImGuiKey key_up, ImGuiKey key_down);
|
IMGUI_API ImVec2 GetKeyVector2d(ImGuiKey key_left, ImGuiKey key_right, ImGuiKey key_up, ImGuiKey key_down);
|
||||||
IMGUI_API float GetNavTweakPressedAmount(ImGuiAxis axis);
|
IMGUI_API float GetNavTweakPressedAmount(ImGuiAxis axis);
|
||||||
IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate);
|
IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate);
|
||||||
IMGUI_API void GetTypematicRepeatRate(ImGuiInputFlags flags, float* repeat_delay, float* repeat_rate);
|
IMGUI_API void GetTypematicRepeatRate(ImGuiInputFlags flags, float* repeat_delay, float* repeat_rate);
|
||||||
|
@ -3041,9 +3023,8 @@ namespace ImGui
|
||||||
IMGUI_API void TabBarQueueReorder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, int offset);
|
IMGUI_API void TabBarQueueReorder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, int offset);
|
||||||
IMGUI_API void TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, ImVec2 mouse_pos);
|
IMGUI_API void TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, ImVec2 mouse_pos);
|
||||||
IMGUI_API bool TabBarProcessReorder(ImGuiTabBar* tab_bar);
|
IMGUI_API bool TabBarProcessReorder(ImGuiTabBar* tab_bar);
|
||||||
IMGUI_API bool TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags, ImGuiWindow* docked_window);
|
IMGUI_API bool TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags);
|
||||||
IMGUI_API ImVec2 TabItemCalcSize(const char* label, bool has_close_button_or_unsaved_marker);
|
IMGUI_API ImVec2 TabItemCalcSize(const char* label, bool has_close_button_or_unsaved_marker);
|
||||||
IMGUI_API ImVec2 TabItemCalcSize(ImGuiWindow* window);
|
|
||||||
IMGUI_API void TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col);
|
IMGUI_API void TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col);
|
||||||
IMGUI_API void TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImVec2 frame_padding, const char* label, ImGuiID tab_id, ImGuiID close_button_id, bool is_contents_visible, bool* out_just_closed, bool* out_text_clipped);
|
IMGUI_API void TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImVec2 frame_padding, const char* label, ImGuiID tab_id, ImGuiID close_button_id, bool is_contents_visible, bool* out_just_closed, bool* out_text_clipped);
|
||||||
|
|
||||||
|
@ -3073,27 +3054,25 @@ namespace ImGui
|
||||||
// Widgets
|
// Widgets
|
||||||
IMGUI_API void TextEx(const char* text, const char* text_end = NULL, ImGuiTextFlags flags = 0);
|
IMGUI_API void TextEx(const char* text, const char* text_end = NULL, ImGuiTextFlags flags = 0);
|
||||||
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0);
|
||||||
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
|
||||||
IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col);
|
|
||||||
IMGUI_API void SeparatorEx(ImGuiSeparatorFlags flags);
|
|
||||||
IMGUI_API bool CheckboxFlags(const char* label, ImS64* flags, ImS64 flags_value);
|
|
||||||
IMGUI_API bool CheckboxFlags(const char* label, ImU64* flags, ImU64 flags_value);
|
|
||||||
|
|
||||||
// Widgets: Window Decorations
|
|
||||||
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos);
|
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos);
|
||||||
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos);
|
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos);
|
||||||
|
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
||||||
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
||||||
IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, ImS64* p_scroll_v, ImS64 avail_v, ImS64 contents_v, ImDrawFlags flags);
|
IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, ImS64* p_scroll_v, ImS64 avail_v, ImS64 contents_v, ImDrawFlags flags);
|
||||||
|
IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col);
|
||||||
IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis);
|
IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis);
|
||||||
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
||||||
IMGUI_API ImGuiID GetWindowResizeCornerID(ImGuiWindow* window, int n); // 0..3: corners
|
IMGUI_API ImGuiID GetWindowResizeCornerID(ImGuiWindow* window, int n); // 0..3: corners
|
||||||
IMGUI_API ImGuiID GetWindowResizeBorderID(ImGuiWindow* window, ImGuiDir dir);
|
IMGUI_API ImGuiID GetWindowResizeBorderID(ImGuiWindow* window, ImGuiDir dir);
|
||||||
|
IMGUI_API void SeparatorEx(ImGuiSeparatorFlags flags);
|
||||||
|
IMGUI_API bool CheckboxFlags(const char* label, ImS64* flags, ImS64 flags_value);
|
||||||
|
IMGUI_API bool CheckboxFlags(const char* label, ImU64* flags, ImU64 flags_value);
|
||||||
|
|
||||||
// Widgets low-level behaviors
|
// Widgets low-level behaviors
|
||||||
IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
||||||
IMGUI_API bool DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v_speed, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags);
|
IMGUI_API bool DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v_speed, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags);
|
||||||
IMGUI_API bool SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* p_v, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb);
|
IMGUI_API bool SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* p_v, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb);
|
||||||
IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f, ImU32 bg_col = 0);
|
IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f);
|
||||||
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL);
|
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL);
|
||||||
IMGUI_API void TreePushOverrideID(ImGuiID id);
|
IMGUI_API void TreePushOverrideID(ImGuiID id);
|
||||||
IMGUI_API void TreeNodeSetOpen(ImGuiID id, bool open);
|
IMGUI_API void TreeNodeSetOpen(ImGuiID id, bool open);
|
||||||
|
@ -3171,7 +3150,6 @@ namespace ImGui
|
||||||
IMGUI_API void DebugNodeWindowsList(ImVector<ImGuiWindow*>* windows, const char* label);
|
IMGUI_API void DebugNodeWindowsList(ImVector<ImGuiWindow*>* windows, const char* label);
|
||||||
IMGUI_API void DebugNodeWindowsListByBeginStackParent(ImGuiWindow** windows, int windows_size, ImGuiWindow* parent_in_begin_stack);
|
IMGUI_API void DebugNodeWindowsListByBeginStackParent(ImGuiWindow** windows, int windows_size, ImGuiWindow* parent_in_begin_stack);
|
||||||
IMGUI_API void DebugNodeViewport(ImGuiViewportP* viewport);
|
IMGUI_API void DebugNodeViewport(ImGuiViewportP* viewport);
|
||||||
IMGUI_API void DebugRenderKeyboardPreview(ImDrawList* draw_list);
|
|
||||||
IMGUI_API void DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb);
|
IMGUI_API void DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb);
|
||||||
|
|
||||||
// Obsolete functions
|
// Obsolete functions
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.89.2
|
// dear imgui, v1.89.1
|
||||||
// (tables and columns code)
|
// (tables and columns code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -395,14 +395,6 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
||||||
table->OuterRect = table->InnerWindow->Rect();
|
table->OuterRect = table->InnerWindow->Rect();
|
||||||
table->InnerRect = table->InnerWindow->InnerRect;
|
table->InnerRect = table->InnerWindow->InnerRect;
|
||||||
IM_ASSERT(table->InnerWindow->WindowPadding.x == 0.0f && table->InnerWindow->WindowPadding.y == 0.0f && table->InnerWindow->WindowBorderSize == 0.0f);
|
IM_ASSERT(table->InnerWindow->WindowPadding.x == 0.0f && table->InnerWindow->WindowPadding.y == 0.0f && table->InnerWindow->WindowBorderSize == 0.0f);
|
||||||
|
|
||||||
// When using multiple instances, ensure they have the same amount of horizontal decorations (aka vertical scrollbar) so stretched columns can be aligned)
|
|
||||||
if (instance_no == 0)
|
|
||||||
{
|
|
||||||
table->HasScrollbarYPrev = table->HasScrollbarYCurr;
|
|
||||||
table->HasScrollbarYCurr = false;
|
|
||||||
}
|
|
||||||
table->HasScrollbarYCurr |= (table->InnerWindow->ScrollMax.y > 0.0f);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -901,8 +893,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
||||||
// [Part 4] Apply final widths based on requested widths
|
// [Part 4] Apply final widths based on requested widths
|
||||||
const ImRect work_rect = table->WorkRect;
|
const ImRect work_rect = table->WorkRect;
|
||||||
const float width_spacings = (table->OuterPaddingX * 2.0f) + (table->CellSpacingX1 + table->CellSpacingX2) * (table->ColumnsEnabledCount - 1);
|
const float width_spacings = (table->OuterPaddingX * 2.0f) + (table->CellSpacingX1 + table->CellSpacingX2) * (table->ColumnsEnabledCount - 1);
|
||||||
const float width_removed = (table->HasScrollbarYPrev && !table->InnerWindow->ScrollbarY) ? g.Style.ScrollbarSize : 0.0f; // To synchronize decoration width of synched tables with mismatching scrollbar state (#5920)
|
const float width_avail = ((table->Flags & ImGuiTableFlags_ScrollX) && table->InnerWidth == 0.0f) ? table->InnerClipRect.GetWidth() : work_rect.GetWidth();
|
||||||
const float width_avail = ImMax(1.0f, (((table->Flags & ImGuiTableFlags_ScrollX) && table->InnerWidth == 0.0f) ? table->InnerClipRect.GetWidth() : work_rect.GetWidth()) - width_removed);
|
|
||||||
const float width_avail_for_stretched_columns = width_avail - width_spacings - sum_width_requests;
|
const float width_avail_for_stretched_columns = width_avail - width_spacings - sum_width_requests;
|
||||||
float width_remaining_for_stretched_columns = width_avail_for_stretched_columns;
|
float width_remaining_for_stretched_columns = width_avail_for_stretched_columns;
|
||||||
table->ColumnsGivenWidth = width_spacings + (table->CellPaddingX * 2.0f) * table->ColumnsEnabledCount;
|
table->ColumnsGivenWidth = width_spacings + (table->CellPaddingX * 2.0f) * table->ColumnsEnabledCount;
|
||||||
|
@ -973,7 +964,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
||||||
const int column_n = table->DisplayOrderToIndex[order_n];
|
const int column_n = table->DisplayOrderToIndex[order_n];
|
||||||
ImGuiTableColumn* column = &table->Columns[column_n];
|
ImGuiTableColumn* column = &table->Columns[column_n];
|
||||||
|
|
||||||
column->NavLayerCurrent = (ImS8)(table->FreezeRowsCount > 0 ? ImGuiNavLayer_Menu : ImGuiNavLayer_Main); // Use Count NOT request so Header line changes layer when frozen
|
column->NavLayerCurrent = (ImS8)((table->FreezeRowsCount > 0 || column_n < table->FreezeColumnsCount) ? ImGuiNavLayer_Menu : ImGuiNavLayer_Main);
|
||||||
|
|
||||||
if (offset_x_frozen && table->FreezeColumnsCount == visible_n)
|
if (offset_x_frozen && table->FreezeColumnsCount == visible_n)
|
||||||
{
|
{
|
||||||
|
@ -1133,13 +1124,6 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
||||||
if (table->IsSortSpecsDirty && (table->Flags & ImGuiTableFlags_Sortable))
|
if (table->IsSortSpecsDirty && (table->Flags & ImGuiTableFlags_Sortable))
|
||||||
TableSortSpecsBuild(table);
|
TableSortSpecsBuild(table);
|
||||||
|
|
||||||
// [Part 14] Setup inner window decoration size (for scrolling / nav tracking to properly take account of frozen rows/columns)
|
|
||||||
if (table->FreezeColumnsRequest > 0)
|
|
||||||
table->InnerWindow->DecoInnerSizeX1 = table->Columns[table->DisplayOrderToIndex[table->FreezeColumnsRequest - 1]].MaxX - table->OuterRect.Min.x;
|
|
||||||
if (table->FreezeRowsRequest > 0)
|
|
||||||
table->InnerWindow->DecoInnerSizeY1 = table_instance->LastFrozenHeight;
|
|
||||||
table_instance->LastFrozenHeight = 0.0f;
|
|
||||||
|
|
||||||
// Initial state
|
// Initial state
|
||||||
ImGuiWindow* inner_window = table->InnerWindow;
|
ImGuiWindow* inner_window = table->InnerWindow;
|
||||||
if (table->Flags & ImGuiTableFlags_NoClip)
|
if (table->Flags & ImGuiTableFlags_NoClip)
|
||||||
|
@ -1855,15 +1839,17 @@ void ImGui::TableEndRow(ImGuiTable* table)
|
||||||
// get the new cursor position.
|
// get the new cursor position.
|
||||||
if (unfreeze_rows_request)
|
if (unfreeze_rows_request)
|
||||||
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
||||||
table->Columns[column_n].NavLayerCurrent = ImGuiNavLayer_Main;
|
{
|
||||||
|
ImGuiTableColumn* column = &table->Columns[column_n];
|
||||||
|
column->NavLayerCurrent = (ImS8)((column_n < table->FreezeColumnsCount) ? ImGuiNavLayer_Menu : ImGuiNavLayer_Main);
|
||||||
|
}
|
||||||
if (unfreeze_rows_actual)
|
if (unfreeze_rows_actual)
|
||||||
{
|
{
|
||||||
IM_ASSERT(table->IsUnfrozenRows == false);
|
IM_ASSERT(table->IsUnfrozenRows == false);
|
||||||
const float y0 = ImMax(table->RowPosY2 + 1, window->InnerClipRect.Min.y);
|
|
||||||
table->IsUnfrozenRows = true;
|
table->IsUnfrozenRows = true;
|
||||||
TableGetInstanceData(table, table->InstanceCurrent)->LastFrozenHeight = y0 - table->OuterRect.Min.y;
|
|
||||||
|
|
||||||
// BgClipRect starts as table->InnerClipRect, reduce it now and make BgClipRectForDrawCmd == BgClipRect
|
// BgClipRect starts as table->InnerClipRect, reduce it now and make BgClipRectForDrawCmd == BgClipRect
|
||||||
|
float y0 = ImMax(table->RowPosY2 + 1, window->InnerClipRect.Min.y);
|
||||||
table->BgClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y = ImMin(y0, window->InnerClipRect.Max.y);
|
table->BgClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y = ImMin(y0, window->InnerClipRect.Max.y);
|
||||||
table->BgClipRect.Max.y = table->Bg2ClipRectForDrawCmd.Max.y = window->InnerClipRect.Max.y;
|
table->BgClipRect.Max.y = table->Bg2ClipRectForDrawCmd.Max.y = window->InnerClipRect.Max.y;
|
||||||
table->Bg2DrawChannelCurrent = table->Bg2DrawChannelUnfrozen;
|
table->Bg2DrawChannelCurrent = table->Bg2DrawChannelUnfrozen;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.89.2
|
// dear imgui, v1.89.1
|
||||||
// (widgets code)
|
// (widgets code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -126,7 +126,7 @@ static const ImU64 IM_U64_MAX = (2ULL * 9223372036854775807LL + 1);
|
||||||
// For InputTextEx()
|
// For InputTextEx()
|
||||||
static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data, ImGuiInputSource input_source);
|
static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data, ImGuiInputSource input_source);
|
||||||
static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end);
|
static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end);
|
||||||
static ImVec2 InputTextCalcTextSizeW(ImGuiContext* ctx, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false);
|
static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false);
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// [SECTION] Widgets: Text, etc.
|
// [SECTION] Widgets: Text, etc.
|
||||||
|
@ -544,21 +544,13 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||||
const ImGuiID test_owner_id = (flags & ImGuiButtonFlags_NoTestKeyOwner) ? ImGuiKeyOwner_Any : id;
|
const ImGuiID test_owner_id = (flags & ImGuiButtonFlags_NoTestKeyOwner) ? ImGuiKeyOwner_Any : id;
|
||||||
if (hovered)
|
if (hovered)
|
||||||
{
|
{
|
||||||
// Poll mouse buttons
|
|
||||||
// - 'mouse_button_clicked' is generally carried into ActiveIdMouseButton when setting ActiveId.
|
|
||||||
// - Technically we only need some values in one code path, but since this is gated by hovered test this is fine.
|
|
||||||
int mouse_button_clicked = -1;
|
|
||||||
int mouse_button_released = -1;
|
|
||||||
for (int button = 0; button < 3; button++)
|
|
||||||
if (flags & (ImGuiButtonFlags_MouseButtonLeft << button)) // Handle ImGuiButtonFlags_MouseButtonRight and ImGuiButtonFlags_MouseButtonMiddle here.
|
|
||||||
{
|
|
||||||
if (IsMouseClicked(button, test_owner_id) && mouse_button_clicked == -1) { mouse_button_clicked = button; }
|
|
||||||
if (IsMouseReleased(button, test_owner_id) && mouse_button_released == -1) { mouse_button_released = button; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process initial action
|
|
||||||
if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))
|
if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))
|
||||||
{
|
{
|
||||||
|
// Poll buttons
|
||||||
|
int mouse_button_clicked = -1;
|
||||||
|
if ((flags & ImGuiButtonFlags_MouseButtonLeft) && IsMouseClicked(0, test_owner_id)) { mouse_button_clicked = 0; }
|
||||||
|
else if ((flags & ImGuiButtonFlags_MouseButtonRight) && IsMouseClicked(1, test_owner_id)) { mouse_button_clicked = 1; }
|
||||||
|
else if ((flags & ImGuiButtonFlags_MouseButtonMiddle) && IsMouseClicked(2, test_owner_id)) { mouse_button_clicked = 2; }
|
||||||
if (mouse_button_clicked != -1 && g.ActiveId != id)
|
if (mouse_button_clicked != -1 && g.ActiveId != id)
|
||||||
{
|
{
|
||||||
if (!(flags & ImGuiButtonFlags_NoSetKeyOwner))
|
if (!(flags & ImGuiButtonFlags_NoSetKeyOwner))
|
||||||
|
@ -586,6 +578,10 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||||
}
|
}
|
||||||
if (flags & ImGuiButtonFlags_PressedOnRelease)
|
if (flags & ImGuiButtonFlags_PressedOnRelease)
|
||||||
{
|
{
|
||||||
|
int mouse_button_released = -1;
|
||||||
|
if ((flags & ImGuiButtonFlags_MouseButtonLeft) && IsMouseReleased(0, test_owner_id)) { mouse_button_released = 0; }
|
||||||
|
else if ((flags & ImGuiButtonFlags_MouseButtonRight) && IsMouseReleased(1, test_owner_id)) { mouse_button_released = 1; }
|
||||||
|
else if ((flags & ImGuiButtonFlags_MouseButtonMiddle) && IsMouseReleased(2, test_owner_id)) { mouse_button_released = 2; }
|
||||||
if (mouse_button_released != -1)
|
if (mouse_button_released != -1)
|
||||||
{
|
{
|
||||||
const bool has_repeated_at_least_once = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay; // Repeat mode trumps on release behavior
|
const bool has_repeated_at_least_once = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay; // Repeat mode trumps on release behavior
|
||||||
|
@ -1477,7 +1473,7 @@ void ImGui::Separator()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using 'hover_visibility_delay' allows us to hide the highlight and mouse cursor for a short time, which can be convenient to reduce visual noise.
|
// Using 'hover_visibility_delay' allows us to hide the highlight and mouse cursor for a short time, which can be convenient to reduce visual noise.
|
||||||
bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend, float hover_visibility_delay, ImU32 bg_col)
|
bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend, float hover_visibility_delay)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
|
@ -1525,9 +1521,7 @@ bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render at new position
|
// Render
|
||||||
if (bg_col & IM_COL32_A_MASK)
|
|
||||||
window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, bg_col, 0.0f);
|
|
||||||
const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : (hovered && g.HoveredIdTimer >= hover_visibility_delay) ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);
|
const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : (hovered && g.HoveredIdTimer >= hover_visibility_delay) ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);
|
||||||
window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, col, 0.0f);
|
window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, col, 0.0f);
|
||||||
|
|
||||||
|
@ -3569,9 +3563,9 @@ static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char**
|
||||||
return line_count;
|
return line_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ImVec2 InputTextCalcTextSizeW(ImGuiContext* ctx, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining, ImVec2* out_offset, bool stop_on_new_line)
|
static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining, ImVec2* out_offset, bool stop_on_new_line)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *ctx;
|
ImGuiContext& g = *GImGui;
|
||||||
ImFont* font = g.Font;
|
ImFont* font = g.Font;
|
||||||
const float line_height = g.FontSize;
|
const float line_height = g.FontSize;
|
||||||
const float scale = line_height / font->FontSize;
|
const float scale = line_height / font->FontSize;
|
||||||
|
@ -3620,14 +3614,14 @@ namespace ImStb
|
||||||
|
|
||||||
static int STB_TEXTEDIT_STRINGLEN(const ImGuiInputTextState* obj) { return obj->CurLenW; }
|
static int STB_TEXTEDIT_STRINGLEN(const ImGuiInputTextState* obj) { return obj->CurLenW; }
|
||||||
static ImWchar STB_TEXTEDIT_GETCHAR(const ImGuiInputTextState* obj, int idx) { return obj->TextW[idx]; }
|
static ImWchar STB_TEXTEDIT_GETCHAR(const ImGuiInputTextState* obj, int idx) { return obj->TextW[idx]; }
|
||||||
static float STB_TEXTEDIT_GETWIDTH(ImGuiInputTextState* obj, int line_start_idx, int char_idx) { ImWchar c = obj->TextW[line_start_idx + char_idx]; if (c == '\n') return STB_TEXTEDIT_GETWIDTH_NEWLINE; ImGuiContext& g = *obj->Ctx; return g.Font->GetCharAdvance(c) * (g.FontSize / g.Font->FontSize); }
|
static float STB_TEXTEDIT_GETWIDTH(ImGuiInputTextState* obj, int line_start_idx, int char_idx) { ImWchar c = obj->TextW[line_start_idx + char_idx]; if (c == '\n') return STB_TEXTEDIT_GETWIDTH_NEWLINE; ImGuiContext& g = *GImGui; return g.Font->GetCharAdvance(c) * (g.FontSize / g.Font->FontSize); }
|
||||||
static int STB_TEXTEDIT_KEYTOTEXT(int key) { return key >= 0x200000 ? 0 : key; }
|
static int STB_TEXTEDIT_KEYTOTEXT(int key) { return key >= 0x200000 ? 0 : key; }
|
||||||
static ImWchar STB_TEXTEDIT_NEWLINE = '\n';
|
static ImWchar STB_TEXTEDIT_NEWLINE = '\n';
|
||||||
static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, ImGuiInputTextState* obj, int line_start_idx)
|
static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, ImGuiInputTextState* obj, int line_start_idx)
|
||||||
{
|
{
|
||||||
const ImWchar* text = obj->TextW.Data;
|
const ImWchar* text = obj->TextW.Data;
|
||||||
const ImWchar* text_remaining = NULL;
|
const ImWchar* text_remaining = NULL;
|
||||||
const ImVec2 size = InputTextCalcTextSizeW(obj->Ctx, text + line_start_idx, text + obj->CurLenW, &text_remaining, NULL, true);
|
const ImVec2 size = InputTextCalcTextSizeW(text + line_start_idx, text + obj->CurLenW, &text_remaining, NULL, true);
|
||||||
r->x0 = 0.0f;
|
r->x0 = 0.0f;
|
||||||
r->x1 = size.x;
|
r->x1 = size.x;
|
||||||
r->baseline_y_delta = size.y;
|
r->baseline_y_delta = size.y;
|
||||||
|
@ -3643,7 +3637,7 @@ static int is_word_boundary_from_left(ImGuiInputTextState* obj, int idx)
|
||||||
static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(ImGuiInputTextState* obj, int idx) { idx--; while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; }
|
static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(ImGuiInputTextState* obj, int idx) { idx--; while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; }
|
||||||
static int STB_TEXTEDIT_MOVEWORDRIGHT_MAC(ImGuiInputTextState* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; }
|
static int STB_TEXTEDIT_MOVEWORDRIGHT_MAC(ImGuiInputTextState* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; }
|
||||||
static int STB_TEXTEDIT_MOVEWORDRIGHT_WIN(ImGuiInputTextState* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; }
|
static int STB_TEXTEDIT_MOVEWORDRIGHT_WIN(ImGuiInputTextState* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; }
|
||||||
static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(ImGuiInputTextState* obj, int idx) { ImGuiContext& g = *obj->Ctx; if (g.IO.ConfigMacOSXBehaviors) return STB_TEXTEDIT_MOVEWORDRIGHT_MAC(obj, idx); else return STB_TEXTEDIT_MOVEWORDRIGHT_WIN(obj, idx); }
|
static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(ImGuiInputTextState* obj, int idx) { if (ImGui::GetIO().ConfigMacOSXBehaviors) return STB_TEXTEDIT_MOVEWORDRIGHT_MAC(obj, idx); else return STB_TEXTEDIT_MOVEWORDRIGHT_WIN(obj, idx); }
|
||||||
#define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h
|
#define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h
|
||||||
#define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL
|
#define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL
|
||||||
|
|
||||||
|
@ -4681,11 +4675,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||||
searches_result_line_no[1] = line_count;
|
searches_result_line_no[1] = line_count;
|
||||||
|
|
||||||
// Calculate 2d position by finding the beginning of the line and measuring distance
|
// Calculate 2d position by finding the beginning of the line and measuring distance
|
||||||
cursor_offset.x = InputTextCalcTextSizeW(&g, ImStrbolW(searches_input_ptr[0], text_begin), searches_input_ptr[0]).x;
|
cursor_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[0], text_begin), searches_input_ptr[0]).x;
|
||||||
cursor_offset.y = searches_result_line_no[0] * g.FontSize;
|
cursor_offset.y = searches_result_line_no[0] * g.FontSize;
|
||||||
if (searches_result_line_no[1] >= 0)
|
if (searches_result_line_no[1] >= 0)
|
||||||
{
|
{
|
||||||
select_start_offset.x = InputTextCalcTextSizeW(&g, ImStrbolW(searches_input_ptr[1], text_begin), searches_input_ptr[1]).x;
|
select_start_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[1], text_begin), searches_input_ptr[1]).x;
|
||||||
select_start_offset.y = searches_result_line_no[1] * g.FontSize;
|
select_start_offset.y = searches_result_line_no[1] * g.FontSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4754,7 +4748,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImVec2 rect_size = InputTextCalcTextSizeW(&g, p, text_selected_end, &p, NULL, true);
|
ImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL, true);
|
||||||
if (rect_size.x <= 0.0f) rect_size.x = IM_FLOOR(g.Font->GetCharAdvance((ImWchar)' ') * 0.50f); // So we can see selected empty lines
|
if (rect_size.x <= 0.0f) rect_size.x = IM_FLOOR(g.Font->GetCharAdvance((ImWchar)' ') * 0.50f); // So we can see selected empty lines
|
||||||
ImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos + ImVec2(rect_size.x, bg_offy_dn));
|
ImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos + ImVec2(rect_size.x, bg_offy_dn));
|
||||||
rect.ClipWith(clip_rect);
|
rect.ClipWith(clip_rect);
|
||||||
|
@ -4862,7 +4856,6 @@ void ImGui::DebugNodeInputTextState(ImGuiInputTextState* state)
|
||||||
Text("ID: 0x%08X, ActiveID: 0x%08X", state->ID, g.ActiveId);
|
Text("ID: 0x%08X, ActiveID: 0x%08X", state->ID, g.ActiveId);
|
||||||
DebugLocateItemOnHover(state->ID);
|
DebugLocateItemOnHover(state->ID);
|
||||||
Text("CurLenW: %d, CurLenA: %d, Cursor: %d, Selection: %d..%d", state->CurLenA, state->CurLenW, stb_state->cursor, stb_state->select_start, stb_state->select_end);
|
Text("CurLenW: %d, CurLenA: %d, Cursor: %d, Selection: %d..%d", state->CurLenA, state->CurLenW, stb_state->cursor, stb_state->select_start, stb_state->select_end);
|
||||||
Text("has_preferred_x: %d (%.2f)", stb_state->has_preferred_x, stb_state->preferred_x);
|
|
||||||
Text("undo_point: %d, redo_point: %d, undo_char_point: %d, redo_char_point: %d", undo_state->undo_point, undo_state->redo_point, undo_state->undo_char_point, undo_state->redo_char_point);
|
Text("undo_point: %d, redo_point: %d, undo_char_point: %d, redo_char_point: %d", undo_state->undo_point, undo_state->redo_point, undo_state->undo_char_point, undo_state->redo_char_point);
|
||||||
if (BeginChild("undopoints", ImVec2(0.0f, GetTextLineHeight() * 15), true)) // Visualize undo state
|
if (BeginChild("undopoints", ImVec2(0.0f, GetTextLineHeight() * 15), true)) // Visualize undo state
|
||||||
{
|
{
|
||||||
|
@ -6374,6 +6367,8 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
||||||
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_ToggledSelection;
|
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_ToggledSelection;
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
|
if (held && (flags & ImGuiSelectableFlags_DrawHoveredWhenHeld))
|
||||||
|
hovered = true;
|
||||||
if (hovered || selected)
|
if (hovered || selected)
|
||||||
{
|
{
|
||||||
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
|
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
|
||||||
|
@ -7308,7 +7303,7 @@ struct ImGuiTabBarSection
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
static void TabBarLayout(ImGuiTabBar* tab_bar);
|
static void TabBarLayout(ImGuiTabBar* tab_bar);
|
||||||
static ImU32 TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label, ImGuiWindow* docked_window);
|
static ImU32 TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label);
|
||||||
static float TabBarCalcMaxTabWidth();
|
static float TabBarCalcMaxTabWidth();
|
||||||
static float TabBarScrollClamp(ImGuiTabBar* tab_bar, float scrolling);
|
static float TabBarScrollClamp(ImGuiTabBar* tab_bar, float scrolling);
|
||||||
static void TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiID tab_id, ImGuiTabBarSection* sections);
|
static void TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiID tab_id, ImGuiTabBarSection* sections);
|
||||||
|
@ -7701,11 +7696,9 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
||||||
window->DC.IdealMaxPos.x = ImMax(window->DC.IdealMaxPos.x, tab_bar->BarRect.Min.x + tab_bar->WidthAllTabsIdeal);
|
window->DC.IdealMaxPos.x = ImMax(window->DC.IdealMaxPos.x, tab_bar->BarRect.Min.x + tab_bar->WidthAllTabsIdeal);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dockable windows uses Name/ID in the global namespace. Non-dockable items use the ID stack.
|
// Dockables uses Name/ID in the global namespace. Non-dockable items use the ID stack.
|
||||||
static ImU32 ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label, ImGuiWindow* docked_window)
|
static ImU32 ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label)
|
||||||
{
|
{
|
||||||
IM_ASSERT(docked_window == NULL); // master branch only
|
|
||||||
IM_UNUSED(docked_window);
|
|
||||||
if (tab_bar->Flags & ImGuiTabBarFlags_DockNode)
|
if (tab_bar->Flags & ImGuiTabBarFlags_DockNode)
|
||||||
{
|
{
|
||||||
ImGuiID id = ImHashStr(label);
|
ImGuiID id = ImHashStr(label);
|
||||||
|
@ -8012,7 +8005,7 @@ bool ImGui::BeginTabItem(const char* label, bool* p_open, ImGuiTabItemFlags f
|
||||||
}
|
}
|
||||||
IM_ASSERT(!(flags & ImGuiTabItemFlags_Button)); // BeginTabItem() Can't be used with button flags, use TabItemButton() instead!
|
IM_ASSERT(!(flags & ImGuiTabItemFlags_Button)); // BeginTabItem() Can't be used with button flags, use TabItemButton() instead!
|
||||||
|
|
||||||
bool ret = TabItemEx(tab_bar, label, p_open, flags, NULL);
|
bool ret = TabItemEx(tab_bar, label, p_open, flags);
|
||||||
if (ret && !(flags & ImGuiTabItemFlags_NoPushId))
|
if (ret && !(flags & ImGuiTabItemFlags_NoPushId))
|
||||||
{
|
{
|
||||||
ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];
|
ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];
|
||||||
|
@ -8053,10 +8046,10 @@ bool ImGui::TabItemButton(const char* label, ImGuiTabItemFlags flags)
|
||||||
IM_ASSERT_USER_ERROR(tab_bar != NULL, "Needs to be called between BeginTabBar() and EndTabBar()!");
|
IM_ASSERT_USER_ERROR(tab_bar != NULL, "Needs to be called between BeginTabBar() and EndTabBar()!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return TabItemEx(tab_bar, label, NULL, flags | ImGuiTabItemFlags_Button | ImGuiTabItemFlags_NoReorder, NULL);
|
return TabItemEx(tab_bar, label, NULL, flags | ImGuiTabItemFlags_Button | ImGuiTabItemFlags_NoReorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags, ImGuiWindow* docked_window)
|
bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags)
|
||||||
{
|
{
|
||||||
// Layout whole tab bar if not already done
|
// Layout whole tab bar if not already done
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
@ -8071,7 +8064,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const ImGuiStyle& style = g.Style;
|
const ImGuiStyle& style = g.Style;
|
||||||
const ImGuiID id = TabBarCalcTabID(tab_bar, label, docked_window);
|
const ImGuiID id = TabBarCalcTabID(tab_bar, label);
|
||||||
|
|
||||||
// If the user called us with *p_open == false, we early out and don't render.
|
// If the user called us with *p_open == false, we early out and don't render.
|
||||||
// We make a call to ItemAdd() so that attempts to use a contextual popup menu with an implicit ID won't use an older ID.
|
// We make a call to ItemAdd() so that attempts to use a contextual popup menu with an implicit ID won't use an older ID.
|
||||||
|
@ -8121,16 +8114,9 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
||||||
tab->LastFrameVisible = g.FrameCount;
|
tab->LastFrameVisible = g.FrameCount;
|
||||||
tab->Flags = flags;
|
tab->Flags = flags;
|
||||||
|
|
||||||
// Append name _WITH_ the zero-terminator
|
// Append name with zero-terminator
|
||||||
if (docked_window != NULL)
|
|
||||||
{
|
|
||||||
IM_ASSERT(docked_window == NULL); // master branch only
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tab->NameOffset = (ImS32)tab_bar->TabsNames.size();
|
tab->NameOffset = (ImS32)tab_bar->TabsNames.size();
|
||||||
tab_bar->TabsNames.append(label, label + strlen(label) + 1);
|
tab_bar->TabsNames.append(label, label + strlen(label) + 1);
|
||||||
}
|
|
||||||
|
|
||||||
// Update selected tab
|
// Update selected tab
|
||||||
if (!is_tab_button)
|
if (!is_tab_button)
|
||||||
|
@ -8293,7 +8279,7 @@ void ImGui::SetTabItemClosed(const char* label)
|
||||||
if (is_within_manual_tab_bar)
|
if (is_within_manual_tab_bar)
|
||||||
{
|
{
|
||||||
ImGuiTabBar* tab_bar = g.CurrentTabBar;
|
ImGuiTabBar* tab_bar = g.CurrentTabBar;
|
||||||
ImGuiID tab_id = TabBarCalcTabID(tab_bar, label, NULL);
|
ImGuiID tab_id = TabBarCalcTabID(tab_bar, label);
|
||||||
if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id))
|
if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id))
|
||||||
tab->WantClose = true; // Will be processed by next call to TabBarLayout()
|
tab->WantClose = true; // Will be processed by next call to TabBarLayout()
|
||||||
}
|
}
|
||||||
|
@ -8311,12 +8297,6 @@ ImVec2 ImGui::TabItemCalcSize(const char* label, bool has_close_button_or_unsave
|
||||||
return ImVec2(ImMin(size.x, TabBarCalcMaxTabWidth()), size.y);
|
return ImVec2(ImMin(size.x, TabBarCalcMaxTabWidth()), size.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImVec2 ImGui::TabItemCalcSize(ImGuiWindow*)
|
|
||||||
{
|
|
||||||
IM_ASSERT(0); // This function exists to facilitate merge with 'docking' branch.
|
|
||||||
return ImVec2(0.0f, 0.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui::TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col)
|
void ImGui::TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col)
|
||||||
{
|
{
|
||||||
// While rendering tabs, we trim 1 pixel off the top of our bounding box so they can fit within a regular frame height while looking "detached" from it.
|
// While rendering tabs, we trim 1 pixel off the top of our bounding box so they can fit within a regular frame height while looking "detached" from it.
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
// This is a slightly modified version of stb_textedit.h 1.14.
|
// This is a slightly modified version of stb_textedit.h 1.14.
|
||||||
// Those changes would need to be pushed into nothings/stb:
|
// Those changes would need to be pushed into nothings/stb:
|
||||||
// - Fix in stb_textedit_discard_redo (see https://github.com/nothings/stb/issues/321)
|
// - Fix in stb_textedit_discard_redo (see https://github.com/nothings/stb/issues/321)
|
||||||
// - Fix in stb_textedit_find_charpos to handle last line (see https://github.com/ocornut/imgui/issues/6000)
|
|
||||||
// Grep for [DEAR IMGUI] to find the changes.
|
// Grep for [DEAR IMGUI] to find the changes.
|
||||||
|
|
||||||
// stb_textedit.h - v1.14 - public domain - Sean Barrett
|
// stb_textedit.h - v1.14 - public domain - Sean Barrett
|
||||||
|
@ -525,14 +524,29 @@ static void stb_textedit_find_charpos(StbFindState *find, STB_TEXTEDIT_STRING *s
|
||||||
int z = STB_TEXTEDIT_STRINGLEN(str);
|
int z = STB_TEXTEDIT_STRINGLEN(str);
|
||||||
int i=0, first;
|
int i=0, first;
|
||||||
|
|
||||||
if (n == z && single_line) {
|
if (n == z) {
|
||||||
// special case if it's at the end (may not be needed?)
|
// if it's at the end, then find the last line -- simpler than trying to
|
||||||
|
// explicitly handle this case in the regular code
|
||||||
|
if (single_line) {
|
||||||
STB_TEXTEDIT_LAYOUTROW(&r, str, 0);
|
STB_TEXTEDIT_LAYOUTROW(&r, str, 0);
|
||||||
find->y = 0;
|
find->y = 0;
|
||||||
find->first_char = 0;
|
find->first_char = 0;
|
||||||
find->length = z;
|
find->length = z;
|
||||||
find->height = r.ymax - r.ymin;
|
find->height = r.ymax - r.ymin;
|
||||||
find->x = r.x1;
|
find->x = r.x1;
|
||||||
|
} else {
|
||||||
|
find->y = 0;
|
||||||
|
find->x = 0;
|
||||||
|
find->height = 1;
|
||||||
|
while (i < z) {
|
||||||
|
STB_TEXTEDIT_LAYOUTROW(&r, str, i);
|
||||||
|
prev_start = i;
|
||||||
|
i += r.num_chars;
|
||||||
|
}
|
||||||
|
find->first_char = i;
|
||||||
|
find->length = 0;
|
||||||
|
find->prev_first = prev_start;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,13 +557,9 @@ static void stb_textedit_find_charpos(StbFindState *find, STB_TEXTEDIT_STRING *s
|
||||||
STB_TEXTEDIT_LAYOUTROW(&r, str, i);
|
STB_TEXTEDIT_LAYOUTROW(&r, str, i);
|
||||||
if (n < i + r.num_chars)
|
if (n < i + r.num_chars)
|
||||||
break;
|
break;
|
||||||
if (i + r.num_chars == z && z > 0 && STB_TEXTEDIT_GETCHAR(str, z - 1) != STB_TEXTEDIT_NEWLINE) // [DEAR IMGUI] special handling for last line
|
|
||||||
break; // [DEAR IMGUI]
|
|
||||||
prev_start = i;
|
prev_start = i;
|
||||||
i += r.num_chars;
|
i += r.num_chars;
|
||||||
find->y += r.baseline_y_delta;
|
find->y += r.baseline_y_delta;
|
||||||
if (i == z) // [DEAR IMGUI]
|
|
||||||
break; // [DEAR IMGUI]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
find->first_char = first = i;
|
find->first_char = first = i;
|
||||||
|
|
|
@ -2008,7 +2008,7 @@ static stbtt__buf stbtt__cid_get_glyph_subrs(const stbtt_fontinfo *info, int gly
|
||||||
start = end;
|
start = end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fdselector == -1) return stbtt__new_buf(NULL, 0); // [DEAR IMGUI] fixed, see #6007 and nothings/stb#1422
|
if (fdselector == -1) stbtt__new_buf(NULL, 0);
|
||||||
return stbtt__get_subrs(info->cff, stbtt__cff_index_get(info->fontdicts, fdselector));
|
return stbtt__get_subrs(info->cff, stbtt__cff_index_get(info->fontdicts, fdselector));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
53
src/gui.zig
53
src/gui.zig
|
@ -243,9 +243,6 @@ pub const io = struct {
|
||||||
pub const addKeyEvent = zguiIoAddKeyEvent;
|
pub const addKeyEvent = zguiIoAddKeyEvent;
|
||||||
extern fn zguiIoAddKeyEvent(key: Key, down: bool) void;
|
extern fn zguiIoAddKeyEvent(key: Key, down: bool) void;
|
||||||
|
|
||||||
pub const addInputCharactersUTF8 = zguiIoAddInputCharactersUTF8;
|
|
||||||
extern fn zguiIoAddInputCharactersUTF8(utf8_chars: ?[*:0]const u8) void;
|
|
||||||
|
|
||||||
pub const setKeyEventNativeData = zguiIoSetKeyEventNativeData;
|
pub const setKeyEventNativeData = zguiIoSetKeyEventNativeData;
|
||||||
extern fn zguiIoSetKeyEventNativeData(key: Key, keycode: i32, scancode: i32) void;
|
extern fn zguiIoSetKeyEventNativeData(key: Key, keycode: i32, scancode: i32) void;
|
||||||
|
|
||||||
|
@ -301,7 +298,7 @@ pub const Key = enum(u32) {
|
||||||
four,
|
four,
|
||||||
five,
|
five,
|
||||||
six,
|
six,
|
||||||
seven,
|
severn,
|
||||||
eight,
|
eight,
|
||||||
nine,
|
nine,
|
||||||
a,
|
a,
|
||||||
|
@ -410,11 +407,11 @@ pub const Key = enum(u32) {
|
||||||
mouse_wheel_x,
|
mouse_wheel_x,
|
||||||
mouse_wheel_y,
|
mouse_wheel_y,
|
||||||
|
|
||||||
mod_ctrl = 1 << 12,
|
pub const mod_ctrl: u32 = 1 << 12;
|
||||||
mod_shift = 1 << 13,
|
pub const mod_shift: u32 = 1 << 13;
|
||||||
mod_alt = 1 << 14,
|
pub const mod_alt: u32 = 1 << 14;
|
||||||
mod_super = 1 << 15,
|
pub const mod_super: u32 = 1 << 15;
|
||||||
mod_mask_ = 0xf000,
|
pub const mod_mask_: u32 = 0xf000;
|
||||||
};
|
};
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
pub const WindowFlags = packed struct(u32) {
|
pub const WindowFlags = packed struct(u32) {
|
||||||
|
@ -561,10 +558,6 @@ pub fn setNextWindowBgAlpha(args: SetNextWindowBgAlpha) void {
|
||||||
zguiSetNextWindowBgAlpha(args.alpha);
|
zguiSetNextWindowBgAlpha(args.alpha);
|
||||||
}
|
}
|
||||||
extern fn zguiSetNextWindowBgAlpha(alpha: f32) void;
|
extern fn zguiSetNextWindowBgAlpha(alpha: f32) void;
|
||||||
|
|
||||||
/// `pub fn setKeyboardFocusHere(offset: i32) void`
|
|
||||||
pub const setKeyboardFocusHere = zguiSetKeyboardFocusHere;
|
|
||||||
extern fn zguiSetKeyboardFocusHere(offset: i32) void;
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
const Begin = struct {
|
const Begin = struct {
|
||||||
popen: ?*bool = null,
|
popen: ?*bool = null,
|
||||||
|
@ -1105,19 +1098,6 @@ extern fn zguiGetTextLineHeightWithSpacing() f32;
|
||||||
extern fn zguiGetFrameHeight() f32;
|
extern fn zguiGetFrameHeight() f32;
|
||||||
extern fn zguiGetFrameHeightWithSpacing() f32;
|
extern fn zguiGetFrameHeightWithSpacing() f32;
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
pub fn getItemRectMax() [2]f32 {
|
|
||||||
var rect: [2]f32 = undefined;
|
|
||||||
zguiGetItemRectMax(&rect);
|
|
||||||
return rect;
|
|
||||||
}
|
|
||||||
pub fn getItemRectMin() [2]f32 {
|
|
||||||
var rect: [2]f32 = undefined;
|
|
||||||
zguiGetItemRectMin(&rect);
|
|
||||||
return rect;
|
|
||||||
}
|
|
||||||
extern fn zguiGetItemRectMax(rect: *[2]f32) void;
|
|
||||||
extern fn zguiGetItemRectMin(rect: *[2]f32) void;
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
//
|
//
|
||||||
// ID stack/scopes
|
// ID stack/scopes
|
||||||
//
|
//
|
||||||
|
@ -2783,21 +2763,14 @@ pub const TableBgTarget = enum(u32) {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const BeginTable = struct {
|
pub const BeginTable = struct {
|
||||||
column: i32,
|
|
||||||
flags: TableFlags = .{},
|
flags: TableFlags = .{},
|
||||||
outer_size: [2]f32 = .{ 0, 0 },
|
outer_size: [2]f32 = .{ 0, 0 },
|
||||||
inner_width: f32 = 0,
|
inner_width: f32 = 0,
|
||||||
};
|
};
|
||||||
pub fn beginTable(name: [:0]const u8, args: BeginTable) void {
|
pub fn beginTable(name: [:0]const u8, args: BeginTable) void {
|
||||||
zguiBeginTable(name, args.column, args.flags, &args.outer_size, args.inner_width);
|
zguiBeginTable(name, args.flags, args.outer_size, args.inner_width);
|
||||||
}
|
}
|
||||||
extern fn zguiBeginTable(
|
extern fn zguiBeginTable(str_id: [*:0]const u8, column: i32, flags: TableFlags, outer_size: [2]f32, inner_width: f32) void;
|
||||||
str_id: [*:0]const u8,
|
|
||||||
column: i32,
|
|
||||||
flags: TableFlags,
|
|
||||||
outer_size: *const [2]f32,
|
|
||||||
inner_width: f32,
|
|
||||||
) void;
|
|
||||||
|
|
||||||
pub fn endTable() void {
|
pub fn endTable() void {
|
||||||
zguiEndTable();
|
zguiEndTable();
|
||||||
|
@ -2897,8 +2870,6 @@ pub const MouseButton = enum(u32) {
|
||||||
right = 1,
|
right = 1,
|
||||||
middle = 2,
|
middle = 2,
|
||||||
};
|
};
|
||||||
/// `pub fn isMouseDoubleClicked(mouse_button: MouseButton) bool`
|
|
||||||
pub const isMouseDoubleClicked = zguiIsMouseDoubleClicked;
|
|
||||||
/// `pub fn isItemClicked(mouse_button: MouseButton) bool`
|
/// `pub fn isItemClicked(mouse_button: MouseButton) bool`
|
||||||
pub const isItemClicked = zguiIsItemClicked;
|
pub const isItemClicked = zguiIsItemClicked;
|
||||||
/// `pub fn isItemVisible() bool`
|
/// `pub fn isItemVisible() bool`
|
||||||
|
@ -2919,7 +2890,6 @@ pub const isAnyItemHovered = zguiIsAnyItemHovered;
|
||||||
pub const isAnyItemActive = zguiIsAnyItemActive;
|
pub const isAnyItemActive = zguiIsAnyItemActive;
|
||||||
/// `pub fn isAnyItemFocused() bool`
|
/// `pub fn isAnyItemFocused() bool`
|
||||||
pub const isAnyItemFocused = zguiIsAnyItemFocused;
|
pub const isAnyItemFocused = zguiIsAnyItemFocused;
|
||||||
extern fn zguiIsMouseDoubleClicked(mouse_button: MouseButton) bool;
|
|
||||||
extern fn zguiIsItemHovered(flags: HoveredFlags) bool;
|
extern fn zguiIsItemHovered(flags: HoveredFlags) bool;
|
||||||
extern fn zguiIsItemActive() bool;
|
extern fn zguiIsItemActive() bool;
|
||||||
extern fn zguiIsItemFocused() bool;
|
extern fn zguiIsItemFocused() bool;
|
||||||
|
@ -3053,8 +3023,6 @@ pub const endTooltip = zguiEndTooltip;
|
||||||
extern fn zguiBeginTooltip() void;
|
extern fn zguiBeginTooltip() void;
|
||||||
extern fn zguiEndTooltip() void;
|
extern fn zguiEndTooltip() void;
|
||||||
|
|
||||||
/// `pub fn beginPopupContextWindow() bool`
|
|
||||||
pub const beginPopupContextWindow = zguiBeginPopupContextWindow;
|
|
||||||
pub const PopupFlags = packed struct(u32) {
|
pub const PopupFlags = packed struct(u32) {
|
||||||
mouse_button_left: bool = false,
|
mouse_button_left: bool = false,
|
||||||
mouse_button_right: bool = false,
|
mouse_button_right: bool = false,
|
||||||
|
@ -3078,7 +3046,6 @@ pub fn openPopup(str_id: [:0]const u8, flags: PopupFlags) void {
|
||||||
pub const endPopup = zguiEndPopup;
|
pub const endPopup = zguiEndPopup;
|
||||||
/// `pub fn closeCurrentPopup() void`
|
/// `pub fn closeCurrentPopup() void`
|
||||||
pub const closeCurrentPopup = zguiCloseCurrentPopup;
|
pub const closeCurrentPopup = zguiCloseCurrentPopup;
|
||||||
extern fn zguiBeginPopupContextWindow() bool;
|
|
||||||
extern fn zguiBeginPopupModal(name: [*:0]const u8, popen: ?*bool, flags: WindowFlags) bool;
|
extern fn zguiBeginPopupModal(name: [*:0]const u8, popen: ?*bool, flags: WindowFlags) bool;
|
||||||
extern fn zguiEndPopup() void;
|
extern fn zguiEndPopup() void;
|
||||||
extern fn zguiOpenPopup(str_id: [*:0]const u8, flags: PopupFlags) void;
|
extern fn zguiOpenPopup(str_id: [*:0]const u8, flags: PopupFlags) void;
|
||||||
|
@ -3314,11 +3281,9 @@ pub const DrawList = *opaque {
|
||||||
anti_aliased_fill: bool = false,
|
anti_aliased_fill: bool = false,
|
||||||
allow_vtx_offset: bool = false,
|
allow_vtx_offset: bool = false,
|
||||||
|
|
||||||
_padding: u28 = 0,
|
_padding: u28,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const setDrawListFlags = zguiDrawList_SetFlags;
|
|
||||||
extern fn zguiDrawList_SetFlags(draw_list: DrawList, flags: DrawListFlags) void;
|
|
||||||
pub const getDrawListFlags = zguiDrawList_GetFlags;
|
pub const getDrawListFlags = zguiDrawList_GetFlags;
|
||||||
extern fn zguiDrawList_GetFlags(draw_list: DrawList) DrawListFlags;
|
extern fn zguiDrawList_GetFlags(draw_list: DrawList) DrawListFlags;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// named parameters and Zig style text formatting.
|
// named parameters and Zig style text formatting.
|
||||||
//
|
//
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
pub const version = @import("std").SemanticVersion{ .major = 0, .minor = 9, .patch = 5 };
|
pub const version = @import("std").SemanticVersion{ .major = 0, .minor = 9, .patch = 4 };
|
||||||
|
|
||||||
pub usingnamespace @import("gui.zig");
|
pub usingnamespace @import("gui.zig");
|
||||||
pub const plot = @import("plot.zig");
|
pub const plot = @import("plot.zig");
|
||||||
|
|
34
src/zgui.cpp
34
src/zgui.cpp
|
@ -44,10 +44,6 @@ ZGUI_API void zguiSetNextWindowBgAlpha(float alpha) {
|
||||||
ImGui::SetNextWindowBgAlpha(alpha);
|
ImGui::SetNextWindowBgAlpha(alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZGUI_API void zguiSetKeyboardFocusHere(int offset) {
|
|
||||||
ImGui::SetKeyboardFocusHere(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
ZGUI_API bool zguiBegin(const char* name, bool* p_open, ImGuiWindowFlags flags) {
|
ZGUI_API bool zguiBegin(const char* name, bool* p_open, ImGuiWindowFlags flags) {
|
||||||
return ImGui::Begin(name, p_open, flags);
|
return ImGui::Begin(name, p_open, flags);
|
||||||
}
|
}
|
||||||
|
@ -190,18 +186,6 @@ ZGUI_API void zguiEndGroup(void) {
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
ZGUI_API void zguiGetItemRectMax(float rect[2]) {
|
|
||||||
const ImVec2 r = ImGui::GetItemRectMax();
|
|
||||||
rect[0] = r.x;
|
|
||||||
rect[1] = r.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
ZGUI_API void zguiGetItemRectMin(float rect[2]) {
|
|
||||||
const ImVec2 r = ImGui::GetItemRectMin();
|
|
||||||
rect[0] = r.x;
|
|
||||||
rect[1] = r.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
ZGUI_API void zguiGetCursorPos(float pos[2]) {
|
ZGUI_API void zguiGetCursorPos(float pos[2]) {
|
||||||
const ImVec2 p = ImGui::GetCursorPos();
|
const ImVec2 p = ImGui::GetCursorPos();
|
||||||
pos[0] = p.x;
|
pos[0] = p.x;
|
||||||
|
@ -1260,10 +1244,6 @@ ZGUI_API void zguiIoAddKeyEvent(ImGuiKey key, bool down) {
|
||||||
ImGui::GetIO().AddKeyEvent(key, down);
|
ImGui::GetIO().AddKeyEvent(key, down);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZGUI_API void zguiIoAddInputCharactersUTF8(const char* utf8_chars) {
|
|
||||||
ImGui::GetIO().AddInputCharactersUTF8(utf8_chars);
|
|
||||||
}
|
|
||||||
|
|
||||||
ZGUI_API void zguiIoSetKeyEventNativeData(ImGuiKey key, int keycode, int scancode) {
|
ZGUI_API void zguiIoSetKeyEventNativeData(ImGuiKey key, int keycode, int scancode) {
|
||||||
ImGui::GetIO().SetKeyEventNativeData(key, keycode, scancode);
|
ImGui::GetIO().SetKeyEventNativeData(key, keycode, scancode);
|
||||||
}
|
}
|
||||||
|
@ -1289,10 +1269,6 @@ ZGUI_API bool zguiIsItemClicked(ImGuiMouseButton mouse_button) {
|
||||||
return ImGui::IsItemClicked(mouse_button);
|
return ImGui::IsItemClicked(mouse_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZGUI_API bool zguiIsMouseDoubleClicked(ImGuiMouseButton button) {
|
|
||||||
return ImGui::IsMouseDoubleClicked(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
ZGUI_API bool zguiIsItemVisible(void) {
|
ZGUI_API bool zguiIsItemVisible(void) {
|
||||||
return ImGui::IsItemVisible();
|
return ImGui::IsItemVisible();
|
||||||
}
|
}
|
||||||
|
@ -1413,10 +1389,6 @@ ZGUI_API void zguiEndTooltip(void) {
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
ZGUI_API bool zguiBeginPopupContextWindow(void) {
|
|
||||||
return ImGui::BeginPopupContextWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
ZGUI_API bool zguiBeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags flags) {
|
ZGUI_API bool zguiBeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags flags) {
|
||||||
return ImGui::BeginPopupModal(name, p_open, flags);
|
return ImGui::BeginPopupModal(name, p_open, flags);
|
||||||
}
|
}
|
||||||
|
@ -1441,7 +1413,7 @@ ZGUI_API void zguiBeginTable(
|
||||||
const char* str_id,
|
const char* str_id,
|
||||||
int column,
|
int column,
|
||||||
ImGuiTableFlags flags,
|
ImGuiTableFlags flags,
|
||||||
const float outer_size[2],
|
float outer_size[2],
|
||||||
float inner_width
|
float inner_width
|
||||||
) {
|
) {
|
||||||
ImGui::BeginTable(str_id, column, flags, { outer_size[0], outer_size[1] }, inner_width);
|
ImGui::BeginTable(str_id, column, flags, { outer_size[0], outer_size[1] }, inner_width);
|
||||||
|
@ -1592,10 +1564,6 @@ ZGUI_API int zguiDrawList_GetCmdBufferLength(ImDrawList *draw_list) {
|
||||||
ZGUI_API ImDrawCmd *zguiDrawList_GetCmdBufferData(ImDrawList *draw_list) {
|
ZGUI_API ImDrawCmd *zguiDrawList_GetCmdBufferData(ImDrawList *draw_list) {
|
||||||
return draw_list->CmdBuffer.begin();
|
return draw_list->CmdBuffer.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
ZGUI_API void zguiDrawList_SetFlags(ImDrawList *draw_list, ImDrawListFlags flags) {
|
|
||||||
draw_list->Flags = flags;
|
|
||||||
}
|
|
||||||
ZGUI_API ImDrawListFlags zguiDrawList_GetFlags(ImDrawList *draw_list) {
|
ZGUI_API ImDrawListFlags zguiDrawList_GetFlags(ImDrawList *draw_list) {
|
||||||
return draw_list->Flags;
|
return draw_list->Flags;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue