Updated ImGui.
This commit is contained in:
parent
acd77dc6c3
commit
7d323e84f3
29
3rdparty/dear-imgui/imgui.cpp
vendored
29
3rdparty/dear-imgui/imgui.cpp
vendored
@ -384,7 +384,15 @@ CODE
|
|||||||
When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
||||||
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||||
|
|
||||||
- 2022/07/08 (1.88) - inputs: removed io.NavInputs[] and ImGuiNavInput enum (following 1.87 changes).
|
- 2022/08/03 (1.89) - changed signature of ImageButton() function. Kept redirection function (will obsolete).
|
||||||
|
- added 'const char* str_id' parameter + removed 'int frame_padding = -1' parameter.
|
||||||
|
- old signature: bool ImageButton(ImTextureID tex_id, ImVec2 size, ImVec2 uv0 = ImVec2(0,0), ImVec2 uv1 = ImVec2(1,1), int frame_padding = -1, ImVec4 bg_col = ImVec4(0,0,0,0), ImVec4 tint_col = ImVec4(1,1,1,1));
|
||||||
|
- used the ImTextureID value to create an ID. This was inconsistent with other functions, led to ID conflicts, and caused problems with engines using transient ImTextureID values.
|
||||||
|
- had a FramePadding override which was inconsistent with other functions and made the already-long signature even longer.
|
||||||
|
- new signature: bool ImageButton(const char* str_id, ImTextureID tex_id, ImVec2 size, ImVec2 uv0 = ImVec2(0,0), ImVec2 uv1 = ImVec2(1,1), ImVec4 bg_col = ImVec4(0,0,0,0), ImVec4 tint_col = ImVec4(1,1,1,1));
|
||||||
|
- requires an explicit identifier. You may still use e.g. PushID() calls and then pass an empty identifier.
|
||||||
|
- always uses style.FramePadding for padding, to be consistent with other buttons. You may use PushStyleVar() to alter this.
|
||||||
|
- 2022/07/08 (1.89) - inputs: removed io.NavInputs[] and ImGuiNavInput enum (following 1.87 changes).
|
||||||
- Official backends from 1.87+ -> no issue.
|
- Official backends from 1.87+ -> no issue.
|
||||||
- Official backends from 1.60 to 1.86 -> will build and convert gamepad inputs, unless IMGUI_DISABLE_OBSOLETE_KEYIO is defined. Need updating!
|
- Official backends from 1.60 to 1.86 -> will build and convert gamepad inputs, unless IMGUI_DISABLE_OBSOLETE_KEYIO is defined. Need updating!
|
||||||
- Custom backends not writing to io.NavInputs[] -> no issue.
|
- Custom backends not writing to io.NavInputs[] -> no issue.
|
||||||
@ -1158,6 +1166,8 @@ ImGuiIO::ImGuiIO()
|
|||||||
#endif
|
#endif
|
||||||
ConfigInputTrickleEventQueue = true;
|
ConfigInputTrickleEventQueue = true;
|
||||||
ConfigInputTextCursorBlink = true;
|
ConfigInputTextCursorBlink = true;
|
||||||
|
ConfigInputTextEnterKeepActive = false;
|
||||||
|
ConfigDragClickToInputText = false;
|
||||||
ConfigWindowsResizeFromEdges = true;
|
ConfigWindowsResizeFromEdges = true;
|
||||||
ConfigWindowsMoveFromTitleBarOnly = false;
|
ConfigWindowsMoveFromTitleBarOnly = false;
|
||||||
ConfigMemoryCompactTimer = 60.0f;
|
ConfigMemoryCompactTimer = 60.0f;
|
||||||
@ -3856,7 +3866,7 @@ void ImGui::StartMouseMovingWindow(ImGuiWindow* window)
|
|||||||
g.NavDisableHighlight = true;
|
g.NavDisableHighlight = true;
|
||||||
g.ActiveIdClickOffset = g.IO.MouseClickedPos[0] - window->RootWindow->Pos;
|
g.ActiveIdClickOffset = g.IO.MouseClickedPos[0] - window->RootWindow->Pos;
|
||||||
g.ActiveIdNoClearOnFocusLoss = true;
|
g.ActiveIdNoClearOnFocusLoss = true;
|
||||||
SetActiveIdUsingNavAndKeys();
|
SetActiveIdUsingAllKeyboardKeys();
|
||||||
|
|
||||||
bool can_move_window = true;
|
bool can_move_window = true;
|
||||||
if ((window->Flags & ImGuiWindowFlags_NoMove) || (window->RootWindow->Flags & ImGuiWindowFlags_NoMove))
|
if ((window->Flags & ImGuiWindowFlags_NoMove) || (window->RootWindow->Flags & ImGuiWindowFlags_NoMove))
|
||||||
@ -5227,12 +5237,17 @@ void ImGui::SetItemUsingMouseWheel()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::SetActiveIdUsingNavAndKeys()
|
// FIXME: Technically this also prevents use of Gamepad D-Pad, may not be an issue.
|
||||||
|
void ImGui::SetActiveIdUsingAllKeyboardKeys()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
IM_ASSERT(g.ActiveId != 0);
|
IM_ASSERT(g.ActiveId != 0);
|
||||||
g.ActiveIdUsingNavDirMask = ~(ImU32)0;
|
g.ActiveIdUsingNavDirMask = ~(ImU32)0;
|
||||||
g.ActiveIdUsingKeyInputMask.SetAllBits();
|
g.ActiveIdUsingKeyInputMask.SetBitRange(ImGuiKey_Keyboard_BEGIN, ImGuiKey_Keyboard_END);
|
||||||
|
g.ActiveIdUsingKeyInputMask.SetBit(ImGuiKey_ModCtrl);
|
||||||
|
g.ActiveIdUsingKeyInputMask.SetBit(ImGuiKey_ModShift);
|
||||||
|
g.ActiveIdUsingKeyInputMask.SetBit(ImGuiKey_ModAlt);
|
||||||
|
g.ActiveIdUsingKeyInputMask.SetBit(ImGuiKey_ModSuper);
|
||||||
NavMoveRequestCancel();
|
NavMoveRequestCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5476,7 +5491,6 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags)
|
|||||||
g.Windows.push_front(window); // Quite slow but rare and only once
|
g.Windows.push_front(window); // Quite slow but rare and only once
|
||||||
else
|
else
|
||||||
g.Windows.push_back(window);
|
g.Windows.push_back(window);
|
||||||
UpdateWindowInFocusOrderList(window, true, window->Flags);
|
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
@ -6089,8 +6103,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
const bool window_just_created = (window == NULL);
|
const bool window_just_created = (window == NULL);
|
||||||
if (window_just_created)
|
if (window_just_created)
|
||||||
window = CreateNewWindow(name, flags);
|
window = CreateNewWindow(name, flags);
|
||||||
else
|
|
||||||
UpdateWindowInFocusOrderList(window, window_just_created, flags);
|
|
||||||
|
|
||||||
// Automatically disable manual moving/resizing when NoInputs is set
|
// Automatically disable manual moving/resizing when NoInputs is set
|
||||||
if ((flags & ImGuiWindowFlags_NoInputs) == ImGuiWindowFlags_NoInputs)
|
if ((flags & ImGuiWindowFlags_NoInputs) == ImGuiWindowFlags_NoInputs)
|
||||||
@ -6118,6 +6130,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
// Update Flags, LastFrameActive, BeginOrderXXX fields
|
// Update Flags, LastFrameActive, BeginOrderXXX fields
|
||||||
if (first_begin_of_the_frame)
|
if (first_begin_of_the_frame)
|
||||||
{
|
{
|
||||||
|
UpdateWindowInFocusOrderList(window, window_just_created, flags);
|
||||||
window->Flags = (ImGuiWindowFlags)flags;
|
window->Flags = (ImGuiWindowFlags)flags;
|
||||||
window->LastFrameActive = current_frame;
|
window->LastFrameActive = current_frame;
|
||||||
window->LastTimeActive = (float)g.Time;
|
window->LastTimeActive = (float)g.Time;
|
||||||
@ -11212,7 +11225,7 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
|||||||
source_drag_active = IsMouseDragging(mouse_button);
|
source_drag_active = IsMouseDragging(mouse_button);
|
||||||
|
|
||||||
// Disable navigation and key inputs while dragging + cancel existing request if any
|
// Disable navigation and key inputs while dragging + cancel existing request if any
|
||||||
SetActiveIdUsingNavAndKeys();
|
SetActiveIdUsingAllKeyboardKeys();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
13
3rdparty/dear-imgui/imgui.h
vendored
13
3rdparty/dear-imgui/imgui.h
vendored
@ -65,7 +65,7 @@ Index of this file:
|
|||||||
// Version
|
// Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||||
#define IMGUI_VERSION "1.89 WIP"
|
#define IMGUI_VERSION "1.89 WIP"
|
||||||
#define IMGUI_VERSION_NUM 18805
|
#define IMGUI_VERSION_NUM 18808
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
|
|
||||||
@ -493,8 +493,6 @@ namespace ImGui
|
|||||||
IMGUI_API bool SmallButton(const char* label); // button with FramePadding=(0,0) to easily embed within text
|
IMGUI_API bool SmallButton(const char* label); // button with FramePadding=(0,0) to easily embed within text
|
||||||
IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size, ImGuiButtonFlags flags = 0); // flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.)
|
IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size, ImGuiButtonFlags flags = 0); // flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.)
|
||||||
IMGUI_API bool ArrowButton(const char* str_id, ImGuiDir dir); // square button with an arrow shape
|
IMGUI_API bool ArrowButton(const char* str_id, ImGuiDir dir); // square button with an arrow shape
|
||||||
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0));
|
|
||||||
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,0), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no padding
|
|
||||||
IMGUI_API bool Checkbox(const char* label, bool* v);
|
IMGUI_API bool Checkbox(const char* label, bool* v);
|
||||||
IMGUI_API bool CheckboxFlags(const char* label, int* flags, int flags_value);
|
IMGUI_API bool CheckboxFlags(const char* label, int* flags, int flags_value);
|
||||||
IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
||||||
@ -503,6 +501,11 @@ namespace ImGui
|
|||||||
IMGUI_API void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-FLT_MIN, 0), const char* overlay = NULL);
|
IMGUI_API void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-FLT_MIN, 0), const char* overlay = NULL);
|
||||||
IMGUI_API void Bullet(); // draw a small circle + keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses
|
IMGUI_API void Bullet(); // draw a small circle + keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses
|
||||||
|
|
||||||
|
// Widgets: Images
|
||||||
|
// - Read about ImTextureID here: https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples
|
||||||
|
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec4& border_col = ImVec4(0, 0, 0, 0));
|
||||||
|
IMGUI_API bool ImageButton(const char* str_id, ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1));
|
||||||
|
|
||||||
// Widgets: Combo Box
|
// Widgets: Combo Box
|
||||||
// - The BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items.
|
// - The BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items.
|
||||||
// - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. This is analogous to how ListBox are created.
|
// - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. This is analogous to how ListBox are created.
|
||||||
@ -1900,7 +1903,7 @@ struct ImGuiIO
|
|||||||
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds.
|
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds.
|
||||||
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
||||||
float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging.
|
float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging.
|
||||||
float KeyRepeatDelay; // = 0.250f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.).
|
float KeyRepeatDelay; // = 0.275f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.).
|
||||||
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.
|
||||||
void* UserData; // = NULL // Store your own data for retrieval by callbacks.
|
void* UserData; // = NULL // Store your own data for retrieval by callbacks.
|
||||||
|
|
||||||
@ -2949,6 +2952,8 @@ namespace ImGui
|
|||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
|
// OBSOLETED in 1.89 (from August 2022)
|
||||||
|
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1)); // Use new ImageButton() signature (explicit item id, regular FramePadding)
|
||||||
// OBSOLETED in 1.88 (from May 2022)
|
// OBSOLETED in 1.88 (from May 2022)
|
||||||
static inline void CaptureKeyboardFromApp(bool want_capture_keyboard = true) { SetNextFrameWantCaptureKeyboard(want_capture_keyboard); } // Renamed as name was misleading + removed default value.
|
static inline void CaptureKeyboardFromApp(bool want_capture_keyboard = true) { SetNextFrameWantCaptureKeyboard(want_capture_keyboard); } // Renamed as name was misleading + removed default value.
|
||||||
static inline void CaptureMouseFromApp(bool want_capture_mouse = true) { SetNextFrameWantCaptureMouse(want_capture_mouse); } // Renamed as name was misleading + removed default value.
|
static inline void CaptureMouseFromApp(bool want_capture_mouse = true) { SetNextFrameWantCaptureMouse(want_capture_mouse); } // Renamed as name was misleading + removed default value.
|
||||||
|
20
3rdparty/dear-imgui/imgui_demo.cpp
vendored
20
3rdparty/dear-imgui/imgui_demo.cpp
vendored
@ -1063,15 +1063,21 @@ static void ShowDemoWindowWidgets()
|
|||||||
static int pressed_count = 0;
|
static int pressed_count = 0;
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
|
// UV coordinates are often (0.0f, 0.0f) and (1.0f, 1.0f) to display an entire textures.
|
||||||
|
// Here are trying to display only a 32x32 pixels area of the texture, hence the UV computation.
|
||||||
|
// Read about UV coordinates here: https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples
|
||||||
ImGui::PushID(i);
|
ImGui::PushID(i);
|
||||||
int frame_padding = -1 + i; // -1 == uses default padding (style.FramePadding)
|
if (i > 0)
|
||||||
ImVec2 size = ImVec2(32.0f, 32.0f); // Size of the image we want to make visible
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(i - 1.0f, i - 1.0f));
|
||||||
ImVec2 uv0 = ImVec2(0.0f, 0.0f); // UV coordinates for lower-left
|
ImVec2 size = ImVec2(32.0f, 32.0f); // Size of the image we want to make visible
|
||||||
ImVec2 uv1 = ImVec2(32.0f / my_tex_w, 32.0f / my_tex_h);// UV coordinates for (32,32) in our texture
|
ImVec2 uv0 = ImVec2(0.0f, 0.0f); // UV coordinates for lower-left
|
||||||
ImVec4 bg_col = ImVec4(0.0f, 0.0f, 0.0f, 1.0f); // Black background
|
ImVec2 uv1 = ImVec2(32.0f / my_tex_w, 32.0f / my_tex_h); // UV coordinates for (32,32) in our texture
|
||||||
ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); // No tint
|
ImVec4 bg_col = ImVec4(0.0f, 0.0f, 0.0f, 1.0f); // Black background
|
||||||
if (ImGui::ImageButton(my_tex_id, size, uv0, uv1, frame_padding, bg_col, tint_col))
|
ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); // No tint
|
||||||
|
if (ImGui::ImageButton("", my_tex_id, size, uv0, uv1, bg_col, tint_col))
|
||||||
pressed_count += 1;
|
pressed_count += 1;
|
||||||
|
if (i > 0)
|
||||||
|
ImGui::PopStyleVar();
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
}
|
}
|
||||||
|
6
3rdparty/dear-imgui/imgui_internal.h
vendored
6
3rdparty/dear-imgui/imgui_internal.h
vendored
@ -1175,6 +1175,8 @@ enum ImGuiKeyPrivate_
|
|||||||
{
|
{
|
||||||
ImGuiKey_LegacyNativeKey_BEGIN = 0,
|
ImGuiKey_LegacyNativeKey_BEGIN = 0,
|
||||||
ImGuiKey_LegacyNativeKey_END = 512,
|
ImGuiKey_LegacyNativeKey_END = 512,
|
||||||
|
ImGuiKey_Keyboard_BEGIN = ImGuiKey_NamedKey_BEGIN,
|
||||||
|
ImGuiKey_Keyboard_END = ImGuiKey_GamepadStart,
|
||||||
ImGuiKey_Gamepad_BEGIN = ImGuiKey_GamepadStart,
|
ImGuiKey_Gamepad_BEGIN = ImGuiKey_GamepadStart,
|
||||||
ImGuiKey_Gamepad_END = ImGuiKey_GamepadRStickDown + 1,
|
ImGuiKey_Gamepad_END = ImGuiKey_GamepadRStickDown + 1,
|
||||||
ImGuiKey_Aliases_BEGIN = ImGuiKey_MouseLeft,
|
ImGuiKey_Aliases_BEGIN = ImGuiKey_MouseLeft,
|
||||||
@ -2702,7 +2704,7 @@ namespace ImGui
|
|||||||
IMGUI_API ImGuiKeyData* GetKeyData(ImGuiKey key);
|
IMGUI_API ImGuiKeyData* GetKeyData(ImGuiKey key);
|
||||||
IMGUI_API void GetKeyChordName(ImGuiModFlags mods, ImGuiKey key, char* out_buf, int out_buf_size);
|
IMGUI_API void GetKeyChordName(ImGuiModFlags mods, ImGuiKey key, char* out_buf, int out_buf_size);
|
||||||
IMGUI_API void SetItemUsingMouseWheel();
|
IMGUI_API void SetItemUsingMouseWheel();
|
||||||
IMGUI_API void SetActiveIdUsingNavAndKeys();
|
IMGUI_API void SetActiveIdUsingAllKeyboardKeys();
|
||||||
inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; }
|
inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; }
|
||||||
inline bool IsActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; return g.ActiveIdUsingKeyInputMask[key]; }
|
inline bool IsActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; return g.ActiveIdUsingKeyInputMask[key]; }
|
||||||
inline void SetActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; g.ActiveIdUsingKeyInputMask.SetBit(key); }
|
inline void SetActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; g.ActiveIdUsingKeyInputMask.SetBit(key); }
|
||||||
@ -2833,7 +2835,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
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 ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col);
|
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
|
||||||
|
36
3rdparty/dear-imgui/imgui_widgets.cpp
vendored
36
3rdparty/dear-imgui/imgui_widgets.cpp
vendored
@ -1038,14 +1038,15 @@ void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2&
|
|||||||
|
|
||||||
// ImageButton() is flawed as 'id' is always derived from 'texture_id' (see #2464 #1390)
|
// ImageButton() is flawed as 'id' is always derived from 'texture_id' (see #2464 #1390)
|
||||||
// We provide this internal helper to write your own variant while we figure out how to redesign the public ImageButton() API.
|
// We provide this internal helper to write your own variant while we figure out how to redesign the public ImageButton() API.
|
||||||
bool ImGui::ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col)
|
bool ImGui::ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size + padding * 2);
|
const ImVec2 padding = g.Style.FramePadding;
|
||||||
|
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size + padding * 2.0f);
|
||||||
ItemSize(bb);
|
ItemSize(bb);
|
||||||
if (!ItemAdd(bb, id))
|
if (!ItemAdd(bb, id))
|
||||||
return false;
|
return false;
|
||||||
@ -1064,9 +1065,21 @@ bool ImGui::ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size
|
|||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// frame_padding < 0: uses FramePadding from style (default)
|
bool ImGui::ImageButton(const char* str_id, ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col)
|
||||||
// frame_padding = 0: no framing
|
{
|
||||||
// frame_padding > 0: set framing size
|
ImGuiContext& g = *GImGui;
|
||||||
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
|
if (window->SkipItems)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return ImageButtonEx(window->GetID(str_id), user_texture_id, size, uv0, uv1, bg_col, tint_col);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
// Legacy API obsoleted in 1.89. Two differences with new ImageButton()
|
||||||
|
// - new ImageButton() requires an explicit 'const char* str_id' Old ImageButton() used opaque imTextureId (created issue with: multiple buttons with same image, transient texture id values, opaque computation of ID)
|
||||||
|
// - new ImageButton() always use style.FramePadding Old ImageButton() had an override argument.
|
||||||
|
// If you need to change padding with new ImageButton() you can use PushStyleVar(ImGuiStyleVar_FramePadding, value), consistent with other Button functions.
|
||||||
bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col, const ImVec4& tint_col)
|
bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col, const ImVec4& tint_col)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
@ -1079,9 +1092,14 @@ bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const I
|
|||||||
const ImGuiID id = window->GetID("#image");
|
const ImGuiID id = window->GetID("#image");
|
||||||
PopID();
|
PopID();
|
||||||
|
|
||||||
const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : g.Style.FramePadding;
|
if (frame_padding >= 0)
|
||||||
return ImageButtonEx(id, user_texture_id, size, uv0, uv1, padding, bg_col, tint_col);
|
PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2((float)frame_padding, (float)frame_padding));
|
||||||
|
bool ret = ImageButtonEx(id, user_texture_id, size, uv0, uv1, bg_col, tint_col);
|
||||||
|
if (frame_padding >= 0)
|
||||||
|
PopStyleVar();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif // #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
|
||||||
bool ImGui::Checkbox(const char* label, bool* v)
|
bool ImGui::Checkbox(const char* label, bool* v)
|
||||||
{
|
{
|
||||||
@ -7758,7 +7776,9 @@ void ImGui::TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id)
|
|||||||
// Called on manual closure attempt
|
// Called on manual closure attempt
|
||||||
void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
|
void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
|
||||||
{
|
{
|
||||||
IM_ASSERT(!(tab->Flags & ImGuiTabItemFlags_Button));
|
if (tab->Flags & ImGuiTabItemFlags_Button)
|
||||||
|
return; // A button appended with TabItemButton().
|
||||||
|
|
||||||
if (!(tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
|
if (!(tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
|
||||||
{
|
{
|
||||||
// This will remove a frame of lag for selecting another tab on closure.
|
// This will remove a frame of lag for selecting another tab on closure.
|
||||||
|
@ -84,12 +84,11 @@ namespace ImGui
|
|||||||
, const ImVec2& _size
|
, const ImVec2& _size
|
||||||
, const ImVec2& _uv0 = ImVec2(0.0f, 0.0f)
|
, const ImVec2& _uv0 = ImVec2(0.0f, 0.0f)
|
||||||
, const ImVec2& _uv1 = ImVec2(1.0f, 1.0f)
|
, const ImVec2& _uv1 = ImVec2(1.0f, 1.0f)
|
||||||
, int _framePadding = -1
|
|
||||||
, const ImVec4& _bgCol = ImVec4(0.0f, 0.0f, 0.0f, 0.0f)
|
, const ImVec4& _bgCol = ImVec4(0.0f, 0.0f, 0.0f, 0.0f)
|
||||||
, const ImVec4& _tintCol = ImVec4(1.0f, 1.0f, 1.0f, 1.0f)
|
, const ImVec4& _tintCol = ImVec4(1.0f, 1.0f, 1.0f, 1.0f)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return ImageButton(toId(_handle, _flags, _mip), _size, _uv0, _uv1, _framePadding, _bgCol, _tintCol);
|
return ImageButton("image", toId(_handle, _flags, _mip), _size, _uv0, _uv1, _bgCol, _tintCol);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function for passing bgfx::TextureHandle to ImGui::ImageButton.
|
// Helper function for passing bgfx::TextureHandle to ImGui::ImageButton.
|
||||||
@ -97,12 +96,11 @@ namespace ImGui
|
|||||||
, const ImVec2& _size
|
, const ImVec2& _size
|
||||||
, const ImVec2& _uv0 = ImVec2(0.0f, 0.0f)
|
, const ImVec2& _uv0 = ImVec2(0.0f, 0.0f)
|
||||||
, const ImVec2& _uv1 = ImVec2(1.0f, 1.0f)
|
, const ImVec2& _uv1 = ImVec2(1.0f, 1.0f)
|
||||||
, int _framePadding = -1
|
|
||||||
, const ImVec4& _bgCol = ImVec4(0.0f, 0.0f, 0.0f, 0.0f)
|
, const ImVec4& _bgCol = ImVec4(0.0f, 0.0f, 0.0f, 0.0f)
|
||||||
, const ImVec4& _tintCol = ImVec4(1.0f, 1.0f, 1.0f, 1.0f)
|
, const ImVec4& _tintCol = ImVec4(1.0f, 1.0f, 1.0f, 1.0f)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return ImageButton(_handle, IMGUI_FLAGS_ALPHA_BLEND, 0, _size, _uv0, _uv1, _framePadding, _bgCol, _tintCol);
|
return ImageButton(_handle, IMGUI_FLAGS_ALPHA_BLEND, 0, _size, _uv0, _uv1, _bgCol, _tintCol);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user