Skip to content
Permalink
Browse files

Add IGUIScrollbar implementation with variable bar sizes (#8507)

  • Loading branch information...
stujones11 authored and rubenwardy committed May 24, 2019
1 parent a2848c9 commit b917ea4723fb0fe976486602a456c8dd41eab7ef
@@ -185,6 +185,7 @@ LOCAL_SRC_FILES := \
jni/src/gui/guiKeyChangeMenu.cpp \
jni/src/gui/guiPasswordChange.cpp \
jni/src/gui/guiPathSelectMenu.cpp \
jni/src/gui/guiScrollBar.cpp \
jni/src/gui/guiTable.cpp \
jni/src/gui/guiVolumeChange.cpp \
jni/src/gui/intlGUIEditBox.cpp \
@@ -7,6 +7,7 @@ set(gui_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/guiKeyChangeMenu.cpp
${CMAKE_CURRENT_SOURCE_DIR}/guiPasswordChange.cpp
${CMAKE_CURRENT_SOURCE_DIR}/guiPathSelectMenu.cpp
${CMAKE_CURRENT_SOURCE_DIR}/guiScrollBar.cpp
${CMAKE_CURRENT_SOURCE_DIR}/guiTable.cpp
${CMAKE_CURRENT_SOURCE_DIR}/guiVolumeChange.cpp
${CMAKE_CURRENT_SOURCE_DIR}/intlGUIEditBox.cpp
@@ -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
@@ -7,7 +7,7 @@

#include "IGUIEditBox.h"
#include "IOSOperator.h"
#include "IGUIScrollBar.h"
#include "guiScrollBar.h"
#include <vector>

using namespace irr;
@@ -187,7 +187,7 @@ class GUIEditBoxWithScrollBar : public IGUIEditBox
core::rect<s32> m_current_text_rect, m_frame_rect; // temporary values

u32 m_scrollbar_width;
IGUIScrollBar *m_vscrollbar;
guiScrollBar *m_vscrollbar;
bool m_writable;

bool m_bg_color_used;

0 comments on commit b917ea4

Please sign in to comment.
You can’t perform that action at this time.