summaryrefslogtreecommitdiff
path: root/src/gui/widgets/textbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/textbox.cpp')
-rw-r--r--src/gui/widgets/textbox.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index 5f565259b..b1849e801 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -85,6 +85,7 @@ TextBox::TextBox(const Widget2 *const widget) :
mEditable(true),
mOpaque(true)
{
+ mAllowLogic = false;
setText("");
setFocusable(true);
@@ -247,10 +248,10 @@ void TextBox::setText(const std::string& text)
adjustSize();
}
-void TextBox::keyPressed(KeyEvent& keyEvent)
+void TextBox::keyPressed(KeyEvent& event)
{
- const Key &key = keyEvent.getKey();
- const int action = keyEvent.getActionId();
+ const Key &key = event.getKey();
+ const int action = event.getActionId();
switch (action)
{
@@ -429,7 +430,7 @@ void TextBox::keyPressed(KeyEvent& keyEvent)
adjustSize();
scrollToCaret();
- keyEvent.consume();
+ event.consume();
}
void TextBox::draw(Graphics* graphics)
@@ -581,28 +582,29 @@ void TextBox::addRow(const std::string &row)
adjustSize();
}
-void TextBox::mousePressed(MouseEvent& mouseEvent)
+void TextBox::mousePressed(MouseEvent& event)
{
- if (mouseEvent.getButton() == MouseEvent::LEFT)
+ if (event.getButton() == MouseEvent::LEFT)
{
const int height = getFont()->getHeight();
if (!height)
return;
- mCaretRow = mouseEvent.getY() / height;
+ event.consume();
+ mCaretRow = event.getY() / height;
const int sz = static_cast<int>(mTextRows.size());
if (mCaretRow >= sz)
mCaretRow = sz - 1;
mCaretColumn = getFont()->getStringIndexAt(
- mTextRows[mCaretRow], mouseEvent.getX());
+ mTextRows[mCaretRow], event.getX());
}
}
-void TextBox::mouseDragged(MouseEvent& mouseEvent)
+void TextBox::mouseDragged(MouseEvent& event)
{
- mouseEvent.consume();
+ event.consume();
}
void TextBox::drawCaret(Graphics *const graphics, const int x, const int y)