MCPcopy Create free account
hub / github.com/Raais/ImStudio / DragIntRange2

Method DragIntRange2

src/third-party/imgui/imgui_widgets.cpp:2532–2562  ·  view source on GitHub ↗

NB: You likely want to specify the ImGuiSliderFlags_AlwaysClamp when using this.

Source from the content-addressed store, hash-verified

2530
2531// NB: You likely want to specify the ImGuiSliderFlags_AlwaysClamp when using this.
2532bool ImGui::DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed, int v_min, int v_max, const char* format, const char* format_max, ImGuiSliderFlags flags)
2533{
2534 ImGuiWindow* window = GetCurrentWindow();
2535 if (window->SkipItems)
2536 return false;
2537
2538 ImGuiContext& g = *GImGui;
2539 PushID(label);
2540 BeginGroup();
2541 PushMultiItemsWidths(2, CalcItemWidth());
2542
2543 int min_min = (v_min >= v_max) ? INT_MIN : v_min;
2544 int min_max = (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max);
2545 ImGuiSliderFlags min_flags = flags | ((min_min == min_max) ? ImGuiSliderFlags_ReadOnly : 0);
2546 bool value_changed = DragInt("##min", v_current_min, v_speed, min_min, min_max, format, min_flags);
2547 PopItemWidth();
2548 SameLine(0, g.Style.ItemInnerSpacing.x);
2549
2550 int max_min = (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min);
2551 int max_max = (v_min >= v_max) ? INT_MAX : v_max;
2552 ImGuiSliderFlags max_flags = flags | ((max_min == max_max) ? ImGuiSliderFlags_ReadOnly : 0);
2553 value_changed |= DragInt("##max", v_current_max, v_speed, max_min, max_max, format_max ? format_max : format, max_flags);
2554 PopItemWidth();
2555 SameLine(0, g.Style.ItemInnerSpacing.x);
2556
2557 TextEx(label, FindRenderedTextEnd(label));
2558 EndGroup();
2559 PopID();
2560
2561 return value_changed;
2562}
2563
2564#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
2565

Callers

nothing calls this directly

Calls 3

GetCurrentWindowFunction · 0.85
ImMinFunction · 0.85
ImMaxFunction · 0.85

Tested by

no test coverage detected