mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Merge branch 'master' into viewport
# Conflicts: # examples/imgui_impl_dx11.cpp # examples/imgui_impl_glfw.cpp # examples/imgui_impl_sdl.cpp # imgui.cpp
This commit is contained in:
commit
8ef0ca9765
@ -35,10 +35,11 @@ HOW TO UPDATE?
|
||||
|
||||
Breaking Changes:
|
||||
|
||||
- Removed per-window ImGuiWindowFlags_ResizeFromAnySide beta flag in favor `io.OptResizeWindowsFromEdges=true` to enable the feature globally. (#1495)
|
||||
The feature is not currently enabled by default because it is not satisfying enough.
|
||||
- Style: Renamed ImGuiCol_ModalWindowDarkening to ImGuiCol_ModalWindowDimBg for consistency with other features. Kept redirection enum (will obsolete).
|
||||
- Changed ImGui::GetTime() return value from float to double to avoid accumulating floating point imprecisions over time.
|
||||
- Removed per-window ImGuiWindowFlags_ResizeFromAnySide beta flag in favor `io.ConfigResizeWindowsFromEdges=true` to enable the feature globally. (#1495)
|
||||
The feature is not currently enabled by default because it is not satisfying enough.
|
||||
- Renamed io.OptCursorBlink to io.ConfigCursorBlink, io.OptMacOSXBehaviors to io.ConfigMacOSXBehaviors for consistency. (#1427, #473)
|
||||
|
||||
Other Changes:
|
||||
|
||||
@ -54,10 +55,12 @@ Other Changes:
|
||||
- Drag and Drop: Calling BeginTooltip() between a BeginDragSource()/EndDragSource() or BeginDropTarget()/EndDropTarget() uses adjusted tooltip
|
||||
settings matching the one created when calling BeginDragSource() without the ImGuiDragDropFlags_SourceNoPreviewTooltip flag. (#143)
|
||||
- Drag and Drop: Payload stays available and under the mouse if the source stops being submitted, however the tooltip is replaced by "...". (#1725)
|
||||
- Drag and Drop: Added ImGuiDragDropFlags_SourceAutoExpirePayload flag to force payload to expire if the source stops being submitted. (#1725, #143).
|
||||
- IsItemHovered(): Added ImGuiHoveredFlags_AllowWhenDisabled flag to query hovered status on disabled items. (#1940, #211)
|
||||
- Misc: Added ImGuiMouseCursor_Hand cursor enum + corresponding software cursor. (#1913, 1914) [@aiekick, @ocornut]
|
||||
- Misc: Tweaked software mouse cursor offset to match the offset of the corresponding Windows 10 cursors.
|
||||
- Made assertion more clear when trying to call Begin() outside of the NewFrame()..EndFrame() scope. (#1987)
|
||||
- Fixed PushID() from keeping alive the new ID Stack top value (if a previously active widget shared the ID it would be erroneously kept alive).
|
||||
- Fixed horizontal mouse wheel not forwarding the request to the parent window if ImGuiWindowFlags_NoScrollWithMouse is set. (#1463, #1380, #1502)
|
||||
- Fixed a include build issue for Cygwin in non-POSIX (Win32) mode. (#1917, #1319, #276)
|
||||
- OS/Windows: Fixed missing ImmReleaseContext() call in the default Win32 IME handler. (#1932) [@vby]
|
||||
@ -73,6 +76,7 @@ Other Changes:
|
||||
- Examples: OpenGL3: Made the example app default to GL 3.0 + GLSL 130 (instead of GL 3.2 + GLSL 150) unless on Mac.
|
||||
- Examples: OpenGL3: Added error output when shaders fail to compile/link.
|
||||
- Examples: DirectX10, DirectX11: Fixed unreleased resources in Init and Shutdown functions. (#1944)
|
||||
- Examples: DirectX11: Querying for IDXGIFactory instead of IDXGIFactory1 to increase compatibility. (#1989) [@matt77hias]
|
||||
- Examples: Win32, Glfw, SDL: Added support for the ImGuiMouseCursor_Hand cursor.
|
||||
|
||||
|
||||
@ -423,7 +427,7 @@ Breaking Changes:
|
||||
|
||||
Other Changes:
|
||||
|
||||
- Added `io.OptCursorBlink` option to allow disabling cursor blinking. (#1427)
|
||||
- Added `io.OptCursorBlink` option to allow disabling cursor blinking. (#1427) [renamed to io.ConfigCursorBlink in 1.63]
|
||||
- Added `GetOverlayDrawList()` helper to quickly get access to a ImDrawList that will be rendered in front of every windows.
|
||||
- Added `GetFrameHeight()` helper which returns `(FontSize + style.FramePadding.y * 2)`.
|
||||
- Drag and Drop: Added Beta API to easily use drag and drop patterns between imgui widgets.
|
||||
|
13
examples/.gitignore
vendored
13
examples/.gitignore
vendored
@ -1,18 +1,21 @@
|
||||
build/*
|
||||
*/Debug/*
|
||||
*/Release/*
|
||||
*/ipch/*
|
||||
*/x64/*
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.suo
|
||||
*.user
|
||||
*.o
|
||||
*.obj
|
||||
*.exe
|
||||
|
||||
## Visual Studio cruft
|
||||
.vs/*
|
||||
*/ipch/*
|
||||
*.opensdf
|
||||
*.log
|
||||
*.pdb
|
||||
*.ilk
|
||||
*.user
|
||||
*.sdf
|
||||
*.suo
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
|
@ -34,11 +34,11 @@ static ID3D10Device* g_pd3dDevice = NULL;
|
||||
static IDXGIFactory* g_pFactory = NULL;
|
||||
static ID3D10Buffer* g_pVB = NULL;
|
||||
static ID3D10Buffer* g_pIB = NULL;
|
||||
static ID3D10Blob * g_pVertexShaderBlob = NULL;
|
||||
static ID3D10Blob* g_pVertexShaderBlob = NULL;
|
||||
static ID3D10VertexShader* g_pVertexShader = NULL;
|
||||
static ID3D10InputLayout* g_pInputLayout = NULL;
|
||||
static ID3D10Buffer* g_pVertexConstantBuffer = NULL;
|
||||
static ID3D10Blob * g_pPixelShaderBlob = NULL;
|
||||
static ID3D10Blob* g_pPixelShaderBlob = NULL;
|
||||
static ID3D10PixelShader* g_pPixelShader = NULL;
|
||||
static ID3D10SamplerState* g_pFontSampler = NULL;
|
||||
static ID3D10ShaderResourceView*g_pFontTextureView = NULL;
|
||||
|
@ -12,6 +12,7 @@
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2018-08-01: DirectX11: Querying for IDXGIFactory instead of IDXGIFactory1 to increase compatibility.
|
||||
// 2018-07-13: DirectX11: Fixed unreleased resources in Init and Shutdown functions.
|
||||
// 2018-06-08: Misc: Extracted imgui_impl_dx11.cpp/.h away from the old combined DX11+Win32 example.
|
||||
// 2018-06-08: DirectX11: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
||||
@ -30,14 +31,14 @@
|
||||
// DirectX data
|
||||
static ID3D11Device* g_pd3dDevice = NULL;
|
||||
static ID3D11DeviceContext* g_pd3dDeviceContext = NULL;
|
||||
static IDXGIFactory1* g_pFactory = NULL;
|
||||
static IDXGIFactory* g_pFactory = NULL;
|
||||
static ID3D11Buffer* g_pVB = NULL;
|
||||
static ID3D11Buffer* g_pIB = NULL;
|
||||
static ID3D10Blob * g_pVertexShaderBlob = NULL;
|
||||
static ID3D10Blob* g_pVertexShaderBlob = NULL;
|
||||
static ID3D11VertexShader* g_pVertexShader = NULL;
|
||||
static ID3D11InputLayout* g_pInputLayout = NULL;
|
||||
static ID3D11Buffer* g_pVertexConstantBuffer = NULL;
|
||||
static ID3D10Blob * g_pPixelShaderBlob = NULL;
|
||||
static ID3D10Blob* g_pPixelShaderBlob = NULL;
|
||||
static ID3D11PixelShader* g_pPixelShader = NULL;
|
||||
static ID3D11SamplerState* g_pFontSampler = NULL;
|
||||
static ID3D11ShaderResourceView*g_pFontTextureView = NULL;
|
||||
@ -477,7 +478,7 @@ bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_co
|
||||
// Get factory from device
|
||||
IDXGIDevice* pDXGIDevice = NULL;
|
||||
IDXGIAdapter* pDXGIAdapter = NULL;
|
||||
IDXGIFactory1* pFactory = NULL;
|
||||
IDXGIFactory* pFactory = NULL;
|
||||
|
||||
if (device->QueryInterface(IID_PPV_ARGS(&pDXGIDevice)) == S_OK)
|
||||
if (pDXGIDevice->GetParent(IID_PPV_ARGS(&pDXGIAdapter)) == S_OK)
|
||||
|
@ -16,6 +16,7 @@
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2018-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
|
||||
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
|
||||
// 2018-06-08: Misc: Extracted imgui_impl_glfw.cpp/.h away from the old combined GLFW+OpenGL/Vulkan examples.
|
||||
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag.
|
||||
@ -223,7 +224,13 @@ static void ImGui_ImplGlfw_UpdateMousePosAndButtons()
|
||||
ImGuiViewport* viewport = platform_io.Viewports[n];
|
||||
GLFWwindow* window = (GLFWwindow*)viewport->PlatformHandle;
|
||||
IM_ASSERT(window != NULL);
|
||||
if (glfwGetWindowAttrib(window, GLFW_FOCUSED))
|
||||
#ifdef __EMSCRIPTEN__
|
||||
const bool focused = true;
|
||||
IM_ASSERT(platform_io.Viewports.Size == 1);
|
||||
#else
|
||||
const bool focused = glfwGetWindowAttrib(window, GLFW_FOCUSED) != 0;
|
||||
#endif
|
||||
if (focused)
|
||||
{
|
||||
if (io.WantSetMousePos)
|
||||
{
|
||||
|
@ -17,6 +17,7 @@
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2018-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
|
||||
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
|
||||
// 2018-06-08: Misc: Extracted imgui_impl_sdl.cpp/.h away from the old combined SDL2+OpenGL/Vulkan examples.
|
||||
// 2018-06-08: Misc: ImGui_ImplSDL2_InitForOpenGL() now takes a SDL_GLContext parameter.
|
||||
@ -253,7 +254,7 @@ static void ImGui_ImplSDL2_UpdateMousePosAndButtons()
|
||||
io.MouseDown[2] = g_MousePressed[2] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
|
||||
g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;
|
||||
|
||||
#if SDL_HAS_CAPTURE_MOUSE
|
||||
#if SDL_HAS_CAPTURE_MOUSE && !defined(__EMSCRIPTEN__)
|
||||
SDL_Window* focused_window = SDL_GetKeyboardFocus();
|
||||
if (focused_window)
|
||||
{
|
||||
|
56
imgui.cpp
56
imgui.cpp
@ -317,9 +317,10 @@
|
||||
- 2018/XX/XX (1.XX) - Moved IME support functions from io.ImeSetInputScreenPosFn, io.ImeWindowHandle to the PlatformIO api.
|
||||
- 2018/XX/XX (1.XX) - removed io.DisplayVisibleMin, io.DisplayVisibleMax settings (it was used to clip within the DisplayMin..DisplayMax range, I don't know of anyone using it)
|
||||
|
||||
- 2018/08/01 (1.63) - removed per-window ImGuiWindowFlags_ResizeFromAnySide beta flag in favor of a global io.ConfigResizeWindowsFromEdges to enable the feature.
|
||||
- 2018/08/01 (1.63) - renamed io.OptCursorBlink to io.ConfigCursorBlink, io.OptMacOSXBehaviors to ConfigMacOSXBehaviors for consistency.
|
||||
- 2018/07/22 (1.63) - changed ImGui::GetTime() return value from float to double to avoid accumulating floating point imprecisions over time.
|
||||
- 2018/07/08 (1.63) - style: renamed ImGuiCol_ModalWindowDarkening to ImGuiCol_ModalWindowDimBg for consistency with other features. Kept redirection enum (will obsolete).
|
||||
- 2018/07/06 (1.63) - removed per-window ImGuiWindowFlags_ResizeFromAnySide beta flag in favor of a global io.OptResizeWindowsFromEdges to enable the feature.
|
||||
- 2018/06/06 (1.62) - renamed GetGlyphRangesChinese() to GetGlyphRangesChineseFull() to distinguish other variants and discourage using the full set.
|
||||
- 2018/06/06 (1.62) - TreeNodeEx()/TreeNodeBehavior(): the ImGuiTreeNodeFlags_CollapsingHeader helper now include the ImGuiTreeNodeFlags_NoTreePushOnOpen flag. See Changelog for details.
|
||||
- 2018/05/03 (1.61) - DragInt(): the default compile-time format string has been changed from "%.0f" to "%d", as we are not using integers internally any more.
|
||||
@ -1061,13 +1062,14 @@ ImGuiIO::ImGuiIO()
|
||||
FontAllowUserScaling = false;
|
||||
DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
|
||||
|
||||
// Advanced/subtle behaviors
|
||||
// Miscellaneous configuration options
|
||||
#ifdef __APPLE__
|
||||
OptMacOSXBehaviors = true; // Set Mac OS X style defaults based on __APPLE__ compile time flag
|
||||
ConfigMacOSXBehaviors = true; // Set Mac OS X style defaults based on __APPLE__ compile time flag
|
||||
#else
|
||||
OptMacOSXBehaviors = false;
|
||||
ConfigMacOSXBehaviors = false;
|
||||
#endif
|
||||
OptCursorBlink = true;
|
||||
ConfigCursorBlink = true;
|
||||
ConfigResizeWindowsFromEdges = false;
|
||||
|
||||
// Settings (User Functions)
|
||||
GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations
|
||||
@ -2214,6 +2216,12 @@ ImGuiID ImGuiWindow::GetIDNoKeepAlive(const char* str, const char* str_end)
|
||||
return ImHash(str, str_end ? (int)(str_end - str) : 0, seed);
|
||||
}
|
||||
|
||||
ImGuiID ImGuiWindow::GetIDNoKeepAlive(const void* ptr)
|
||||
{
|
||||
ImGuiID seed = IDStack.back();
|
||||
return ImHash(&ptr, sizeof(void*), seed);
|
||||
}
|
||||
|
||||
// This is only used in rare/specific situations to manufacture an ID out of nowhere.
|
||||
ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs)
|
||||
{
|
||||
@ -4307,9 +4315,9 @@ void ImGui::NewFrame()
|
||||
if (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard)
|
||||
IM_ASSERT(g.IO.KeyMap[ImGuiKey_Space] != -1 && "ImGuiKey_Space is not mapped, required for keyboard navigation.");
|
||||
|
||||
// Perform simple check: the beta io.OptResizeWindowsFromEdges option requires back-end to honor mouse cursor changes and set the ImGuiBackendFlags_HasMouseCursors flag accordingly.
|
||||
if (g.IO.OptResizeWindowsFromEdges && !(g.IO.BackendFlags & ImGuiBackendFlags_HasMouseCursors))
|
||||
g.IO.OptResizeWindowsFromEdges = false;
|
||||
// Perform simple check: the beta io.ConfigResizeWindowsFromEdges option requires back-end to honor mouse cursor changes and set the ImGuiBackendFlags_HasMouseCursors flag accordingly.
|
||||
if (g.IO.ConfigResizeWindowsFromEdges && !(g.IO.BackendFlags & ImGuiBackendFlags_HasMouseCursors))
|
||||
g.IO.ConfigResizeWindowsFromEdges = false;
|
||||
|
||||
// Perform simple checks: multi-viewport and platform windows support
|
||||
if (g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
@ -4996,12 +5004,13 @@ void ImGui::EndFrame()
|
||||
|
||||
SetCurrentViewport(NULL, NULL);
|
||||
|
||||
// Drag and Drop: Elapse payload at the end of the frame if mouse has been released
|
||||
if (g.DragDropActive && g.DragDropPayload.DataFrameCount + 1 < g.FrameCount && !IsMouseDown(g.DragDropMouseButton))
|
||||
// Drag and Drop: Elapse payload (if delivered, or if source stops being submitted)
|
||||
if (g.DragDropActive)
|
||||
{
|
||||
bool is_delivered = g.DragDropPayload.Delivery;
|
||||
bool is_elapsed = (g.DragDropPayload.DataFrameCount + 1 < g.FrameCount) && ((g.DragDropSourceFlags & ImGuiDragDropFlags_SourceAutoExpirePayload) || !IsMouseDown(g.DragDropMouseButton));
|
||||
if (is_delivered || is_elapsed)
|
||||
ClearDragDrop();
|
||||
g.DragDropPayloadBufHeap.clear();
|
||||
memset(&g.DragDropPayloadBufLocal, 0, sizeof(g.DragDropPayloadBufLocal));
|
||||
}
|
||||
|
||||
// Drag and Drop: Fallback for source tooltip. This is not ideal but better than nothing.
|
||||
@ -6984,7 +6993,7 @@ static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au
|
||||
if ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0)
|
||||
return;
|
||||
|
||||
const int resize_border_count = g.IO.OptResizeWindowsFromEdges ? 4 : 0;
|
||||
const int resize_border_count = g.IO.ConfigResizeWindowsFromEdges ? 4 : 0;
|
||||
const float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f);
|
||||
const float grip_hover_size = (float)(int)(grip_draw_size * 0.75f);
|
||||
|
||||
@ -7470,7 +7479,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
// Handle manual resize: Resize Grips, Borders, Gamepad
|
||||
int border_held = -1;
|
||||
ImU32 resize_grip_col[4] = { 0 };
|
||||
const int resize_grip_count = g.IO.OptResizeWindowsFromEdges ? 2 : 1; // 4
|
||||
const int resize_grip_count = g.IO.ConfigResizeWindowsFromEdges ? 2 : 1; // 4
|
||||
const float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f);
|
||||
if (!window->Collapsed)
|
||||
UpdateManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0]);
|
||||
@ -9940,26 +9949,26 @@ void ImGui::SetNextTreeNodeOpen(bool is_open, ImGuiCond cond)
|
||||
void ImGui::PushID(const char* str_id)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindowRead();
|
||||
window->IDStack.push_back(window->GetID(str_id));
|
||||
window->IDStack.push_back(window->GetIDNoKeepAlive(str_id));
|
||||
}
|
||||
|
||||
void ImGui::PushID(const char* str_id_begin, const char* str_id_end)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindowRead();
|
||||
window->IDStack.push_back(window->GetID(str_id_begin, str_id_end));
|
||||
window->IDStack.push_back(window->GetIDNoKeepAlive(str_id_begin, str_id_end));
|
||||
}
|
||||
|
||||
void ImGui::PushID(const void* ptr_id)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindowRead();
|
||||
window->IDStack.push_back(window->GetID(ptr_id));
|
||||
window->IDStack.push_back(window->GetIDNoKeepAlive(ptr_id));
|
||||
}
|
||||
|
||||
void ImGui::PushID(int int_id)
|
||||
{
|
||||
const void* ptr_id = (void*)(intptr_t)int_id;
|
||||
ImGuiWindow* window = GetCurrentWindowRead();
|
||||
window->IDStack.push_back(window->GetID(ptr_id));
|
||||
window->IDStack.push_back(window->GetIDNoKeepAlive(ptr_id));
|
||||
}
|
||||
|
||||
void ImGui::PopID()
|
||||
@ -11835,7 +11844,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
const float mouse_x = (io.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + edit_state.ScrollX;
|
||||
const float mouse_y = (is_multiline ? (io.MousePos.y - draw_window->DC.CursorPos.y - style.FramePadding.y) : (g.FontSize*0.5f));
|
||||
|
||||
const bool is_osx = io.OptMacOSXBehaviors;
|
||||
const bool is_osx = io.ConfigMacOSXBehaviors;
|
||||
if (select_all || (hovered && !is_osx && io.MouseDoubleClicked[0]))
|
||||
{
|
||||
edit_state.SelectAll();
|
||||
@ -11888,7 +11897,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
{
|
||||
// Handle key-presses
|
||||
const int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0);
|
||||
const bool is_osx = io.OptMacOSXBehaviors;
|
||||
const bool is_osx = io.ConfigMacOSXBehaviors;
|
||||
const bool is_shortcut_key = (is_osx ? (io.KeySuper && !io.KeyCtrl) : (io.KeyCtrl && !io.KeySuper)) && !io.KeyAlt && !io.KeyShift; // OS X style: Shortcuts using Cmd/Super instead of Ctrl
|
||||
const bool is_osx_shift_shortcut = is_osx && io.KeySuper && io.KeyShift && !io.KeyCtrl && !io.KeyAlt;
|
||||
const bool is_wordmove_key_down = is_osx ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl
|
||||
@ -12247,7 +12256,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos - render_scroll, GetColorU32(ImGuiCol_Text), buf_display, buf_display + edit_state.CurLenA, 0.0f, is_multiline ? NULL : &clip_rect);
|
||||
|
||||
// Draw blinking cursor
|
||||
bool cursor_is_visible = (!g.IO.OptCursorBlink) || (g.InputTextState.CursorAnim <= 0.0f) || ImFmod(g.InputTextState.CursorAnim, 1.20f) <= 0.80f;
|
||||
bool cursor_is_visible = (!g.IO.ConfigCursorBlink) || (g.InputTextState.CursorAnim <= 0.0f) || ImFmod(g.InputTextState.CursorAnim, 1.20f) <= 0.80f;
|
||||
ImVec2 cursor_screen_pos = render_pos + cursor_offset - render_scroll;
|
||||
ImRect cursor_screen_rect(cursor_screen_pos.x, cursor_screen_pos.y-g.FontSize+0.5f, cursor_screen_pos.x+1.0f, cursor_screen_pos.y-1.5f);
|
||||
if (cursor_is_visible && cursor_screen_rect.Overlaps(clip_rect))
|
||||
@ -14644,6 +14653,9 @@ void ImGui::ClearDragDrop()
|
||||
g.DragDropAcceptIdCurr = g.DragDropAcceptIdPrev = 0;
|
||||
g.DragDropAcceptIdCurrRectSurface = FLT_MAX;
|
||||
g.DragDropAcceptFrameCount = -1;
|
||||
|
||||
g.DragDropPayloadBufHeap.clear();
|
||||
memset(&g.DragDropPayloadBufLocal, 0, sizeof(g.DragDropPayloadBufLocal));
|
||||
}
|
||||
|
||||
// Call when current ID is active.
|
||||
@ -14817,6 +14829,8 @@ bool ImGui::BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id)
|
||||
IM_ASSERT(id != 0);
|
||||
if (!IsMouseHoveringRect(bb.Min, bb.Max) || (id == g.DragDropPayload.SourceId))
|
||||
return false;
|
||||
if (window->SkipItems)
|
||||
return false;
|
||||
|
||||
IM_ASSERT(g.DragDropWithinSourceOrTarget == false);
|
||||
g.DragDropTargetRect = bb;
|
||||
|
11
imgui.h
11
imgui.h
@ -643,7 +643,7 @@ enum ImGuiWindowFlags_
|
||||
|
||||
// [Obsolete]
|
||||
//ImGuiWindowFlags_ShowBorders = 1 << 7, // --> Set style.FrameBorderSize=1.0f / style.WindowBorderSize=1.0f to enable borders around windows and items
|
||||
//ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // --> Set io.OptResizeWindowsFromEdges and make sure mouse cursors are supported by back-end (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors)
|
||||
//ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // --> Set io.ConfigResizeWindowsFromEdges and make sure mouse cursors are supported by back-end (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors)
|
||||
};
|
||||
|
||||
// Flags for ImGui::InputText()
|
||||
@ -759,6 +759,7 @@ enum ImGuiDragDropFlags_
|
||||
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_SourceExtern = 1 << 4, // External source (from outside of imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously.
|
||||
ImGuiDragDropFlags_SourceAutoExpirePayload = 1 << 5, // Automatically expire the payload if the source cease to be submitted (otherwise payloads are persisting while being dragged)
|
||||
// AcceptDragDropPayload() flags
|
||||
ImGuiDragDropFlags_AcceptBeforeDelivery = 1 << 10, // AcceptDragDropPayload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered.
|
||||
ImGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 11, // Do not draw the default highlight rectangle when hovering over target.
|
||||
@ -1120,10 +1121,10 @@ struct ImGuiIO
|
||||
ImFont* FontDefault; // = NULL // Font to use on NewFrame(). Use NULL to uses Fonts->Fonts[0].
|
||||
ImVec2 DisplayFramebufferScale; // = (1.0f,1.0f) // For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui.
|
||||
|
||||
// Miscellaneous options
|
||||
bool OptMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl
|
||||
bool OptCursorBlink; // = true // Enable blinking cursor, for users who consider it annoying.
|
||||
bool OptResizeWindowsFromEdges;// = false // [BETA] Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be the ImGuiWindowFlags_ResizeFromAnySide flag)
|
||||
// Miscellaneous configuration options
|
||||
bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl (was called io.OptMacOSXBehaviors prior to 1.63)
|
||||
bool ConfigCursorBlink; // = true // Set to false to disable blinking cursor, for users who consider it distracting. (was called: io.OptCursorBlink prior to 1.63)
|
||||
bool ConfigResizeWindowsFromEdges; // = false // [BETA] Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be the ImGuiWindowFlags_ResizeFromAnySide flag)
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Settings (User Functions)
|
||||
|
@ -2156,6 +2156,10 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
ImGui::SameLine(); ShowHelpMarker("Instruct navigation to move the mouse cursor. See comment for ImGuiConfigFlags_NavEnableSetMousePos.");
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NoMouseCursorChange", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NoMouseCursorChange);
|
||||
ImGui::SameLine(); ShowHelpMarker("Instruct back-end to not alter mouse cursor shape and visibility.");
|
||||
ImGui::Checkbox("io.ConfigCursorBlink", &io.ConfigCursorBlink);
|
||||
ImGui::SameLine(); ShowHelpMarker("Set to false to disable blinking cursor, for users who consider it distracting");
|
||||
ImGui::Checkbox("io.ConfigResizeWindowsFromEdges [beta]", &io.ConfigResizeWindowsFromEdges);
|
||||
ImGui::SameLine(); ShowHelpMarker("Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback.");
|
||||
|
||||
if (ImGui::TreeNode("Keyboard, Mouse & Navigation State"))
|
||||
{
|
||||
@ -2494,8 +2498,8 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
ImGui::Text("The quick brown fox jumps over the lazy dog");
|
||||
ImGui::PopFont();
|
||||
ImGui::DragFloat("Font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f"); // Scale only this font
|
||||
ImGui::InputFloat("Font offset", &font->DisplayOffset.y, 1, 1, 0);
|
||||
ImGui::SameLine(); ShowHelpMarker("Note than the default embedded font is NOT meant to be scaled.\n\nFont are currently rendered into bitmaps at a given size at the time of building the atlas. You may oversample them to get some flexibility with scaling. You can also render at multiple sizes and select which one to use at runtime.\n\n(Glimmer of hope: the atlas system should hopefully be rewritten in the future to make scaling more natural and automatic.)");
|
||||
ImGui::InputFloat("Font offset", &font->DisplayOffset.y, 1, 1, "%.0f");
|
||||
ImGui::Text("Ascent: %f, Descent: %f, Height: %f", font->Ascent, font->Descent, font->Ascent - font->Descent);
|
||||
ImGui::Text("Fallback character: '%c' (%d)", font->FallbackChar, font->FallbackChar);
|
||||
ImGui::Text("Texture surface: %d pixels (approx) ~ %dx%d", font->MetricsTotalSurface, (int)sqrtf((float)font->MetricsTotalSurface), (int)sqrtf((float)font->MetricsTotalSurface));
|
||||
|
@ -1104,6 +1104,7 @@ public:
|
||||
ImGuiID GetID(const char* str, const char* str_end = NULL);
|
||||
ImGuiID GetID(const void* ptr);
|
||||
ImGuiID GetIDNoKeepAlive(const char* str, const char* str_end = NULL);
|
||||
ImGuiID GetIDNoKeepAlive(const void* ptr);
|
||||
ImGuiID GetIDFromRectangle(const ImRect& r_abs);
|
||||
|
||||
// We don't use g.FontSize because the window may be != g.CurrentWidow.
|
||||
|
Loading…
Reference in New Issue
Block a user