mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 09:27:00 +00:00
Merge branch 'master' into viewport
# Conflicts: # imgui.cpp
This commit is contained in:
commit
14cef31467
@ -42,13 +42,18 @@ Other Changes:
|
|||||||
|
|
||||||
- ArrowButton: Fixed to honor PushButtonRepeat() setting (and internals' ImGuiItemFlags_ButtonRepeat).
|
- ArrowButton: Fixed to honor PushButtonRepeat() setting (and internals' ImGuiItemFlags_ButtonRepeat).
|
||||||
- ArrowButton: Setup current line text baseline so that ArrowButton() + SameLine() + Text() are aligned properly.
|
- ArrowButton: Setup current line text baseline so that ArrowButton() + SameLine() + Text() are aligned properly.
|
||||||
- Window: Allow menu windows from ignoring the style.WindowMinSize values so short menus are not padded. (#1909)
|
- Window: Allow menu and popups windows from ignoring the style.WindowMinSize values so short menus/popups are not padded. (#1909)
|
||||||
- Window: Added global io.OptResizeWindowsFromEdges option to enable resizing windows from their edges and from the lower-left corner. (#1495)
|
- Window: Added global io.OptResizeWindowsFromEdges option to enable resizing windows from their edges and from the lower-left corner. (#1495)
|
||||||
- Drag and Drop: Fixed an incorrect assert when dropping a source that is submitted after the target (bug introduced with 1.62 changes
|
- Drag and Drop: Fixed an incorrect assert when dropping a source that is submitted after the target (bug introduced with 1.62 changes
|
||||||
related to the addition of IsItemDeactivated()). (#1875, #143)
|
related to the addition of IsItemDeactivated()). (#1875, #143)
|
||||||
|
- Drag and Drop: Fixed ImGuiDragDropFlags_SourceNoDisableHover to affect hovering state prior to calling IsItemHovered() + fixed description. (#143)
|
||||||
|
- 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)
|
||||||
- Misc: Added ImGuiMouseCursor_Hand cursor enum + corresponding software cursor. (#1913, 1914) [@aiekick, @ocornut]
|
- 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.
|
- Misc: Tweaked software mouse cursor offset to match the offset of the corresponding Windows 10 cursors.
|
||||||
- Fixed a include build issue for Cygwin in non-POSIX (Win32) mode. (#1917, #1319, #276)
|
- Fixed a include build issue for Cygwin in non-POSIX (Win32) mode. (#1917, #1319, #276)
|
||||||
|
- Windows: Fixed missing ImmReleaseContext() call in the default Win32 IME handler. (#1932) [@vby]
|
||||||
|
- Demo: Added basic Drag and Drop demo. (#143)
|
||||||
- Examples: Metal: Added Metal rendering backend. (#1929, #1873) [@warrenm]
|
- Examples: Metal: Added Metal rendering backend. (#1929, #1873) [@warrenm]
|
||||||
- Examples: OSX: Added early raw OSX platform backend. (#1873) [@pagghiu, @itamago, @ocornut]
|
- Examples: OSX: Added early raw OSX platform backend. (#1873) [@pagghiu, @itamago, @ocornut]
|
||||||
- Examples: Added mac OSX & iOS + Metal example in example_apple_metal/. (#1929, #1873) [@warrenm]
|
- Examples: Added mac OSX & iOS + Metal example in example_apple_metal/. (#1929, #1873) [@warrenm]
|
||||||
|
7
TODO.txt
7
TODO.txt
@ -17,7 +17,8 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- window: background options for child windows, border option (disable rounding).
|
- window: background options for child windows, border option (disable rounding).
|
||||||
- window: resizing from any sides? done. > need backends to honor mouse cursors properly. (#822)
|
- window: resizing from any sides? done. > need backends to honor mouse cursors properly. (#822)
|
||||||
- window: resize from borders: support some form of outer padding to make it easier to grab borders. (#822)
|
- window: resize from borders: support some form of outer padding to make it easier to grab borders. (#822)
|
||||||
- window: begin with *p_open == false should return false.
|
- window: fix resize glitch when collapsing an AlwaysAutoResize window.
|
||||||
|
- window: begin with *p_open == false could return false.
|
||||||
- window: get size/pos helpers given names (see discussion in #249)
|
- window: get size/pos helpers given names (see discussion in #249)
|
||||||
- window: a collapsed window can be stuck behind the main menu bar?
|
- window: a collapsed window can be stuck behind the main menu bar?
|
||||||
- window: when window is very small, prioritize resize button over close button.
|
- window: when window is very small, prioritize resize button over close button.
|
||||||
@ -28,7 +29,8 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- window: using SetWindowPos() inside Begin() and moving the window with the mouse reacts a very ugly glitch. We should just defer the SetWindowPos() call.
|
- window: using SetWindowPos() inside Begin() and moving the window with the mouse reacts a very ugly glitch. We should just defer the SetWindowPos() call.
|
||||||
- window: GetWindowSize() returns (0,0) when not calculated? (#1045)
|
- window: GetWindowSize() returns (0,0) when not calculated? (#1045)
|
||||||
- window: freeze window flag: if not focused/hovered, return false, render with previous ImDrawList. and/or reduce refresh rate.
|
- window: freeze window flag: if not focused/hovered, return false, render with previous ImDrawList. and/or reduce refresh rate.
|
||||||
!- scrolling: allow immediately effective change of scroll after Begin() if we haven't appended items yet.
|
- window: investigate better auto-positioning for new windows.
|
||||||
|
- scrolling: allow immediately effective change of scroll after Begin() if we haven't appended items yet.
|
||||||
- scrolling/clipping: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y). (2017-08-20: can't repro)
|
- scrolling/clipping: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y). (2017-08-20: can't repro)
|
||||||
|
|
||||||
- drawdata: make it easy to clone (or swap?) a ImDrawData so user can easily save that data if they use threaded rendering.
|
- drawdata: make it easy to clone (or swap?) a ImDrawData so user can easily save that data if they use threaded rendering.
|
||||||
@ -218,6 +220,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- drag and drop: add demo. (#143, #479)
|
- drag and drop: add demo. (#143, #479)
|
||||||
- drag and drop: have some way to know when a drag begin from BeginDragDropSource() pov
|
- drag and drop: have some way to know when a drag begin from BeginDragDropSource() pov
|
||||||
- drag and drop: allow using with other mouse buttons (where activeid won't be set). (#1637)
|
- drag and drop: allow using with other mouse buttons (where activeid won't be set). (#1637)
|
||||||
|
- drag and drop: make it easier and provide a demo to have tooltip both are source and target site, with a more detailed one on target site (tooltip ordering problem)
|
||||||
- drag and drop: test with reordering nodes (in a list, or a tree node). (#143)
|
- drag and drop: test with reordering nodes (in a list, or a tree node). (#143)
|
||||||
- drag and drop: test integrating with os drag and drop.
|
- drag and drop: test integrating with os drag and drop.
|
||||||
- drag and drop: make payload optional? (#143)
|
- drag and drop: make payload optional? (#143)
|
||||||
|
@ -7,9 +7,13 @@
|
|||||||
#include "imgui_impl_glfw.h"
|
#include "imgui_impl_glfw.h"
|
||||||
#include "imgui_impl_opengl3.h"
|
#include "imgui_impl_opengl3.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <GL/gl3w.h> // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
|
|
||||||
|
#include <GL/gl3w.h> // This example is using gl3w to access OpenGL functions. You may use another OpenGL loader/header such as: glew, glext, glad, glLoadGen, etc.
|
||||||
//#include <glew.h>
|
//#include <glew.h>
|
||||||
#include <GLFW/glfw3.h>
|
//#include <glext.h>
|
||||||
|
//#include <glad/glad.h>
|
||||||
|
|
||||||
|
#include <GLFW/glfw3.h> // Include glfw3.h after our OpenGL definitions
|
||||||
|
|
||||||
static void glfw_error_callback(int error, const char* description)
|
static void glfw_error_callback(int error, const char* description)
|
||||||
{
|
{
|
||||||
|
@ -7,10 +7,13 @@
|
|||||||
#include "imgui_impl_sdl.h"
|
#include "imgui_impl_sdl.h"
|
||||||
#include "imgui_impl_opengl3.h"
|
#include "imgui_impl_opengl3.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <GL/gl3w.h> // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
|
|
||||||
//#include <glew.h>
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
|
#include <GL/gl3w.h> // This example is using gl3w to access OpenGL functions. You may use another OpenGL loader/header such as: glew, glext, glad, glLoadGen, etc.
|
||||||
|
//#include <glew.h>
|
||||||
|
//#include <glext.h>
|
||||||
|
//#include <glad/glad.h>
|
||||||
|
|
||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
{
|
{
|
||||||
// Setup SDL
|
// Setup SDL
|
||||||
|
@ -543,8 +543,11 @@ static void ImGui_ImplWin32_SetImeInputPos(ImGuiViewport* viewport, ImVec2 pos)
|
|||||||
COMPOSITIONFORM cf = { CFS_FORCE_POSITION, { (LONG)(pos.x - viewport->Pos.x), (LONG)(pos.y - viewport->Pos.y) }, { 0, 0, 0, 0 } };
|
COMPOSITIONFORM cf = { CFS_FORCE_POSITION, { (LONG)(pos.x - viewport->Pos.x), (LONG)(pos.y - viewport->Pos.y) }, { 0, 0, 0, 0 } };
|
||||||
if (ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData)
|
if (ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData)
|
||||||
if (HWND hwnd = glfwGetWin32Window(data->Window))
|
if (HWND hwnd = glfwGetWin32Window(data->Window))
|
||||||
if (HIMC himc = ImmGetContext(hwnd))
|
if (HIMC himc = ::ImmGetContext(hwnd))
|
||||||
ImmSetCompositionWindow(himc, &cf);
|
{
|
||||||
|
::ImmSetCompositionWindow(himc, &cf);
|
||||||
|
::ImmReleaseContext(hwnd, himc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define HAS_WIN32_IME 0
|
#define HAS_WIN32_IME 0
|
||||||
|
@ -33,8 +33,11 @@
|
|||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_opengl3.h"
|
#include "imgui_impl_opengl3.h"
|
||||||
#include <GL/gl3w.h> // This example is using gl3w to access OpenGL functions. You may freely use any other OpenGL loader such as: glew, glad, glLoadGen, etc.
|
|
||||||
|
#include <GL/gl3w.h> // This example is using gl3w to access OpenGL functions. You may use another OpenGL loader/header such as: glew, glext, glad, glLoadGen, etc.
|
||||||
//#include <glew.h>
|
//#include <glew.h>
|
||||||
|
//#include <glext.h>
|
||||||
|
//#include <glad/glad.h>
|
||||||
|
|
||||||
// OpenGL Data
|
// OpenGL Data
|
||||||
static char g_GlslVersion[32] = "";
|
static char g_GlslVersion[32] = "";
|
||||||
|
@ -396,8 +396,11 @@ static void ImGui_ImplWin32_SetImeInputPos(ImGuiViewport* viewport, ImVec2 pos)
|
|||||||
{
|
{
|
||||||
COMPOSITIONFORM cf = { CFS_FORCE_POSITION,{ (LONG)(pos.x - viewport->Pos.x), (LONG)(pos.y - viewport->Pos.y) },{ 0, 0, 0, 0 } };
|
COMPOSITIONFORM cf = { CFS_FORCE_POSITION,{ (LONG)(pos.x - viewport->Pos.x), (LONG)(pos.y - viewport->Pos.y) },{ 0, 0, 0, 0 } };
|
||||||
if (HWND hwnd = (HWND)viewport->PlatformHandle)
|
if (HWND hwnd = (HWND)viewport->PlatformHandle)
|
||||||
if (HIMC himc = ImmGetContext(hwnd))
|
if (HIMC himc = ::ImmGetContext(hwnd))
|
||||||
ImmSetCompositionWindow(himc, &cf);
|
{
|
||||||
|
::ImmSetCompositionWindow(himc, &cf);
|
||||||
|
::ImmReleaseContext(hwnd, himc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define HAS_WIN32_IME 0
|
#define HAS_WIN32_IME 0
|
||||||
|
89
imgui.cpp
89
imgui.cpp
@ -2152,7 +2152,6 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name)
|
|||||||
ParentWindow = NULL;
|
ParentWindow = NULL;
|
||||||
RootWindow = NULL;
|
RootWindow = NULL;
|
||||||
RootWindowForTitleBarHighlight = NULL;
|
RootWindowForTitleBarHighlight = NULL;
|
||||||
RootWindowForTabbing = NULL;
|
|
||||||
RootWindowForNav = NULL;
|
RootWindowForNav = NULL;
|
||||||
|
|
||||||
NavLastIds[0] = NavLastIds[1] = 0;
|
NavLastIds[0] = NavLastIds[1] = 0;
|
||||||
@ -3116,12 +3115,19 @@ static void ImGui::NavUpdateWindowing()
|
|||||||
ImGuiWindow* apply_focus_window = NULL;
|
ImGuiWindow* apply_focus_window = NULL;
|
||||||
bool apply_toggle_layer = false;
|
bool apply_toggle_layer = false;
|
||||||
|
|
||||||
|
ImGuiWindow* modal_window = GetFrontMostPopupModal();
|
||||||
|
if (modal_window != NULL)
|
||||||
|
{
|
||||||
|
g.NavWindowingTarget = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool start_windowing_with_gamepad = !g.NavWindowingTarget && IsNavInputPressed(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed);
|
bool start_windowing_with_gamepad = !g.NavWindowingTarget && IsNavInputPressed(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed);
|
||||||
bool start_windowing_with_keyboard = !g.NavWindowingTarget && g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab) && (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard);
|
bool start_windowing_with_keyboard = !g.NavWindowingTarget && g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab) && (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard);
|
||||||
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
|
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
|
||||||
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavigable(g.Windows.Size - 1, -INT_MAX, -1))
|
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavigable(g.Windows.Size - 1, -INT_MAX, -1))
|
||||||
{
|
{
|
||||||
g.NavWindowingTarget = window->RootWindowForTabbing;
|
g.NavWindowingTarget = window;
|
||||||
g.NavWindowingHighlightTimer = g.NavWindowingHighlightAlpha = 0.0f;
|
g.NavWindowingHighlightTimer = g.NavWindowingHighlightAlpha = 0.0f;
|
||||||
g.NavWindowingToggleLayer = start_windowing_with_keyboard ? false : true;
|
g.NavWindowingToggleLayer = start_windowing_with_keyboard ? false : true;
|
||||||
g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_NavKeyboard : ImGuiInputSource_NavGamepad;
|
g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_NavKeyboard : ImGuiInputSource_NavGamepad;
|
||||||
@ -3190,7 +3196,7 @@ static void ImGui::NavUpdateWindowing()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply final focus
|
// Apply final focus
|
||||||
if (apply_focus_window && (g.NavWindow == NULL || apply_focus_window != g.NavWindow->RootWindowForTabbing))
|
if (apply_focus_window && (g.NavWindow == NULL || apply_focus_window != g.NavWindow->RootWindow))
|
||||||
{
|
{
|
||||||
g.NavDisableHighlight = false;
|
g.NavDisableHighlight = false;
|
||||||
g.NavDisableMouseHover = true;
|
g.NavDisableMouseHover = true;
|
||||||
@ -4270,6 +4276,7 @@ void ImGui::NewFrame()
|
|||||||
g.DragDropAcceptIdPrev = g.DragDropAcceptIdCurr;
|
g.DragDropAcceptIdPrev = g.DragDropAcceptIdCurr;
|
||||||
g.DragDropAcceptIdCurr = 0;
|
g.DragDropAcceptIdCurr = 0;
|
||||||
g.DragDropAcceptIdCurrRectSurface = FLT_MAX;
|
g.DragDropAcceptIdCurrRectSurface = FLT_MAX;
|
||||||
|
g.DragDropWithinSourceOrTarget = false;
|
||||||
|
|
||||||
// Update keyboard input state
|
// Update keyboard input state
|
||||||
memcpy(g.IO.KeysDownDurationPrev, g.IO.KeysDownDuration, sizeof(g.IO.KeysDownDuration));
|
memcpy(g.IO.KeysDownDurationPrev, g.IO.KeysDownDuration, sizeof(g.IO.KeysDownDuration));
|
||||||
@ -4292,6 +4299,7 @@ void ImGui::NewFrame()
|
|||||||
UpdateMovingWindow();
|
UpdateMovingWindow();
|
||||||
UpdateHoveredWindowAndCaptureFlags();
|
UpdateHoveredWindowAndCaptureFlags();
|
||||||
|
|
||||||
|
// Background darkening/whitening
|
||||||
if (GetFrontMostPopupModal() != NULL)
|
if (GetFrontMostPopupModal() != NULL)
|
||||||
g.ModalWindowDarkeningRatio = ImMin(g.ModalWindowDarkeningRatio + g.IO.DeltaTime * 6.0f, 1.0f);
|
g.ModalWindowDarkeningRatio = ImMin(g.ModalWindowDarkeningRatio + g.IO.DeltaTime * 6.0f, 1.0f);
|
||||||
else
|
else
|
||||||
@ -5792,7 +5800,23 @@ void ImGui::SetTooltip(const char* fmt, ...)
|
|||||||
|
|
||||||
void ImGui::BeginTooltip()
|
void ImGui::BeginTooltip()
|
||||||
{
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
if (g.DragDropWithinSourceOrTarget)
|
||||||
|
{
|
||||||
|
// The default tooltip position is a little offset to give space to see the context menu (it's also clamped within the current viewport/monitor)
|
||||||
|
// In the context of a dragging tooltip we try to reduce that offset and we enforce following the cursor.
|
||||||
|
// Whatever we do we want to call SetNextWindowPos() to enforce a tooltip position and disable clipping the tooltip without our display area, like regular tooltip do.
|
||||||
|
//ImVec2 tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding;
|
||||||
|
ImVec2 tooltip_pos = g.IO.MousePos + ImVec2(16 * g.Style.MouseCursorScale, 8 * g.Style.MouseCursorScale);
|
||||||
|
SetNextWindowPos(tooltip_pos);
|
||||||
|
SetNextWindowBgAlpha(g.Style.Colors[ImGuiCol_PopupBg].w * 0.60f);
|
||||||
|
//PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This would be nice but e.g ColorButton with checkboard has issue with transparent colors :(
|
||||||
|
BeginTooltipEx(0, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
BeginTooltipEx(0, false);
|
BeginTooltipEx(0, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::EndTooltip()
|
void ImGui::EndTooltip()
|
||||||
@ -6491,11 +6515,12 @@ static ImVec2 CalcSizeAutoFit(ImGuiWindow* window, const ImVec2& size_contents)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Maximum window size is determined by the viewport size or monitor size
|
// Maximum window size is determined by the viewport size or monitor size
|
||||||
const bool is_popup = (window->Flags & ImGuiWindowFlags_Popup) != 0 && (window->Flags & ImGuiWindowFlags_AlwaysAutoResize) != 0;
|
const bool is_popup = (window->Flags & ImGuiWindowFlags_Popup) != 0;
|
||||||
const bool is_menu = (window->Flags & ImGuiWindowFlags_ChildMenu) != 0;
|
const bool is_menu = (window->Flags & ImGuiWindowFlags_ChildMenu) != 0;
|
||||||
ImVec2 size_min(1.0f, 1.0f);
|
ImVec2 size_min = style.WindowMinSize;
|
||||||
if (!is_popup && !is_menu)
|
if (is_popup || is_menu) // Popups and menus bypass style.WindowMinSize by default, but we give then a non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups)
|
||||||
size_min = style.WindowMinSize;
|
size_min = ImMin(size_min, ImVec2(4.0f, 4.0f));
|
||||||
|
|
||||||
ImVec2 avail_size = window->Viewport->Size;
|
ImVec2 avail_size = window->Viewport->Size;
|
||||||
if (window->ViewportOwned)
|
if (window->ViewportOwned)
|
||||||
avail_size = ImVec2(FLT_MAX, FLT_MAX);
|
avail_size = ImVec2(FLT_MAX, FLT_MAX);
|
||||||
@ -6996,11 +7021,11 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
window->ParentWindow = parent_window;
|
window->ParentWindow = parent_window;
|
||||||
window->RootWindow = window->RootWindowForTitleBarHighlight = window->RootWindowForTabbing = window->RootWindowForNav = window;
|
window->RootWindow = window->RootWindowForTitleBarHighlight = window->RootWindowForNav = window;
|
||||||
if (parent_window && (flags & ImGuiWindowFlags_ChildWindow) && !window_is_child_tooltip)
|
if (parent_window && (flags & ImGuiWindowFlags_ChildWindow) && !window_is_child_tooltip)
|
||||||
window->RootWindow = parent_window->RootWindow;
|
window->RootWindow = parent_window->RootWindow;
|
||||||
if (parent_window && !(flags & ImGuiWindowFlags_Modal) && (flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))
|
if (parent_window && !(flags & ImGuiWindowFlags_Modal) && (flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))
|
||||||
window->RootWindowForTitleBarHighlight = window->RootWindowForTabbing = parent_window->RootWindowForTitleBarHighlight; // Same value in master branch, will differ for docking
|
window->RootWindowForTitleBarHighlight = parent_window->RootWindowForTitleBarHighlight;
|
||||||
while (window->RootWindowForNav->Flags & ImGuiWindowFlags_NavFlattened)
|
while (window->RootWindowForNav->Flags & ImGuiWindowFlags_NavFlattened)
|
||||||
window->RootWindowForNav = window->RootWindowForNav->ParentWindow;
|
window->RootWindowForNav = window->RootWindowForNav->ParentWindow;
|
||||||
|
|
||||||
@ -8168,7 +8193,7 @@ bool ImGui::IsWindowFocused(ImGuiFocusedFlags flags)
|
|||||||
bool ImGui::IsWindowNavFocusable(ImGuiWindow* window)
|
bool ImGui::IsWindowNavFocusable(ImGuiWindow* window)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
return window->Active && window == window->RootWindowForTabbing && (!(window->Flags & ImGuiWindowFlags_NoNavFocus) || window == g.NavWindow);
|
return window->Active && window == window->RootWindow && (!(window->Flags & ImGuiWindowFlags_NoNavFocus) || window == g.NavWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ImGui::GetWindowWidth()
|
float ImGui::GetWindowWidth()
|
||||||
@ -8907,7 +8932,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
bool hovered = ItemHoverable(bb, id);
|
bool hovered = ItemHoverable(bb, id);
|
||||||
|
|
||||||
// Drag source doesn't report as hovered
|
// Drag source doesn't report as hovered
|
||||||
if (hovered && g.DragDropActive && g.DragDropPayload.SourceId == id)
|
if (hovered && g.DragDropActive && g.DragDropPayload.SourceId == id && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoDisableHover))
|
||||||
hovered = false;
|
hovered = false;
|
||||||
|
|
||||||
// Special mode for Drag and Drop where holding button pressed for a long time while dragging another item triggers the button
|
// Special mode for Drag and Drop where holding button pressed for a long time while dragging another item triggers the button
|
||||||
@ -9060,7 +9085,7 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags
|
|||||||
MarkItemValueChanged(id);
|
MarkItemValueChanged(id);
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
||||||
RenderNavHighlight(bb, id);
|
RenderNavHighlight(bb, id);
|
||||||
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
||||||
RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb);
|
RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb);
|
||||||
@ -9109,7 +9134,7 @@ bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiBu
|
|||||||
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
|
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
||||||
RenderNavHighlight(bb, id);
|
RenderNavHighlight(bb, id);
|
||||||
RenderFrame(bb.Min, bb.Max, col, true, g.Style.FrameRounding);
|
RenderFrame(bb.Min, bb.Max, col, true, g.Style.FrameRounding);
|
||||||
RenderArrow(bb.Min + ImVec2(ImMax(0.0f, size.x - g.FontSize - g.Style.FramePadding.x), ImMax(0.0f, size.y - g.FontSize - g.Style.FramePadding.y)), dir);
|
RenderArrow(bb.Min + ImVec2(ImMax(0.0f, size.x - g.FontSize - g.Style.FramePadding.x), ImMax(0.0f, size.y - g.FontSize - g.Style.FramePadding.y)), dir);
|
||||||
@ -9228,7 +9253,7 @@ bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const I
|
|||||||
bool pressed = ButtonBehavior(bb, id, &hovered, &held);
|
bool pressed = ButtonBehavior(bb, id, &hovered, &held);
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
||||||
RenderNavHighlight(bb, id);
|
RenderNavHighlight(bb, id);
|
||||||
RenderFrame(bb.Min, bb.Max, col, true, ImClamp((float)ImMin(padding.x, padding.y), 0.0f, style.FrameRounding));
|
RenderFrame(bb.Min, bb.Max, col, true, ImClamp((float)ImMin(padding.x, padding.y), 0.0f, style.FrameRounding));
|
||||||
if (bg_col.w > 0.0f)
|
if (bg_col.w > 0.0f)
|
||||||
@ -14477,12 +14502,13 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
|||||||
g.DragDropSourceFlags = flags;
|
g.DragDropSourceFlags = flags;
|
||||||
g.DragDropMouseButton = mouse_button;
|
g.DragDropMouseButton = mouse_button;
|
||||||
}
|
}
|
||||||
|
g.DragDropWithinSourceOrTarget = true;
|
||||||
|
|
||||||
if (!(flags & ImGuiDragDropFlags_SourceNoPreviewTooltip))
|
if (!(flags & ImGuiDragDropFlags_SourceNoPreviewTooltip))
|
||||||
{
|
{
|
||||||
// Target can request the Source to not display its tooltip (we use a dedicated flag to make this request explicit)
|
// Target can request the Source to not display its tooltip (we use a dedicated flag to make this request explicit)
|
||||||
// We unfortunately can't just modify the source flags and skip the call to BeginTooltip, as caller may be emitting contents.
|
// We unfortunately can't just modify the source flags and skip the call to BeginTooltip, as caller may be emitting contents.
|
||||||
BeginDragDropTooltip();
|
BeginTooltip();
|
||||||
if (g.DragDropActive && g.DragDropAcceptIdPrev && (g.DragDropAcceptFlags & ImGuiDragDropFlags_AcceptNoPreviewTooltip))
|
if (g.DragDropActive && g.DragDropAcceptIdPrev && (g.DragDropAcceptFlags & ImGuiDragDropFlags_AcceptNoPreviewTooltip))
|
||||||
{
|
{
|
||||||
ImGuiWindow* tooltip_window = g.CurrentWindow;
|
ImGuiWindow* tooltip_window = g.CurrentWindow;
|
||||||
@ -14503,32 +14529,15 @@ void ImGui::EndDragDropSource()
|
|||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
IM_ASSERT(g.DragDropActive);
|
IM_ASSERT(g.DragDropActive);
|
||||||
|
IM_ASSERT(g.DragDropWithinSourceOrTarget && "Not after a BeginDragDropSource()?");
|
||||||
|
|
||||||
if (!(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoPreviewTooltip))
|
if (!(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoPreviewTooltip))
|
||||||
EndDragDropTooltip();
|
EndTooltip();
|
||||||
|
|
||||||
// Discard the drag if have not called SetDragDropPayload()
|
// Discard the drag if have not called SetDragDropPayload()
|
||||||
if (g.DragDropPayload.DataFrameCount == -1)
|
if (g.DragDropPayload.DataFrameCount == -1)
|
||||||
ClearDragDrop();
|
ClearDragDrop();
|
||||||
}
|
g.DragDropWithinSourceOrTarget = false;
|
||||||
|
|
||||||
void ImGui::BeginDragDropTooltip()
|
|
||||||
{
|
|
||||||
// The default tooltip position is a little offset to give space to see the context menu (it's also clamped within the current viewport/monitor)
|
|
||||||
// In the context of a dragging tooltip we try to reduce that offset and we enforce following the cursor.
|
|
||||||
// Whatever we do we want to call SetNextWindowPos() to enforce a tooltip position and disable clipping the tooltip without our display area, like regular tooltip do.
|
|
||||||
ImGuiContext& g = *GImGui;
|
|
||||||
//ImVec2 tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding;
|
|
||||||
ImVec2 tooltip_pos = g.IO.MousePos + ImVec2(16 * g.Style.MouseCursorScale, 8 * g.Style.MouseCursorScale);
|
|
||||||
SetNextWindowPos(tooltip_pos);
|
|
||||||
SetNextWindowBgAlpha(g.Style.Colors[ImGuiCol_PopupBg].w * 0.60f);
|
|
||||||
//PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This would be nice but e.g ColorButton with checkboard has issue with transparent colors :(
|
|
||||||
BeginTooltipEx(0, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui::EndDragDropTooltip()
|
|
||||||
{
|
|
||||||
EndTooltip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use 'cond' to choose to submit payload on drag start or every frame
|
// Use 'cond' to choose to submit payload on drag start or every frame
|
||||||
@ -14588,8 +14597,10 @@ bool ImGui::BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id)
|
|||||||
if (!IsMouseHoveringRect(bb.Min, bb.Max) || (id == g.DragDropPayload.SourceId))
|
if (!IsMouseHoveringRect(bb.Min, bb.Max) || (id == g.DragDropPayload.SourceId))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
IM_ASSERT(g.DragDropWithinSourceOrTarget == false);
|
||||||
g.DragDropTargetRect = bb;
|
g.DragDropTargetRect = bb;
|
||||||
g.DragDropTargetId = id;
|
g.DragDropTargetId = id;
|
||||||
|
g.DragDropWithinSourceOrTarget = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14616,8 +14627,10 @@ bool ImGui::BeginDragDropTarget()
|
|||||||
if (g.DragDropPayload.SourceId == id)
|
if (g.DragDropPayload.SourceId == id)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
IM_ASSERT(g.DragDropWithinSourceOrTarget == false);
|
||||||
g.DragDropTargetRect = display_rect;
|
g.DragDropTargetRect = display_rect;
|
||||||
g.DragDropTargetId = id;
|
g.DragDropTargetId = id;
|
||||||
|
g.DragDropWithinSourceOrTarget = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14673,8 +14686,10 @@ const ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDrop
|
|||||||
// We don't really use/need this now, but added it for the sake of consistency and because we might need it later.
|
// We don't really use/need this now, but added it for the sake of consistency and because we might need it later.
|
||||||
void ImGui::EndDragDropTarget()
|
void ImGui::EndDragDropTarget()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui; (void)g;
|
ImGuiContext& g = *GImGui;
|
||||||
IM_ASSERT(g.DragDropActive);
|
IM_ASSERT(g.DragDropActive);
|
||||||
|
IM_ASSERT(g.DragDropWithinSourceOrTarget);
|
||||||
|
g.DragDropWithinSourceOrTarget = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -14927,7 +14942,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
(flags & ImGuiWindowFlags_Modal) ? "Modal " : "", (flags & ImGuiWindowFlags_ChildMenu) ? "ChildMenu " : "", (flags & ImGuiWindowFlags_NoSavedSettings) ? "NoSavedSettings " : "",
|
(flags & ImGuiWindowFlags_Modal) ? "Modal " : "", (flags & ImGuiWindowFlags_ChildMenu) ? "ChildMenu " : "", (flags & ImGuiWindowFlags_NoSavedSettings) ? "NoSavedSettings " : "",
|
||||||
(flags & ImGuiWindowFlags_AlwaysAutoResize) ? "AlwaysAutoResize" : "");
|
(flags & ImGuiWindowFlags_AlwaysAutoResize) ? "AlwaysAutoResize" : "");
|
||||||
ImGui::BulletText("Scroll: (%.2f/%.2f,%.2f/%.2f)", window->Scroll.x, GetScrollMaxX(window), window->Scroll.y, GetScrollMaxY(window));
|
ImGui::BulletText("Scroll: (%.2f/%.2f,%.2f/%.2f)", window->Scroll.x, GetScrollMaxX(window), window->Scroll.y, GetScrollMaxY(window));
|
||||||
ImGui::BulletText("Active: %d, WriteAccessed: %d, BeginOrderWithinContext: %d", window->Active, window->WriteAccessed, (window->Active || window->WasActive) ? window->BeginOrderWithinContext : -1);
|
ImGui::BulletText("Active: %d, WriteAccessed: %d, BeginOrderWithinContext: %d", window->Active || window->WasActive, window->WriteAccessed, (window->Active || window->WasActive) ? window->BeginOrderWithinContext : -1);
|
||||||
ImGui::BulletText("NavLastIds: 0x%08X,0x%08X, NavLayerActiveMask: %X", window->NavLastIds[0], window->NavLastIds[1], window->DC.NavLayerActiveMask);
|
ImGui::BulletText("NavLastIds: 0x%08X,0x%08X, NavLayerActiveMask: %X", window->NavLastIds[0], window->NavLastIds[1], window->DC.NavLayerActiveMask);
|
||||||
ImGui::BulletText("NavLastChildNavWindow: %s", window->NavLastChildNavWindow ? window->NavLastChildNavWindow->Name : "NULL");
|
ImGui::BulletText("NavLastChildNavWindow: %s", window->NavLastChildNavWindow ? window->NavLastChildNavWindow->Name : "NULL");
|
||||||
if (!window->NavRectRel[0].IsInverted())
|
if (!window->NavRectRel[0].IsInverted())
|
||||||
|
2
imgui.h
2
imgui.h
@ -745,7 +745,7 @@ enum ImGuiDragDropFlags_
|
|||||||
ImGuiDragDropFlags_None = 0,
|
ImGuiDragDropFlags_None = 0,
|
||||||
// BeginDragDropSource() flags
|
// BeginDragDropSource() flags
|
||||||
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 disable 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 disable this behavior.
|
||||||
ImGuiDragDropFlags_SourceNoDisableHover = 1 << 1, // By default, when dragging we clear data so that IsItemHovered() will return true, to avoid subsequent user code submitting tooltips. This flag disable 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 disable 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.
|
||||||
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_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.
|
||||||
|
@ -399,7 +399,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
static float col1[3] = { 1.0f,0.0f,0.2f };
|
static float col1[3] = { 1.0f,0.0f,0.2f };
|
||||||
static float col2[4] = { 0.4f,0.7f,0.0f,0.5f };
|
static float col2[4] = { 0.4f,0.7f,0.0f,0.5f };
|
||||||
ImGui::ColorEdit3("color 1", col1);
|
ImGui::ColorEdit3("color 1", col1);
|
||||||
ImGui::SameLine(); ShowHelpMarker("Click on the colored square to open a color picker.\nRight-click on the colored square to show options.\nCTRL+click on individual component to input value.\n");
|
ImGui::SameLine(); ShowHelpMarker("Click on the colored square to open a color picker.\nClick and hold to use drag and drop.\nRight-click on the colored square to show options.\nCTRL+click on individual component to input value.\n");
|
||||||
|
|
||||||
ImGui::ColorEdit4("color 2", col2);
|
ImGui::ColorEdit4("color 2", col2);
|
||||||
}
|
}
|
||||||
@ -1186,6 +1186,83 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui::TreeNode("Drag and Drop"))
|
||||||
|
{
|
||||||
|
{
|
||||||
|
// ColorEdit widgets automatically act as drag source and drag target.
|
||||||
|
// They are using standardized payload strings IMGUI_PAYLOAD_TYPE_COLOR_3F and IMGUI_PAYLOAD_TYPE_COLOR_4F to allow your own widgets
|
||||||
|
// to use colors in their drag and drop interaction. Also see the demo in Color Picker -> Palette demo.
|
||||||
|
ImGui::BulletText("Drag and drop in standard widgets");
|
||||||
|
ImGui::Indent();
|
||||||
|
static float col1[3] = { 1.0f,0.0f,0.2f };
|
||||||
|
static float col2[4] = { 0.4f,0.7f,0.0f,0.5f };
|
||||||
|
ImGui::ColorEdit3("color 1", col1);
|
||||||
|
ImGui::ColorEdit4("color 2", col2);
|
||||||
|
ImGui::Unindent();
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
ImGui::BulletText("Drag and drop to copy/swap items");
|
||||||
|
ImGui::Indent();
|
||||||
|
enum Mode
|
||||||
|
{
|
||||||
|
Mode_Copy,
|
||||||
|
Mode_Move,
|
||||||
|
Mode_Swap
|
||||||
|
};
|
||||||
|
static int mode = 0;
|
||||||
|
if (ImGui::RadioButton("Copy", mode == Mode_Copy)) { mode = Mode_Copy; } ImGui::SameLine();
|
||||||
|
if (ImGui::RadioButton("Move", mode == Mode_Move)) { mode = Mode_Move; } ImGui::SameLine();
|
||||||
|
if (ImGui::RadioButton("Swap", mode == Mode_Swap)) { mode = Mode_Swap; }
|
||||||
|
static const char* names[9] = { "Bobby", "Beatrice", "Betty", "Brianna", "Barry", "Bernard", "Bibi", "Blaine", "Bryn" };
|
||||||
|
for (int n = 0; n < IM_ARRAYSIZE(names); n++)
|
||||||
|
{
|
||||||
|
ImGui::PushID(n);
|
||||||
|
if ((n % 3) != 0)
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Button(names[n], ImVec2(60,60));
|
||||||
|
|
||||||
|
// Our buttons are both drag sources and drag targets here!
|
||||||
|
if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_None))
|
||||||
|
{
|
||||||
|
ImGui::SetDragDropPayload("DND_DEMO_CELL", &n, sizeof(int)); // Set payload to carry the index of our item (could be anything)
|
||||||
|
if (mode == Mode_Copy) { ImGui::Text("Copy %s", names[n]); } // Display preview (could be anything, e.g. when dragging an image we could decide to display the filename and a small preview of the image, etc.)
|
||||||
|
if (mode == Mode_Move) { ImGui::Text("Move %s", names[n]); }
|
||||||
|
if (mode == Mode_Swap) { ImGui::Text("Swap %s", names[n]); }
|
||||||
|
ImGui::EndDragDropSource();
|
||||||
|
}
|
||||||
|
if (ImGui::BeginDragDropTarget())
|
||||||
|
{
|
||||||
|
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("DND_DEMO_CELL"))
|
||||||
|
{
|
||||||
|
IM_ASSERT(payload->DataSize == sizeof(int));
|
||||||
|
int payload_n = *(const int*)payload->Data;
|
||||||
|
if (mode == Mode_Copy)
|
||||||
|
{
|
||||||
|
names[n] = names[payload_n];
|
||||||
|
}
|
||||||
|
if (mode == Mode_Move)
|
||||||
|
{
|
||||||
|
names[n] = names[payload_n];
|
||||||
|
names[payload_n] = "";
|
||||||
|
}
|
||||||
|
if (mode == Mode_Swap)
|
||||||
|
{
|
||||||
|
const char* tmp = names[n];
|
||||||
|
names[n] = names[payload_n];
|
||||||
|
names[payload_n] = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndDragDropTarget();
|
||||||
|
}
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
ImGui::Unindent();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::TreeNode("Active, Focused, Hovered & Focused Tests"))
|
if (ImGui::TreeNode("Active, Focused, Hovered & Focused Tests"))
|
||||||
{
|
{
|
||||||
// Display the value of IsItemHovered() and other common item state functions. Note that the flags can be combined.
|
// Display the value of IsItemHovered() and other common item state functions. Note that the flags can be combined.
|
||||||
@ -2834,7 +2911,7 @@ struct ExampleAppConsole
|
|||||||
// Here we create a context menu only available from the title bar.
|
// Here we create a context menu only available from the title bar.
|
||||||
if (ImGui::BeginPopupContextItem())
|
if (ImGui::BeginPopupContextItem())
|
||||||
{
|
{
|
||||||
if (ImGui::MenuItem("Close"))
|
if (ImGui::MenuItem("Close Console"))
|
||||||
*p_open = false;
|
*p_open = false;
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
@ -3101,7 +3178,11 @@ struct ExampleAppLog
|
|||||||
void Draw(const char* title, bool* p_open = NULL)
|
void Draw(const char* title, bool* p_open = NULL)
|
||||||
{
|
{
|
||||||
ImGui::SetNextWindowSize(ImVec2(500,400), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(500,400), ImGuiCond_FirstUseEver);
|
||||||
ImGui::Begin(title, p_open);
|
if (!ImGui::Begin(title, p_open))
|
||||||
|
{
|
||||||
|
ImGui::End();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (ImGui::Button("Clear")) Clear();
|
if (ImGui::Button("Clear")) Clear();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
bool copy = ImGui::Button("Copy");
|
bool copy = ImGui::Button("Copy");
|
||||||
|
@ -237,11 +237,11 @@ enum ImGuiColumnsFlags_
|
|||||||
enum ImGuiSelectableFlagsPrivate_
|
enum ImGuiSelectableFlagsPrivate_
|
||||||
{
|
{
|
||||||
// NB: need to be in sync with last value of ImGuiSelectableFlags_
|
// NB: need to be in sync with last value of ImGuiSelectableFlags_
|
||||||
ImGuiSelectableFlags_NoHoldingActiveID = 1 << 3,
|
ImGuiSelectableFlags_NoHoldingActiveID = 1 << 10,
|
||||||
ImGuiSelectableFlags_PressedOnClick = 1 << 4,
|
ImGuiSelectableFlags_PressedOnClick = 1 << 11,
|
||||||
ImGuiSelectableFlags_PressedOnRelease = 1 << 5,
|
ImGuiSelectableFlags_PressedOnRelease = 1 << 12,
|
||||||
ImGuiSelectableFlags_Disabled = 1 << 6,
|
ImGuiSelectableFlags_Disabled = 1 << 13,
|
||||||
ImGuiSelectableFlags_DrawFillAvailWidth = 1 << 7
|
ImGuiSelectableFlags_DrawFillAvailWidth = 1 << 14
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiSeparatorFlags_
|
enum ImGuiSeparatorFlags_
|
||||||
@ -734,6 +734,7 @@ struct ImGuiContext
|
|||||||
|
|
||||||
// Drag and Drop
|
// Drag and Drop
|
||||||
bool DragDropActive;
|
bool DragDropActive;
|
||||||
|
bool DragDropWithinSourceOrTarget;
|
||||||
ImGuiDragDropFlags DragDropSourceFlags;
|
ImGuiDragDropFlags DragDropSourceFlags;
|
||||||
int DragDropMouseButton;
|
int DragDropMouseButton;
|
||||||
ImGuiPayload DragDropPayload;
|
ImGuiPayload DragDropPayload;
|
||||||
@ -858,7 +859,7 @@ struct ImGuiContext
|
|||||||
ModalWindowDarkeningRatio = 0.0f;
|
ModalWindowDarkeningRatio = 0.0f;
|
||||||
MouseCursor = ImGuiMouseCursor_Arrow;
|
MouseCursor = ImGuiMouseCursor_Arrow;
|
||||||
|
|
||||||
DragDropActive = false;
|
DragDropActive = DragDropWithinSourceOrTarget = false;
|
||||||
DragDropSourceFlags = 0;
|
DragDropSourceFlags = 0;
|
||||||
DragDropMouseButton = -1;
|
DragDropMouseButton = -1;
|
||||||
DragDropTargetId = 0;
|
DragDropTargetId = 0;
|
||||||
@ -1058,7 +1059,6 @@ struct IMGUI_API ImGuiWindow
|
|||||||
ImGuiWindow* ParentWindow; // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.
|
ImGuiWindow* ParentWindow; // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.
|
||||||
ImGuiWindow* RootWindow; // Point to ourself or first ancestor that is not a child window.
|
ImGuiWindow* RootWindow; // Point to ourself or first ancestor that is not a child window.
|
||||||
ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
|
ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
|
||||||
ImGuiWindow* RootWindowForTabbing; // Point to ourself or first ancestor which can be CTRL-Tabbed into.
|
|
||||||
ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag.
|
ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag.
|
||||||
|
|
||||||
ImGuiWindow* NavLastChildNavWindow; // When going to the menu bar, we remember the child window we came from. (This could probably be made implicit if we kept g.Windows sorted by last focused including child window.)
|
ImGuiWindow* NavLastChildNavWindow; // When going to the menu bar, we remember the child window we came from. (This could probably be made implicit if we kept g.Windows sorted by last focused including child window.)
|
||||||
@ -1195,8 +1195,6 @@ namespace ImGui
|
|||||||
IMGUI_API bool BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id);
|
IMGUI_API bool BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id);
|
||||||
IMGUI_API void ClearDragDrop();
|
IMGUI_API void ClearDragDrop();
|
||||||
IMGUI_API bool IsDragDropPayloadBeingAccepted();
|
IMGUI_API bool IsDragDropPayloadBeingAccepted();
|
||||||
IMGUI_API void BeginDragDropTooltip();
|
|
||||||
IMGUI_API void EndDragDropTooltip();
|
|
||||||
|
|
||||||
// FIXME-WIP: New Columns API
|
// FIXME-WIP: New Columns API
|
||||||
IMGUI_API void BeginColumns(const char* str_id, int count, ImGuiColumnsFlags flags = 0); // setup number of columns. use an identifier to distinguish multiple column sets. close with EndColumns().
|
IMGUI_API void BeginColumns(const char* str_id, int count, ImGuiColumnsFlags flags = 0); // setup number of columns. use an identifier to distinguish multiple column sets. close with EndColumns().
|
||||||
|
Loading…
Reference in New Issue
Block a user