mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57:00 +00:00
CheckboxFlags: Display mixed-value/tristate marker when passed flags that have multiple bits set and stored value matches neither zero neither the full set.
This commit is contained in:
parent
4fd43a8b64
commit
12d9505534
@ -39,12 +39,12 @@ Breaking Changes:
|
||||
|
||||
- Fonts: Removed ImFont::DisplayOffset in favor of ImFontConfig::GlyphOffset. DisplayOffset was applied
|
||||
after scaling and not very meaningful/useful outside of being needed by the default ProggyClean font.
|
||||
It was also getting in the way of better font scaling, so let's get rid of it now!
|
||||
It was also getting in the way of better font scaling, so let's get rid of it now!
|
||||
If you used DisplayOffset it was probably in association to rasterizing a font at a specific size,
|
||||
in which case the corresponding offset may be reported into GlyphOffset. (#1619)
|
||||
- ImGuiListClipper: Renamed constructor parameters which created an ambiguous alternative to using
|
||||
- ImGuiListClipper: Renamed constructor parameters which created an ambiguous alternative to using
|
||||
the ImGuiListClipper::Begin() function, with misleading edge cases. Always use ImGuiListClipper::Begin()!
|
||||
Kept inline redirection function (will obsolete).
|
||||
Kept inline redirection function (will obsolete).
|
||||
(note: imgui_memory_editor <0.40 from imgui_club/ used this old clipper API. Update your copy if needed).
|
||||
- Style: Renamed style.TabMinWidthForUnselectedCloseButton to style.TabMinWidthForCloseButton.
|
||||
- Renamed ImGuiSliderFlags_ClampOnInput to ImGuiSliderFlags_AlwaysClamp. Kept redirection enum (will obsolete).
|
||||
@ -72,7 +72,7 @@ Other Changes:
|
||||
- InputText: Fixed cursor being partially covered after using Ctrl+End key.
|
||||
- InputText: Fixed callback's helper DeleteChars() function when cursor is inside the deleted block. (#3454)
|
||||
- InputText: Made pressing Down arrow on the last line when it doesn't have a carriage return not move to
|
||||
the end of the line (so it is consistent with Up arrow, and behave same as Notepad and Visual Studio.
|
||||
the end of the line (so it is consistent with Up arrow, and behave same as Notepad and Visual Studio.
|
||||
Note that some other text editors instead would move the crusor to the end of the line). [@Xipiryon]
|
||||
- DragFloat, DragScalar: Fixed ImGuiSliderFlags_ClampOnInput not being honored in the special case
|
||||
where v_min == v_max. (#3361)
|
||||
@ -80,6 +80,8 @@ Other Changes:
|
||||
with signed and unsigned types. Added reverse Sliders to Demo. (#3432, #3449) [@rokups]
|
||||
- Text: Bypass unnecessary formatting when using the TextColored()/TextWrapped()/TextDisabled() helpers
|
||||
with a "%s" format string. (#3466)
|
||||
- CheckboxFlags: Display mixed-value/tristate marker when passed flags that have multiple bits set and
|
||||
stored value matches neither zero neither the full set.
|
||||
- BeginMenuBar: Fixed minor bug where CursorPosMax gets pushed to CursorPos prior to calling BeginMenuBar(),
|
||||
so e.g. calling the function at the end of a window would often add +ItemSpacing.y to scrolling range.
|
||||
- TreeNode, CollapsingHeader: Made clicking on arrow toggle toggle the open state on the Mouse Down event
|
||||
@ -87,7 +89,7 @@ Other Changes:
|
||||
and amends the change done in 1.76 which only affected cases were _OpenOnArrow flag was set.
|
||||
(This is also necessary to support full multi/range-select/drag and drop operations.)
|
||||
- Tab Bar: Added TabItemButton() to submit tab that behave like a button. (#3291) [@Xipiryon]
|
||||
- Tab Bar: Added ImGuiTabItemFlags_Leading and ImGuiTabItemFlags_Trailing flags to position tabs or button
|
||||
- Tab Bar: Added ImGuiTabItemFlags_Leading and ImGuiTabItemFlags_Trailing flags to position tabs or button
|
||||
at either end of the tab bar. Those tabs won't be part of the scrolling region, and when reordering cannot
|
||||
be moving outside of their section. Most often used with TabItemButton(). (#3291) [@Xipiryon]
|
||||
- Tab Bar: Added ImGuiTabItemFlags_NoReorder flag to disable reordering a given tab.
|
||||
@ -104,7 +106,7 @@ Other Changes:
|
||||
- Fonts: AddFontDefault() adjust its vertical offset based on floor(size/13) instead of always +1.
|
||||
- Metrics: Various tweaks, listing windows front-to-back, greying inactive items when possible.
|
||||
- Demo: Add simple InputText() callbacks demo (aside from the more elaborate ones in 'Examples->Console').
|
||||
- Backends: OpenGL3: Fix to avoid compiling/calling glBindSampler() on ES or pre 3.3 contexts which have
|
||||
- Backends: OpenGL3: Fix to avoid compiling/calling glBindSampler() on ES or pre 3.3 contexts which have
|
||||
the defines set by a loader. (#3467, #1985) [@jjwebb]
|
||||
- Backends: Vulkan: Some internal refactor aimed at allowing multi-viewport feature to create their
|
||||
own render pass. (#3455, #3459) [@FunMiles]
|
||||
|
@ -1071,7 +1071,8 @@ bool ImGui::Checkbox(const char* label, bool* v)
|
||||
RenderNavHighlight(total_bb, id);
|
||||
RenderFrame(check_bb.Min, check_bb.Max, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding);
|
||||
ImU32 check_col = GetColorU32(ImGuiCol_CheckMark);
|
||||
if (window->DC.ItemFlags & ImGuiItemFlags_MixedValue)
|
||||
bool mixed_value = (window->DC.ItemFlags & ImGuiItemFlags_MixedValue) != 0;
|
||||
if (mixed_value)
|
||||
{
|
||||
// Undocumented tristate/mixed/indeterminate checkbox (#2644)
|
||||
ImVec2 pad(ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)), ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)));
|
||||
@ -1084,7 +1085,7 @@ bool ImGui::Checkbox(const char* label, bool* v)
|
||||
}
|
||||
|
||||
if (g.LogEnabled)
|
||||
LogRenderedText(&total_bb.Min, *v ? "[x]" : "[ ]");
|
||||
LogRenderedText(&total_bb.Min, mixed_value ? "[~]" : *v ? "[x]" : "[ ]");
|
||||
if (label_size.x > 0.0f)
|
||||
RenderText(ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y), label);
|
||||
|
||||
@ -1095,7 +1096,21 @@ bool ImGui::Checkbox(const char* label, bool* v)
|
||||
bool ImGui::CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value)
|
||||
{
|
||||
bool v = ((*flags & flags_value) == flags_value);
|
||||
bool pressed = Checkbox(label, &v);
|
||||
bool pressed;
|
||||
if (v == false && (*flags & flags_value) != 0)
|
||||
{
|
||||
// Mixed value (FIXME: find a way to expose neatly to Checkbox?)
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
const ImGuiItemFlags backup_item_flags = window->DC.ItemFlags;
|
||||
window->DC.ItemFlags |= ImGuiItemFlags_MixedValue;
|
||||
pressed = Checkbox(label, &v);
|
||||
window->DC.ItemFlags = backup_item_flags;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Regular checkbox
|
||||
pressed = Checkbox(label, &v);
|
||||
}
|
||||
if (pressed)
|
||||
{
|
||||
if (v)
|
||||
|
Loading…
Reference in New Issue
Block a user