mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add IGUIScrollbar implementation with variable bar sizes (#8507)
This commit is contained in:
parent
a2848c9cde
commit
b917ea4723
10 changed files with 543 additions and 14 deletions
|
@ -13,7 +13,6 @@
|
|||
#include "porting.h"
|
||||
#include "Keycodes.h"
|
||||
|
||||
|
||||
/*
|
||||
todo:
|
||||
optional scrollbars [done]
|
||||
|
@ -76,7 +75,8 @@ GUIEditBoxWithScrollBar::~GUIEditBoxWithScrollBar()
|
|||
if (m_operator)
|
||||
m_operator->drop();
|
||||
|
||||
m_vscrollbar->remove();
|
||||
if (m_vscrollbar)
|
||||
m_vscrollbar->drop();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1400,7 +1400,9 @@ void GUIEditBoxWithScrollBar::createVScrollBar()
|
|||
|
||||
irr::core::rect<s32> scrollbarrect = m_frame_rect;
|
||||
scrollbarrect.UpperLeftCorner.X += m_frame_rect.getWidth() - m_scrollbar_width;
|
||||
m_vscrollbar = Environment->addScrollBar(false, scrollbarrect, getParent(), getID());
|
||||
m_vscrollbar = new guiScrollBar(Environment, getParent(), -1,
|
||||
scrollbarrect, false, true);
|
||||
|
||||
m_vscrollbar->setVisible(false);
|
||||
m_vscrollbar->setSmallStep(1);
|
||||
m_vscrollbar->setLargeStep(1);
|
||||
|
@ -1422,6 +1424,7 @@ void GUIEditBoxWithScrollBar::updateVScrollBar()
|
|||
if (scrollymax != m_vscrollbar->getMax()) {
|
||||
// manage a newline or a deleted line
|
||||
m_vscrollbar->setMax(scrollymax);
|
||||
m_vscrollbar->setPageSize(s32(getTextDimension().Height));
|
||||
calculateScrollPos();
|
||||
} else {
|
||||
// manage a newline or a deleted line
|
||||
|
@ -1436,6 +1439,7 @@ void GUIEditBoxWithScrollBar::updateVScrollBar()
|
|||
s32 scrollymax = getTextDimension().Height - m_frame_rect.getHeight();
|
||||
if (scrollymax != m_vscrollbar->getMax()) {
|
||||
m_vscrollbar->setMax(scrollymax);
|
||||
m_vscrollbar->setPageSize(s32(getTextDimension().Height));
|
||||
}
|
||||
|
||||
if (!m_vscrollbar->isVisible()) {
|
||||
|
@ -1448,10 +1452,10 @@ void GUIEditBoxWithScrollBar::updateVScrollBar()
|
|||
m_vscroll_pos = 0;
|
||||
m_vscrollbar->setPos(0);
|
||||
m_vscrollbar->setMax(1);
|
||||
m_vscrollbar->setPageSize(s32(getTextDimension().Height));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//! set true if this editbox is writable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue