Nav: store NavJustMovedToIsTabbing + shuffle a few nav related fields.
(for usage by multi-select)
This commit is contained in:
parent
77d582fa37
commit
0582f7678a
@ -12393,6 +12393,8 @@ void ImGui::NavInitRequestApplyResult()
|
|||||||
g.NavJustMovedToId = result->ID;
|
g.NavJustMovedToId = result->ID;
|
||||||
g.NavJustMovedToFocusScopeId = result->FocusScopeId;
|
g.NavJustMovedToFocusScopeId = result->FocusScopeId;
|
||||||
g.NavJustMovedToKeyMods = 0;
|
g.NavJustMovedToKeyMods = 0;
|
||||||
|
g.NavJustMovedToIsTabbing = false;
|
||||||
|
g.NavJustMovedToHasSelectionData = (result->InFlags & ImGuiItemFlags_HasSelectionUserData) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply result from previous navigation init request (will typically select the first item, unless SetItemDefaultFocus() has been called)
|
// Apply result from previous navigation init request (will typically select the first item, unless SetItemDefaultFocus() has been called)
|
||||||
@ -12649,6 +12651,9 @@ void ImGui::NavMoveRequestApplyResult()
|
|||||||
g.NavJustMovedToId = result->ID;
|
g.NavJustMovedToId = result->ID;
|
||||||
g.NavJustMovedToFocusScopeId = result->FocusScopeId;
|
g.NavJustMovedToFocusScopeId = result->FocusScopeId;
|
||||||
g.NavJustMovedToKeyMods = g.NavMoveKeyMods;
|
g.NavJustMovedToKeyMods = g.NavMoveKeyMods;
|
||||||
|
g.NavJustMovedToIsTabbing = (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing) != 0;
|
||||||
|
g.NavJustMovedToHasSelectionData = (result->InFlags & ImGuiItemFlags_HasSelectionUserData) != 0;
|
||||||
|
//IMGUI_DEBUG_LOG_NAV("[nav] NavJustMovedFromFocusScopeId = 0x%08X, NavJustMovedToFocusScopeId = 0x%08X\n", g.NavJustMovedFromFocusScopeId, g.NavJustMovedToFocusScopeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply new NavID/Focus
|
// Apply new NavID/Focus
|
||||||
|
@ -1599,7 +1599,7 @@ struct ImGuiNavItemData
|
|||||||
float DistBox; // Move // Best candidate box distance to current NavId
|
float DistBox; // Move // Best candidate box distance to current NavId
|
||||||
float DistCenter; // Move // Best candidate center distance to current NavId
|
float DistCenter; // Move // Best candidate center distance to current NavId
|
||||||
float DistAxial; // Move // Best candidate axial distance to current NavId
|
float DistAxial; // Move // Best candidate axial distance to current NavId
|
||||||
ImGuiSelectionUserData SelectionUserData;//I+Mov // Best candidate SetNextItemSelectionData() value.
|
ImGuiSelectionUserData SelectionUserData;//I+Mov // Best candidate SetNextItemSelectionUserData() value. Valid if (InFlags & ImGuiItemFlags_HasSelectionUserData)
|
||||||
|
|
||||||
ImGuiNavItemData() { Clear(); }
|
ImGuiNavItemData() { Clear(); }
|
||||||
void Clear() { Window = NULL; ID = FocusScopeId = 0; InFlags = 0; SelectionUserData = -1; DistBox = DistCenter = DistAxial = FLT_MAX; }
|
void Clear() { Window = NULL; ID = FocusScopeId = 0; InFlags = 0; SelectionUserData = -1; DistBox = DistCenter = DistAxial = FLT_MAX; }
|
||||||
@ -2044,6 +2044,7 @@ struct ImGuiContext
|
|||||||
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusedWindow'
|
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusedWindow'
|
||||||
ImGuiID NavId; // Focused item for navigation
|
ImGuiID NavId; // Focused item for navigation
|
||||||
ImGuiID NavFocusScopeId; // Focused focus scope (e.g. selection code often wants to "clear other items" when landing on an item of the same scope)
|
ImGuiID NavFocusScopeId; // Focused focus scope (e.g. selection code often wants to "clear other items" when landing on an item of the same scope)
|
||||||
|
ImGuiNavLayer NavLayer; // Focused layer (main scrolling layer, or menu/title bar layer)
|
||||||
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItem()
|
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItem()
|
||||||
ImGuiID NavActivateDownId; // ~~ IsKeyDown(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyDown(ImGuiKey_NavGamepadActivate) ? NavId : 0
|
ImGuiID NavActivateDownId; // ~~ IsKeyDown(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyDown(ImGuiKey_NavGamepadActivate) ? NavId : 0
|
||||||
ImGuiID NavActivatePressedId; // ~~ IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate) ? NavId : 0 (no repeat)
|
ImGuiID NavActivatePressedId; // ~~ IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate) ? NavId : 0 (no repeat)
|
||||||
@ -2051,13 +2052,9 @@ struct ImGuiContext
|
|||||||
ImVector<ImGuiFocusScopeData> NavFocusRoute; // Reversed copy focus scope stack for NavId (should contains NavFocusScopeId). This essentially follow the window->ParentWindowForFocusRoute chain.
|
ImVector<ImGuiFocusScopeData> NavFocusRoute; // Reversed copy focus scope stack for NavId (should contains NavFocusScopeId). This essentially follow the window->ParentWindowForFocusRoute chain.
|
||||||
ImGuiID NavHighlightActivatedId;
|
ImGuiID NavHighlightActivatedId;
|
||||||
float NavHighlightActivatedTimer;
|
float NavHighlightActivatedTimer;
|
||||||
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest).
|
|
||||||
ImGuiID NavJustMovedToFocusScopeId; // Just navigated to this focus scope id (result of a successfully MoveRequest).
|
|
||||||
ImGuiKeyChord NavJustMovedToKeyMods;
|
|
||||||
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame.
|
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame.
|
||||||
ImGuiActivateFlags NavNextActivateFlags;
|
ImGuiActivateFlags NavNextActivateFlags;
|
||||||
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS CAN ONLY BE ImGuiInputSource_Keyboard or ImGuiInputSource_Mouse
|
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS CAN ONLY BE ImGuiInputSource_Keyboard or ImGuiInputSource_Mouse
|
||||||
ImGuiNavLayer NavLayer; // Layer we are navigating on. For now the system is hard-coded for 0=main contents and 1=menu/title bar, may expose layers later.
|
|
||||||
ImGuiSelectionUserData NavLastValidSelectionUserData; // Last valid data passed to SetNextItemSelectionUser(), or -1. For current window. Not reset when focusing an item that doesn't have selection data.
|
ImGuiSelectionUserData NavLastValidSelectionUserData; // Last valid data passed to SetNextItemSelectionUser(), or -1. For current window. Not reset when focusing an item that doesn't have selection data.
|
||||||
bool NavIdIsAlive; // Nav widget has been seen this frame ~~ NavRectRel is valid
|
bool NavIdIsAlive; // Nav widget has been seen this frame ~~ NavRectRel is valid
|
||||||
bool NavMousePosDirty; // When set we will update mouse position if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) if set (NB: this not enabled by default)
|
bool NavMousePosDirty; // When set we will update mouse position if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) if set (NB: this not enabled by default)
|
||||||
@ -2088,6 +2085,14 @@ struct ImGuiContext
|
|||||||
ImGuiNavItemData NavMoveResultOther; // Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags_NavFlattened flag)
|
ImGuiNavItemData NavMoveResultOther; // Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags_NavFlattened flag)
|
||||||
ImGuiNavItemData NavTabbingResultFirst; // First tabbing request candidate within NavWindow and flattened hierarchy
|
ImGuiNavItemData NavTabbingResultFirst; // First tabbing request candidate within NavWindow and flattened hierarchy
|
||||||
|
|
||||||
|
// Navigation: record of last move request
|
||||||
|
ImGuiID NavJustMovedFromFocusScopeId; // Just navigated from this focus scope id (result of a successfully MoveRequest).
|
||||||
|
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest).
|
||||||
|
ImGuiID NavJustMovedToFocusScopeId; // Just navigated to this focus scope id (result of a successfully MoveRequest).
|
||||||
|
ImGuiKeyChord NavJustMovedToKeyMods;
|
||||||
|
bool NavJustMovedToIsTabbing; // Copy of ImGuiNavMoveFlags_IsTabbing. Maybe we should store whole flags.
|
||||||
|
bool NavJustMovedToHasSelectionData; // Copy of move result's InFlags & ImGuiItemFlags_HasSelectionUserData). Maybe we should just store ImGuiNavItemData.
|
||||||
|
|
||||||
// Navigation: Windowing (CTRL+TAB for list, or Menu button + keys or directional pads to move/resize)
|
// Navigation: Windowing (CTRL+TAB for list, or Menu button + keys or directional pads to move/resize)
|
||||||
ImGuiKeyChord ConfigNavWindowingKeyNext; // = ImGuiMod_Ctrl | ImGuiKey_Tab (or ImGuiMod_Super | ImGuiKey_Tab on OS X). For reconfiguration (see #4828)
|
ImGuiKeyChord ConfigNavWindowingKeyNext; // = ImGuiMod_Ctrl | ImGuiKey_Tab (or ImGuiMod_Super | ImGuiKey_Tab on OS X). For reconfiguration (see #4828)
|
||||||
ImGuiKeyChord ConfigNavWindowingKeyPrev; // = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab (or ImGuiMod_Super | ImGuiMod_Shift | ImGuiKey_Tab on OS X)
|
ImGuiKeyChord ConfigNavWindowingKeyPrev; // = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab (or ImGuiMod_Super | ImGuiMod_Shift | ImGuiKey_Tab on OS X)
|
||||||
@ -2324,18 +2329,18 @@ struct ImGuiContext
|
|||||||
|
|
||||||
NavWindow = NULL;
|
NavWindow = NULL;
|
||||||
NavId = NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = 0;
|
NavId = NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = 0;
|
||||||
NavJustMovedToId = NavJustMovedToFocusScopeId = NavNextActivateId = 0;
|
NavLayer = ImGuiNavLayer_Main;
|
||||||
|
NavNextActivateId = 0;
|
||||||
NavActivateFlags = NavNextActivateFlags = ImGuiActivateFlags_None;
|
NavActivateFlags = NavNextActivateFlags = ImGuiActivateFlags_None;
|
||||||
NavHighlightActivatedId = 0;
|
NavHighlightActivatedId = 0;
|
||||||
NavHighlightActivatedTimer = 0.0f;
|
NavHighlightActivatedTimer = 0.0f;
|
||||||
NavJustMovedToKeyMods = ImGuiMod_None;
|
|
||||||
NavInputSource = ImGuiInputSource_Keyboard;
|
NavInputSource = ImGuiInputSource_Keyboard;
|
||||||
NavLayer = ImGuiNavLayer_Main;
|
|
||||||
NavLastValidSelectionUserData = ImGuiSelectionUserData_Invalid;
|
NavLastValidSelectionUserData = ImGuiSelectionUserData_Invalid;
|
||||||
NavIdIsAlive = false;
|
NavIdIsAlive = false;
|
||||||
NavMousePosDirty = false;
|
NavMousePosDirty = false;
|
||||||
NavDisableHighlight = true;
|
NavDisableHighlight = true;
|
||||||
NavDisableMouseHover = false;
|
NavDisableMouseHover = false;
|
||||||
|
|
||||||
NavAnyRequest = false;
|
NavAnyRequest = false;
|
||||||
NavInitRequest = false;
|
NavInitRequest = false;
|
||||||
NavInitRequestFromMove = false;
|
NavInitRequestFromMove = false;
|
||||||
@ -2350,6 +2355,11 @@ struct ImGuiContext
|
|||||||
NavTabbingDir = 0;
|
NavTabbingDir = 0;
|
||||||
NavTabbingCounter = 0;
|
NavTabbingCounter = 0;
|
||||||
|
|
||||||
|
NavJustMovedFromFocusScopeId = NavJustMovedToId = NavJustMovedToFocusScopeId = 0;
|
||||||
|
NavJustMovedToKeyMods = ImGuiMod_None;
|
||||||
|
NavJustMovedToIsTabbing = false;
|
||||||
|
NavJustMovedToHasSelectionData = false;
|
||||||
|
|
||||||
// All platforms use Ctrl+Tab but Ctrl<>Super are swapped on Mac...
|
// All platforms use Ctrl+Tab but Ctrl<>Super are swapped on Mac...
|
||||||
// FIXME: Because this value is stored, it annoyingly interfere with toggling io.ConfigMacOSXBehaviors updating this..
|
// FIXME: Because this value is stored, it annoyingly interfere with toggling io.ConfigMacOSXBehaviors updating this..
|
||||||
ConfigNavWindowingKeyNext = IO.ConfigMacOSXBehaviors ? (ImGuiMod_Super | ImGuiKey_Tab) : (ImGuiMod_Ctrl | ImGuiKey_Tab);
|
ConfigNavWindowingKeyNext = IO.ConfigMacOSXBehaviors ? (ImGuiMod_Super | ImGuiKey_Tab) : (ImGuiMod_Ctrl | ImGuiKey_Tab);
|
||||||
|
Loading…
Reference in New Issue
Block a user