@ -2903,15 +2903,12 @@ void ImGui::NewFrame()
{
KeepAliveID ( g . MovedWindowMoveId ) ;
IM_ASSERT ( g . MovedWindow & & g . MovedWindow - > RootWindow ) ;
IM_ASSERT ( g . MovedWindow - > RootWindow - > MoveId = = g . MovedWindowMoveId ) ;
IM_ASSERT ( g . MovedWindow - > MoveId = = g . MovedWindowMoveId ) ;
if ( g . IO . MouseDown [ 0 ] )
{
if ( ! ( g . MovedWindow - > Flags & ImGuiWindowFlags_NoMove ) )
{
g . MovedWindow - > PosFloat + = g . IO . MouseDelta ;
if ( g . IO . MouseDelta . x ! = 0.0f | | g . IO . MouseDelta . y ! = 0.0f )
MarkIniSettingsDirty ( g . MovedWindow ) ;
}
g . MovedWindow - > RootWindow - > PosFloat + = g . IO . MouseDelta ;
if ( g . IO . MouseDelta . x ! = 0.0f | | g . IO . MouseDelta . y ! = 0.0f )
MarkIniSettingsDirty ( g . MovedWindow - > RootWindow ) ;
FocusWindow ( g . MovedWindow ) ;
}
else
@ -3388,7 +3385,7 @@ void ImGui::EndFrame()
if ( ! ( g . HoveredWindow - > Flags & ImGuiWindowFlags_NoMove ) )
{
g . MovedWindow = g . HoveredWindow ;
g . MovedWindowMoveId = g . HoveredRoot Window - > MoveId ;
g . MovedWindowMoveId = g . HoveredWindow - > MoveId ;
SetActiveIDNoNav ( g . MovedWindowMoveId , g . HoveredRootWindow ) ;
}
}
@ -4359,7 +4356,7 @@ bool ImGui::BeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags ext
SetNextWindowPos ( g . IO . DisplaySize * 0.5f , ImGuiCond_Appearing , ImVec2 ( 0.5f , 0.5f ) ) ;
ImGuiWindowFlags flags = extra_flags | ImGuiWindowFlags_Popup | ImGuiWindowFlags_Modal | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings ;
bool is_open = ImGui : : Begin ( name , p_open , flags ) ;
bool is_open = Begin ( name , p_open , flags ) ;
if ( ! is_open | | ( p_open & & ! * p_open ) ) // NB: is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
{
EndPopup ( ) ;
@ -4376,9 +4373,9 @@ void ImGui::EndPopup()
ImGuiWindow * window = GetCurrentWindow ( ) ;
IM_ASSERT ( window - > Flags & ImGuiWindowFlags_Popup ) ; // Mismatched BeginPopup()/EndPopup() calls
IM_ASSERT ( GImGui - > CurrentPopupStack . Size > 0 ) ;
ImGui : : End ( ) ;
End ( ) ;
if ( ! ( window - > Flags & ImGuiWindowFlags_Modal ) )
ImGui : : PopStyleVar ( ) ;
PopStyleVar ( ) ;
}
// This is a helper to handle the most simple case of associating one named popup to one given widget.
@ -4507,17 +4504,17 @@ bool ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags ext
{
ImGuiContext & g = * GImGui ;
const ImGuiStyle & style = g . Style ;
ImGui : : PushStyleColor ( ImGuiCol_ChildWindowBg , style . Colors [ ImGuiCol_FrameBg ] ) ;
ImGui : : PushStyleVar ( ImGuiStyleVar_ChildWindowRounding , style . FrameRounding ) ;
ImGui : : PushStyleVar ( ImGuiStyleVar_WindowPadding , style . FramePadding ) ;
return ImGui : : BeginChild ( id , size , ( g . CurrentWindow - > Flags & ImGuiWindowFlags_ShowBorders ) ? true : false , ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags ) ;
PushStyleColor ( ImGuiCol_ChildWindowBg , style . Colors [ ImGuiCol_FrameBg ] ) ;
PushStyleVar ( ImGuiStyleVar_ChildWindowRounding , style . FrameRounding ) ;
PushStyleVar ( ImGuiStyleVar_WindowPadding , style . FramePadding ) ;
return BeginChild ( id , size , ( g . CurrentWindow - > Flags & ImGuiWindowFlags_ShowBorders ) ? true : false , ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags ) ;
}
void ImGui : : EndChildFrame ( )
{
ImGui : : EndChild ( ) ;
ImGui : : PopStyleVar ( 2 ) ;
ImGui : : PopStyleColor ( ) ;
EndChild ( ) ;
PopStyleVar ( 2 ) ;
PopStyleColor ( ) ;
}
// Save and compare stack sizes on Begin()/End() to detect usage errors
@ -5995,7 +5992,7 @@ void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiCond cond, const ImVec2& pi
# ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
void ImGui : : SetNextWindowPosCenter ( ImGuiCond cond )
{
SetNextWindowPos ( ImGui : : GetIO ( ) . DisplaySize * 0.5f , cond , ImVec2 ( 0.5f , 0.5f ) ) ;
SetNextWindowPos ( GetIO ( ) . DisplaySize * 0.5f , cond , ImVec2 ( 0.5f , 0.5f ) ) ;
}
# endif
@ -9538,8 +9535,11 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImVec2 popu
return false ;
const float arrow_size = SmallSquareSize ( ) ;
const bool hovered = IsHovered ( frame_bb , id ) ;
bool hovered , held ;
bool pressed = ButtonBehavior ( frame_bb , id , & hovered , & held ) ;
const bool navigated = g . NavId = = id ;
bool popup_open = IsPopupOpen ( id ) ;
const ImRect value_bb ( frame_bb . Min , frame_bb . Max - ImVec2 ( arrow_size , 0.0f ) ) ;
@ -9554,32 +9554,12 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImVec2 popu
if ( label_size . x > 0 )
RenderText ( ImVec2 ( frame_bb . Max . x + style . ItemInnerSpacing . x , frame_bb . Min . y + style . FramePadding . y ) , label ) ;
bool popup_toggled = false ;
if ( hovered )
if ( ( pressed | | g . NavActivateId = = id ) & & ! popup_open )
{
SetHoveredID ( id ) ;
if ( g . IO . MouseClicked [ 0 ] )
{
ClearActiveID ( ) ;
popup_toggled = true ;
}
}
if ( g . NavActivateId = = id )
popup_toggled = true ;
if ( popup_toggled )
{
if ( popup_open )
{
ClosePopup ( id ) ;
}
else
{
if ( window - > DC . NavLayerCurrent = = 0 )
window - > NavLastId = id ;
FocusWindow ( window ) ;
OpenPopupEx ( id , false ) ;
}
popup_open = ! popup_open ;
if ( window - > DC . NavLayerCurrent = = 0 )
window - > NavLastId = id ;
OpenPopupEx ( id , false ) ;
popup_open = true ;
}
if ( ! popup_open )
@ -10095,7 +10075,7 @@ void ImGui::EndMenu()
}
// Note: only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.
void ImGui : : ColorTooltip ( const char * text , const float col [ 4 ] , ImGuiColorEditFlags flags )
void ImGui : : ColorTooltip ( const char * text , const float * col , ImGuiColorEditFlags flags )
{
ImGuiContext & g = * GImGui ;
@ -10236,51 +10216,52 @@ bool ImGui::ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flag
return ColorEdit4 ( label , col , flags | ImGuiColorEditFlags_NoAlpha ) ;
}
static void ColorEditOptionsPopup ( ImGuiColorEditFlags flags , float * col )
void ImGui : : ColorEditOptionsPopup ( const float * col , ImGuiColorEditFlags flags )
{
bool allow_opt_inputs = ! ( flags & ImGuiColorEditFlags__InputsMask ) ;
bool allow_opt_datatype = ! ( flags & ImGuiColorEditFlags__DataTypeMask ) ;
if ( ( ! allow_opt_inputs & & ! allow_opt_datatype ) | | ! ImGui : : BeginPopup ( " context " ) )
if ( ( ! allow_opt_inputs & & ! allow_opt_datatype ) | | ! BeginPopup ( " context " ) )
return ;
ImGuiContext & g = * GImGui ;
ImGuiColorEditFlags opts = g . ColorEditOptions ;
if ( allow_opt_inputs )
{
if ( ImGui : : RadioButton ( " RGB " , ( opts & ImGuiColorEditFlags_RGB ) ? 1 : 0 ) ) opts = ( opts & ~ ImGuiColorEditFlags__InputsMask ) | ImGuiColorEditFlags_RGB ;
if ( ImGui : : RadioButton ( " HSV " , ( opts & ImGuiColorEditFlags_HSV ) ? 1 : 0 ) ) opts = ( opts & ~ ImGuiColorEditFlags__InputsMask ) | ImGuiColorEditFlags_HSV ;
if ( ImGui : : RadioButton ( " HEX " , ( opts & ImGuiColorEditFlags_HEX ) ? 1 : 0 ) ) opts = ( opts & ~ ImGuiColorEditFlags__InputsMask ) | ImGuiColorEditFlags_HEX ;
if ( RadioButton ( " RGB " , ( opts & ImGuiColorEditFlags_RGB ) ? 1 : 0 ) ) opts = ( opts & ~ ImGuiColorEditFlags__InputsMask ) | ImGuiColorEditFlags_RGB ;
if ( RadioButton ( " HSV " , ( opts & ImGuiColorEditFlags_HSV ) ? 1 : 0 ) ) opts = ( opts & ~ ImGuiColorEditFlags__InputsMask ) | ImGuiColorEditFlags_HSV ;
if ( RadioButton ( " HEX " , ( opts & ImGuiColorEditFlags_HEX ) ? 1 : 0 ) ) opts = ( opts & ~ ImGuiColorEditFlags__InputsMask ) | ImGuiColorEditFlags_HEX ;
}
if ( allow_opt_datatype )
{
if ( allow_opt_inputs ) ImGui : : Separator ( ) ;
if ( ImGui : : RadioButton ( " 0..255 " , ( opts & ImGuiColorEditFlags_Uint8 ) ? 1 : 0 ) ) opts = ( opts & ~ ImGuiColorEditFlags__DataTypeMask ) | ImGuiColorEditFlags_Uint8 ;
if ( ImGui : : RadioButton ( " 0.00..1.00 " , ( opts & ImGuiColorEditFlags_Float ) ? 1 : 0 ) ) opts = ( opts & ~ ImGuiColorEditFlags__DataTypeMask ) | ImGuiColorEditFlags_Float ;
if ( allow_opt_inputs ) Separator ( ) ;
if ( RadioButton ( " 0..255 " , ( opts & ImGuiColorEditFlags_Uint8 ) ? 1 : 0 ) ) opts = ( opts & ~ ImGuiColorEditFlags__DataTypeMask ) | ImGuiColorEditFlags_Uint8 ;
if ( RadioButton ( " 0.00..1.00 " , ( opts & ImGuiColorEditFlags_Float ) ? 1 : 0 ) ) opts = ( opts & ~ ImGuiColorEditFlags__DataTypeMask ) | ImGuiColorEditFlags_Float ;
}
if ( allow_opt_inputs | | allow_opt_datatype ) ImGui : : Separator ( ) ;
if ( ImGui : : Button ( " Copy as.. " , ImVec2 ( - 1 , 0 ) ) )
ImGui : : OpenPopup ( " Copy " ) ;
if ( ImGui : : BeginPopup ( " Copy " ) )
if ( allow_opt_inputs | | allow_opt_datatype )
Separator ( ) ;
if ( Button ( " Copy as.. " , ImVec2 ( - 1 , 0 ) ) )
OpenPopup ( " Copy " ) ;
if ( BeginPopup ( " Copy " ) )
{
int cr = IM_F32_TO_INT8_SAT ( col [ 0 ] ) , cg = IM_F32_TO_INT8_SAT ( col [ 1 ] ) , cb = IM_F32_TO_INT8_SAT ( col [ 2 ] ) , ca = ( flags & ImGuiColorEditFlags_NoAlpha ) ? 255 : IM_F32_TO_INT8_SAT ( col [ 3 ] ) ;
char buf [ 64 ] ;
sprintf ( buf , " (%.3ff, %.3ff, %.3ff, %.3ff) " , col [ 0 ] , col [ 1 ] , col [ 2 ] , ( flags & ImGuiColorEditFlags_NoAlpha ) ? 1.0f : col [ 3 ] ) ;
if ( ImGui : : Selectable ( buf ) )
ImGui : : SetClipboardText ( buf ) ;
if ( Selectable ( buf ) )
SetClipboardText ( buf ) ;
sprintf ( buf , " (%d,%d,%d,%d) " , cr , cg , cb , ca ) ;
if ( ImGui : : Selectable ( buf ) )
ImGui : : SetClipboardText ( buf ) ;
if ( Selectable ( buf ) )
SetClipboardText ( buf ) ;
if ( flags & ImGuiColorEditFlags_NoAlpha )
sprintf ( buf , " 0x%02X%02X%02X " , cr , cg , cb ) ;
else
sprintf ( buf , " 0x%02X%02X%02X%02X " , cr , cg , cb , ca ) ;
if ( ImGui : : Selectable ( buf ) )
ImGui : : SetClipboardText ( buf ) ;
ImGui : : EndPopup ( ) ;
if ( Selectable ( buf ) )
SetClipboardText ( buf ) ;
EndPopup ( ) ;
}
g . ColorEditOptions = opts ;
ImGui : : EndPopup ( ) ;
EndPopup ( ) ;
}
static void ColorPickerOptionsPopup ( ImGuiColorEditFlags flags , float * ref_col )
@ -10351,7 +10332,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
// Context menu: display and modify options (before defaults are applied)
if ( ! ( flags & ImGuiColorEditFlags_NoOptions ) )
ColorEditOptionsPopup ( flags , col ) ;
ColorEditOptionsPopup ( col , flags ) ;
// Read stored options
if ( ! ( flags & ImGuiColorEditFlags__InputsMask ) )