@ -1140,7 +1140,7 @@ ImGuiStyle::ImGuiStyle()
ItemInnerSpacing = ImVec2 ( 4 , 4 ) ; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
TouchExtraPadding = ImVec2 ( 0 , 0 ) ; // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
IndentSpacing = 21.0f ; // Horizontal spacing when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).
ColumnsMinSpacing = 6.0f ; // Minimum horizontal spacing between two columns
ColumnsMinSpacing = 6.0f ; // Minimum horizontal spacing between two columns . Preferably > (FramePadding.x + 1).
ScrollbarSize = 16.0f ; // Width of the vertical scrollbar, Height of the horizontal scrollbar
ScrollbarRounding = 9.0f ; // Radius of grab corners rounding for scrollbar
GrabMinSize = 10.0f ; // Minimum width/height of a grab box for slider/scrollbar
@ -5452,6 +5452,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window - > InnerClipRect . Min . y = ImFloor ( 0.5f + window - > InnerMainRect . Min . y ) ;
window - > InnerClipRect . Max . x = ImFloor ( 0.5f + window - > InnerMainRect . Max . x - ImMax ( 0.0f , ImFloor ( window - > WindowPadding . x * 0.5f - window - > WindowBorderSize ) ) ) ;
window - > InnerClipRect . Max . y = ImFloor ( 0.5f + window - > InnerMainRect . Max . y ) ;
// Setup drawing context
// (NB: That term "drawing context / DC" lost its meaning a long time ago. Initially was meant to hold transient data only. Nowadays difference between window-> and window->DC-> is dubious.)
window - > DC . Indent . x = 0.0f + window - > WindowPadding . x - window - > Scroll . x ;
@ -8434,12 +8435,12 @@ int ImGui::GetColumnsCount()
static float OffsetNormToPixels ( const ImGuiColumns * columns , float offset_norm )
{
return offset_norm * ( columns - > MaxX - columns - > MinX) ;
return offset_norm * ( columns - > Off MaxX - columns - > Off MinX) ;
}
static float PixelsToOffsetNorm ( const ImGuiColumns * columns , float offset )
{
return offset / ( columns - > MaxX - columns - > MinX) ;
return offset / ( columns - > Off MaxX - columns - > Off MinX) ;
}
static const float COLUMNS_HIT_RECT_HALF_WIDTH = 4.0f ;
@ -8472,7 +8473,7 @@ float ImGui::GetColumnOffset(int column_index)
IM_ASSERT ( column_index < columns - > Columns . Size ) ;
const float t = columns - > Columns [ column_index ] . OffsetNorm ;
const float x_offset = ImLerp ( columns - > MinX, columns - > MaxX, t ) ;
const float x_offset = ImLerp ( columns - > Off MinX, columns - > Off MaxX, t ) ;
return x_offset ;
}
@ -8515,8 +8516,8 @@ void ImGui::SetColumnOffset(int column_index, float offset)
const float width = preserve_width ? GetColumnWidthEx ( columns , column_index , columns - > IsBeingResized ) : 0.0f ;
if ( ! ( columns - > Flags & ImGuiColumnsFlags_NoForceWithinWindow ) )
offset = ImMin ( offset , columns - > MaxX - g . Style . ColumnsMinSpacing * ( columns - > Count - column_index ) ) ;
columns - > Columns [ column_index ] . OffsetNorm = PixelsToOffsetNorm ( columns , offset - columns - > MinX) ;
offset = ImMin ( offset , columns - > Off MaxX - g . Style . ColumnsMinSpacing * ( columns - > Count - column_index ) ) ;
columns - > Columns [ column_index ] . OffsetNorm = PixelsToOffsetNorm ( columns , offset - columns - > Off MinX) ;
if ( preserve_width )
SetColumnOffset ( column_index + 1 , offset + ImMax ( g . Style . ColumnsMinSpacing , width ) ) ;
@ -8551,7 +8552,7 @@ void ImGui::PushColumnsBackground()
ImGuiColumns * columns = window - > DC . CurrentColumns ;
window - > DrawList - > ChannelsSetCurrent ( 0 ) ;
int cmd_size = window - > DrawList - > CmdBuffer . Size ;
PushClipRect ( columns - > BackupClipRect. Min , columns - > Backup ClipRect. Max , false ) ;
PushClipRect ( columns - > HostClipRect. Min , columns - > Host ClipRect. Max , false ) ;
IM_ASSERT ( cmd_size = = window - > DrawList - > CmdBuffer . Size ) ; // Being in channel 0 this should not have created an ImDrawCmd
}
@ -8597,9 +8598,8 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlag
IM_ASSERT ( columns_count > = 1 ) ;
IM_ASSERT ( window - > DC . CurrentColumns = = NULL ) ; // Nested columns are currently not supported
ImGuiID id = GetColumnsID ( str_id , columns_count ) ;
// Acquire storage for the columns set
ImGuiID id = GetColumnsID ( str_id , columns_count ) ;
ImGuiColumns * columns = FindOrCreateColumns ( window , id ) ;
IM_ASSERT ( columns - > ID = = id ) ;
columns - > Current = 0 ;
@ -8609,11 +8609,11 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlag
// Set state for first column
const float content_region_width = ( window - > SizeContentsExplicit . x ! = 0.0f ) ? ( window - > SizeContentsExplicit . x ) : ( window - > InnerClipRect . Max . x - window - > Pos . x ) ;
columns - > MinX = window - > DC . Indent . x - g . Style . ItemSpacing . x ; // Lock our horizontal range
columns - > MaxX = ImMax ( content_region_width - window - > Scroll . x , columns - > MinX + 1.0f ) ;
columns - > Backup CursorPosY = window - > DC . CursorPos . y ;
columns - > Backup CursorMaxPosX = window - > DC . CursorMaxPos . x ;
columns - > Backup ClipRect = window - > ClipRect ;
columns - > Off MinX = window - > DC . Indent . x - g . Style . ItemSpacing . x ; // Lock our horizontal range
columns - > Off MaxX = ImMax ( content_region_width - window - > Scroll . x , columns - > Off MinX + 1.0f ) ;
columns - > Host CursorPosY = window - > DC . CursorPos . y ;
columns - > Host CursorMaxPosX = window - > DC . CursorMaxPos . x ;
columns - > Host ClipRect = window - > ClipRect ;
columns - > LineMinY = columns - > LineMaxY = window - > DC . CursorPos . y ;
window - > DC . ColumnsOffset . x = 0.0f ;
window - > DC . CursorPos . x = ( float ) ( int ) ( window - > Pos . x + window - > DC . Indent . x + window - > DC . ColumnsOffset . x ) ;
@ -8622,7 +8622,7 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlag
if ( columns - > Columns . Size ! = 0 & & columns - > Columns . Size ! = columns_count + 1 )
columns - > Columns . resize ( 0 ) ;
// Initialize default s
// Initialize default width s
columns - > IsFirstFrame = ( columns - > Columns . Size = = 0 ) ;
if ( columns - > Columns . Size = = 0 )
{
@ -8668,17 +8668,19 @@ void ImGui::EndColumns()
window - > DrawList - > ChannelsMerge ( ) ;
}
const ImGuiColumnsFlags flags = columns - > Flags ;
columns - > LineMaxY = ImMax ( columns - > LineMaxY , window - > DC . CursorPos . y ) ;
window - > DC . CursorPos . y = columns - > LineMaxY ;
if ( ! ( columns- > F lags & ImGuiColumnsFlags_GrowParentContentsSize ) )
window - > DC . CursorMaxPos . x = columns - > Backup CursorMaxPosX; // Restore cursor max pos, as columns don't grow parent
if ( ! ( f lags & ImGuiColumnsFlags_GrowParentContentsSize ) )
window - > DC . CursorMaxPos . x = columns - > Host CursorMaxPosX; // Restore cursor max pos, as columns don't grow parent
// Draw columns borders and handle resize
// The IsBeingResized flag ensure we preserve pre-resize columns width so back-and-forth are not lossy
bool is_being_resized = false ;
if ( ! ( columns- > F lags & ImGuiColumnsFlags_NoBorder ) & & ! window - > SkipItems )
if ( ! ( f lags & ImGuiColumnsFlags_NoBorder ) & & ! window - > SkipItems )
{
// We clip Y boundaries CPU side because very long triangles are mishandled by some GPU drivers.
const float y1 = ImMax ( columns - > Backup CursorPosY, window - > ClipRect . Min . y ) ;
const float y1 = ImMax ( columns - > Host CursorPosY, window - > ClipRect . Min . y ) ;
const float y2 = ImMin ( window - > DC . CursorPos . y , window - > ClipRect . Max . y ) ;
int dragging_column = - 1 ;
for ( int n = 1 ; n < columns - > Count ; n + + )
@ -8693,7 +8695,7 @@ void ImGui::EndColumns()
continue ;
bool hovered = false , held = false ;
if ( ! ( columns- > F lags & ImGuiColumnsFlags_NoResize ) )
if ( ! ( f lags & ImGuiColumnsFlags_NoResize ) )
{
ButtonBehavior ( column_hit_rect , column_id , & hovered , & held ) ;
if ( hovered | | held )
@ -8745,6 +8747,7 @@ void ImGui::Columns(int columns_count, const char* id, bool border)
BeginColumns ( id , columns_count , flags ) ;
}
//-----------------------------------------------------------------------------
// [SECTION] DRAG AND DROP
//-----------------------------------------------------------------------------
@ -9692,7 +9695,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
{
if ( ! ImGui : : TreeNode ( ( void * ) ( uintptr_t ) columns - > ID , " Columns Id: 0x%08X, Count: %d, Flags: 0x%04X " , columns - > ID , columns - > Count , columns - > Flags ) )
return ;
ImGui : : BulletText ( " Width: %.1f (MinX: %.1f, MaxX: %.1f) " , columns - > MaxX - columns - > MinX, columns - > MinX, columns - > MaxX) ;
ImGui : : BulletText ( " Width: %.1f (MinX: %.1f, MaxX: %.1f) " , columns - > Off MaxX - columns - > Off MinX, columns - > Off MinX, columns - > Off MaxX) ;
for ( int column_n = 0 ; column_n < columns - > Columns . Size ; column_n + + )
ImGui : : BulletText ( " Column %02d: OffsetNorm %.3f (= %.1f px) " , column_n , columns - > Columns [ column_n ] . OffsetNorm , OffsetNormToPixels ( columns , columns - > Columns [ column_n ] . OffsetNorm ) ) ;
ImGui : : TreePop ( ) ;