diff options
author | stujones11 <stujones111@gmail.com> | 2019-05-24 16:42:05 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2019-05-24 16:42:05 +0100 |
commit | b917ea4723fb0fe976486602a456c8dd41eab7ef (patch) | |
tree | ab459ae6aaeb19599d19a63b4508dcc60b632386 /src/gui/guiTable.cpp | |
parent | a2848c9cdeba8d077c61ef20108cb208fd073ef8 (diff) | |
download | minetest-b917ea4723fb0fe976486602a456c8dd41eab7ef.tar.gz minetest-b917ea4723fb0fe976486602a456c8dd41eab7ef.tar.bz2 minetest-b917ea4723fb0fe976486602a456c8dd41eab7ef.zip |
Add IGUIScrollbar implementation with variable bar sizes (#8507)
Diffstat (limited to 'src/gui/guiTable.cpp')
-rw-r--r-- | src/gui/guiTable.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/guiTable.cpp b/src/gui/guiTable.cpp index a123bdd6d..371e7ab6c 100644 --- a/src/gui/guiTable.cpp +++ b/src/gui/guiTable.cpp @@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <cstring> #include <IGUISkin.h> #include <IGUIFont.h> -#include <IGUIScrollBar.h> #include "client/renderingengine.h" #include "debug.h" #include "log.h" @@ -62,12 +61,12 @@ GUITable::GUITable(gui::IGUIEnvironment *env, } const s32 s = skin->getSize(gui::EGDS_SCROLLBAR_SIZE); - m_scrollbar = Environment->addScrollBar(false, + m_scrollbar = new guiScrollBar(Environment, this, -1, core::rect<s32>(RelativeRect.getWidth() - s, 0, RelativeRect.getWidth(), RelativeRect.getHeight()), - this, -1); + false, true); m_scrollbar->setSubElement(true); m_scrollbar->setTabStop(false); m_scrollbar->setAlignment(gui::EGUIA_LOWERRIGHT, gui::EGUIA_LOWERRIGHT, @@ -99,7 +98,8 @@ GUITable::~GUITable() if (m_font) m_font->drop(); - m_scrollbar->remove(); + if (m_scrollbar) + m_scrollbar->drop(); } GUITable::Option GUITable::splitOption(const std::string &str) @@ -1075,6 +1075,7 @@ void GUITable::updateScrollBar() m_scrollbar->setMax(scrollmax); m_scrollbar->setSmallStep(m_rowheight); m_scrollbar->setLargeStep(2 * m_rowheight); + m_scrollbar->setPageSize(totalheight); } void GUITable::sendTableEvent(s32 column, bool doubleclick) |