mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 03:47:00 +00:00
Added PushDisabled(), PopDisabled() currently only exposed in imgui_internal.h (#211)
This commit is contained in:
parent
b66529fe3e
commit
61f4aec868
22
imgui.cpp
22
imgui.cpp
@ -6575,6 +6575,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)
|
||||
{
|
||||
|
2
imgui.h
2
imgui.h
@ -61,7 +61,7 @@ Index of this file:
|
||||
// Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||
#define IMGUI_VERSION "1.84 WIP"
|
||||
#define IMGUI_VERSION_NUM 18305
|
||||
#define IMGUI_VERSION_NUM 18306
|
||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||
#define IMGUI_HAS_TABLE
|
||||
|
||||
|
@ -2379,6 +2379,8 @@ namespace ImGui
|
||||
IMGUI_API void PushMultiItemsWidths(int components, float width_full);
|
||||
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled);
|
||||
IMGUI_API void PopItemFlag();
|
||||
IMGUI_API void PushDisabled();
|
||||
IMGUI_API void PopDisabled();
|
||||
IMGUI_API bool IsItemToggledSelection(); // Was the last item selection toggled? (after Selectable(), TreeNode() etc. We only returns toggle _event_ in order to handle clipping correctly)
|
||||
IMGUI_API ImVec2 GetContentRegionMaxAbs();
|
||||
IMGUI_API void ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_excess);
|
||||
|
Loading…
Reference in New Issue
Block a user