|
@@ -1,4 +1,4 @@
|
|
|
-// dear imgui, v1.89.2 WIP
|
|
|
+// dear imgui, v1.89.2
|
|
|
// (internal structures/api)
|
|
|
|
|
|
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
|
@@ -159,6 +159,7 @@ typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // E
|
|
|
// Flags
|
|
|
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 ImGuiInputFlags; // -> enum ImGuiInputFlags_ // Flags: for IsKeyPressed(), IsMouseClicked(), SetKeyOwner(), SetItemKeyOwner() etc.
|
|
|
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag(), g.LastItemData.InFlags
|
|
|
typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for g.LastItemData.StatusFlags
|
|
|
typedef int ImGuiOldColumnFlags; // -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
|
|
@@ -900,10 +901,9 @@ enum ImGuiSelectableFlagsPrivate_
|
|
|
ImGuiSelectableFlags_SelectOnClick = 1 << 22, // Override button behavior to react on Click (default is Click+Release)
|
|
|
ImGuiSelectableFlags_SelectOnRelease = 1 << 23, // Override button behavior to react on Release (default is Click+Release)
|
|
|
ImGuiSelectableFlags_SpanAvailWidth = 1 << 24, // Span all avail width even if we declared less for layout purpose. FIXME: We may be able to remove this (added in 6251d379, 2bcafc86 for menus)
|
|
|
- ImGuiSelectableFlags_DrawHoveredWhenHeld = 1 << 25, // Always show active when held, even is not hovered. This concept could probably be renamed/formalized somehow.
|
|
|
- ImGuiSelectableFlags_SetNavIdOnHover = 1 << 26, // Set Nav/Focus ID on mouse hover (used by MenuItem)
|
|
|
- ImGuiSelectableFlags_NoPadWithHalfSpacing = 1 << 27, // Disable padding each side with ItemSpacing * 0.5f
|
|
|
- ImGuiSelectableFlags_NoSetKeyOwner = 1 << 28, // Don't set key/input owner on the initial click (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
|
|
|
+ ImGuiSelectableFlags_SetNavIdOnHover = 1 << 25, // Set Nav/Focus ID on mouse hover (used by MenuItem)
|
|
|
+ ImGuiSelectableFlags_NoPadWithHalfSpacing = 1 << 26, // Disable padding each side with ItemSpacing * 0.5f
|
|
|
+ ImGuiSelectableFlags_NoSetKeyOwner = 1 << 27, // Don't set key/input owner on the initial click (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
|
|
|
};
|
|
|
|
|
|
// Extend ImGuiTreeNodeFlags_
|
|
@@ -1349,12 +1349,13 @@ struct ImGuiKeyOwnerData
|
|
|
ImGuiKeyOwnerData() { OwnerCurr = OwnerNext = ImGuiKeyOwner_None; LockThisFrame = LockUntilRelease = false; }
|
|
|
};
|
|
|
|
|
|
-// Extend ImGuiInputFlags_
|
|
|
// Flags for extended versions of IsKeyPressed(), IsMouseClicked(), Shortcut(), SetKeyOwner(), SetItemKeyOwner()
|
|
|
// Don't mistake with ImGuiInputTextFlags! (for ImGui::InputText() function)
|
|
|
-enum ImGuiInputFlagsPrivate_
|
|
|
+enum ImGuiInputFlags_
|
|
|
{
|
|
|
// Flags for IsKeyPressed(), IsMouseClicked(), Shortcut()
|
|
|
+ ImGuiInputFlags_None = 0,
|
|
|
+ ImGuiInputFlags_Repeat = 1 << 0, // Return true on successive repeats. Default for legacy IsKeyPressed(). NOT Default for legacy IsMouseClicked(). MUST BE == 1.
|
|
|
ImGuiInputFlags_RepeatRateDefault = 1 << 1, // Repeat rate: Regular (default)
|
|
|
ImGuiInputFlags_RepeatRateNavMove = 1 << 2, // Repeat rate: Fast
|
|
|
ImGuiInputFlags_RepeatRateNavTweak = 1 << 3, // Repeat rate: Faster
|
|
@@ -1370,9 +1371,26 @@ enum ImGuiInputFlagsPrivate_
|
|
|
ImGuiInputFlags_LockThisFrame = 1 << 6, // Access to key data will require EXPLICIT owner ID (ImGuiKeyOwner_Any/0 will NOT accepted for polling). Cleared at end of frame. This is useful to make input-owner-aware code steal keys from non-input-owner-aware code.
|
|
|
ImGuiInputFlags_LockUntilRelease = 1 << 7, // Access to key data will require EXPLICIT owner ID (ImGuiKeyOwner_Any/0 will NOT accepted for polling). Cleared when the key is released or at end of each frame if key is released. This is useful to make input-owner-aware code steal keys from non-input-owner-aware code.
|
|
|
|
|
|
+ // Routing policies for Shortcut() + low-level SetShortcutRouting()
|
|
|
+ // - The general idea is that several callers register interest in a shortcut, and only one owner gets it.
|
|
|
+ // - When a policy (other than _RouteAlways) is set, Shortcut() will register itself with SetShortcutRouting(),
|
|
|
+ // allowing the system to decide where to route the input among other route-aware calls.
|
|
|
+ // - Shortcut() uses ImGuiInputFlags_RouteFocused by default: meaning that a simple Shortcut() poll
|
|
|
+ // will register a route and only succeed when parent window is in the focus stack and if no-one
|
|
|
+ // with a higher priority is claiming the shortcut.
|
|
|
+ // - Using ImGuiInputFlags_RouteAlways is roughly equivalent to doing e.g. IsKeyPressed(key) + testing mods.
|
|
|
+ // - Priorities: GlobalHigh > Focused (when owner is active item) > Global > Focused (when focused window) > GlobalLow.
|
|
|
+ // - Can select only 1 policy among all available.
|
|
|
+ ImGuiInputFlags_RouteFocused = 1 << 8, // (Default) Register focused route: Accept inputs if window is in focus stack. Deep-most focused window takes inputs. ActiveId takes inputs over deep-most focused window.
|
|
|
+ ImGuiInputFlags_RouteGlobalLow = 1 << 9, // Register route globally (lowest priority: unless a focused window or active item registered the route) -> recommended Global priority.
|
|
|
+ ImGuiInputFlags_RouteGlobal = 1 << 10, // Register route globally (medium priority: unless an active item registered the route, e.g. CTRL+A registered by InputText).
|
|
|
+ ImGuiInputFlags_RouteGlobalHigh = 1 << 11, // Register route globally (highest priority: unlikely you need to use that: will interfere with every active items)
|
|
|
+ ImGuiInputFlags_RouteMask_ = ImGuiInputFlags_RouteFocused | ImGuiInputFlags_RouteGlobal | ImGuiInputFlags_RouteGlobalLow | ImGuiInputFlags_RouteGlobalHigh, // _Always not part of this!
|
|
|
+ ImGuiInputFlags_RouteAlways = 1 << 12, // Do not register route, poll keys directly.
|
|
|
+ ImGuiInputFlags_RouteUnlessBgFocused= 1 << 13, // Global routes will not be applied if underlying background/void is focused (== no Dear ImGui windows are focused). Useful for overlay applications.
|
|
|
+ ImGuiInputFlags_RouteExtraMask_ = ImGuiInputFlags_RouteAlways | ImGuiInputFlags_RouteUnlessBgFocused,
|
|
|
+
|
|
|
// [Internal] Mask of which function support which flags
|
|
|
- ImGuiInputFlags_RouteMask_ = ImGuiInputFlags_RouteFocused | ImGuiInputFlags_RouteGlobal | ImGuiInputFlags_RouteGlobalLow | ImGuiInputFlags_RouteGlobalHigh, // _Always not part of this!
|
|
|
- ImGuiInputFlags_RouteExtraMask_ = ImGuiInputFlags_RouteAlways | ImGuiInputFlags_RouteUnlessBgFocused,
|
|
|
ImGuiInputFlags_SupportedByIsKeyPressed = ImGuiInputFlags_Repeat | ImGuiInputFlags_RepeatRateMask_,
|
|
|
ImGuiInputFlags_SupportedByShortcut = ImGuiInputFlags_Repeat | ImGuiInputFlags_RepeatRateMask_ | ImGuiInputFlags_RouteMask_ | ImGuiInputFlags_RouteExtraMask_,
|
|
|
ImGuiInputFlags_SupportedBySetKeyOwner = ImGuiInputFlags_LockThisFrame | ImGuiInputFlags_LockUntilRelease,
|
|
@@ -3154,11 +3172,17 @@ namespace ImGui
|
|
|
IMGUI_API bool IsMouseClicked(ImGuiMouseButton button, ImGuiID owner_id, ImGuiInputFlags flags = 0);
|
|
|
IMGUI_API bool IsMouseReleased(ImGuiMouseButton button, ImGuiID owner_id);
|
|
|
|
|
|
- // [EXPERIMENTAL] Low-Level: Shortcut Routing
|
|
|
+ // [EXPERIMENTAL] Shortcut Routing
|
|
|
+ // - ImGuiKeyChord = a ImGuiKey optionally OR-red with ImGuiMod_Alt/ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Super.
|
|
|
+ // ImGuiKey_C (accepted by functions taking ImGuiKey or ImGuiKeyChord)
|
|
|
+ // ImGuiKey_C | ImGuiMod_Ctrl (accepted by functions taking ImGuiKeyChord)
|
|
|
+ // ONLY ImGuiMod_XXX values are legal to 'OR' with an ImGuiKey. You CANNOT 'OR' two ImGuiKey values.
|
|
|
+ // - When using one of the routing flags (e.g. ImGuiInputFlags_RouteFocused): routes requested ahead of time given a chord (key + modifiers) and a routing policy.
|
|
|
// - Routes are resolved during NewFrame(): if keyboard modifiers are matching current ones: SetKeyOwner() is called + route is granted for the frame.
|
|
|
// - Route is granted to a single owner. When multiple requests are made we have policies to select the winning route.
|
|
|
// - Multiple read sites may use the same owner id and will all get the granted route.
|
|
|
// - For routing: when owner_id is 0 we use the current Focus Scope ID as a default owner in order to identify our location.
|
|
|
+ IMGUI_API bool Shortcut(ImGuiKeyChord key_chord, ImGuiID owner_id = 0, ImGuiInputFlags flags = 0);
|
|
|
IMGUI_API bool SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id = 0, ImGuiInputFlags flags = 0);
|
|
|
IMGUI_API bool TestShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id);
|
|
|
IMGUI_API ImGuiKeyRoutingData* GetShortcutRoutingData(ImGuiKeyChord key_chord);
|