@ -7930,7 +7930,7 @@ static float GetDraggedColumnOffset(ImGuiColumns* columns, int column_index)
float x = g . IO . MousePos . x - g . ActiveIdClickOffset . x + COLUMNS_HIT_RECT_HALF_WIDTH - window - > Pos . x ;
float x = g . IO . MousePos . x - g . ActiveIdClickOffset . x + COLUMNS_HIT_RECT_HALF_WIDTH - window - > Pos . x ;
x = ImMax ( x , ImGui : : GetColumnOffset ( column_index - 1 ) + g . Style . ColumnsMinSpacing ) ;
x = ImMax ( x , ImGui : : GetColumnOffset ( column_index - 1 ) + g . Style . ColumnsMinSpacing ) ;
if ( ( columns - > Flags & ImGui Columns Flags_NoPreserveWidths) )
if ( ( columns - > Flags & ImGui Old ColumnFlags_NoPreserveWidths) )
x = ImMin ( x , ImGui : : GetColumnOffset ( column_index + 1 ) - g . Style . ColumnsMinSpacing ) ;
x = ImMin ( x , ImGui : : GetColumnOffset ( column_index + 1 ) - g . Style . ColumnsMinSpacing ) ;
return x ;
return x ;
@ -7989,10 +7989,10 @@ void ImGui::SetColumnOffset(int column_index, float offset)
column_index = columns - > Current ;
column_index = columns - > Current ;
IM_ASSERT ( column_index < columns - > Columns . Size ) ;
IM_ASSERT ( column_index < columns - > Columns . Size ) ;
const bool preserve_width = ! ( columns - > Flags & ImGui Columns Flags_NoPreserveWidths) & & ( column_index < columns - > Count - 1 ) ;
const bool preserve_width = ! ( columns - > Flags & ImGui Old ColumnFlags_NoPreserveWidths) & & ( column_index < columns - > Count - 1 ) ;
const float width = preserve_width ? GetColumnWidthEx ( columns , column_index , columns - > IsBeingResized ) : 0.0f ;
const float width = preserve_width ? GetColumnWidthEx ( columns , column_index , columns - > IsBeingResized ) : 0.0f ;
if ( ! ( columns - > Flags & ImGui Columns Flags_NoForceWithinWindow) )
if ( ! ( columns - > Flags & ImGui Old ColumnFlags_NoForceWithinWindow) )
offset = ImMin ( offset , columns - > OffMaxX - g . Style . ColumnsMinSpacing * ( columns - > Count - column_index ) ) ;
offset = ImMin ( offset , columns - > OffMaxX - g . Style . ColumnsMinSpacing * ( columns - > Count - column_index ) ) ;
columns - > Columns [ column_index ] . OffsetNorm = GetColumnNormFromOffset ( columns , offset - columns - > OffMinX ) ;
columns - > Columns [ column_index ] . OffsetNorm = GetColumnNormFromOffset ( columns , offset - columns - > OffMinX ) ;
@ -8074,7 +8074,7 @@ ImGuiID ImGui::GetColumnsID(const char* str_id, int columns_count)
return id ;
return id ;
}
}
void ImGui : : BeginColumns ( const char * str_id , int columns_count , ImGui Columns Flags flags )
void ImGui : : BeginColumns ( const char * str_id , int columns_count , ImGui Old ColumnFlags flags )
{
{
ImGuiContext & g = * GImGui ;
ImGuiContext & g = * GImGui ;
ImGuiWindow * window = GetCurrentWindow ( ) ;
ImGuiWindow * window = GetCurrentWindow ( ) ;
@ -8220,16 +8220,16 @@ void ImGui::EndColumns()
columns - > Splitter . Merge ( window - > DrawList ) ;
columns - > Splitter . Merge ( window - > DrawList ) ;
}
}
const ImGui Columns Flags flags = columns - > Flags ;
const ImGui Old ColumnFlags flags = columns - > Flags ;
columns - > LineMaxY = ImMax ( columns - > LineMaxY , window - > DC . CursorPos . y ) ;
columns - > LineMaxY = ImMax ( columns - > LineMaxY , window - > DC . CursorPos . y ) ;
window - > DC . CursorPos . y = columns - > LineMaxY ;
window - > DC . CursorPos . y = columns - > LineMaxY ;
if ( ! ( flags & ImGui Columns Flags_GrowParentContentsSize) )
if ( ! ( flags & ImGui Old ColumnFlags_GrowParentContentsSize) )
window - > DC . CursorMaxPos . x = columns - > HostCursorMaxPosX ; // Restore cursor max pos, as columns don't grow parent
window - > DC . CursorMaxPos . x = columns - > HostCursorMaxPosX ; // Restore cursor max pos, as columns don't grow parent
// Draw columns borders and handle resize
// Draw columns borders and handle resize
// The IsBeingResized flag ensure we preserve pre-resize columns width so back-and-forth are not lossy
// The IsBeingResized flag ensure we preserve pre-resize columns width so back-and-forth are not lossy
bool is_being_resized = false ;
bool is_being_resized = false ;
if ( ! ( flags & ImGui Columns Flags_NoBorder) & & ! window - > SkipItems )
if ( ! ( flags & ImGui Old ColumnFlags_NoBorder) & & ! window - > SkipItems )
{
{
// We clip Y boundaries CPU side because very long triangles are mishandled by some GPU drivers.
// We clip Y boundaries CPU side because very long triangles are mishandled by some GPU drivers.
const float y1 = ImMax ( columns - > HostCursorPosY , window - > ClipRect . Min . y ) ;
const float y1 = ImMax ( columns - > HostCursorPosY , window - > ClipRect . Min . y ) ;
@ -8247,12 +8247,12 @@ void ImGui::EndColumns()
continue ;
continue ;
bool hovered = false , held = false ;
bool hovered = false , held = false ;
if ( ! ( flags & ImGui Columns Flags_NoResize) )
if ( ! ( flags & ImGui Old ColumnFlags_NoResize) )
{
{
ButtonBehavior ( column_hit_rect , column_id , & hovered , & held ) ;
ButtonBehavior ( column_hit_rect , column_id , & hovered , & held ) ;
if ( hovered | | held )
if ( hovered | | held )
g . MouseCursor = ImGuiMouseCursor_ResizeEW ;
g . MouseCursor = ImGuiMouseCursor_ResizeEW ;
if ( held & & ! ( column - > Flags & ImGui Columns Flags_NoResize) )
if ( held & & ! ( column - > Flags & ImGui Old ColumnFlags_NoResize) )
dragging_column = n ;
dragging_column = n ;
}
}
@ -8282,14 +8282,13 @@ void ImGui::EndColumns()
window - > DC . CursorPos . x = IM_FLOOR ( window - > Pos . x + window - > DC . Indent . x + window - > DC . ColumnsOffset . x ) ;
window - > DC . CursorPos . x = IM_FLOOR ( window - > Pos . x + window - > DC . Indent . x + window - > DC . ColumnsOffset . x ) ;
}
}
// [2018-03: This is currently the only public API, while we are working on making BeginColumns/EndColumns user-facing]
void ImGui : : Columns ( int columns_count , const char * id , bool border )
void ImGui : : Columns ( int columns_count , const char * id , bool border )
{
{
ImGuiWindow * window = GetCurrentWindow ( ) ;
ImGuiWindow * window = GetCurrentWindow ( ) ;
IM_ASSERT ( columns_count > = 1 ) ;
IM_ASSERT ( columns_count > = 1 ) ;
ImGui Columns Flags flags = ( border ? 0 : ImGui Columns Flags_NoBorder) ;
ImGui Old ColumnFlags flags = ( border ? 0 : ImGui Old ColumnFlags_NoBorder) ;
//flags |= ImGui Columns Flags_NoPreserveWidths; // NB: Legacy behavior
//flags |= ImGui Old ColumnFlags_NoPreserveWidths; // NB: Legacy behavior
ImGuiColumns * columns = window - > DC . CurrentColumns ;
ImGuiColumns * columns = window - > DC . CurrentColumns ;
if ( columns ! = NULL & & columns - > Count = = columns_count & & columns - > Flags = = flags )
if ( columns ! = NULL & & columns - > Count = = columns_count & & columns - > Flags = = flags )
return ;
return ;