@ -251,7 +251,7 @@
ISSUES & TODO - LIST
= = = = = = = = = = = = = = = = = =
- misc : merge or clarify ImVec4 / Im GuiAabb , they are essentially duplicate containers
- misc : merge or clarify ImVec4 / Im Rect , they are essentially duplicate containers
- window : add horizontal scroll
- window : fix resize grip rendering scaling along with Rounding style setting
- window : autofit feedback loop when user relies on any dynamic layout ( window width multiplier , column ) . maybe just clearly drop manual autofit ?
@ -415,16 +415,16 @@ using namespace IMGUI_STB_NAMESPACE;
// Forward Declarations
//-------------------------------------------------------------------------
struct ImRect ;
struct ImGuiColMod ;
struct ImGuiStyleMod ;
struct ImGuiAabb ;
struct ImGuiDrawContext ;
struct ImGuiTextEditState ;
struct ImGuiIniData ;
struct ImGuiState ;
struct ImGuiWindow ;
static bool ButtonBehavior ( const Im GuiAabb & bb , ImGuiID id , bool * out_hovered , bool * out_held , bool allow_key_modifiers , bool repeat = false , bool pressed_on_click = false ) ;
static bool ButtonBehavior ( const Im Rect & bb , ImGuiID id , bool * out_hovered , bool * out_held , bool allow_key_modifiers , bool repeat = false , bool pressed_on_click = false ) ;
static void LogText ( const ImVec2 & ref_pos , const char * text , const char * text_end = NULL ) ;
static void RenderText ( ImVec2 pos , const char * text , const char * text_end = NULL , bool hide_text_after_hash = true ) ;
@ -434,13 +434,13 @@ static void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool
static void RenderCollapseTriangle ( ImVec2 p_min , bool opened , float scale = 1.0f , bool shadow = false ) ;
static void SetFont ( ImFont * font ) ;
static bool ItemAdd ( const Im GuiAabb & bb , const ImGuiID * id ) ;
static bool ItemAdd ( const Im Rect & bb , const ImGuiID * id ) ;
static void ItemSize ( ImVec2 size , float text_offset_y = 0.0f ) ;
static void ItemSize ( const Im GuiAabb & bb , float text_offset_y = 0.0f ) ;
static void ItemSize ( const Im Rect & bb , float text_offset_y = 0.0f ) ;
static void PushColumnClipRect ( int column_index = - 1 ) ;
static bool IsClipped ( const Im GuiAabb & bb ) ;
static bool IsClipped ( const Im Rect & bb ) ;
static bool IsMouseHoveringRect ( const Im GuiAabb & bb ) ;
static bool IsMouseHoveringRect ( const Im Rect & bb ) ;
static bool IsKeyPressedMap ( ImGuiKey key , bool repeat = true ) ;
static void Scrollbar ( ImGuiWindow * window ) ;
@ -877,32 +877,33 @@ struct ImGuiStyleMod // Style modifier, backup of modified data so we can res
ImVec2 PreviousValue ;
} ;
struct Im GuiAabb // 2D axis aligned bounding-box
struct Im Rect // 2D axis aligned bounding-box
{
ImVec2 Min ;
ImVec2 Max ;
Im GuiAabb( ) { Min = ImVec2 ( FLT_MAX , FLT_MAX ) ; Max = ImVec2 ( - FLT_MAX , - FLT_MAX ) ; }
Im GuiAabb ( const ImVec2 & min , const ImVec2 & max ) { Min = min ; Max = max ; }
Im GuiAabb ( const ImVec4 & v ) { Min . x = v . x ; Min . y = v . y ; Max . x = v . z ; Max . y = v . w ; }
Im GuiAabb ( float x1 , float y1 , float x2 , float y2 ) { Min . x = x1 ; Min . y = y1 ; Max . x = x2 ; Max . y = y2 ; }
ImVec2 GetCenter ( ) const { return Min + ( Max - Min ) * 0.5f ; }
ImVec2 GetSize ( ) const { return Max - Min ; }
float GetWidth ( ) const { return ( Max - Min ) . x ; }
float GetHeight ( ) const { return ( Max - Min ) . y ; }
ImVec2 GetTL ( ) const { return Min ; }
ImVec2 GetTR ( ) const { return ImVec2 ( Max . x , Min . y ) ; }
ImVec2 GetBL ( ) const { return ImVec2 ( Min . x , Max . y ) ; }
ImVec2 GetBR ( ) const { return Max ; }
bool Contains ( const ImVec2 & p ) const { return p . x > = Min . x & & p . y > = Min . y & & p . x < = Max . x & & p . y < = Max . y ; }
bool Contains ( const Im GuiAabb& r ) const { return r . Min . x > = Min . x & & r . Min . y > = Min . y & & r . Max . x < = Max . x & & r . Max . y < = Max . y ; }
bool Overlaps ( const Im GuiAabb& r ) const { return r . Min . y < = Max . y & & r . Max . y > = Min . y & & r . Min . x < = Max . x & & r . Max . x > = Min . x ; }
void Add ( const ImVec2 & rhs ) { Min . x = ImMin ( Min . x , rhs . x ) ; Min . y = ImMin ( Min . y , rhs . y ) ; Max . x = ImMax ( Max . x , rhs . x ) ; Max . y = ImMax ( Max . x , rhs . x ) ; }
void Add ( const Im GuiAabb& rhs ) { Min . x = ImMin ( Min . x , rhs . Min . x ) ; Min . y = ImMin ( Min . y , rhs . Min . y ) ; Max . x = ImMax ( Max . x , rhs . Max . x ) ; Max . y = ImMax ( Max . y , rhs . Max . y ) ; }
void Expand ( const ImVec2 & sz ) { Min - = sz ; Max + = sz ; }
void Clip ( const Im GuiAabb& clip ) { Min . x = ImMax ( Min . x , clip . Min . x ) ; Min . y = ImMax ( Min . y , clip . Min . y ) ; Max . x = ImMin ( Max . x , clip . Max . x ) ; Max . y = ImMin ( Max . y , clip . Max . y ) ; }
Im Rect( ) { Min = ImVec2 ( FLT_MAX , FLT_MAX ) ; Max = ImVec2 ( - FLT_MAX , - FLT_MAX ) ; }
Im Rect ( const ImVec2 & min , const ImVec2 & max ) { Min = min ; Max = max ; }
Im Rect ( const ImVec4 & v ) { Min . x = v . x ; Min . y = v . y ; Max . x = v . z ; Max . y = v . w ; }
Im Rect ( float x1 , float y1 , float x2 , float y2 ) { Min . x = x1 ; Min . y = y1 ; Max . x = x2 ; Max . y = y2 ; }
ImVec2 GetCenter ( ) const { return Min + ( Max - Min ) * 0.5f ; }
ImVec2 GetSize ( ) const { return Max - Min ; }
float GetWidth ( ) const { return ( Max - Min ) . x ; }
float GetHeight ( ) const { return ( Max - Min ) . y ; }
ImVec2 GetTL ( ) const { return Min ; }
ImVec2 GetTR ( ) const { return ImVec2 ( Max . x , Min . y ) ; }
ImVec2 GetBL ( ) const { return ImVec2 ( Min . x , Max . y ) ; }
ImVec2 GetBR ( ) const { return Max ; }
bool Contains ( const ImVec2 & p ) const { return p . x > = Min . x & & p . y > = Min . y & & p . x < = Max . x & & p . y < = Max . y ; }
bool Contains ( const Im Rect& r ) const { return r . Min . x > = Min . x & & r . Min . y > = Min . y & & r . Max . x < = Max . x & & r . Max . y < = Max . y ; }
bool Overlaps ( const Im Rect& r ) const { return r . Min . y < = Max . y & & r . Max . y > = Min . y & & r . Min . x < = Max . x & & r . Max . x > = Min . x ; }
void Add ( const ImVec2 & rhs ) { Min . x = ImMin ( Min . x , rhs . x ) ; Min . y = ImMin ( Min . y , rhs . y ) ; Max . x = ImMax ( Max . x , rhs . x ) ; Max . y = ImMax ( Max . x , rhs . x ) ; }
void Add ( const Im Rect& rhs ) { Min . x = ImMin ( Min . x , rhs . Min . x ) ; Min . y = ImMin ( Min . y , rhs . Min . y ) ; Max . x = ImMax ( Max . x , rhs . Max . x ) ; Max . y = ImMax ( Max . y , rhs . Max . y ) ; }
void Expand ( const ImVec2 & sz ) { Min - = sz ; Max + = sz ; }
void Clip ( const Im Rect& clip ) { Min . x = ImMax ( Min . x , clip . Min . x ) ; Min . y = ImMax ( Min . y , clip . Min . y ) ; Max . x = ImMin ( Max . x , clip . Max . x ) ; Max . y = ImMin ( Max . y , clip . Max . y ) ; }
} ;
typedef ImRect ImGuiAabb ; // FIXME-OBSOLETE
struct ImGuiGroupData
{
@ -928,7 +929,7 @@ struct ImGuiDrawContext
float LogLinePosY ;
int TreeDepth ;
ImGuiID LastItemID ;
Im GuiAabb LastItemAabb ;
Im Rect LastItemRect ;
bool LastItemHovered ;
ImVector < ImGuiWindow * > ChildWindows ;
ImVector < bool > AllowKeyboardFocus ;
@ -957,7 +958,7 @@ struct ImGuiDrawContext
LogLinePosY = - 1.0f ;
TreeDepth = 0 ;
LastItemID = 0 ;
LastItem Aabb = ImGuiAabb ( 0.0f , 0.0f , 0.0f , 0.0f ) ;
LastItem Rect = ImRect ( 0.0f , 0.0f , 0.0f , 0.0f ) ;
LastItemHovered = false ;
StateStorage = NULL ;
@ -1165,7 +1166,7 @@ struct ImGuiWindow
ImGuiDrawContext DC ; // Temporary per-window data, reset at the beginning of the frame
ImVector < ImGuiID > IDStack ; // ID stack. ID are hashes seeded with the value at the top of the stack
ImVector < ImVec4 > ClipRectStack ; // Scissoring / clipping rectangle. x1, y1, x2, y2.
Im GuiAabb ClippedAabb ; // = ClipRectStack.front() after setup in Begin()
Im Rect ClippedRect ; // = ClipRectStack.front() after setup in Begin()
int LastFrameDrawn ;
float ItemWidthDefault ;
ImGuiStorage StateStorage ;
@ -1192,12 +1193,12 @@ public:
bool FocusItemRegister ( bool is_active , bool tab_stop = true ) ; // Return true if focus is requested
void FocusItemUnregister ( ) ;
Im GuiAabb Aabb ( ) const { return Im GuiAabb ( Pos , Pos + Size ) ; }
Im Rect Aabb ( ) const { return Im Rect ( Pos , Pos + Size ) ; }
ImFont * Font ( ) const { return GImGui - > Font ; }
float FontSize ( ) const { return GImGui - > FontSize * FontWindowScale ; }
ImVec2 CursorPos ( ) const { return DC . CursorPos ; }
float TitleBarHeight ( ) const { return ( Flags & ImGuiWindowFlags_NoTitleBar ) ? 0 : FontSize ( ) + GImGui - > Style . FramePadding . y * 2.0f ; }
Im GuiAabb TitleBarAabb ( ) const { return Im GuiAabb ( Pos , Pos + ImVec2 ( SizeFull . x , TitleBarHeight ( ) ) ) ; }
Im Rect TitleBarAabb ( ) const { return Im Rect ( Pos , Pos + ImVec2 ( SizeFull . x , TitleBarHeight ( ) ) ) ; }
ImVec2 WindowPadding ( ) const { return ( ( Flags & ImGuiWindowFlags_ChildWindow ) & & ! ( Flags & ImGuiWindowFlags_ShowBorders ) ) ? ImVec2 ( 0 , 0 ) : GImGui - > Style . WindowPadding ; }
ImU32 Color ( ImGuiCol idx , float a = 1.f ) const { ImVec4 c = GImGui - > Style . Colors [ idx ] ; c . w * = GImGui - > Style . Alpha * a ; return ImGui : : ColorConvertFloat4ToU32 ( c ) ; }
ImU32 Color ( const ImVec4 & col ) const { ImVec4 c = col ; c . w * = GImGui - > Style . Alpha ; return ImGui : : ColorConvertFloat4ToU32 ( c ) ; }
@ -2421,37 +2422,37 @@ static ImGuiWindow* FindHoveredWindow(ImVec2 pos, bool excluding_childs)
continue ;
// Using the clipped AABB so a child window will typically be clipped by its parent.
Im GuiAabb bb ( window - > ClippedAabb . Min - g . Style . TouchExtraPadding , window - > Clipped Aabb . Max + g . Style . TouchExtraPadding ) ;
Im Rect bb ( window - > ClippedRect . Min - g . Style . TouchExtraPadding , window - > Clipped Rect . Max + g . Style . TouchExtraPadding ) ;
if ( bb . Contains ( pos ) )
return window ;
}
return NULL ;
}
// Test if mouse cursor is hovering given aabb
// Test if mouse cursor is hovering given rectangle
// NB- Box is clipped by our current clip setting
// NB- Expand the aabb to be generous on imprecise inputs systems (g.Style.TouchExtraPadding)
static bool IsMouseHoveringRect ( const Im GuiAabb & bb )
// NB- Expand the AABB to be generous on imprecise inputs systems (g.Style.TouchExtraPadding)
static bool IsMouseHoveringRect ( const Im Rect & bb )
{
ImGuiState & g = * GImGui ;
ImGuiWindow * window = GetCurrentWindow ( ) ;
// Clip
Im GuiAabb box_clipped = bb ;
Im Rect box_clipped = bb ;
if ( ! window - > ClipRectStack . empty ( ) )
{
const ImVec4 clip_rect = window - > ClipRectStack . back ( ) ;
box_clipped . Clip ( Im GuiAabb ( ImVec2 ( clip_rect . x , clip_rect . y ) , ImVec2 ( clip_rect . z , clip_rect . w ) ) ) ;
box_clipped . Clip ( Im Rect ( ImVec2 ( clip_rect . x , clip_rect . y ) , ImVec2 ( clip_rect . z , clip_rect . w ) ) ) ;
}
// Expand for touch input
const Im GuiAabb box_for_touch ( box_clipped . Min - g . Style . TouchExtraPadding , box_clipped . Max + g . Style . TouchExtraPadding ) ;
const Im Rect box_for_touch ( box_clipped . Min - g . Style . TouchExtraPadding , box_clipped . Max + g . Style . TouchExtraPadding ) ;
return box_for_touch . Contains ( g . IO . MousePos ) ;
}
bool ImGui : : IsMouseHoveringRect ( const ImVec2 & box_min , const ImVec2 & box_max )
{
return IsMouseHoveringRect ( Im GuiAabb ( box_min , box_max ) ) ;
return IsMouseHoveringRect ( Im Rect ( box_min , box_max ) ) ;
}
bool ImGui : : IsMouseHoveringWindow ( )
@ -2553,19 +2554,19 @@ bool ImGui::IsAnyItemActive()
ImVec2 ImGui : : GetItemRectMin ( )
{
ImGuiWindow * window = GetCurrentWindow ( ) ;
return window - > DC . LastItem Aabb . Min ;
return window - > DC . LastItem Rect . Min ;
}
ImVec2 ImGui : : GetItemRectMax ( )
{
ImGuiWindow * window = GetCurrentWindow ( ) ;
return window - > DC . LastItem Aabb . Max ;
return window - > DC . LastItem Rect . Max ;
}
ImVec2 ImGui : : GetItemRectSize ( )
{
ImGuiWindow * window = GetCurrentWindow ( ) ;
return window - > DC . LastItem Aabb . GetSize ( ) ;
return window - > DC . LastItem Rect . GetSize ( ) ;
}
// Tooltip is stored and turned into a BeginTooltip()/EndTooltip() sequence at the end of the frame. Each call override previous value.
@ -2673,7 +2674,7 @@ void ImGui::EndChild()
ImGui : : End ( ) ;
window = GetCurrentWindow ( ) ;
Im GuiAabb bb ( window - > DC . CursorPos , window - > DC . CursorPos + sz ) ;
Im Rect bb ( window - > DC . CursorPos , window - > DC . CursorPos + sz ) ;
ItemSize ( sz ) ;
ItemAdd ( bb , NULL ) ;
}
@ -2932,7 +2933,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size, float bg
window - > FocusIdxAllCounter = window - > FocusIdxTabCounter = - 1 ;
window - > FocusIdxAllRequestNext = window - > FocusIdxTabRequestNext = IM_INT_MAX ;
Im GuiAabb title_bar_aabb = window - > TitleBarAabb ( ) ;
Im Rect title_bar_aabb = window - > TitleBarAabb ( ) ;
// Apply and ImClamp scrolling
window - > ScrollY = window - > NextScrollY ;
@ -3002,7 +3003,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size, float bg
else if ( ! ( window - > Flags & ImGuiWindowFlags_NoResize ) )
{
// Manual resize grip
const Im GuiAabb resize_aabb ( window - > Aabb ( ) . GetBR ( ) - ImVec2 ( 18 , 18 ) , window - > Aabb ( ) . GetBR ( ) ) ;
const Im Rect resize_aabb ( window - > Aabb ( ) . GetBR ( ) - ImVec2 ( 18 , 18 ) , window - > Aabb ( ) . GetBR ( ) ) ;
const ImGuiID resize_id = window - > GetID ( " #RESIZE " ) ;
bool hovered , held ;
ButtonBehavior ( resize_aabb , resize_id , & hovered , & held , true ) ;
@ -3131,8 +3132,8 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size, float bg
}
// Save clipped aabb so we can access it in constant-time in FindHoveredWindow()
window - > Clipped Aabb = window - > Aabb ( ) ;
window - > Clipped Aabb . Clip ( window - > ClipRectStack . front ( ) ) ;
window - > Clipped Rect = window - > Aabb ( ) ;
window - > Clipped Rect . Clip ( window - > ClipRectStack . front ( ) ) ;
// Pressing CTRL+C while holding on a window copy its content to the clipboard
// This works but 1. doesn't handle multiple Begin/End pairs, 2. recursing into another Begin/End pair - so we need to work that out and add better logging scope.
@ -3146,7 +3147,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size, float bg
// Inner clipping rectangle
// We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame
const Im GuiAabb title_bar_aabb = window - > TitleBarAabb ( ) ;
const Im Rect title_bar_aabb = window - > TitleBarAabb ( ) ;
ImVec4 clip_rect ( title_bar_aabb . Min . x + 0.5f + window - > WindowPadding ( ) . x * 0.5f , title_bar_aabb . Max . y + 0.5f , window - > Aabb ( ) . Max . x + 0.5f - window - > WindowPadding ( ) . x * 0.5f , window - > Aabb ( ) . Max . y - 1.5f ) ;
if ( window - > ScrollbarY )
clip_rect . z - = style . ScrollbarWidth ;
@ -3210,7 +3211,7 @@ static void Scrollbar(ImGuiWindow* window)
const ImGuiID id = window - > GetID ( " #SCROLLY " ) ;
// Render background
Im GuiAabb bb ( window - > Aabb ( ) . Max . x - style . ScrollbarWidth , window - > Pos . y + window - > TitleBarHeight ( ) + 1 , window - > Aabb ( ) . Max . x , window - > Aabb ( ) . Max . y - 1 ) ;
Im Rect bb ( window - > Aabb ( ) . Max . x - style . ScrollbarWidth , window - > Pos . y + window - > TitleBarHeight ( ) + 1 , window - > Aabb ( ) . Max . x , window - > Aabb ( ) . Max . y - 1 ) ;
window - > DrawList - > AddRectFilled ( bb . Min , bb . Max , window - > Color ( ImGuiCol_ScrollbarBg ) ) ;
bb . Expand ( ImVec2 ( - 3 , - 3 ) ) ;
const float scrollbar_height = bb . GetHeight ( ) ;
@ -3947,7 +3948,7 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
// Lines to render
if ( line < text_end )
{
Im GuiAabb line_box ( pos , pos + ImVec2 ( ImGui : : GetWindowWidth ( ) , line_height ) ) ;
Im Rect line_box ( pos , pos + ImVec2 ( ImGui : : GetWindowWidth ( ) , line_height ) ) ;
while ( line < text_end )
{
const char * line_end = strchr ( line , ' \n ' ) ;
@ -3981,7 +3982,7 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
text_size . y + = ( pos - text_pos ) . y ;
}
Im GuiAabb bb ( text_pos , text_pos + text_size ) ;
Im Rect bb ( text_pos , text_pos + text_size ) ;
ItemSize ( bb ) ;
ItemAdd ( bb , NULL ) ;
}
@ -3994,7 +3995,7 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
ImVec2 text_pos = window - > DC . CursorPos ;
text_pos . y + = window - > DC . CurrentLineTextBaseOffset ;
Im GuiAabb bb ( text_pos , text_pos + text_size ) ;
Im Rect bb ( text_pos , text_pos + text_size ) ;
ItemSize ( bb . GetSize ( ) ) ;
if ( ! ItemAdd ( bb , NULL ) )
return ;
@ -4031,8 +4032,8 @@ void ImGui::LabelTextV(const char* label, const char* fmt, va_list args)
const char * value_text_end = value_text_begin + ImFormatStringV ( g . TempBuffer , IM_ARRAYSIZE ( g . TempBuffer ) , fmt , args ) ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const Im GuiAabb value_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w + style . FramePadding . x * 2 , label_size . y + style . FramePadding . y * 2 ) ) ;
const Im GuiAabb bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w + style . FramePadding . x * 2 + ( label_size . x > 0.0f ? style . ItemInnerSpacing . x : 0.0f ) , style . FramePadding . y * 2 ) + label_size ) ;
const Im Rect value_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w + style . FramePadding . x * 2 , label_size . y + style . FramePadding . y * 2 ) ) ;
const Im Rect bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w + style . FramePadding . x * 2 + ( label_size . x > 0.0f ? style . ItemInnerSpacing . x : 0.0f ) , style . FramePadding . y * 2 ) + label_size ) ;
ItemSize ( bb , style . FramePadding . y ) ;
if ( ! ItemAdd ( value_bb , NULL ) )
return ;
@ -4050,7 +4051,7 @@ void ImGui::LabelText(const char* label, const char* fmt, ...)
va_end ( args ) ;
}
static bool IsHovered ( const Im GuiAabb & bb , ImGuiID id )
static bool IsHovered ( const Im Rect & bb , ImGuiID id )
{
ImGuiState & g = * GImGui ;
if ( g . HoveredId = = 0 )
@ -4065,7 +4066,7 @@ static bool IsHovered(const ImGuiAabb& bb, ImGuiID id)
return false ;
}
static bool ButtonBehavior ( const Im GuiAabb & bb , ImGuiID id , bool * out_hovered , bool * out_held , bool allow_key_modifiers , bool repeat , bool pressed_on_click )
static bool ButtonBehavior ( const Im Rect & bb , ImGuiID id , bool * out_hovered , bool * out_held , bool allow_key_modifiers , bool repeat , bool pressed_on_click )
{
ImGuiState & g = * GImGui ;
ImGuiWindow * window = GetCurrentWindow ( ) ;
@ -4130,7 +4131,7 @@ bool ImGui::Button(const char* label, const ImVec2& size_arg, bool repeat_when_h
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const ImVec2 size ( size_arg . x ! = 0.0f ? size_arg . x : ( label_size . x + style . FramePadding . x * 2 ) , size_arg . y ! = 0.0f ? size_arg . y : ( label_size . y + style . FramePadding . y * 2 ) ) ;
const Im GuiAabb bb ( window - > DC . CursorPos , window - > DC . CursorPos + size ) ;
const Im Rect bb ( window - > DC . CursorPos , window - > DC . CursorPos + size ) ;
ItemSize ( bb , style . FramePadding . y ) ;
if ( ! ItemAdd ( bb , & id ) )
return false ;
@ -4162,7 +4163,7 @@ bool ImGui::SmallButton(const char* label)
ImVec2 text_pos = window - > DC . CursorPos ;
text_pos . y + = window - > DC . CurrentLineTextBaseOffset ;
Im GuiAabb bb ( text_pos , text_pos + label_size + ImVec2 ( style . FramePadding . x * 2 , 0 ) ) ;
Im Rect bb ( text_pos , text_pos + label_size + ImVec2 ( style . FramePadding . x * 2 , 0 ) ) ;
ItemSize ( bb ) ;
if ( ! ItemAdd ( bb , & id ) )
return false ;
@ -4187,7 +4188,7 @@ bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size)
return false ;
const ImGuiID id = window - > GetID ( str_id ) ;
const Im GuiAabb bb ( window - > DC . CursorPos , window - > DC . CursorPos + size ) ;
const Im Rect bb ( window - > DC . CursorPos , window - > DC . CursorPos + size ) ;
ItemSize ( bb ) ;
if ( ! ItemAdd ( bb , & id ) )
return false ;
@ -4205,7 +4206,7 @@ static bool CloseWindowButton(bool* p_opened)
const ImGuiID id = window - > GetID ( " #CLOSE " ) ;
const float size = window - > TitleBarHeight ( ) - 4.0f ;
const Im GuiAabb bb ( window - > Aabb ( ) . GetTR ( ) + ImVec2 ( - 3.0f - size , 2.0f ) , window - > Aabb ( ) . GetTR ( ) + ImVec2 ( - 3.0f , 2.0f + size ) ) ;
const Im Rect bb ( window - > Aabb ( ) . GetTR ( ) + ImVec2 ( - 3.0f - size , 2.0f ) , window - > Aabb ( ) . GetTR ( ) + ImVec2 ( - 3.0f , 2.0f + size ) ) ;
bool hovered , held ;
bool pressed = ButtonBehavior ( bb , id , & hovered , & held , true ) ;
@ -4234,7 +4235,7 @@ void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2&
if ( window - > SkipItems )
return ;
Im GuiAabb bb ( window - > DC . CursorPos , window - > DC . CursorPos + size ) ;
Im Rect bb ( window - > DC . CursorPos , window - > DC . CursorPos + size ) ;
if ( border_col . w > 0.0f )
bb . Max + = ImVec2 ( 2 , 2 ) ;
ItemSize ( bb ) ;
@ -4272,8 +4273,8 @@ bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const I
ImGui : : PopID ( ) ;
const ImVec2 padding = ( frame_padding > = 0 ) ? ImVec2 ( ( float ) frame_padding , ( float ) frame_padding ) : style . FramePadding ;
const Im GuiAabb bb ( window - > DC . CursorPos , window - > DC . CursorPos + size + padding * 2 ) ;
const Im GuiAabb image_bb ( window - > DC . CursorPos + padding , window - > DC . CursorPos + padding + size ) ;
const Im Rect bb ( window - > DC . CursorPos , window - > DC . CursorPos + size + padding * 2 ) ;
const Im Rect image_bb ( window - > DC . CursorPos + padding , window - > DC . CursorPos + padding + size ) ;
ItemSize ( bb ) ;
if ( ! ItemAdd ( bb , & id ) )
return false ;
@ -4449,7 +4450,7 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, bool display
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const ImVec2 pos_min = window - > DC . CursorPos ;
const ImVec2 pos_max = window - > Pos + GetContentRegionMax ( ) ;
Im GuiAabb bb = ImGuiAabb ( pos_min , ImVec2 ( pos_max . x , pos_min . y + label_size . y ) ) ;
Im Rect bb = ImRect ( pos_min , ImVec2 ( pos_max . x , pos_min . y + label_size . y ) ) ;
if ( display_frame )
{
bb . Min . x - = window_padding . x * 0.5f - 1 ;
@ -4458,7 +4459,7 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, bool display
}
// FIXME: we don't provide our width so that it doesn't get feed back into AutoFit. Should manage that better so we can still hover without extending ContentsSize
const Im GuiAabb text_bb ( bb . Min , bb . Min + ImVec2 ( window - > FontSize ( ) + style . FramePadding . x * 2 * 2 , 0 ) + label_size ) ;
const Im Rect text_bb ( bb . Min , bb . Min + ImVec2 ( window - > FontSize ( ) + style . FramePadding . x * 2 * 2 , 0 ) + label_size ) ;
ItemSize ( ImVec2 ( text_bb . GetSize ( ) . x , bb . GetSize ( ) . y ) , display_frame ? style . FramePadding . y : 0.0f ) ;
// When logging is enabled, if automatically expand tree nodes (but *NOT* collapsing headers.. seems like sensible behavior).
@ -4520,7 +4521,7 @@ void ImGui::Bullet()
const ImGuiStyle & style = g . Style ;
const float line_height = window - > FontSize ( ) ;
const Im GuiAabb bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( line_height , line_height ) ) ;
const Im Rect bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( line_height , line_height ) ) ;
ItemSize ( bb ) ;
if ( ! ItemAdd ( bb , NULL ) )
return ;
@ -4547,7 +4548,7 @@ void ImGui::BulletTextV(const char* fmt, va_list args)
const ImGuiStyle & style = g . Style ;
const float line_height = window - > FontSize ( ) ;
const ImVec2 label_size = CalcTextSize ( text_begin , text_end , true ) ;
const Im GuiAabb bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( line_height + ( label_size . x > 0.0f ? ( style . FramePadding . x * 2 ) : 0.0f ) , 0 ) + label_size ) ; // Empty text doesn't add padding
const Im Rect bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( line_height + ( label_size . x > 0.0f ? ( style . FramePadding . x * 2 ) : 0.0f ) , 0 ) + label_size ) ; // Empty text doesn't add padding
ItemSize ( bb ) ;
if ( ! ItemAdd ( bb , NULL ) )
return ;
@ -4779,7 +4780,7 @@ static void ParseFormat(const char* fmt, int& decimal_precision)
}
}
static bool SliderBehavior ( const Im GuiAabb& frame_bb , const ImGuiAabb & slider_bb , ImGuiID id , float * v , float v_min , float v_max , float power , int decimal_precision , bool horizontal )
static bool SliderBehavior ( const Im Rect& frame_bb , const ImRect & slider_bb , ImGuiID id , float * v , float v_min , float v_max , float power , int decimal_precision , bool horizontal )
{
ImGuiState & g = * GImGui ;
ImGuiWindow * window = GetCurrentWindow ( ) ;
@ -4907,11 +4908,11 @@ static bool SliderBehavior(const ImGuiAabb& frame_bb, const ImGuiAabb& slider_bb
if ( ! horizontal )
grab_t = 1.0f - grab_t ;
const float grab_pos = ImLerp ( slider_usable_pos_min , slider_usable_pos_max , grab_t ) ;
Im GuiAabb grab_bb ;
Im Rect grab_bb ;
if ( horizontal )
grab_bb = Im GuiAabb ( ImVec2 ( grab_pos - grab_sz * 0.5f , frame_bb . Min . y + 2.0f ) , ImVec2 ( grab_pos + grab_sz * 0.5f , frame_bb . Max . y - 2.0f ) ) ;
grab_bb = Im Rect ( ImVec2 ( grab_pos - grab_sz * 0.5f , frame_bb . Min . y + 2.0f ) , ImVec2 ( grab_pos + grab_sz * 0.5f , frame_bb . Max . y - 2.0f ) ) ;
else
grab_bb = Im GuiAabb ( ImVec2 ( frame_bb . Min . x + 2.0f , grab_pos - grab_sz * 0.5f ) , ImVec2 ( frame_bb . Max . x - 2.0f , grab_pos + grab_sz * 0.5f ) ) ;
grab_bb = Im Rect ( ImVec2 ( frame_bb . Min . x + 2.0f , grab_pos - grab_sz * 0.5f ) , ImVec2 ( frame_bb . Max . x - 2.0f , grab_pos + grab_sz * 0.5f ) ) ;
window - > DrawList - > AddRectFilled ( grab_bb . Min , grab_bb . Max , window - > Color ( g . ActiveId = = id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab ) ) ;
}
@ -4935,9 +4936,9 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
const float w = ImGui : : CalcItemWidth ( ) ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const Im GuiAabb frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w , label_size . y ) + style . FramePadding * 2.0f ) ;
const Im GuiAabb slider_bb ( frame_bb . Min + style . FramePadding , frame_bb . Max - style . FramePadding ) ;
const Im GuiAabb bb ( frame_bb . Min , frame_bb . Max + ImVec2 ( label_size . x > 0.0f ? style . ItemInnerSpacing . x + label_size . x : 0.0f , 0.0f ) ) ;
const Im Rect frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w , label_size . y ) + style . FramePadding * 2.0f ) ;
const Im Rect slider_bb ( frame_bb . Min + style . FramePadding , frame_bb . Max - style . FramePadding ) ;
const Im Rect bb ( frame_bb . Min , frame_bb . Max + ImVec2 ( label_size . x > 0.0f ? style . ItemInnerSpacing . x + label_size . x : 0.0f , 0.0f ) ) ;
// NB- we don't call ItemSize() yet becausae we may turn into a text edit box below
if ( ! ItemAdd ( frame_bb , & id ) )
@ -5002,9 +5003,9 @@ bool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float
const ImGuiID id = window - > GetID ( label ) ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const Im GuiAabb frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + size ) ;
const Im GuiAabb slider_bb ( frame_bb . Min + style . FramePadding , frame_bb . Max - style . FramePadding ) ;
const Im GuiAabb bb ( frame_bb . Min , frame_bb . Max + ImVec2 ( label_size . x > 0.0f ? style . ItemInnerSpacing . x + label_size . x : 0.0f , 0.0f ) ) ;
const Im Rect frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + size ) ;
const Im Rect slider_bb ( frame_bb . Min + style . FramePadding , frame_bb . Max - style . FramePadding ) ;
const Im Rect bb ( frame_bb . Min , frame_bb . Max + ImVec2 ( label_size . x > 0.0f ? style . ItemInnerSpacing . x + label_size . x : 0.0f , 0.0f ) ) ;
ItemSize ( bb , style . FramePadding . y ) ;
if ( ! ItemAdd ( frame_bb , & id ) )
@ -5181,9 +5182,9 @@ static void Plot(ImGuiPlotType plot_type, const char* label, float (*values_gett
if ( graph_size . y = = 0.0f )
graph_size . y = label_size . y + ( style . FramePadding . y * 2 ) ;
const Im GuiAabb frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( graph_size . x , graph_size . y ) ) ;
const Im GuiAabb graph_bb ( frame_bb . Min + style . FramePadding , frame_bb . Max - style . FramePadding ) ;
const Im GuiAabb bb ( frame_bb . Min , frame_bb . Max + ImVec2 ( label_size . x > 0.0f ? style . ItemInnerSpacing . x + label_size . x : 0.0f , 0 ) ) ;
const Im Rect frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( graph_size . x , graph_size . y ) ) ;
const Im Rect graph_bb ( frame_bb . Min + style . FramePadding , frame_bb . Max - style . FramePadding ) ;
const Im Rect bb ( frame_bb . Min , frame_bb . Max + ImVec2 ( label_size . x > 0.0f ? style . ItemInnerSpacing . x + label_size . x : 0.0f , 0 ) ) ;
ItemSize ( bb , style . FramePadding . y ) ;
if ( ! ItemAdd ( bb , NULL ) )
return ;
@ -5310,17 +5311,17 @@ bool ImGui::Checkbox(const char* label, bool* v)
const ImGuiID id = window - > GetID ( label ) ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const Im GuiAabb check_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( label_size . y + style . FramePadding . y * 2 , label_size . y + style . FramePadding . y * 2 ) ) ;
const Im Rect check_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( label_size . y + style . FramePadding . y * 2 , label_size . y + style . FramePadding . y * 2 ) ) ;
ItemSize ( check_bb , style . FramePadding . y ) ;
Im GuiAabb total_bb = check_bb ;
Im Rect total_bb = check_bb ;
if ( label_size . x > 0 )
SameLine ( 0 , ( int ) style . ItemInnerSpacing . x ) ;
const Im GuiAabb text_bb ( window - > DC . CursorPos + ImVec2 ( 0 , style . FramePadding . y ) , window - > DC . CursorPos + ImVec2 ( 0 , style . FramePadding . y ) + label_size ) ;
const Im Rect text_bb ( window - > DC . CursorPos + ImVec2 ( 0 , style . FramePadding . y ) , window - > DC . CursorPos + ImVec2 ( 0 , style . FramePadding . y ) + label_size ) ;
if ( label_size . x > 0 )
{
ItemSize ( ImVec2 ( text_bb . GetWidth ( ) , check_bb . GetHeight ( ) ) , style . FramePadding . y ) ;
total_bb = Im GuiAabb ( ImMin ( check_bb . Min , text_bb . Min ) , ImMax ( check_bb . Max , text_bb . Max ) ) ;
total_bb = Im Rect ( ImMin ( check_bb . Min , text_bb . Min ) , ImMax ( check_bb . Max , text_bb . Max ) ) ;
}
if ( ! ItemAdd ( total_bb , & id ) )
@ -5368,13 +5369,13 @@ bool ImGui::RadioButton(const char* label, bool active)
const ImGuiID id = window - > GetID ( label ) ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const Im GuiAabb check_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( label_size . y + style . FramePadding . y * 2 - 1 , label_size . y + style . FramePadding . y * 2 - 1 ) ) ;
const Im Rect check_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( label_size . y + style . FramePadding . y * 2 - 1 , label_size . y + style . FramePadding . y * 2 - 1 ) ) ;
ItemSize ( check_bb , style . FramePadding . y ) ;
Im GuiAabb total_bb = check_bb ;
Im Rect total_bb = check_bb ;
if ( label_size . x > 0 )
SameLine ( 0 , ( int ) style . ItemInnerSpacing . x ) ;
const Im GuiAabb text_bb ( window - > DC . CursorPos + ImVec2 ( 0 , style . FramePadding . y ) , window - > DC . CursorPos + ImVec2 ( 0 , style . FramePadding . y ) + label_size ) ;
const Im Rect text_bb ( window - > DC . CursorPos + ImVec2 ( 0 , style . FramePadding . y ) , window - > DC . CursorPos + ImVec2 ( 0 , style . FramePadding . y ) + label_size ) ;
if ( label_size . x > 0 )
{
ItemSize ( ImVec2 ( text_bb . GetWidth ( ) , check_bb . GetHeight ( ) ) , style . FramePadding . y ) ;
@ -5600,7 +5601,7 @@ bool ImGui::InputFloat(const char* label, float *v, float step, float step_fast,
const ImGuiStyle & style = g . Style ;
const float w = ImGui : : CalcItemWidth ( ) ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const Im GuiAabb frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w , label_size . y ) + style . FramePadding * 2.0f ) ;
const Im Rect frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w , label_size . y ) + style . FramePadding * 2.0f ) ;
ImGui : : PushID ( label ) ;
const ImVec2 button_sz = ImVec2 ( window - > FontSize ( ) , window - > FontSize ( ) ) + style . FramePadding * 2 ;
@ -5762,8 +5763,8 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT
const float w = ImGui : : CalcItemWidth ( ) ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const Im GuiAabb frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w , label_size . y ) + style . FramePadding * 2.0f ) ;
const Im GuiAabb bb ( frame_bb . Min , frame_bb . Max + ImVec2 ( label_size . x > 0.0f ? ( style . ItemInnerSpacing . x + label_size . x ) : 0.0f , 0.0f ) ) ;
const Im Rect frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w , label_size . y ) + style . FramePadding * 2.0f ) ;
const Im Rect bb ( frame_bb . Min , frame_bb . Max + ImVec2 ( label_size . x > 0.0f ? ( style . ItemInnerSpacing . x + label_size . x ) : 0.0f , 0.0f ) ) ;
ItemSize ( bb , style . FramePadding . y ) ;
if ( ! ItemAdd ( frame_bb , & id ) )
return false ;
@ -6236,8 +6237,8 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
const float w = ImGui : : CalcItemWidth ( ) ;
const ImVec2 label_size = CalcTextSize ( label , NULL , true ) ;
const Im GuiAabb frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w , label_size . y ) + style . FramePadding * 2.0f ) ;
const Im GuiAabb bb ( frame_bb . Min , frame_bb . Max + ImVec2 ( style . ItemInnerSpacing . x + label_size . x , 0 ) ) ;
const Im Rect frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( w , label_size . y ) + style . FramePadding * 2.0f ) ;
const Im Rect bb ( frame_bb . Min , frame_bb . Max + ImVec2 ( style . ItemInnerSpacing . x + label_size . x , 0 ) ) ;
ItemSize ( bb , style . FramePadding . y ) ;
if ( ! ItemAdd ( frame_bb , & id ) )
return false ;
@ -6246,7 +6247,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
const bool hovered = IsHovered ( frame_bb , id ) ;
bool value_changed = false ;
const Im GuiAabb value_bb ( frame_bb . Min , frame_bb . Max - ImVec2 ( arrow_size , 0.0f ) ) ;
const Im Rect value_bb ( frame_bb . Min , frame_bb . Max - ImVec2 ( arrow_size , 0.0f ) ) ;
RenderFrame ( frame_bb . Min , frame_bb . Max , window - > Color ( ImGuiCol_FrameBg ) , true , style . FrameRounding ) ;
RenderFrame ( ImVec2 ( frame_bb . Max . x - arrow_size , frame_bb . Min . y ) , frame_bb . Max , window - > Color ( hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button ) , true , style . FrameRounding ) ; // FIXME-ROUNDING
RenderCollapseTriangle ( ImVec2 ( frame_bb . Max . x - arrow_size , frame_bb . Min . y ) + style . FramePadding , true ) ;
@ -6284,7 +6285,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
const ImVec2 backup_pos = ImGui : : GetCursorPos ( ) ;
const float popup_off_x = 0.0f ; //style.ItemInnerSpacing.x;
const float popup_height = ( label_size . y + style . ItemSpacing . y ) * ImMin ( items_count , height_in_items ) + style . WindowPadding . y ;
const Im GuiAabb popup_aabb ( ImVec2 ( frame_bb . Min . x + popup_off_x , frame_bb . Max . y ) , ImVec2 ( frame_bb . Max . x + popup_off_x , frame_bb . Max . y + popup_height ) ) ;
const Im Rect popup_aabb ( ImVec2 ( frame_bb . Min . x + popup_off_x , frame_bb . Max . y ) , ImVec2 ( frame_bb . Max . x + popup_off_x , frame_bb . Max . y + popup_height ) ) ;
ImGui : : SetCursorPos ( popup_aabb . Min - window - > Pos ) ;
const ImGuiWindowFlags flags = ImGuiWindowFlags_ComboBox | ( ( window - > Flags & ImGuiWindowFlags_ShowBorders ) ? ImGuiWindowFlags_ShowBorders : 0 ) ;
@ -6341,11 +6342,11 @@ bool ImGui::Selectable(const char* label, bool selected, const ImVec2& size_arg)
const float w = window - > Pos . x + ImGui : : GetContentRegionMax ( ) . x - window - > DC . CursorPos . x ;
const ImVec2 size ( size_arg . x ! = 0.0f ? size_arg . x : w , size_arg . y ! = 0.0f ? size_arg . y : label_size . y ) ;
const Im GuiAabb bb ( window - > DC . CursorPos , window - > DC . CursorPos + size ) ;
const Im Rect bb ( window - > DC . CursorPos , window - > DC . CursorPos + size ) ;
ItemSize ( bb ) ;
// Selectables are meant to be tightly packed together. So for both rendering and collision we extend to compensate for spacing.
Im GuiAabb bb_with_spacing = bb ;
Im Rect bb_with_spacing = bb ;
const float spacing_L = ( float ) ( int ) ( style . ItemSpacing . x * 0.5f ) ;
const float spacing_U = ( float ) ( int ) ( style . ItemSpacing . y * 0.5f ) ;
const float spacing_R = style . ItemSpacing . x - spacing_L ;
@ -6398,9 +6399,9 @@ bool ImGui::ListBoxHeader(const char* label, const ImVec2& size_arg)
size . x = ( size_arg . x ! = 0.0f ) ? ( size_arg . x ) : ImGui : : CalcItemWidth ( ) + style . FramePadding . x * 2.0f ;
size . y = ( size_arg . y ! = 0.0f ) ? ( size_arg . y ) : ImGui : : GetTextLineHeightWithSpacing ( ) * 7.4f + style . ItemSpacing . y ;
const ImVec2 frame_size = ImVec2 ( size . x , ImMax ( size . y , label_size . y ) ) ;
const Im GuiAabb frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + frame_size ) ;
const Im GuiAabb 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 . LastItem Aabb = bb ;
const Im Rect frame_bb ( window - > DC . CursorPos , window - > DC . CursorPos + frame_size ) ;
const Im Rect 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 . LastItem Rect = bb ;
if ( label_size . x > 0 )
RenderText ( ImVec2 ( frame_bb . Max . x + style . ItemInnerSpacing . x , frame_bb . Min . y + style . FramePadding . y ) , label ) ;
@ -6428,7 +6429,7 @@ bool ImGui::ListBoxHeader(const char* label, int items_count, int height_in_item
void ImGui : : ListBoxFooter ( )
{
ImGuiWindow * parent_window = GetParentWindow ( ) ;
const Im GuiAabb bb = parent_window - > DC . LastItemAabb ;
const Im Rect bb = parent_window - > DC . LastItemRect ;
const ImGuiStyle & style = ImGui : : GetStyle ( ) ;
ImGui : : EndChildFrame ( ) ;
@ -6487,7 +6488,7 @@ bool ImGui::ColorButton(const ImVec4& col, bool small_height, bool outline_borde
const ImGuiStyle & style = g . Style ;
const ImGuiID id = window - > GetID ( " #colorbutton " ) ;
const float square_size = window - > FontSize ( ) ;
const Im GuiAabb bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( square_size + style . FramePadding . x * 2 , square_size + ( small_height ? 0 : style . FramePadding . y * 2 ) ) ) ;
const Im Rect bb ( window - > DC . CursorPos , window - > DC . CursorPos + ImVec2 ( square_size + style . FramePadding . x * 2 , square_size + ( small_height ? 0 : style . FramePadding . y * 2 ) ) ) ;
ItemSize ( bb , small_height ? 0.0f : style . FramePadding . y ) ;
if ( ! ItemAdd ( bb , & id ) )
return false ;
@ -6681,7 +6682,7 @@ void ImGui::Separator()
if ( window - > DC . ColumnsCount > 1 )
PopClipRect ( ) ;
const Im GuiAabb bb ( ImVec2 ( window - > Pos . x , window - > DC . CursorPos . y ) , ImVec2 ( window - > Pos . x + window - > Size . x , window - > DC . CursorPos . y ) ) ;
const Im Rect bb ( ImVec2 ( window - > Pos . x , window - > DC . CursorPos . y ) , ImVec2 ( window - > Pos . x + window - > Size . x , window - > DC . CursorPos . y ) ) ;
ItemSize ( ImVec2 ( 0.0f , bb . GetSize ( ) . y ) ) ; // NB: we don't provide our width so that it doesn't get feed back into AutoFit
if ( ! ItemAdd ( bb , NULL ) )
{
@ -6736,17 +6737,17 @@ static void ItemSize(ImVec2 size, float text_offset_y)
window - > DC . CurrentLineHeight = window - > DC . CurrentLineTextBaseOffset = 0.0f ;
}
static inline void ItemSize ( const Im GuiAabb & bb , float text_offset_y )
static inline void ItemSize ( const Im Rect & bb , float text_offset_y )
{
ItemSize ( bb . GetSize ( ) , text_offset_y ) ;
}
static bool IsClipped ( const Im GuiAabb & bb )
static bool IsClipped ( const Im Rect & bb )
{
ImGuiState & g = * GImGui ;
ImGuiWindow * window = GetCurrentWindow ( ) ;
if ( ! bb . Overlaps ( Im GuiAabb ( window - > ClipRectStack . back ( ) ) ) & & ! g . LogEnabled )
if ( ! bb . Overlaps ( Im Rect ( window - > ClipRectStack . back ( ) ) ) & & ! g . LogEnabled )
return true ;
return false ;
}
@ -6754,14 +6755,14 @@ static bool IsClipped(const ImGuiAabb& bb)
bool ImGui : : IsClipped ( const ImVec2 & item_size )
{
ImGuiWindow * window = GetCurrentWindow ( ) ;
return IsClipped ( Im GuiAabb ( window - > DC . CursorPos , window - > DC . CursorPos + item_size ) ) ;
return IsClipped ( Im Rect ( window - > DC . CursorPos , window - > DC . CursorPos + item_size ) ) ;
}
static bool ItemAdd ( const Im GuiAabb & bb , const ImGuiID * id )
static bool ItemAdd ( const Im Rect & bb , const ImGuiID * id )
{
ImGuiWindow * window = GetCurrentWindow ( ) ;
window - > DC . LastItemID = id ? * id : 0 ;
window - > DC . LastItem Aabb = bb ;
window - > DC . LastItem Rect = bb ;
if ( IsClipped ( bb ) )
{
window - > DC . LastItemHovered = false ;
@ -6803,7 +6804,7 @@ void ImGui::EndGroup()
ImGuiGroupData & group_data = window - > DC . GroupStack . back ( ) ;
Im GuiAabb group_bb ( group_data . BackupCursorPos , window - > DC . CursorMaxPos ) ;
Im Rect group_bb ( group_data . BackupCursorPos , window - > DC . CursorMaxPos ) ;
group_bb . Max . y - = style . ItemSpacing . y ;
window - > DC . CursorPos = group_data . BackupCursorPos ;
@ -6977,7 +6978,7 @@ void ImGui::Columns(int columns_count, const char* id, bool border)
float x = window - > Pos . x + GetColumnOffset ( i ) ;
const ImGuiID column_id = window - > DC . ColumnsSetID + ImGuiID ( i ) ;
const Im GuiAabb column_aabb ( ImVec2 ( x - 4 , y1 ) , ImVec2 ( x + 4 , y2 ) ) ;
const Im Rect column_aabb ( ImVec2 ( x - 4 , y1 ) , ImVec2 ( x + 4 , y2 ) ) ;
if ( IsClipped ( column_aabb ) )
continue ;