Allow text box widget to process left / right events
This commit is contained in:
parent
264b79ef0d
commit
eb8b68dcb6
@ -120,7 +120,8 @@ using namespace gui;
|
||||
virtual void setDrawBackground(bool) { }
|
||||
|
||||
void openScreenKeyboard();
|
||||
|
||||
s32 getCursorPosInBox() const { return CursorPos; }
|
||||
s32 getTextCount() const { return (s32)Text.size(); }
|
||||
protected:
|
||||
//! Breaks the single text line.
|
||||
void breakText();
|
||||
|
@ -209,3 +209,22 @@ EventPropagation TextBoxWidget::onActivationInput(const int playerID)
|
||||
// event to avoid breaking something
|
||||
return EVENT_BLOCK;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
EventPropagation TextBoxWidget::rightPressed(const int playerID)
|
||||
{
|
||||
if (((MyCGUIEditBox*)m_element)->getTextCount() ==
|
||||
((MyCGUIEditBox*)m_element)->getCursorPosInBox())
|
||||
return EVENT_BLOCK;
|
||||
|
||||
return EVENT_LET;
|
||||
} // rightPressed
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
EventPropagation TextBoxWidget::leftPressed (const int playerID)
|
||||
{
|
||||
if (((MyCGUIEditBox*)m_element)->getCursorPosInBox() == 0)
|
||||
return EVENT_BLOCK;
|
||||
|
||||
return EVENT_LET;
|
||||
} // leftPressed
|
||||
|
@ -77,6 +77,9 @@ namespace GUIEngine
|
||||
virtual void setActive(bool active=true);
|
||||
|
||||
virtual EventPropagation onActivationInput(const int playerID);
|
||||
virtual EventPropagation rightPressed(const int playerID);
|
||||
virtual EventPropagation leftPressed (const int playerID);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user