mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-03 22:51:06 +01:00 
			
		
		
		
	Merge branch 'master' into drag_and_drop
This commit is contained in:
		
							
								
								
									
										64
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										64
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -59,23 +59,21 @@
 | 
			
		||||
 END-USER GUIDE
 | 
			
		||||
 ==============
 | 
			
		||||
 | 
			
		||||
 - Double-click title bar to collapse window
 | 
			
		||||
 - Click upper right corner to close a window, available when 'bool* p_open' is passed to ImGui::Begin()
 | 
			
		||||
 - Click and drag on lower right corner to resize window
 | 
			
		||||
 - Click and drag on any empty space to move window
 | 
			
		||||
 - Double-click/double-tap on lower right corner grip to auto-fit to content
 | 
			
		||||
 - TAB/SHIFT+TAB to cycle through keyboard editable fields
 | 
			
		||||
 - Use mouse wheel to scroll
 | 
			
		||||
 - Use CTRL+mouse wheel to zoom window contents (if io.FontAllowScaling is true)
 | 
			
		||||
 - CTRL+Click on a slider or drag box to input value as text
 | 
			
		||||
 - Double-click on title bar to collapse window.
 | 
			
		||||
 - Click upper right corner to close a window, available when 'bool* p_open' is passed to ImGui::Begin().
 | 
			
		||||
 - Click and drag on lower right corner to resize window (double-click to auto fit window to its contents).
 | 
			
		||||
 - Click and drag on any empty space to move window.
 | 
			
		||||
 - TAB/SHIFT+TAB to cycle through keyboard editable fields.
 | 
			
		||||
 - CTRL+Click on a slider or drag box to input value as text.
 | 
			
		||||
 - Use mouse wheel to scroll.
 | 
			
		||||
 - Text editor:
 | 
			
		||||
   - Hold SHIFT or use mouse to select text.
 | 
			
		||||
   - CTRL+Left/Right to word jump
 | 
			
		||||
   - CTRL+Shift+Left/Right to select words
 | 
			
		||||
   - CTRL+A our Double-Click to select all
 | 
			
		||||
   - CTRL+X,CTRL+C,CTRL+V to use OS clipboard
 | 
			
		||||
   - CTRL+Z,CTRL+Y to undo/redo
 | 
			
		||||
   - ESCAPE to revert text to its original value
 | 
			
		||||
   - CTRL+Left/Right to word jump.
 | 
			
		||||
   - CTRL+Shift+Left/Right to select words.
 | 
			
		||||
   - CTRL+A our Double-Click to select all.
 | 
			
		||||
   - CTRL+X,CTRL+C,CTRL+V to use OS clipboard/
 | 
			
		||||
   - CTRL+Z,CTRL+Y to undo/redo.
 | 
			
		||||
   - ESCAPE to revert text to its original value.
 | 
			
		||||
   - You can apply arithmetic operators +,*,/ on numerical values. Use +- to subtract (because - would set a negative value!)
 | 
			
		||||
   - Controls are automatically adjusted for OSX to match standard OSX text editing operations.
 | 
			
		||||
 | 
			
		||||
@@ -216,6 +214,7 @@
 | 
			
		||||
 Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
 | 
			
		||||
 Also read releases logs https://github.com/ocornut/imgui/releases for more details.
 | 
			
		||||
 | 
			
		||||
 - 2017/11/02 (1.53) - marked IsRootWindowOrAnyChildHovered() as obsolete is favor of using IsWindowHovered(ImGuiHoveredFlags_FlattenChilds);
 | 
			
		||||
 - 2017/10/24 (1.52) - renamed IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS/IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS to IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS/IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS for consistency.
 | 
			
		||||
 - 2017/10/20 (1.52) - changed IsWindowHovered() default parameters behavior to return false if an item is active in another window (e.g. click-dragging item from another window to this window). You can use the newly introduced IsWindowHovered() flags to requests this specific behavior if you need it.
 | 
			
		||||
 - 2017/10/20 (1.52) - marked IsItemHoveredRect()/IsMouseHoveringWindow() as obsolete, in favor of using the newly introduced flags for IsItemHovered() and IsWindowHovered(). See https://github.com/ocornut/imgui/issues/1382 for details.
 | 
			
		||||
@@ -1994,7 +1993,7 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// This is roughly matching the behavior of internal-facing ItemHoverable()
 | 
			
		||||
// - we allow hovering to be true when ActiveId==window->MoveID, so that clicking on non-interactive items such as a Text() item still returns true with IsItemHovered())
 | 
			
		||||
// - we allow hovering to be true when ActiveId==window->MoveID, so that clicking on non-interactive items such as a Text() item still returns true with IsItemHovered()
 | 
			
		||||
