mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
Nav: Minor tidying up. (#787)
This commit is contained in:
parent
2081fc15b5
commit
8ad88f725c
@ -5035,7 +5035,6 @@ void ImGui::EndChild()
|
||||
|
||||
ImGuiWindow* parent_window = g.CurrentWindow;
|
||||
ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz);
|
||||
|
||||
ItemSize(sz);
|
||||
if ((window->DC.NavLayerActiveMask != 0 || window->DC.NavHasScroll) && !(window->Flags & ImGuiWindowFlags_NavFlattened))
|
||||
{
|
||||
@ -6265,13 +6264,13 @@ void ImGui::FocusWindow(ImGuiWindow* window)
|
||||
|
||||
if (g.NavWindow != window)
|
||||
{
|
||||
g.NavId = window ? window->NavLastIds[0] : 0; // Restore NavId
|
||||
g.NavIdIsAlive = false;
|
||||
g.NavLayer = 0;
|
||||
g.NavWindow = window;
|
||||
if (window && g.NavDisableMouseHover)
|
||||
g.NavMousePosDirty = true;
|
||||
g.NavInitRequest = false;
|
||||
g.NavId = window ? window->NavLastIds[0] : 0; // Restore NavId
|
||||
g.NavIdIsAlive = false;
|
||||
g.NavLayer = 0;
|
||||
}
|
||||
|
||||
// Passing NULL allow to disable keyboard focus
|
||||
|
1
imgui.h
1
imgui.h
@ -455,6 +455,7 @@ namespace ImGui
|
||||
IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL);
|
||||
|
||||
// Focus, Activation
|
||||
// (Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHere()" when applicable, to make your code more forward compatible when navigation branch is merged)
|
||||
IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window. Please use instead of "if (IsWindowAppearing()) SetScrollHere()" to signify "default item".
|
||||
IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget.
|
||||
|
||||
|
@ -2730,7 +2730,7 @@ struct ExampleAppConsole
|
||||
|
||||
// Demonstrate keeping focus on the input box
|
||||
ImGui::SetItemDefaultFocus();
|
||||
if (reclaim_focus) //|| ImGui::IsItemHovered())
|
||||
if (reclaim_focus)
|
||||
ImGui::SetKeyboardFocusHere(-1); // Auto focus previous widget
|
||||
|
||||
ImGui::End();
|
||||
|
@ -247,6 +247,16 @@ enum ImGuiDataType
|
||||
ImGuiDataType_Float2
|
||||
};
|
||||
|
||||
enum ImGuiDir
|
||||
{
|
||||
ImGuiDir_None = -1,
|
||||
ImGuiDir_Left = 0,
|
||||
ImGuiDir_Right = 1,
|
||||
ImGuiDir_Up = 2,
|
||||
ImGuiDir_Down = 3,
|
||||
ImGuiDir_Count_
|
||||
};
|
||||
|
||||
enum ImGuiInputSource
|
||||
{
|
||||
ImGuiInputSource_None = 0,
|
||||
@ -268,16 +278,6 @@ enum ImGuiInputReadMode
|
||||
ImGuiInputReadMode_RepeatFast
|
||||
};
|
||||
|
||||
enum ImGuiDir
|
||||
{
|
||||
ImGuiDir_None = -1,
|
||||
ImGuiDir_Left = 0,
|
||||
ImGuiDir_Right = 1,
|
||||
ImGuiDir_Up = 2,
|
||||
ImGuiDir_Down = 3,
|
||||
ImGuiDir_Count_
|
||||
};
|
||||
|
||||
enum ImGuiNavHighlightFlags_
|
||||
{
|
||||
ImGuiNavHighlightFlags_TypeDefault = 1 << 0,
|
||||
|
Loading…
Reference in New Issue
Block a user