+ Demo: use BeginDisabled() block in BackendFlags section.
I'd still consider this undefined behavior as some combination may not work properly, but let's fix things while we can as we encounter them.
(There are two additional unhandled flags that only affect padding: '-' and ' '. Formatting flags don't make sense in a SliderInt's format string, so I've omitted them)
Altered ItemAdd() clipping rule to keep previous-frame ActiveId unclipped to support that late commit.
Also, MarkItemEdited() may in theory need to do:
if (g.ActiveIdPreviousFrame == id)
g.ActiveIdPreviousFrameHasBeenEditedBefore = true;
But this should already be set so not adding now.
This commit is a preparation toward adding ImGui apis with explicit context
and making ImGui applications being able to use multiple context at the same time
whatever their concurrency model.
This commit modifies ImGuiInputTextCallback, ImGuiListClipper and ImGuiStackSize so those classes do not to depend on GImGui context anymore.
About ImGuiInputTextCallback:
- ImGuiInputTextCallback depends on ImGuiContext because it has a
`InsertChars` method adding character to `g.InputTextState`
- To make ImGuiInputTextCallback aware of which context to use, the
appropriate context is given as argument of ImGuiInputTextCallback
constructor.
About ImGuiListClipper:
- ImGuiListClipper apply to a context through its `Begin`, `End`, and `Step`
method.
- To make ImGuiListClipper aware of which context to use, the
appropriate context is given as argument of ImGuiListClipper
constructor.
- Since the behavior is different than previously the class has been
renamed ImGuiListClipperEx
- In order to preserve backward compatibility, a subclass of ImGuiListClipperEx
named ImGuiListClipper has been defined and forward the implicit context
to ImGuiListClipperEx parent.
About ImGuiTextFilter:
- ImGuiTextFilter depends on the implicit context because the Draw(..)
method call ImGui::InputText(...)
- Instead from that commit the Draw(...) method takes an explicit context
as first argument
- Since the behavior is different than previously the class has been
renamed ImGuiTextFilterEx
- In order to preserve backward compatibility, a subclass of ImGuiTextFilterEx
named ImGuiTextFilter has been defined. This subclass has a draw method
override which and forward the implicit context to the parent class Draw(...)
About ImGuiStackSizes:
- ImGuiStackSizes was depending on ImGuiContext because of its
`SetToCurrentState` and `CompareWithCurrentState` method
- ImGuiStackSizes is an helper object use
for comparing state of context. It does not necessarily need to
compare the same context. For that reason, as opposed to previous
classes it takes the context it wants to compare to as argument of
its method.
- For this occasion `SetToCurrentState` and `CompareWithCurrentState`
have been renamed `SetToContextState` and `CompareWithContextState`
to match the new method signature.
ImGuiListClipper
ImGuiInputTextCallbackData
In particular:
- imgui.cpp : move UpdateInputEvents() higher in NewFrame() to match docking + update RenderMouseCursor() to match.
- imgui_draw.cpp: ImDrawList::_ResetForNewFrame() change from c807192ab
- Backends: SDL2. Add MouseWindowID + change SDL_CaptureMouse() test to match docking branch. Not strictly necessary but aimed at reducing drift because we go on and fork this file.
+ moved responsability of checking valid names to TabBarGetTabName() to simplify both branches.
Needlessly introduced in baae057a from WIP tables branch at the time, ended up unused by Tables.
A comment "I find it counter intuitive that hovering supersedes activation." in #3516 led me to this however this is not the cause of said issue.
This commit is a preparation toward adding ImGui apis with explicit context
and making ImGui applications being able to use multiple context at the same time
whatever their concurrency model.
--
Prior to this commit ImGuiInputTextState::OnKeyPressed was depending on the
global context to know which font and font size to use, and if it should
follow MacOSX behaviors or not (c.f ConfigMacOSXBehaviors).
Instead of using the global context, this commit store the context as
attribute of ImGuiInputTextState. Since this state is forwarded to most
of text edit related function, it possible to access font, font size and
ConfigMacOSXBehaviors from everywhere.
NOTE: I have noticed a bug prior to that commit: if the font or font size
change while editing the same widget, the ImGuiInputTextState become invalid
and there is no code to handle this invalidation. Fixing this bug is out
of scope of current pull request.
# Conflicts:
# imgui_internal.h