Fix GTK negative content width warnings for bitmap toggle buttons
On Linux/GTK, CheckBox, RadioBox, and SwitchButton set their size to exactly the bitmap size (18x18 or 16x16), but GTK's internal CSS padding requires additional space, resulting in negative content width warnings. Use GetBestSize() on GTK to account for theme padding.
This commit is contained in:
@@ -180,8 +180,15 @@ void SwitchButton::Rescale()
|
||||
(i == 0 ? m_off : m_on).bmp() = bmp;
|
||||
}
|
||||
}
|
||||
SetSize(m_on.GetBmpSize());
|
||||
update();
|
||||
#ifdef __WXGTK__
|
||||
wxSize bestSize = GetBestSize();
|
||||
bestSize.IncTo(m_on.GetBmpSize());
|
||||
SetSize(bestSize);
|
||||
SetMinSize(bestSize);
|
||||
#else
|
||||
SetSize(m_on.GetBmpSize());
|
||||
#endif
|
||||
}
|
||||
|
||||
void SwitchButton::update()
|
||||
|
||||
Reference in New Issue
Block a user