mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Add parameter to force showing scrollbar with listbox
This commit is contained in:
parent
b376fbb331
commit
9efab4964b
|
@ -60,7 +60,7 @@ void CListBox::DoFooter(const char *pBottomText, float FooterHeight)
|
|||
m_FooterHeight = FooterHeight;
|
||||
}
|
||||
|
||||
void CListBox::DoStart(float RowHeight, int NumItems, int ItemsPerRow, int RowsPerScroll, int SelectedIndex, const CUIRect *pRect, bool Background, int BackgroundCorners)
|
||||
void CListBox::DoStart(float RowHeight, int NumItems, int ItemsPerRow, int RowsPerScroll, int SelectedIndex, const CUIRect *pRect, bool Background, int BackgroundCorners, bool ForceShowScrollbar)
|
||||
{
|
||||
CUIRect View;
|
||||
if(pRect)
|
||||
|
@ -119,6 +119,7 @@ void CListBox::DoStart(float RowHeight, int NumItems, int ItemsPerRow, int RowsP
|
|||
ScrollParams.m_Active = m_Active;
|
||||
ScrollParams.m_ScrollbarWidth = ScrollbarWidthMax();
|
||||
ScrollParams.m_ScrollUnit = (m_ListBoxRowHeight + m_AutoSpacing) * RowsPerScroll;
|
||||
ScrollParams.m_Flags = ForceShowScrollbar ? CScrollRegionParams::FLAG_CONTENT_STATIC_WIDTH : 0;
|
||||
m_ScrollRegion.Begin(&m_ListBoxView, &m_ScrollOffset, &ScrollParams);
|
||||
m_ListBoxView.y += m_ScrollOffset.y;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
void DoAutoSpacing(float Spacing = 20.0f) { m_AutoSpacing = Spacing; }
|
||||
void DoSpacing(float Spacing = 20.0f);
|
||||
void DoFooter(const char *pBottomText, float FooterHeight = 20.0f); // call before DoStart to create a footer
|
||||
void DoStart(float RowHeight, int NumItems, int ItemsPerRow, int RowsPerScroll, int SelectedIndex, const CUIRect *pRect = nullptr, bool Background = true, int BackgroundCorners = IGraphics::CORNER_ALL);
|
||||
void DoStart(float RowHeight, int NumItems, int ItemsPerRow, int RowsPerScroll, int SelectedIndex, const CUIRect *pRect = nullptr, bool Background = true, int BackgroundCorners = IGraphics::CORNER_ALL, bool ForceShowScrollbar = false);
|
||||
void ScrollToSelected() { m_ListBoxUpdateScroll = true; }
|
||||
CListboxItem DoNextItem(const void *pID, bool Selected = false);
|
||||
CListboxItem DoSubheader();
|
||||
|
|
Loading…
Reference in a new issue