@ -320,7 +320,7 @@ void ImGui::LabelTextV(const char* label, const char* fmt, va_list args)
ImGuiContext & g = * GImGui ;
const ImGuiStyle & style = g . Style ;
const float w = GetNext ItemWidth( ) ;
const float w = Calc ItemWidth( ) ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const ImRect value_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w , label_size . y + style . FramePadding . y * 2 ) ) ;
@ -1091,7 +1091,7 @@ void ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* over
const ImGuiStyle & style = g . Style ;
ImVec2 pos = window - > DC . CursorPos ;
ImVec2 size = CalcItemSize ( size_arg , GetNext ItemWidth( ) , g . FontSize + style . FramePadding . y * 2.0f ) ;
ImVec2 size = CalcItemSize ( size_arg , Calc ItemWidth( ) , g . FontSize + style . FramePadding . y * 2.0f ) ;
ImRect bb ( pos , pos + size ) ;
ItemSize ( size , style . FramePadding . y ) ;
if ( ! ItemAdd ( bb , 0 ) )
@ -1364,7 +1364,7 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboF
const float arrow_size = ( flags & ImGuiComboFlags_NoArrowButton ) ? 0.0f : GetFrameHeight ( ) ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const float expected_w = GetNext ItemWidth( ) ;
const float expected_w = Calc ItemWidth( ) ;
const float w = ( flags & ImGuiComboFlags_NoPreview ) ? arrow_size : expected_w ;
const ImRect frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w , label_size . y + style . FramePadding . y * 2.0f ) ) ;
const ImRect total_bb ( frame_bb . Min , frame_bb . Max + ImVec2 ( label_size . x > 0.0f ? style . ItemInnerSpacing . x + label_size . x : 0.0f , 0.0f ) ) ;
@ -1991,8 +1991,7 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* v, floa
ImGuiContext & g = * GImGui ;
const ImGuiStyle & style = g . Style ;
const ImGuiID id = window - > GetID ( label ) ;
const float w = GetNextItemWidth ( ) ;
const float w = CalcItemWidth ( ) ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const ImRect frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w , label_size . y + style . FramePadding . y * 2.0f ) ) ;
const ImRect total_bb ( frame_bb . Min , frame_bb . Max + ImVec2 ( label_size . x > 0.0f ? style . ItemInnerSpacing . x + label_size . x : 0.0f , 0.0f ) ) ;
@ -2064,7 +2063,7 @@ bool ImGui::DragScalarN(const char* label, ImGuiDataType data_type, void* v, int
bool value_changed = false ;
BeginGroup ( ) ;
PushID ( label ) ;
PushMultiItemsWidths ( components , GetNext ItemWidth( ) ) ;
PushMultiItemsWidths ( components , Calc ItemWidth( ) ) ;
size_t type_size = GDataTypeInfo [ data_type ] . Size ;
for ( int i = 0 ; i < components ; i + + )
{
@ -2111,7 +2110,7 @@ bool ImGui::DragFloatRange2(const char* label, float* v_current_min, float* v_cu
ImGuiContext & g = * GImGui ;
PushID ( label ) ;
BeginGroup ( ) ;
PushMultiItemsWidths ( 2 , GetNext ItemWidth( ) ) ;
PushMultiItemsWidths ( 2 , Calc ItemWidth( ) ) ;
bool value_changed = DragFloat ( " ##min " , v_current_min , v_speed , ( v_min > = v_max ) ? - FLT_MAX : v_min , ( v_min > = v_max ) ? * v_current_max : ImMin ( v_max , * v_current_max ) , format , power ) ;
PopItemWidth ( ) ;
@ -2156,7 +2155,7 @@ bool ImGui::DragIntRange2(const char* label, int* v_current_min, int* v_current_
ImGuiContext & g = * GImGui ;
PushID ( label ) ;
BeginGroup ( ) ;
PushMultiItemsWidths ( 2 , GetNext ItemWidth( ) ) ;
PushMultiItemsWidths ( 2 , Calc ItemWidth( ) ) ;
bool value_changed = DragInt ( " ##min " , v_current_min , v_speed , ( v_min > = v_max ) ? INT_MIN : v_min , ( v_min > = v_max ) ? * v_current_max : ImMin ( v_max , * v_current_max ) , format ) ;
PopItemWidth ( ) ;
@ -2434,7 +2433,7 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* v, co
ImGuiContext & g = * GImGui ;
const ImGuiStyle & style = g . Style ;
const ImGuiID id = window - > GetID ( label ) ;
const float w = GetNext ItemWidth( ) ;
const float w = Calc ItemWidth( ) ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const ImRect frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w , label_size . y + style . FramePadding . y * 2.0f ) ) ;
@ -2512,7 +2511,7 @@ bool ImGui::SliderScalarN(const char* label, ImGuiDataType data_type, void* v, i
bool value_changed = false ;
BeginGroup ( ) ;
PushID ( label ) ;
PushMultiItemsWidths ( components , GetNext ItemWidth( ) ) ;
PushMultiItemsWidths ( components , Calc ItemWidth( ) ) ;
size_t type_size = GDataTypeInfo [ data_type ] . Size ;
for ( int i = 0 ; i < components ; i + + )
{
@ -2800,7 +2799,7 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* data_p
BeginGroup ( ) ; // The only purpose of the group here is to allow the caller to query item data e.g. IsItemActive()
PushID ( label ) ;
SetNextItemWidth ( ImMax ( 1.0f , GetNext ItemWidth( ) - ( button_size + style . ItemInnerSpacing . x ) * 2 ) ) ;
SetNextItemWidth ( ImMax ( 1.0f , Calc ItemWidth( ) - ( button_size + style . ItemInnerSpacing . x ) * 2 ) ) ;
if ( InputText ( " " , buf , IM_ARRAYSIZE ( buf ) , flags ) ) // PushId(label) + "" gives us the expected ID from outside point of view
value_changed = DataTypeApplyOpFromText ( buf , g . InputTextState . InitialTextA . Data , data_type , data_ptr , format ) ;
@ -2848,7 +2847,7 @@ bool ImGui::InputScalarN(const char* label, ImGuiDataType data_type, void* v, in
bool value_changed = false ;
BeginGroup ( ) ;
PushID ( label ) ;
PushMultiItemsWidths ( components , GetNext ItemWidth( ) ) ;
PushMultiItemsWidths ( components , Calc ItemWidth( ) ) ;
size_t type_size = GDataTypeInfo [ data_type ] . Size ;
for ( int i = 0 ; i < components ; i + + )
{
@ -3298,7 +3297,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
BeginGroup ( ) ;
const ImGuiID id = window - > GetID ( label ) ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
ImVec2 size = CalcItemSize ( size_arg , GetNext ItemWidth( ) , ( is_multiline ? GetTextLineHeight ( ) * 8.0f : label_size . y ) + style . FramePadding . y * 2.0f ) ; // Arbitrary default of 8 lines high for multi-line
ImVec2 size = CalcItemSize ( size_arg , Calc ItemWidth( ) , ( is_multiline ? GetTextLineHeight ( ) * 8.0f : label_size . y ) + style . FramePadding . y * 2.0f ) ; // Arbitrary default of 8 lines high for multi-line
const ImRect frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + size ) ;
const ImRect total_bb ( frame_bb . Min , frame_bb . Max + ImVec2 ( label_size . x > 0.0f ? ( style . ItemInnerSpacing . x + label_size . x ) : 0.0f , 0.0f ) ) ;
@ -4056,8 +4055,9 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
const ImGuiStyle & style = g . Style ;
const float square_sz = GetFrameHeight ( ) ;
const float w_extra = ( flags & ImGuiColorEditFlags_NoSmallPreview ) ? 0.0f : ( square_sz + style . ItemInnerSpacing . x ) ;
const float w_items_all = GetNext ItemWidth( ) - w_extra ;
const float w_items_all = Calc ItemWidth( ) - w_extra ;
const char * label_display_end = FindRenderedTextEnd ( label ) ;
g . NextItemData . ClearFlags ( ) ;
BeginGroup ( ) ;
PushID ( label ) ;
@ -4337,6 +4337,9 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
ImGuiStyle & style = g . Style ;
ImGuiIO & io = g . IO ;
const float width = CalcItemWidth ( ) ;
g . NextItemData . ClearFlags ( ) ;
PushID ( label ) ;
BeginGroup ( ) ;
@ -4363,7 +4366,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
ImVec2 picker_pos = window - > DC . CursorPos ;
float square_sz = GetFrameHeight ( ) ;
float bars_width = square_sz ; // Arbitrary smallish width of Hue/Alpha picking bars
float sv_picker_size = ImMax ( bars_width * 1 , GetNextItemWidth( ) - ( alpha_bar ? 2 : 1 ) * ( bars_width + style . ItemInnerSpacing . x ) ) ; // Saturation/Value picking box
float sv_picker_size = ImMax ( bars_width * 1 , width - ( alpha_bar ? 2 : 1 ) * ( bars_width + style . ItemInnerSpacing . x ) ) ; // Saturation/Value picking box
float bar0_pos_x = picker_pos . x + sv_picker_size + style . ItemInnerSpacing . x ;
float bar1_pos_x = bar0_pos_x + bars_width + style . ItemInnerSpacing . x ;
float bars_triangles_half_sz = ( float ) ( int ) ( bars_width * 0.20f ) ;
@ -5255,6 +5258,7 @@ float ImGui::GetTreeNodeToLabelSpacing()
return g . FontSize + ( g . Style . FramePadding . x * 2.0f ) ;
}
// Set next TreeNode/CollapsingHeader open state.
void ImGui : : SetNextItemOpen ( bool is_open , ImGuiCond cond )
{
ImGuiContext & g = * GImGui ;
@ -5452,20 +5456,22 @@ bool ImGui::Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags
// Tip: To have a list filling the entire window width, PushItemWidth(-1) and pass an non-visible label e.g. "##empty"
bool ImGui : : ListBoxHeader ( const char * label , const ImVec2 & size_arg )
{
ImGuiContext & g = * GImGui ;
ImGuiWindow * window = GetCurrentWindow ( ) ;
if ( window - > SkipItems )
return false ;
const ImGuiStyle & style = GetStyle( ) ;
const ImGuiStyle & style = g. Style ;
const ImGuiID id = GetID ( label ) ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
// Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar.
ImVec2 size = CalcItemSize ( size_arg , GetNext ItemWidth( ) , GetTextLineHeightWithSpacing ( ) * 7.4f + style . ItemSpacing . y ) ;
ImVec2 size = CalcItemSize ( size_arg , Calc ItemWidth( ) , GetTextLineHeightWithSpacing ( ) * 7.4f + style . ItemSpacing . y ) ;
ImVec2 frame_size = ImVec2 ( size . x , ImMax ( size . y , label_size . y ) ) ;
ImRect frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + frame_size ) ;
ImRect bb ( frame_bb . Min , frame_bb . Max + ImVec2 ( label_size . x > 0.0f ? style . ItemInnerSpacing . x + label_size . x : 0.0f , 0.0f ) ) ;
window - > DC . LastItemRect = bb ; // Forward storage for ListBoxFooter.. dodgy.
g . NextItemData . ClearFlags ( ) ;
if ( ! IsRectVisible ( bb . Min , bb . Max ) )
{
@ -5578,7 +5584,7 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
if ( frame_size . x = = 0.0f )
frame_size . x = GetNext ItemWidth( ) ;
frame_size . x = Calc ItemWidth( ) ;
if ( frame_size . y = = 0.0f )
frame_size . y = label_size . y + ( style . FramePadding . y * 2 ) ;