Allow disabling text boxes

This commit is contained in:
Marianne Gagnon 2014-06-03 19:13:25 -04:00
parent 6982a3de59
commit 9c1e371803
2 changed files with 39 additions and 0 deletions

View File

@ -94,6 +94,9 @@ void TextBoxWidget::add()
(m_parent ? m_parent : GUIEngine::getGUIEnv()->getRootGUIElement()),
getNewID(), widget_size);
if (m_deactivated)
m_element->setEnabled(false);
//m_element = GUIEngine::getGUIEnv()->addEditBox(text.c_str(), widget_size,
// true /* border */, m_parent, getNewID());
m_id = m_element->getID();
@ -168,3 +171,33 @@ void TextBoxWidget::elementRemoved()
m_element->drop();
Widget::elementRemoved();
}
// -----------------------------------------------------------------------------
void TextBoxWidget::setActivated()
{
Widget::setActivated();
if (m_element != NULL)
{
IGUIEditBox* textCtrl = Widget::getIrrlichtElement<IGUIEditBox>();
assert(textCtrl != NULL);
textCtrl->setEnabled(true);
}
}
// -----------------------------------------------------------------------------
void TextBoxWidget::setDeactivated()
{
Widget::setDeactivated();
if (m_element != NULL)
{
IGUIEditBox* textCtrl = Widget::getIrrlichtElement<IGUIEditBox>();
assert(textCtrl != NULL);
textCtrl->setEnabled(false);
}
}
// -----------------------------------------------------------------------------

View File

@ -71,6 +71,12 @@ namespace GUIEngine
void setPasswordBox(bool passwordBox, wchar_t passwordChar = L'*');
virtual void elementRemoved();
/** Override method from base class Widget */
virtual void setActivated();
/** Override method from base class Widget */
virtual void setDeactivated();
};
}