mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-05 04:28:47 +02:00
Added PushDisabled(), PopDisabled() currently only exposed in imgui_internal.h (#211)
This commit is contained in:
22
imgui.cpp
22
imgui.cpp
@ -7178,6 +7178,28 @@ void ImGui::PopItemFlag()
|
||||
g.CurrentItemFlags = g.ItemFlagsStack.back();
|
||||
}
|
||||
|
||||
// PushDisabled()/PopDisabled()
|
||||
// - Those are not yet exposed in imgui.h because we are unsure of how to alter the style in a way that works for everyone.
|
||||
// We may rework this. Hypothetically, a future styling system may set a flag which make widgets use different colors.
|
||||
// - Feedback welcome at https://github.com/ocornut/imgui/issues/211
|
||||
// - You may trivially implement your own variation of this if needed.
|
||||
// Here we test (CurrentItemFlags & ImGuiItemFlags_Disabled) to allow nested PushDisabled() calls.
|
||||
void ImGui::PushDisabled()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if ((g.CurrentItemFlags & ImGuiItemFlags_Disabled) == 0)
|
||||
PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.6f);
|
||||
PushItemFlag(ImGuiItemFlags_Disabled, true);
|
||||
}
|
||||
|
||||
void ImGui::PopDisabled()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
PopItemFlag();
|
||||
if ((g.CurrentItemFlags & ImGuiItemFlags_Disabled) == 0)
|
||||
PopStyleVar();
|
||||
}
|
||||
|
||||
// FIXME: Look into renaming this once we have settled the new Focus/Activation/TabStop system.
|
||||
void ImGui::PushAllowKeyboardFocus(bool allow_keyboard_focus)
|
||||
{
|
||||
|
Reference in New Issue
Block a user