mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-26 05:27:01 +00:00
Added most basic form of Disabled flag to disable interactions (but visuals aren't altered), in imgui_internals.h, undocumented/unsupported (#211, #1012)
This commit is contained in:
parent
efcd53a0c3
commit
4faf99eff5
@ -2051,6 +2051,8 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
|
|||||||
return false;
|
return false;
|
||||||
if (!IsWindowContentHoverable(window, flags))
|
if (!IsWindowContentHoverable(window, flags))
|
||||||
return false;
|
return false;
|
||||||
|
if (window->DC.ItemFlags & ImGuiItemFlags_Disabled)
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2070,6 +2072,8 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id)
|
|||||||
return false;
|
return false;
|
||||||
if (!IsWindowContentHoverable(window, ImGuiHoveredFlags_Default))
|
if (!IsWindowContentHoverable(window, ImGuiHoveredFlags_Default))
|
||||||
return false;
|
return false;
|
||||||
|
if (window->DC.ItemFlags & ImGuiItemFlags_Disabled)
|
||||||
|
return false;
|
||||||
|
|
||||||
SetHoveredID(id);
|
SetHoveredID(id);
|
||||||
return true;
|
return true;
|
||||||
@ -2090,7 +2094,7 @@ bool ImGui::FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop
|
|||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
|
||||||
const bool allow_keyboard_focus = (window->DC.ItemFlags & ImGuiItemFlags_AllowKeyboardFocus) != 0;
|
const bool allow_keyboard_focus = (window->DC.ItemFlags & (ImGuiItemFlags_AllowKeyboardFocus | ImGuiItemFlags_Disabled)) == ImGuiItemFlags_AllowKeyboardFocus;
|
||||||
window->FocusIdxAllCounter++;
|
window->FocusIdxAllCounter++;
|
||||||
if (allow_keyboard_focus)
|
if (allow_keyboard_focus)
|
||||||
window->FocusIdxTabCounter++;
|
window->FocusIdxTabCounter++;
|
||||||
|
@ -582,9 +582,10 @@ enum ImGuiItemFlags_
|
|||||||
{
|
{
|
||||||
ImGuiItemFlags_AllowKeyboardFocus = 1 << 0, // true
|
ImGuiItemFlags_AllowKeyboardFocus = 1 << 0, // true
|
||||||
ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.
|
ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.
|
||||||
//ImGuiItemFlags_Disabled = 1 << 2, // false // All widgets appears are disabled
|
ImGuiItemFlags_Disabled = 1 << 2, // false // FIXME-WIP: Disable interactions but doesn't affect visuals. Should be: grey out and disable interactions with widgets that affect data + view widgets (WIP)
|
||||||
//ImGuiItemFlags_AllowNavDefaultFocus = 1 << 3, // true
|
//ImGuiItemFlags_NoNav = 1 << 3, // false
|
||||||
ImGuiItemFlags_SelectableDontClosePopup = 1 << 4, // false // MenuItem/Selectable() automatically closes current Popup window
|
//ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false
|
||||||
|
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // MenuItem/Selectable() automatically closes current Popup window
|
||||||
ImGuiItemFlags_Default_ = ImGuiItemFlags_AllowKeyboardFocus
|
ImGuiItemFlags_Default_ = ImGuiItemFlags_AllowKeyboardFocus
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user