// - this should work even for non-interactive items that have no ID, so we cannot use LastItemId
 | 
			
		||||
bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
 | 
			
		||||
{
 | 
			
		||||
@@ -2003,6 +2002,8 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
 | 
			
		||||
    ImGuiWindow* window = g.CurrentWindow;
 | 
			
		||||
    if (!window->DC.LastItemRectHoveredRect)
 | 
			
		||||
        return false;
 | 
			
		||||
    IM_ASSERT((flags & ImGuiHoveredFlags_FlattenChilds) == 0);   // Flags not supported by this function
 | 
			
		||||
 | 
			
		||||
    // [2017/10/16] Reverted commit 344d48be3 and testing RootWindow instead. I believe it is correct to NOT test for RootWindow but this leaves us unable to use IsItemHovered() after EndChild() itself.
 | 
			
		||||
    // Until a solution is found I believe reverting to the test from 2017/09/27 is safe since this was the test that has been running for a long while.
 | 
			
		||||
    //if (g.HoveredWindow != window)
 | 
			
		||||
@@ -5131,12 +5132,20 @@ bool ImGui::IsWindowHovered(ImGuiHoveredFlags flags)
 | 
			
		||||
{
 | 
			
		||||
    IM_ASSERT((flags & ImGuiHoveredFlags_AllowWhenOverlapped) == 0);   // Flags not supported by this function
 | 
			
		||||
    ImGuiContext& g = *GImGui;
 | 
			
		||||
    if (g.HoveredWindow != g.CurrentWindow)
 | 
			
		||||
        return false;
 | 
			
		||||
    if (flags & ImGuiHoveredFlags_FlattenChilds)
 | 
			
		||||
    {
 | 
			
		||||
        if (g.HoveredRootWindow != g.CurrentWindow->RootWindow)
 | 
			
		||||
            return false;
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        if (g.HoveredWindow != g.CurrentWindow)
 | 
			
		||||
            return false;
 | 
			
		||||
    }
 | 
			
		||||
    if (!IsWindowContentHoverable(g.HoveredRootWindow, flags))
 | 
			
		||||
        return false;
 | 
			
		||||
    if (!(flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))
 | 
			
		||||
        if (g.ActiveId != 0 && g.ActiveIdWindow != g.CurrentWindow)
 | 
			
		||||
        if (g.ActiveId != 0 && !g.ActiveIdAllowOverlap && g.ActiveId != g.HoveredWindow->MoveId)
 | 
			
		||||
            return false;
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
@@ -5144,35 +5153,24 @@ bool ImGui::IsWindowHovered(ImGuiHoveredFlags flags)
 | 
			
		||||
bool ImGui::IsWindowFocused()
 | 
			
		||||
{
 | 
			
		||||
    ImGuiContext& g = *GImGui;
 | 
			
		||||
    IM_ASSERT(g.CurrentWindow);     // Not inside a Begin()/End()
 | 
			
		||||
    return g.NavWindow == g.CurrentWindow;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ImGui::IsRootWindowFocused()
 | 
			
		||||
{
 | 
			
		||||
    ImGuiContext& g = *GImGui;
 | 
			
		||||
    IM_ASSERT(g.CurrentWindow);     // Not inside a Begin()/End()
 | 
			
		||||
    return g.NavWindow == g.CurrentWindow->RootWindow;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ImGui::IsRootWindowOrAnyChildFocused()
 | 
			
		||||
{
 | 
			
		||||
    ImGuiContext& g = *GImGui;
 | 
			
		||||
    IM_ASSERT(g.CurrentWindow);     // Not inside a Begin()/End()
 | 
			
		||||
    return g.NavWindow && g.NavWindow->RootWindow == g.CurrentWindow->RootWindow;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ImGui::IsRootWindowOrAnyChildHovered(ImGuiHoveredFlags flags)
 | 
			
		||||
{
 | 
			
		||||
    IM_ASSERT((flags & ImGuiHoveredFlags_AllowWhenOverlapped) == 0);   // Flags not supported by this function
 | 
			
		||||
    ImGuiContext& g = *GImGui;
 | 
			
		||||
    if (!g.HoveredRootWindow || (g.HoveredRootWindow != g.CurrentWindow->RootWindow))
 | 
			
		||||
        return false;
 | 
			
		||||
    if (!IsWindowContentHoverable(g.HoveredRootWindow, flags))
 | 
			
		||||
        return false;
 | 
			
		||||
    if (!(flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))
 | 
			
		||||
        if (g.ActiveId != 0 && g.ActiveIdWindow != g.CurrentWindow)
 | 
			
		||||
            return false;
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
float ImGui::GetWindowWidth()
 | 
			
		||||
{
 | 
			
		||||
    ImGuiWindow* window = GImGui->CurrentWindow;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user