Allow disabling text boxes
This commit is contained in:
parent
6982a3de59
commit
9c1e371803
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -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();
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user