#include <util/numeric.h>
#include "intlGUIEditBox.h"
-#if defined(_IRR_COMPILE_WITH_GUI_) && IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9
+#if defined(_IRR_COMPILE_WITH_GUI_) && IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9 || defined(__ANDROID__)
#include "IGUISkin.h"
#include "IGUIEnvironment.h"
#include "IGUIFont.h"
#include "IVideoDriver.h"
-//#include "rect.h"
//#include "irrlicht/os.cpp"
#include "porting.h"
//#include "Keycodes.h"
break;
case KEY_KEY_X:
// cut to the clipboard
- if (!PasswordBox && Operator && MarkBegin != MarkEnd)
- {
+ if (!PasswordBox && Operator && MarkBegin != MarkEnd) {
const s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
sc = Text.subString(realmbgn, realmend - realmbgn).c_str();
Operator->copyToClipboard(sc.c_str());
- if (IsEnabled)
- {
+ if (IsEnabled && m_writable) {
// delete
core::stringw s;
s = Text.subString(0, realmbgn);
}
break;
case KEY_KEY_V:
- if ( !IsEnabled )
+ if (!IsEnabled || !m_writable)
break;
// paste from the clipboard
break;
case KEY_BACK:
- if ( !this->IsEnabled )
+ if (!this->IsEnabled || !m_writable)
break;
if (!Text.empty()) {
}
break;
case KEY_DELETE:
- if ( !this->IsEnabled )
+ if (!this->IsEnabled || !m_writable)
break;
if (!Text.empty()) {
}
break;
case EMIE_MOUSE_WHEEL:
- if (m_vscrollbar) {
+ if (m_vscrollbar && m_vscrollbar->isVisible()) {
s32 pos = m_vscrollbar->getPos();
s32 step = m_vscrollbar->getSmallStep();
m_vscrollbar->setPos(pos - event.MouseInput.Wheel * step);
void intlGUIEditBox::inputChar(wchar_t c)
{
- if (!IsEnabled)
+ if (!IsEnabled || !m_writable)
return;
if (c != 0)
// todo: adjust scrollbar
}
- // vertical scroll position
- if (FrameRect.LowerRightCorner.Y < CurrentTextRect.LowerRightCorner.Y + VScrollPos)
- VScrollPos = CurrentTextRect.LowerRightCorner.Y - FrameRect.LowerRightCorner.Y + VScrollPos;
+ if (!WordWrap && !MultiLine)
+ return;
- else if (FrameRect.UpperLeftCorner.Y > CurrentTextRect.UpperLeftCorner.Y + VScrollPos)
- VScrollPos = CurrentTextRect.UpperLeftCorner.Y - FrameRect.UpperLeftCorner.Y + VScrollPos;
- else
- VScrollPos = 0;
+ // vertical scroll position
+ if (FrameRect.LowerRightCorner.Y < CurrentTextRect.LowerRightCorner.Y)
+ VScrollPos += CurrentTextRect.LowerRightCorner.Y - FrameRect.LowerRightCorner.Y; // scrolling downwards
+ else if (FrameRect.UpperLeftCorner.Y > CurrentTextRect.UpperLeftCorner.Y)
+ VScrollPos += CurrentTextRect.UpperLeftCorner.Y - FrameRect.UpperLeftCorner.Y; // scrolling upwards
// todo: adjust scrollbar
if (m_vscrollbar)