@ -1071,7 +1071,8 @@ bool ImGui::Checkbox(const char* label, bool* v)
RenderNavHighlight ( total_bb , id ) ;
RenderNavHighlight ( total_bb , id ) ;
RenderFrame ( check_bb . Min , check_bb . Max , GetColorU32 ( ( held & & hovered ) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg ) , true , style . FrameRounding ) ;
RenderFrame ( check_bb . Min , check_bb . Max , GetColorU32 ( ( held & & hovered ) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg ) , true , style . FrameRounding ) ;
ImU32 check_col = GetColorU32 ( ImGuiCol_CheckMark ) ;
ImU32 check_col = GetColorU32 ( ImGuiCol_CheckMark ) ;
if ( window - > DC . ItemFlags & ImGuiItemFlags_MixedValue )
bool mixed_value = ( window - > DC . ItemFlags & ImGuiItemFlags_MixedValue ) ! = 0 ;
if ( mixed_value )
{
{
// Undocumented tristate/mixed/indeterminate checkbox (#2644)
// Undocumented tristate/mixed/indeterminate checkbox (#2644)
ImVec2 pad ( ImMax ( 1.0f , IM_FLOOR ( square_sz / 3.6f ) ) , ImMax ( 1.0f , IM_FLOOR ( square_sz / 3.6f ) ) ) ;
ImVec2 pad ( ImMax ( 1.0f , IM_FLOOR ( square_sz / 3.6f ) ) , ImMax ( 1.0f , IM_FLOOR ( square_sz / 3.6f ) ) ) ;
@ -1084,7 +1085,7 @@ bool ImGui::Checkbox(const char* label, bool* v)
}
}
if ( g . LogEnabled )
if ( g . LogEnabled )
LogRenderedText ( & total_bb . Min , * v ? " [x] " : " [ ] " ) ;
LogRenderedText ( & total_bb . Min , mixed_value ? " [~] " : * v ? " [x] " : " [ ] " ) ;
if ( label_size . x > 0.0f )
if ( label_size . x > 0.0f )
RenderText ( ImVec2 ( check_bb . Max . x + style . ItemInnerSpacing . x , check_bb . Min . y + style . FramePadding . y ) , label ) ;
RenderText ( ImVec2 ( check_bb . Max . x + style . ItemInnerSpacing . x , check_bb . Min . y + style . FramePadding . y ) , label ) ;
@ -1095,7 +1096,21 @@ bool ImGui::Checkbox(const char* label, bool* v)
bool ImGui : : CheckboxFlags ( const char * label , unsigned int * flags , unsigned int flags_value )
bool ImGui : : CheckboxFlags ( const char * label , unsigned int * flags , unsigned int flags_value )
{
{
bool v = ( ( * flags & flags_value ) = = flags_value ) ;
bool v = ( ( * flags & flags_value ) = = flags_value ) ;
bool pressed = Checkbox ( label , & v ) ;
bool pressed ;
if ( v = = false & & ( * flags & flags_value ) ! = 0 )
{
// Mixed value (FIXME: find a way to expose neatly to Checkbox?)
ImGuiWindow * window = GetCurrentWindow ( ) ;
const ImGuiItemFlags backup_item_flags = window - > DC . ItemFlags ;
window - > DC . ItemFlags | = ImGuiItemFlags_MixedValue ;
pressed = Checkbox ( label , & v ) ;
window - > DC . ItemFlags = backup_item_flags ;
}
else
{
// Regular checkbox
pressed = Checkbox ( label , & v ) ;
}
if ( pressed )
if ( pressed )
{
{
if ( v )
if ( v )