mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Removed io.NavInputs[] and ImGuiNavInput enum. Kept inline redirection code. (#4921, #4858, #787, #1599, #323)
This commit is contained in:
@ -148,11 +148,11 @@ struct ImGuiWindowSettings; // Storage for a window .ini settings (we ke
|
||||
typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
|
||||
typedef int ImGuiActivateFlags; // -> enum ImGuiActivateFlags_ // Flags: for navigation/focus function (will be for ActivateItem() later)
|
||||
typedef int ImGuiDebugLogFlags; // -> enum ImGuiDebugLogFlags_ // Flags: for ShowDebugLogWindow(), g.DebugLogFlags
|
||||
typedef int ImGuiInputReadFlags; // -> enum ImGuiInputReadFlags_ // Flags: for IsKeyPressedEx()
|
||||
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag()
|
||||
typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for DC.LastItemStatusFlags
|
||||
typedef int ImGuiOldColumnFlags; // -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
|
||||
typedef int ImGuiNavHighlightFlags; // -> enum ImGuiNavHighlightFlags_ // Flags: for RenderNavHighlight()
|
||||
typedef int ImGuiNavDirSourceFlags; // -> enum ImGuiNavDirSourceFlags_ // Flags: for GetNavInputAmount2d()
|
||||
typedef int ImGuiNavMoveFlags; // -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests
|
||||
typedef int ImGuiNextItemDataFlags; // -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions
|
||||
typedef int ImGuiNextWindowDataFlags; // -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions
|
||||
@ -1177,6 +1177,16 @@ enum ImGuiKeyPrivate_
|
||||
ImGuiKey_LegacyNativeKey_END = 512,
|
||||
ImGuiKey_Gamepad_BEGIN = ImGuiKey_GamepadStart,
|
||||
ImGuiKey_Gamepad_END = ImGuiKey_GamepadRStickDown + 1,
|
||||
|
||||
// [Internal] Named shortcuts for Navigation
|
||||
ImGuiKey_NavKeyboardTweakSlow = ImGuiKey_ModCtrl,
|
||||
ImGuiKey_NavKeyboardTweakFast = ImGuiKey_ModShift,
|
||||
ImGuiKey_NavGamepadTweakSlow = ImGuiKey_GamepadL1,
|
||||
ImGuiKey_NavGamepadTweakFast = ImGuiKey_GamepadR1,
|
||||
ImGuiKey_NavGamepadActivate = ImGuiKey_GamepadFaceDown,
|
||||
ImGuiKey_NavGamepadCancel = ImGuiKey_GamepadFaceRight,
|
||||
ImGuiKey_NavGamepadMenu = ImGuiKey_GamepadFaceLeft,
|
||||
ImGuiKey_NavGamepadInput = ImGuiKey_GamepadFaceUp,
|
||||
};
|
||||
|
||||
enum ImGuiInputEventType
|
||||
@ -1229,13 +1239,19 @@ struct ImGuiInputEvent
|
||||
ImGuiInputEvent() { memset(this, 0, sizeof(*this)); }
|
||||
};
|
||||
|
||||
// FIXME-NAV: Clarify/expose various repeat delay/rate
|
||||
enum ImGuiNavReadMode
|
||||
// Flags for IsKeyPressedEx(). In upcoming feature this will be used more (and IsKeyPressedEx() renamed)
|
||||
// Don't mistake with ImGuiInputTextFlags! (for ImGui::InputText() function)
|
||||
enum ImGuiInputReadFlags_
|
||||
{
|
||||
ImGuiNavReadMode_Down,
|
||||
ImGuiNavReadMode_Repeat,
|
||||
ImGuiNavReadMode_RepeatSlow,
|
||||
ImGuiNavReadMode_RepeatFast,
|
||||
// Flags for IsKeyPressedEx()
|
||||
ImGuiInputReadFlags_None = 0,
|
||||
ImGuiInputReadFlags_Repeat = 1 << 0, // Return true on successive repeats. Default for legacy IsKeyPressed(). NOT Default for legacy IsMouseClicked(). MUST BE == 1.
|
||||
|
||||
// Repeat rate
|
||||
ImGuiInputReadFlags_RepeatRateDefault = 1 << 1, // Regular
|
||||
ImGuiInputReadFlags_RepeatRateNavMove = 1 << 2, // Fast
|
||||
ImGuiInputReadFlags_RepeatRateNavTweak = 1 << 3, // Faster
|
||||
ImGuiInputReadFlags_RepeatRateMask_ = ImGuiInputReadFlags_RepeatRateDefault | ImGuiInputReadFlags_RepeatRateNavMove | ImGuiInputReadFlags_RepeatRateNavTweak,
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1303,14 +1319,6 @@ enum ImGuiNavHighlightFlags_
|
||||
ImGuiNavHighlightFlags_NoRounding = 1 << 3,
|
||||
};
|
||||
|
||||
enum ImGuiNavDirSourceFlags_
|
||||
{
|
||||
ImGuiNavDirSourceFlags_None = 0,
|
||||
ImGuiNavDirSourceFlags_Keyboard = 1 << 0,
|
||||
ImGuiNavDirSourceFlags_PadDPad = 1 << 1,
|
||||
ImGuiNavDirSourceFlags_PadLStick = 1 << 2,
|
||||
};
|
||||
|
||||
enum ImGuiNavMoveFlags_
|
||||
{
|
||||
ImGuiNavMoveFlags_None = 0,
|
||||
@ -1332,7 +1340,7 @@ enum ImGuiNavMoveFlags_
|
||||
enum ImGuiNavLayer
|
||||
{
|
||||
ImGuiNavLayer_Main = 0, // Main scrolling layer
|
||||
ImGuiNavLayer_Menu = 1, // Menu layer (access with Alt/ImGuiNavInput_Menu)
|
||||
ImGuiNavLayer_Menu = 1, // Menu layer (access with Alt)
|
||||
ImGuiNavLayer_COUNT
|
||||
};
|
||||
|
||||
@ -1645,8 +1653,10 @@ struct ImGuiContext
|
||||
// Input Ownership
|
||||
bool ActiveIdUsingMouseWheel; // Active widget will want to read mouse wheel. Blocks scrolling the underlying window.
|
||||
ImU32 ActiveIdUsingNavDirMask; // Active widget will want to read those nav move requests (e.g. can activate a button and move away from it)
|
||||
ImU32 ActiveIdUsingNavInputMask; // Active widget will want to read those nav inputs.
|
||||
ImBitArrayForNamedKeys ActiveIdUsingKeyInputMask; // Active widget will want to read those key inputs. When we grow the ImGuiKey enum we'll need to either to order the enum to make useful keys come first, either redesign this into e.g. a small array.
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||
ImU32 ActiveIdUsingNavInputMask; // If you used this. Since (IMGUI_VERSION_NUM >= 18804) : 'g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel);' becomes 'SetActiveIdUsingKey(ImGuiKey_Escape); SetActiveIdUsingKey(ImGuiKey_NavGamepadCancel);'
|
||||
#endif
|
||||
|
||||
// Next window/item data
|
||||
ImGuiItemFlags CurrentItemFlags; // == g.ItemFlagsStack.back()
|
||||
@ -1672,10 +1682,10 @@ struct ImGuiContext
|
||||
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusedWindow'
|
||||
ImGuiID NavId; // Focused item for navigation
|
||||
ImGuiID NavFocusScopeId; // Identify a selection scope (selection code often wants to "clear other items" when landing on an item of the selection set)
|
||||
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem()
|
||||
ImGuiID NavActivateDownId; // ~~ IsNavInputDown(ImGuiNavInput_Activate) ? NavId : 0
|
||||
ImGuiID NavActivatePressedId; // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0
|
||||
ImGuiID NavActivateInputId; // ~~ IsNavInputPressed(ImGuiNavInput_Input) ? NavId : 0; ImGuiActivateFlags_PreferInput will be set and NavActivateId will be 0.
|
||||
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItem()
|
||||
ImGuiID NavActivateDownId; // ~~ IsKeyDown(ImGuiKey_Space) || IsKeyDown(ImGuiKey_NavGamepadActivate) ? NavId : 0
|
||||
ImGuiID NavActivatePressedId; // ~~ IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_NavGamepadActivate) ? NavId : 0 (no repeat)
|
||||
ImGuiID NavActivateInputId; // ~~ IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadInput) ? NavId : 0; ImGuiActivateFlags_PreferInput will be set and NavActivateId will be 0.
|
||||
ImGuiActivateFlags NavActivateFlags;
|
||||
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).
|
||||
@ -1888,8 +1898,10 @@ struct ImGuiContext
|
||||
|
||||
ActiveIdUsingMouseWheel = false;
|
||||
ActiveIdUsingNavDirMask = 0x00;
|
||||
ActiveIdUsingNavInputMask = 0x00;
|
||||
ActiveIdUsingKeyInputMask.ClearAllBits();
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||
ActiveIdUsingNavInputMask = 0x00;
|
||||
#endif
|
||||
|
||||
CurrentItemFlags = ImGuiItemFlags_None;
|
||||
BeginMenuCount = 0;
|
||||
@ -2671,10 +2683,6 @@ namespace ImGui
|
||||
IMGUI_API void NavMoveRequestCancel();
|
||||
IMGUI_API void NavMoveRequestApplyResult();
|
||||
IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags);
|
||||
IMGUI_API const char* GetNavInputName(ImGuiNavInput n);
|
||||
IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiNavReadMode mode);
|
||||
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiNavReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f);
|
||||
IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate);
|
||||
IMGUI_API void ActivateItem(ImGuiID id); // Remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again.
|
||||
IMGUI_API void SetNavWindow(ImGuiWindow* window);
|
||||
IMGUI_API void SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiID focus_scope_id, const ImRect& rect_rel);
|
||||
@ -2696,20 +2704,19 @@ namespace ImGui
|
||||
IMGUI_API void SetItemUsingMouseWheel();
|
||||
IMGUI_API void SetActiveIdUsingNavAndKeys();
|
||||
inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; }
|
||||
inline bool IsActiveIdUsingNavInput(ImGuiNavInput input) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavInputMask & (1 << input)) != 0; }
|
||||
inline bool IsActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; return g.ActiveIdUsingKeyInputMask[key]; }
|
||||
inline void SetActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; g.ActiveIdUsingKeyInputMask.SetBit(key); }
|
||||
IMGUI_API bool IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold = -1.0f);
|
||||
IMGUI_API ImGuiModFlags GetMergedModFlags();
|
||||
IMGUI_API ImVec2 GetKeyVector2d(ImGuiKey key_left, ImGuiKey key_right, ImGuiKey key_up, ImGuiKey key_down);
|
||||
IMGUI_API float GetNavTweakPressedAmount(ImGuiAxis axis);
|
||||
IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate);
|
||||
IMGUI_API void GetTypematicRepeatRate(ImGuiInputReadFlags flags, float* repeat_delay, float* repeat_rate);
|
||||
IMGUI_API bool IsKeyPressedEx(ImGuiKey key, ImGuiInputReadFlags flags = 0);
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||
inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { IM_ASSERT(IsNamedKey(key)); return IsKeyPressed(key, repeat); } // [removed in 1.87]
|
||||
#endif
|
||||
|
||||
// Inputs: Navigation
|
||||
inline bool IsNavInputDown(ImGuiNavInput n) { ImGuiContext& g = *GImGui; return g.IO.NavInputs[n] > 0.0f; }
|
||||
inline bool IsNavInputPressed(ImGuiNavInput n) { ImGuiContext& g = *GImGui; return g.IO.NavInputsDownDuration[n] == 0.0f; }
|
||||
inline bool IsNavInputTest(ImGuiNavInput n, ImGuiNavReadMode read_mode) { return (GetNavInputAmount(n, read_mode) > 0.0f); }
|
||||
|
||||
// Drag and Drop
|
||||
IMGUI_API bool IsDragDropActive();
|
||||
IMGUI_API bool BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id);
|
||||
|
Reference in New Issue
Block a user