MCPcopy Create free account
hub / github.com/Wemino/MarkerPatch / DragIntRange2

Method DragIntRange2

include/imgui/imgui_widgets.cpp:2919–2949  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2917
2918// NB: You likely want to specify the ImGuiSliderFlags_AlwaysClamp when using this.
2919bool 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)
2920{
2921 ImGuiWindow* window = GetCurrentWindow();
2922 if (window->SkipItems)
2923 return false;
2924
2925 ImGuiContext& g = *GImGui;
2926 PushID(label);
2927 BeginGroup();
2928 PushMultiItemsWidths(2, CalcItemWidth());
2929
2930 int min_min = (v_min >= v_max) ? INT_MIN : v_min;
2931 int min_max = (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max);
2932 ImGuiSliderFlags min_flags = flags | ((min_min == min_max) ? ImGuiSliderFlags_ReadOnly : 0);
2933 bool value_changed = DragInt("##min", v_current_min, v_speed, min_min, min_max, format, min_flags);
2934 PopItemWidth();
2935 SameLine(0, g.Style.ItemInnerSpacing.x);
2936
2937 int max_min = (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min);
2938 int max_max = (v_min >= v_max) ? INT_MAX : v_max;
2939 ImGuiSliderFlags max_flags = flags | ((max_min == max_max) ? ImGuiSliderFlags_ReadOnly : 0);
2940 value_changed |= DragInt("##max", v_current_max, v_speed, max_min, max_max, format_max ? format_max : format, max_flags);
2941 PopItemWidth();
2942 SameLine(0, g.Style.ItemInnerSpacing.x);
2943
2944 TextEx(label, FindRenderedTextEnd(label));
2945 EndGroup();
2946 PopID();
2947
2948 return value_changed;
2949}
2950
2951//-------------------------------------------------------------------------
2952// [SECTION] Widgets: SliderScalar, SliderFloat, SliderInt, etc.

Callers

nothing calls this directly

Calls 3

GetCurrentWindowFunction · 0.85
ImMinFunction · 0.85
ImMaxFunction · 0.85

Tested by

no test coverage detected