Default scrollbar width wasn't always taken from texture size in widgets containing scrollbars

0.8
Bruno Van de Velde 2018-12-22 16:55:06 +01:00
parent 05a048bd97
commit e56acc278d
5 changed files with 39 additions and 0 deletions

View File

@ -468,6 +468,13 @@ namespace tgui
else if (property == "scrollbar")
{
m_scroll->setRenderer(getSharedRenderer()->getScrollbar());
// If no scrollbar width was set then we may need to use the one from the texture
if (!getSharedRenderer()->getScrollbarWidth())
{
m_scroll->setSize({m_scroll->getDefaultWidth(), m_scroll->getSize().y});
setSize(m_size);
}
}
else if (property == "scrollbarwidth")
{

View File

@ -719,6 +719,13 @@ namespace tgui
else if (property == "scrollbar")
{
m_scroll->setRenderer(getSharedRenderer()->getScrollbar());
// If no scrollbar width was set then we may need to use the one from the texture
if (!getSharedRenderer()->getScrollbarWidth())
{
m_scroll->setSize({m_scroll->getDefaultWidth(), m_scroll->getSize().y});
setSize(m_size);
}
}
else if (property == "scrollbarwidth")
{

View File

@ -575,6 +575,15 @@ namespace tgui
{
m_verticalScrollbar->setRenderer(getSharedRenderer()->getScrollbar());
m_horizontalScrollbar->setRenderer(getSharedRenderer()->getScrollbar());
// If no scrollbar width was set then we may need to use the one from the texture
if (!getSharedRenderer()->getScrollbarWidth())
{
const float width = m_verticalScrollbar->getDefaultWidth();
m_verticalScrollbar->setSize({width, m_verticalScrollbar->getSize().y});
m_horizontalScrollbar->setSize({m_horizontalScrollbar->getSize().x, width});
updateScrollbars();
}
}
else if (property == "scrollbarwidth")
{

View File

@ -1492,6 +1492,13 @@ namespace tgui
else if (property == "scrollbar")
{
m_verticalScroll->setRenderer(getSharedRenderer()->getScrollbar());
// If no scrollbar width was set then we may need to use the one from the texture
if (!getSharedRenderer()->getScrollbarWidth())
{
m_verticalScroll->setSize({m_verticalScroll->getDefaultWidth(), m_verticalScroll->getSize().y});
setSize(m_size);
}
}
else if (property == "scrollbarwidth")
{

View File

@ -853,6 +853,15 @@ namespace tgui
{
m_verticalScrollbar->setRenderer(getSharedRenderer()->getScrollbar());
m_horizontalScrollbar->setRenderer(getSharedRenderer()->getScrollbar());
// If no scrollbar width was set then we may need to use the one from the texture
if (!getSharedRenderer()->getScrollbarWidth())
{
const float width = m_verticalScrollbar->getDefaultWidth();
m_verticalScrollbar->setSize({width, m_verticalScrollbar->getSize().y});
m_horizontalScrollbar->setSize({m_horizontalScrollbar->getSize().x, width});
markNodesDirty();
}
}
else if (property == "scrollbarwidth")
{