@ -1,4 +1,4 @@
// dear imgui, v1.90.8
// dear imgui, v1.90.9 WIP
// (main code and documentation)
// Help:
@ -430,6 +430,7 @@ CODE
When you are not sure about an old symbol or function name , try using the Search / Find function of your IDE to look for comments or references in all imgui files .
You can read releases logs https : //github.com/ocornut/imgui/releases for more details.
- 2024 / 06 / 10 ( 1.90 .9 ) - removed old nested structure : renaming ImGuiStorage : : ImGuiStoragePair type to ImGuiStoragePair ( simpler for many languages ) .
- 2024 / 06 / 06 ( 1.90 .8 ) - reordered ImGuiInputTextFlags values . This should not be breaking unless you are using generated headers that have values not matching the main library .
- 2024 / 06 / 06 ( 1.90 .8 ) - removed ' ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft ' , was mostly unused and misleading .
- 2024 / 05 / 27 ( 1.90 .7 ) - commented out obsolete symbols marked obsolete in 1.88 ( May 2022 ) :
@ -2502,18 +2503,16 @@ void ImGui::ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float&
//-----------------------------------------------------------------------------
// std::lower_bound but without the bullshit
static ImGuiStorage : : ImGuiStoragePair * LowerBound ( ImVector < ImGuiStorage : : ImGuiStoragePair > & data , ImGuiID key )
ImGuiStoragePair * Im LowerBound( ImGuiStoragePair * in_begin , ImGuiStoragePair * in_end , ImGuiID key )
{
ImGuiStorage : : ImGuiStoragePair * first = data . Data ;
ImGuiStorage : : ImGuiStoragePair * last = data . Data + data . Size ;
size_t count = ( size_t ) ( last - first ) ;
while ( count > 0 )
ImGuiStoragePair * in_p = in_begin ;
for ( size_t count = ( size_t ) ( in_end - in_p ) ; count > 0 ; )
{
size_t count2 = count > > 1 ;
ImGuiStorage : : ImGuiStorage Pair* mid = first + count2 ;
ImGuiStoragePair * mid = in_p + count2 ;
if ( mid - > key < key )
{
first = + + mid ;
in_p = + + mid ;
count - = count2 + 1 ;
}
else
@ -2521,7 +2520,7 @@ static ImGuiStorage::ImGuiStoragePair* LowerBound(ImVector<ImGuiStorage::ImGuiSt
count = count2 ;
}
}
return first ;
return in_p ;
}
// For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.
@ -2542,7 +2541,7 @@ void ImGuiStorage::BuildSortByKey()
int ImGuiStorage : : GetInt ( ImGuiID key , int default_val ) const
{
ImGuiStoragePair * it = LowerBound ( const_cast < ImVector < ImGuiStoragePair > & > ( Data ) , key ) ;
ImGuiStoragePair * it = Im LowerBound( const_cast < ImGuiStoragePair * > ( Data . Data ) , const_cast < ImGuiStoragePair * > ( Data . Data + Data . Size ) , key ) ;
if ( it = = Data . end ( ) | | it - > key ! = key )
return default_val ;
return it - > val_i ;
@ -2555,7 +2554,7 @@ bool ImGuiStorage::GetBool(ImGuiID key, bool default_val) const
float ImGuiStorage : : GetFloat ( ImGuiID key , float default_val ) const
{
ImGuiStoragePair * it = LowerBound ( const_cast < ImVector < ImGuiStoragePair > & > ( Data ) , key ) ;
ImGuiStoragePair * it = Im LowerBound( const_cast < ImGuiStoragePair * > ( Data . Data ) , const_cast < ImGuiStoragePair * > ( Data . Data + Data . Size ) , key ) ;
if ( it = = Data . end ( ) | | it - > key ! = key )
return default_val ;
return it - > val_f ;
@ -2563,7 +2562,7 @@ float ImGuiStorage::GetFloat(ImGuiID key, float default_val) const
void * ImGuiStorage : : GetVoidPtr ( ImGuiID key ) const
{
ImGuiStoragePair * it = LowerBound ( const_cast < ImVector < ImGuiStoragePair > & > ( Data ) , key ) ;
ImGuiStoragePair * it = Im LowerBound( const_cast < ImGuiStoragePair * > ( Data . Data ) , const_cast < ImGuiStoragePair * > ( Data . Data + Data . Size ) , key ) ;
if ( it = = Data . end ( ) | | it - > key ! = key )
return NULL ;
return it - > val_p ;
@ -2572,7 +2571,7 @@ void* ImGuiStorage::GetVoidPtr(ImGuiID key) const
// References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer.
int * ImGuiStorage : : GetIntRef ( ImGuiID key , int default_val )
{
ImGuiStoragePair * it = LowerBound ( Data , key ) ;
ImGuiStoragePair * it = Im LowerBound( Data . Data , Data . Data + Data . Size , key ) ;
if ( it = = Data . end ( ) | | it - > key ! = key )
it = Data . insert ( it , ImGuiStoragePair ( key , default_val ) ) ;
return & it - > val_i ;
@ -2585,7 +2584,7 @@ bool* ImGuiStorage::GetBoolRef(ImGuiID key, bool default_val)
float * ImGuiStorage : : GetFloatRef ( ImGuiID key , float default_val )
{
ImGuiStoragePair * it = LowerBound ( Data , key ) ;
ImGuiStoragePair * it = Im LowerBound( Data . Data , Data . Data + Data . Size , key ) ;
if ( it = = Data . end ( ) | | it - > key ! = key )
it = Data . insert ( it , ImGuiStoragePair ( key , default_val ) ) ;
return & it - > val_f ;
@ -2593,7 +2592,7 @@ float* ImGuiStorage::GetFloatRef(ImGuiID key, float default_val)
void * * ImGuiStorage : : GetVoidPtrRef ( ImGuiID key , void * default_val )
{
ImGuiStoragePair * it = LowerBound ( Data , key ) ;
ImGuiStoragePair * it = Im LowerBound( Data . Data , Data . Data + Data . Size , key ) ;
if ( it = = Data . end ( ) | | it - > key ! = key )
it = Data . insert ( it , ImGuiStoragePair ( key , default_val ) ) ;
return & it - > val_p ;
@ -2602,7 +2601,7 @@ void** ImGuiStorage::GetVoidPtrRef(ImGuiID key, void* default_val)
// FIXME-OPT: Need a way to reuse the result of lower_bound when doing GetInt()/SetInt() - not too bad because it only happens on explicit interaction (maximum one a frame)
void ImGuiStorage : : SetInt ( ImGuiID key , int val )
{
ImGuiStoragePair * it = LowerBound ( Data , key ) ;
ImGuiStoragePair * it = Im LowerBound( Data . Data , Data . Data + Data . Size , key ) ;
if ( it = = Data . end ( ) | | it - > key ! = key )
Data . insert ( it , ImGuiStoragePair ( key , val ) ) ;
else
@ -2616,7 +2615,7 @@ void ImGuiStorage::SetBool(ImGuiID key, bool val)
void ImGuiStorage : : SetFloat ( ImGuiID key , float val )
{
ImGuiStoragePair * it = LowerBound ( Data , key ) ;
ImGuiStoragePair * it = Im LowerBound( Data . Data , Data . Data + Data . Size , key ) ;
if ( it = = Data . end ( ) | | it - > key ! = key )
Data . insert ( it , ImGuiStoragePair ( key , val ) ) ;
else
@ -2625,7 +2624,7 @@ void ImGuiStorage::SetFloat(ImGuiID key, float val)
void ImGuiStorage : : SetVoidPtr ( ImGuiID key , void * val )
{
ImGuiStoragePair * it = LowerBound ( Data , key ) ;
ImGuiStoragePair * it = Im LowerBound( Data . Data , Data . Data + Data . Size , key ) ;
if ( it = = Data . end ( ) | | it - > key ! = key )
Data . insert ( it , ImGuiStoragePair ( key , val ) ) ;
else
@ -4172,7 +4171,7 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id, ImGuiItemFlags item_flag
// Done with rectangle culling so we can perform heavier checks now.
if ( ! ( item_flags & ImGuiItemFlags_NoWindowHoverableCheck ) & & ! IsWindowContentHoverable ( window , ImGuiHoveredFlags_None ) )
{
g . HoveredIdDisabled = true ;
g . HoveredIdIs Disabled = true ;
return false ;
}
@ -4207,7 +4206,7 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id, ImGuiItemFlags item_flag
// Release active id if turning disabled
if ( g . ActiveId = = id & & id ! = 0 )
ClearActiveID ( ) ;
g . HoveredIdDisabled = true ;
g . HoveredIdIs Disabled = true ;
return false ;
}
@ -4510,7 +4509,7 @@ void ImGui::UpdateMouseMovingWindowEndFrame()
g . MovingWindow = NULL ;
// Cancel moving if clicked over an item which was disabled or inhibited by popups (note that we know HoveredId == 0 already)
if ( g . HoveredIdDisabled )
if ( g . HoveredIdIs Disabled )
g . MovingWindow = NULL ;
}
else if ( root_window = = NULL & & g . NavWindow ! = NULL )
@ -4704,7 +4703,7 @@ void ImGui::NewFrame()
g . HoveredIdPreviousFrame = g . HoveredId ;
g . HoveredId = 0 ;
g . HoveredIdAllowOverlap = false ;
g . HoveredIdDisabled = false ;
g . HoveredIdIs Disabled = false ;
// Clear ActiveID if the item is not alive anymore.
// In 1.87, the common most call to KeepAliveID() was moved from GetID() to ItemAdd().
@ -9920,10 +9919,6 @@ static void ImGui::ErrorCheckNewFrameSanityChecks()
if ( ( g . IO . ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard ) & & g . IO . BackendUsingLegacyKeyArrays = = 1 )
IM_ASSERT ( g . IO . KeyMap [ ImGuiKey_Space ] ! = - 1 & & " ImGuiKey_Space is not mapped, required for keyboard navigation. " ) ;
# endif
// Check: the io.ConfigWindowsResizeFromEdges option requires backend to honor mouse cursor changes and set the ImGuiBackendFlags_HasMouseCursors flag accordingly.
if ( g . IO . ConfigWindowsResizeFromEdges & & ! ( g . IO . BackendFlags & ImGuiBackendFlags_HasMouseCursors ) )
g . IO . ConfigWindowsResizeFromEdges = false ;
}
static void ImGui : : ErrorCheckEndFrameSanityChecks ( )
@ -11238,8 +11233,8 @@ void ImGui::CloseCurrentPopup()
window - > DC . NavHideHighlightOneFrame = true ;
}
// Attention! BeginPopup() adds default flags which BeginPopupEx()!
bool ImGui : : BeginPopupEx ( ImGuiID id , ImGuiWindowFlags flags )
// Attention! BeginPopup() adds default flags when calling BeginPopupEx()!
bool ImGui : : BeginPopupEx ( ImGuiID id , ImGuiWindowFlags extra_window_ flags)
{
ImGuiContext & g = * GImGui ;
if ( ! IsPopupOpen ( id , ImGuiPopupFlags_None ) )
@ -11249,13 +11244,12 @@ bool ImGui::BeginPopupEx(ImGuiID id, ImGuiWindowFlags flags)
}
char name [ 20 ] ;
if ( flags & ImGuiWindowFlags_ChildMenu )
if ( extra_window_ flags & ImGuiWindowFlags_ChildMenu )
ImFormatString ( name , IM_ARRAYSIZE ( name ) , " ##Menu_%02d " , g . BeginMenuDepth ) ; // Recycle windows based on depth
else
ImFormatString ( name , IM_ARRAYSIZE ( name ) , " ##Popup_%08x " , id ) ; // Not recycling, so we can close/open during the same frame
flags | = ImGuiWindowFlags_Popup ;
bool is_open = Begin ( name , NULL , flags ) ;
bool is_open = Begin ( name , NULL , extra_window_flags | ImGuiWindowFlags_Popup ) ;
if ( ! is_open ) // NB: Begin can return false when the popup is completely clipped (e.g. zero size display)
EndPopup ( ) ;
@ -15419,7 +15413,7 @@ void ImGui::DebugNodeStorage(ImGuiStorage* storage, const char* label)
{
if ( ! TreeNode ( label , " %s: %d entries, %d bytes " , label , storage - > Data . Size , storage - > Data . size_in_bytes ( ) ) )
return ;
for ( const ImGuiStorage : : ImGuiStorage Pair& p : storage - > Data )
for ( const ImGuiStoragePair & p : storage - > Data )
BulletText ( " Key 0x%08X Value { i: %d } " , p . key , p . val_i ) ; // Important: we currently don't store a type, real value may not be integer.
TreePop ( ) ;
}