Просмотр исходного кода

Changing utility method isInFocus() to hasFocus() and making it protected.
Using this method in one place it was missing, which gets TextBox working again.

ablake 12 лет назад
Родитель
Сommit
d11c3739d5

+ 5 - 5
gameplay/src/Container.cpp

@@ -645,7 +645,7 @@ bool Container::keyEvent(Keyboard::KeyEvent evt, int key)
             continue;
         }
 
-        if (control->isInFocus() && control->keyEvent(evt, key))
+        if (control->hasFocus() && control->keyEvent(evt, key))
         {
             release();
             return true;
@@ -677,7 +677,7 @@ void Container::guaranteeFocus(Control* inFocus)
         {
             ((Container*)control)->guaranteeFocus(inFocus);
         }
-        else if (control->isInFocus())
+        else if (control->hasFocus())
         {
             control->setState(NORMAL);
             return;
@@ -697,7 +697,7 @@ bool Container::moveFocus(Direction direction, Control* outsideControl)
         {
             Control* control = *it;
             GP_ASSERT(control);
-            if (control->isInFocus())
+            if (control->hasFocus())
             {
                 start = control;
                 break;
@@ -904,7 +904,7 @@ bool Container::moveFocus(Direction direction, Control* outsideControl)
 void Container::timeEvent(long timeDiff, void* cookie)
 {
     double time = Game::getAbsoluteTime();
-    if (_focusChangeRepeat && isInFocus() && _focusPressed &&
+    if (_focusChangeRepeat && hasFocus() && _focusPressed &&
         abs(time - timeDiff - _focusChangeRepeatDelay - _focusChangeStartTime) < 50)
     {
         ++_focusChangeCount;
@@ -961,7 +961,7 @@ bool Container::gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsign
     {
         Control* control = *it;
         GP_ASSERT(control);
-        if (control->isInFocus() || control->getState() == Control::ACTIVE)
+        if (control->hasFocus() || control->getState() == Control::ACTIVE)
         {
             eventConsumed |= control->gamepadEvent(evt, gamepad, analogIndex);
             break;

+ 1 - 1
gameplay/src/Control.cpp

@@ -275,7 +275,7 @@ bool Control::isVisible() const
     return _visible;
 }
 
-bool Control::isInFocus() const
+bool Control::hasFocus() const
 {
     return (_state == FOCUS || (_state == HOVER && _previousState == FOCUS));
 }

+ 8 - 9
gameplay/src/Control.h

@@ -630,14 +630,6 @@ public:
      */
     bool isVisible() const;
 
-    /**
-     * Gets whether this control is in focus.
-     * Note that a control's state can be HOVER while the control is in focus.
-     * When the cursor leaves the control, it will return to the FOCUS state.
-     * This method will still return true in this case.
-     */
-    bool isInFocus() const;
-
     /**
      * Set the opacity of this control.
      *
@@ -964,7 +956,6 @@ protected:
      *
      * @param eventType The event to trigger.
      */
-    //void notifyListeners(Listener::EventType eventType);
     void notifyListeners(Control::Listener::EventType eventType);
 
     /**
@@ -975,6 +966,14 @@ protected:
      */
     static Alignment getAlignment(const char* alignment);
 
+    /**
+     * Gets whether this control is in focus.
+     * Note that a control's state can be HOVER while the control is in focus.
+     * When the cursor leaves the control, it will return to the FOCUS state.
+     * This method will still return true in this case.
+     */
+    bool hasFocus() const;
+
     /** 
      * The Control's ID.
      */ 

+ 2 - 2
gameplay/src/Form.cpp

@@ -659,7 +659,7 @@ bool Form::keyEventInternal(Keyboard::KeyEvent evt, int key)
     {
         Form* form = __forms[i];
         GP_ASSERT(form);
-        if (form->isEnabled() && form->isVisible() && form->getState() == Control::FOCUS)
+        if (form->isEnabled() && form->isVisible() && form->hasFocus())
         {
             if (form->keyEvent(evt, key))
                 return true;
@@ -727,7 +727,7 @@ void Form::gamepadEventInternal(Gamepad::GamepadEvent evt, Gamepad* gamepad, uns
         Form* form = __forms[i];
         GP_ASSERT(form);
 
-        if (form->isEnabled() && form->isVisible() && form->isInFocus())
+        if (form->isEnabled() && form->isVisible() && form->hasFocus())
         {
             if (form->gamepadEvent(evt, gamepad, analogIndex))
                 return;

+ 2 - 2
gameplay/src/Slider.cpp

@@ -262,7 +262,7 @@ bool Slider::mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta)
 
         case Mouse::MOUSE_WHEEL:
         {
-            if ((isInFocus() && _state == HOVER) || _state == ACTIVE)
+            if ((hasFocus() && _state == HOVER) || _state == ACTIVE)
             {
                 float total = _max - _min;
                 float oldValue = _value;
@@ -366,7 +366,7 @@ bool Slider::gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsigned
         {
             _selectButtonDown = false;
 
-            if (isInFocus())
+            if (hasFocus())
                 setState(ACTIVE);
             else if (_state == ACTIVE)
                 setState(FOCUS);

+ 162 - 165
gameplay/src/TextBox.cpp

@@ -105,209 +105,206 @@ bool TextBox::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int conta
 
 bool TextBox::keyEvent(Keyboard::KeyEvent evt, int key)
 {
-    if (isInFocus())
+    switch (evt)
     {
-        switch (evt)
+        case Keyboard::KEY_PRESS:
         {
-            case Keyboard::KEY_PRESS:
+            switch (key)
             {
-                switch (key)
+                case Keyboard::KEY_HOME:
                 {
-                    case Keyboard::KEY_HOME:
-                    {
-                        // TODO: Move cursor to beginning of line.
-                        // This only works for left alignment...
+                    // TODO: Move cursor to beginning of line.
+                    // This only works for left alignment...
                         
-                        //_caretLocation.x = _viewportClipBounds.x;
-                        //_dirty = true;
-                        break;
-                    }
-                    case Keyboard::KEY_END:
-                    {
-                        // TODO: Move cursor to end of line.
-                        break;
-                    }
-                    case Keyboard::KEY_DELETE:
-                    {
-                        Font* font = getFont(_state);
-                        GP_ASSERT(font);
-                        unsigned int fontSize = getFontSize(_state);
-                        Font::Justify textAlignment = getTextAlignment(_state);
-                        bool rightToLeft = getTextRightToLeft(_state);
+                    //_caretLocation.x = _viewportClipBounds.x;
+                    //_dirty = true;
+                    break;
+                }
+                case Keyboard::KEY_END:
+                {
+                    // TODO: Move cursor to end of line.
+                    break;
+                }
+                case Keyboard::KEY_DELETE:
+                {
+                    Font* font = getFont(_state);
+                    GP_ASSERT(font);
+                    unsigned int fontSize = getFontSize(_state);
+                    Font::Justify textAlignment = getTextAlignment(_state);
+                    bool rightToLeft = getTextRightToLeft(_state);
 
-                        int textIndex = font->getIndexAtLocation(_text.c_str(), _textBounds, fontSize, _caretLocation, &_caretLocation,
-                            textAlignment, true, rightToLeft);
+                    int textIndex = font->getIndexAtLocation(_text.c_str(), _textBounds, fontSize, _caretLocation, &_caretLocation,
+                        textAlignment, true, rightToLeft);
                         
-                        _text.erase(textIndex, 1);
-                        font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, textIndex,
-                            textAlignment, true, rightToLeft);
-                        _dirty = true;
-                        notifyListeners(Control::Listener::TEXT_CHANGED);
-                        break;
-                    }
-                    case Keyboard::KEY_LEFT_ARROW:
-                    {
-                        Font* font = getFont(_state);
-                        GP_ASSERT(font);
-                        unsigned int fontSize = getFontSize(_state);
-                        Font::Justify textAlignment = getTextAlignment(_state);
-                        bool rightToLeft = getTextRightToLeft(_state);
+                    _text.erase(textIndex, 1);
+                    font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, textIndex,
+                        textAlignment, true, rightToLeft);
+                    _dirty = true;
+                    notifyListeners(Control::Listener::TEXT_CHANGED);
+                    break;
+                }
+                case Keyboard::KEY_LEFT_ARROW:
+                {
+                    Font* font = getFont(_state);
+                    GP_ASSERT(font);
+                    unsigned int fontSize = getFontSize(_state);
+                    Font::Justify textAlignment = getTextAlignment(_state);
+                    bool rightToLeft = getTextRightToLeft(_state);
 
-                        int textIndex = font->getIndexAtLocation(_text.c_str(), _textBounds, fontSize, _caretLocation, &_caretLocation,
-                            textAlignment, true, rightToLeft);
-                        font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, textIndex - 1,
-                            textAlignment, true, rightToLeft);
-                        _dirty = true;
-                        break;
-                    }
-                    case Keyboard::KEY_RIGHT_ARROW:
-                    {
-                        Font* font = getFont(_state);
-                        GP_ASSERT(font);
-                        unsigned int fontSize = getFontSize(_state);
-                        Font::Justify textAlignment = getTextAlignment(_state);
-                        bool rightToLeft = getTextRightToLeft(_state);
+                    int textIndex = font->getIndexAtLocation(_text.c_str(), _textBounds, fontSize, _caretLocation, &_caretLocation,
+                        textAlignment, true, rightToLeft);
+                    font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, textIndex - 1,
+                        textAlignment, true, rightToLeft);
+                    _dirty = true;
+                    break;
+                }
+                case Keyboard::KEY_RIGHT_ARROW:
+                {
+                    Font* font = getFont(_state);
+                    GP_ASSERT(font);
+                    unsigned int fontSize = getFontSize(_state);
+                    Font::Justify textAlignment = getTextAlignment(_state);
+                    bool rightToLeft = getTextRightToLeft(_state);
 
-                        int textIndex = font->getIndexAtLocation(_text.c_str(), _textBounds, fontSize, _caretLocation, &_caretLocation,
-                            textAlignment, true, rightToLeft);
-                        font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, textIndex + 1,
-                            textAlignment, true, rightToLeft);
-                        _dirty = true;
-                        break;
-                    }
-                    case Keyboard::KEY_UP_ARROW:
+                    int textIndex = font->getIndexAtLocation(_text.c_str(), _textBounds, fontSize, _caretLocation, &_caretLocation,
+                        textAlignment, true, rightToLeft);
+                    font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, textIndex + 1,
+                        textAlignment, true, rightToLeft);
+                    _dirty = true;
+                    break;
+                }
+                case Keyboard::KEY_UP_ARROW:
+                {
+                    Font* font = getFont(_state);
+                    GP_ASSERT(font);
+                    unsigned int fontSize = getFontSize(_state);
+                    Font::Justify textAlignment = getTextAlignment(_state);
+                    bool rightToLeft = getTextRightToLeft(_state);
+                    _prevCaretLocation.set(_caretLocation);
+                    _caretLocation.y -= fontSize;
+                    int textIndex = font->getIndexAtLocation(_text.c_str(), _textBounds, fontSize, _caretLocation, &_caretLocation,
+                        textAlignment, true, rightToLeft);
+                    if (textIndex == -1)
                     {
-                        Font* font = getFont(_state);
-                        GP_ASSERT(font);
-                        unsigned int fontSize = getFontSize(_state);
-                        Font::Justify textAlignment = getTextAlignment(_state);
-                        bool rightToLeft = getTextRightToLeft(_state);
-                        _prevCaretLocation.set(_caretLocation);
-                        _caretLocation.y -= fontSize;
-                        int textIndex = font->getIndexAtLocation(_text.c_str(), _textBounds, fontSize, _caretLocation, &_caretLocation,
-                            textAlignment, true, rightToLeft);
-                        if (textIndex == -1)
-                        {
-                            _caretLocation.set(_prevCaretLocation);
-                        }
-
-                        _dirty = true;
-                        break;
+                        _caretLocation.set(_prevCaretLocation);
                     }
-                    case Keyboard::KEY_DOWN_ARROW:
-                    {
-                        Font* font = getFont(_state);
-                        GP_ASSERT(font);
-                        unsigned int fontSize = getFontSize(_state);
-                        Font::Justify textAlignment = getTextAlignment(_state);
-                        bool rightToLeft = getTextRightToLeft(_state);
-                        _prevCaretLocation.set(_caretLocation);
-                        _caretLocation.y += fontSize;
-                        int textIndex = font->getIndexAtLocation(_text.c_str(), _textBounds, fontSize, _caretLocation, &_caretLocation,
-                            textAlignment, true, rightToLeft);
-                        if (textIndex == -1)
-                        {
-                            _caretLocation.set(_prevCaretLocation);
-                        }
 
-                        _dirty = true;
-                        break;
+                    _dirty = true;
+                    break;
+                }
+                case Keyboard::KEY_DOWN_ARROW:
+                {
+                    Font* font = getFont(_state);
+                    GP_ASSERT(font);
+                    unsigned int fontSize = getFontSize(_state);
+                    Font::Justify textAlignment = getTextAlignment(_state);
+                    bool rightToLeft = getTextRightToLeft(_state);
+                    _prevCaretLocation.set(_caretLocation);
+                    _caretLocation.y += fontSize;
+                    int textIndex = font->getIndexAtLocation(_text.c_str(), _textBounds, fontSize, _caretLocation, &_caretLocation,
+                        textAlignment, true, rightToLeft);
+                    if (textIndex == -1)
+                    {
+                        _caretLocation.set(_prevCaretLocation);
                     }
+
+                    _dirty = true;
+                    break;
                 }
-                break;
             }
+            break;
+        }
 
-            case Keyboard::KEY_CHAR:
-            {
-                Font* font = getFont(_state);
-                GP_ASSERT(font);
-                unsigned int fontSize = getFontSize(_state);
-                Font::Justify textAlignment = getTextAlignment(_state);
-                bool rightToLeft = getTextRightToLeft(_state);
+        case Keyboard::KEY_CHAR:
+        {
+            Font* font = getFont(_state);
+            GP_ASSERT(font);
+            unsigned int fontSize = getFontSize(_state);
+            Font::Justify textAlignment = getTextAlignment(_state);
+            bool rightToLeft = getTextRightToLeft(_state);
 
-                int textIndex = font->getIndexAtLocation(_text.c_str(), _textBounds, fontSize, _caretLocation, &_caretLocation,
+            int textIndex = font->getIndexAtLocation(_text.c_str(), _textBounds, fontSize, _caretLocation, &_caretLocation,
+                textAlignment, true, rightToLeft);
+            if (textIndex == -1)
+            {
+                textIndex = 0;
+                font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, 0,
                     textAlignment, true, rightToLeft);
-                if (textIndex == -1)
-                {
-                    textIndex = 0;
-                    font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, 0,
-                        textAlignment, true, rightToLeft);
-                }
+            }
 
-                switch (key)
+            switch (key)
+            {
+                case Keyboard::KEY_BACKSPACE:
                 {
-                    case Keyboard::KEY_BACKSPACE:
+                    if (textIndex > 0)
                     {
-                        if (textIndex > 0)
-                        {
-                            --textIndex;
-                            _text.erase(textIndex, 1);
-                            font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, textIndex,
-                                textAlignment, true, rightToLeft);
+                        --textIndex;
+                        _text.erase(textIndex, 1);
+                        font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, textIndex,
+                            textAlignment, true, rightToLeft);
 
-                            _dirty = true;
-                        }
-                        break;
+                        _dirty = true;
                     }
-                    case Keyboard::KEY_RETURN:
-                        // TODO: Handle line-break insertion correctly.
-                        break;
-                    case Keyboard::KEY_ESCAPE:
-                        break;
-                    case Keyboard::KEY_TAB:
-                        // Allow tab to move the focus forward.
-                        return false;
-                        break;
-                    default:
-                    {
-                        // Insert character into string.
-                        _text.insert(textIndex, 1, (char)key);
-
-                        // Get new location of caret.
-                        font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, textIndex + 1,
-                            textAlignment, true, rightToLeft);
+                    break;
+                }
+                case Keyboard::KEY_RETURN:
+                    // TODO: Handle line-break insertion correctly.
+                    break;
+                case Keyboard::KEY_ESCAPE:
+                    break;
+                case Keyboard::KEY_TAB:
+                    // Allow tab to move the focus forward.
+                    return false;
+                    break;
+                default:
+                {
+                    // Insert character into string.
+                    _text.insert(textIndex, 1, (char)key);
 
-                        if (key == ' ')
-                        {
-                            // If a space was entered, check that caret is still within bounds.
-                            if (_caretLocation.x >= _textBounds.x + _textBounds.width ||
-                                _caretLocation.y >= _textBounds.y + _textBounds.height)
-                            {
-                                // If not, undo the character insertion.
-                                _text.erase(textIndex, 1);
-                                font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, textIndex,
-                                    textAlignment, true, rightToLeft);
-
-                                // No need to check again.
-                                break;
-                            }
-                        }
+                    // Get new location of caret.
+                    font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, textIndex + 1,
+                        textAlignment, true, rightToLeft);
 
-                        // Always check that the text still fits within the clip region.
-                        Rectangle textBounds;
-                        font->measureText(_text.c_str(), _textBounds, fontSize, &textBounds, textAlignment, true, true);
-                        if (textBounds.x < _textBounds.x || textBounds.y < _textBounds.y ||
-                            textBounds.width >= _textBounds.width || textBounds.height >= _textBounds.height)
+                    if (key == ' ')
+                    {
+                        // If a space was entered, check that caret is still within bounds.
+                        if (_caretLocation.x >= _textBounds.x + _textBounds.width ||
+                            _caretLocation.y >= _textBounds.y + _textBounds.height)
                         {
                             // If not, undo the character insertion.
                             _text.erase(textIndex, 1);
                             font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, textIndex,
                                 textAlignment, true, rightToLeft);
 
-                            // TextBox is not dirty.
+                            // No need to check again.
                             break;
                         }
-                
-                        _dirty = true;
+                    }
+
+                    // Always check that the text still fits within the clip region.
+                    Rectangle textBounds;
+                    font->measureText(_text.c_str(), _textBounds, fontSize, &textBounds, textAlignment, true, true);
+                    if (textBounds.x < _textBounds.x || textBounds.y < _textBounds.y ||
+                        textBounds.width >= _textBounds.width || textBounds.height >= _textBounds.height)
+                    {
+                        // If not, undo the character insertion.
+                        _text.erase(textIndex, 1);
+                        font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, textIndex,
+                            textAlignment, true, rightToLeft);
+
+                        // TextBox is not dirty.
                         break;
                     }
-            
+                
+                    _dirty = true;
                     break;
                 }
-
-                notifyListeners(Control::Listener::TEXT_CHANGED);
+            
                 break;
             }
+
+            notifyListeners(Control::Listener::TEXT_CHANGED);
+            break;
         }
     }
 
@@ -326,7 +323,7 @@ void TextBox::update(const Control* container, const Vector2& offset)
 
 void TextBox::drawImages(SpriteBatch* spriteBatch, const Rectangle& clip)
 {
-    if (_caretImage && (_state == ACTIVE || isInFocus()))
+    if (_caretImage && (_state == ACTIVE || hasFocus()))
     {
         // Draw the cursor at its current location.
         const Rectangle& region = _caretImage->getRegion();

+ 0 - 36
gameplay/src/lua/lua_Button.cpp

@@ -74,7 +74,6 @@ void luaRegister_Button()
         {"getZIndex", lua_Button_getZIndex},
         {"isContainer", lua_Button_isContainer},
         {"isEnabled", lua_Button_isEnabled},
-        {"isInFocus", lua_Button_isInFocus},
         {"isVisible", lua_Button_isVisible},
         {"release", lua_Button_release},
         {"removeListener", lua_Button_removeListener},
@@ -2603,41 +2602,6 @@ int lua_Button_isEnabled(lua_State* state)
     return 0;
 }
 
-int lua_Button_isInFocus(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Button* instance = getInstance(state);
-                bool result = instance->isInFocus();
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Button_isInFocus - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Button_isVisible(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 1
gameplay/src/lua/lua_Button.h

@@ -54,7 +54,6 @@ int lua_Button_getY(lua_State* state);
 int lua_Button_getZIndex(lua_State* state);
 int lua_Button_isContainer(lua_State* state);
 int lua_Button_isEnabled(lua_State* state);
-int lua_Button_isInFocus(lua_State* state);
 int lua_Button_isVisible(lua_State* state);
 int lua_Button_release(lua_State* state);
 int lua_Button_removeListener(lua_State* state);

+ 0 - 36
gameplay/src/lua/lua_CheckBox.cpp

@@ -78,7 +78,6 @@ void luaRegister_CheckBox()
         {"isChecked", lua_CheckBox_isChecked},
         {"isContainer", lua_CheckBox_isContainer},
         {"isEnabled", lua_CheckBox_isEnabled},
-        {"isInFocus", lua_CheckBox_isInFocus},
         {"isVisible", lua_CheckBox_isVisible},
         {"release", lua_CheckBox_release},
         {"removeListener", lua_CheckBox_removeListener},
@@ -2723,41 +2722,6 @@ int lua_CheckBox_isEnabled(lua_State* state)
     return 0;
 }
 
-int lua_CheckBox_isInFocus(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                CheckBox* instance = getInstance(state);
-                bool result = instance->isInFocus();
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_CheckBox_isInFocus - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_CheckBox_isVisible(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 1
gameplay/src/lua/lua_CheckBox.h

@@ -57,7 +57,6 @@ int lua_CheckBox_getZIndex(lua_State* state);
 int lua_CheckBox_isChecked(lua_State* state);
 int lua_CheckBox_isContainer(lua_State* state);
 int lua_CheckBox_isEnabled(lua_State* state);
-int lua_CheckBox_isInFocus(lua_State* state);
 int lua_CheckBox_isVisible(lua_State* state);
 int lua_CheckBox_release(lua_State* state);
 int lua_CheckBox_removeListener(lua_State* state);

+ 0 - 36
gameplay/src/lua/lua_Container.cpp

@@ -94,7 +94,6 @@ void luaRegister_Container()
         {"insertControl", lua_Container_insertControl},
         {"isContainer", lua_Container_isContainer},
         {"isEnabled", lua_Container_isEnabled},
-        {"isInFocus", lua_Container_isInFocus},
         {"isScrollBarsAutoHide", lua_Container_isScrollBarsAutoHide},
         {"isScrolling", lua_Container_isScrolling},
         {"isVisible", lua_Container_isVisible},
@@ -2984,41 +2983,6 @@ int lua_Container_isEnabled(lua_State* state)
     return 0;
 }
 
-int lua_Container_isInFocus(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Container* instance = getInstance(state);
-                bool result = instance->isInFocus();
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Container_isInFocus - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Container_isScrollBarsAutoHide(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 1
gameplay/src/lua/lua_Container.h

@@ -62,7 +62,6 @@ int lua_Container_getZIndex(lua_State* state);
 int lua_Container_insertControl(lua_State* state);
 int lua_Container_isContainer(lua_State* state);
 int lua_Container_isEnabled(lua_State* state);
-int lua_Container_isInFocus(lua_State* state);
 int lua_Container_isScrollBarsAutoHide(lua_State* state);
 int lua_Container_isScrolling(lua_State* state);
 int lua_Container_isVisible(lua_State* state);

+ 0 - 36
gameplay/src/lua/lua_Control.cpp

@@ -71,7 +71,6 @@ void luaRegister_Control()
         {"getZIndex", lua_Control_getZIndex},
         {"isContainer", lua_Control_isContainer},
         {"isEnabled", lua_Control_isEnabled},
-        {"isInFocus", lua_Control_isInFocus},
         {"isVisible", lua_Control_isVisible},
         {"release", lua_Control_release},
         {"removeListener", lua_Control_removeListener},
@@ -2598,41 +2597,6 @@ int lua_Control_isEnabled(lua_State* state)
     return 0;
 }
 
-int lua_Control_isInFocus(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Control* instance = getInstance(state);
-                bool result = instance->isInFocus();
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Control_isInFocus - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Control_isVisible(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 1
gameplay/src/lua/lua_Control.h

@@ -54,7 +54,6 @@ int lua_Control_getY(lua_State* state);
 int lua_Control_getZIndex(lua_State* state);
 int lua_Control_isContainer(lua_State* state);
 int lua_Control_isEnabled(lua_State* state);
-int lua_Control_isInFocus(lua_State* state);
 int lua_Control_isVisible(lua_State* state);
 int lua_Control_release(lua_State* state);
 int lua_Control_removeListener(lua_State* state);

+ 0 - 36
gameplay/src/lua/lua_Form.cpp

@@ -99,7 +99,6 @@ void luaRegister_Form()
         {"insertControl", lua_Form_insertControl},
         {"isContainer", lua_Form_isContainer},
         {"isEnabled", lua_Form_isEnabled},
-        {"isInFocus", lua_Form_isInFocus},
         {"isScrollBarsAutoHide", lua_Form_isScrollBarsAutoHide},
         {"isScrolling", lua_Form_isScrolling},
         {"isVisible", lua_Form_isVisible},
@@ -3068,41 +3067,6 @@ int lua_Form_isEnabled(lua_State* state)
     return 0;
 }
 
-int lua_Form_isInFocus(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Form* instance = getInstance(state);
-                bool result = instance->isInFocus();
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Form_isInFocus - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Form_isScrollBarsAutoHide(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 1
gameplay/src/lua/lua_Form.h

@@ -64,7 +64,6 @@ int lua_Form_getZIndex(lua_State* state);
 int lua_Form_insertControl(lua_State* state);
 int lua_Form_isContainer(lua_State* state);
 int lua_Form_isEnabled(lua_State* state);
-int lua_Form_isInFocus(lua_State* state);
 int lua_Form_isScrollBarsAutoHide(lua_State* state);
 int lua_Form_isScrolling(lua_State* state);
 int lua_Form_isVisible(lua_State* state);

+ 0 - 36
gameplay/src/lua/lua_ImageControl.cpp

@@ -78,7 +78,6 @@ void luaRegister_ImageControl()
         {"getZIndex", lua_ImageControl_getZIndex},
         {"isContainer", lua_ImageControl_isContainer},
         {"isEnabled", lua_ImageControl_isEnabled},
-        {"isInFocus", lua_ImageControl_isInFocus},
         {"isVisible", lua_ImageControl_isVisible},
         {"release", lua_ImageControl_release},
         {"removeListener", lua_ImageControl_removeListener},
@@ -2733,41 +2732,6 @@ int lua_ImageControl_isEnabled(lua_State* state)
     return 0;
 }
 
-int lua_ImageControl_isInFocus(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                ImageControl* instance = getInstance(state);
-                bool result = instance->isInFocus();
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_ImageControl_isInFocus - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_ImageControl_isVisible(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 1
gameplay/src/lua/lua_ImageControl.h

@@ -57,7 +57,6 @@ int lua_ImageControl_getY(lua_State* state);
 int lua_ImageControl_getZIndex(lua_State* state);
 int lua_ImageControl_isContainer(lua_State* state);
 int lua_ImageControl_isEnabled(lua_State* state);
-int lua_ImageControl_isInFocus(lua_State* state);
 int lua_ImageControl_isVisible(lua_State* state);
 int lua_ImageControl_release(lua_State* state);
 int lua_ImageControl_removeListener(lua_State* state);

+ 0 - 36
gameplay/src/lua/lua_Joystick.cpp

@@ -76,7 +76,6 @@ void luaRegister_Joystick()
         {"getZIndex", lua_Joystick_getZIndex},
         {"isContainer", lua_Joystick_isContainer},
         {"isEnabled", lua_Joystick_isEnabled},
-        {"isInFocus", lua_Joystick_isInFocus},
         {"isRelative", lua_Joystick_isRelative},
         {"isVisible", lua_Joystick_isVisible},
         {"release", lua_Joystick_release},
@@ -2775,41 +2774,6 @@ int lua_Joystick_isEnabled(lua_State* state)
     return 0;
 }
 
-int lua_Joystick_isInFocus(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Joystick* instance = getInstance(state);
-                bool result = instance->isInFocus();
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Joystick_isInFocus - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Joystick_isRelative(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 1
gameplay/src/lua/lua_Joystick.h

@@ -58,7 +58,6 @@ int lua_Joystick_getY(lua_State* state);
 int lua_Joystick_getZIndex(lua_State* state);
 int lua_Joystick_isContainer(lua_State* state);
 int lua_Joystick_isEnabled(lua_State* state);
-int lua_Joystick_isInFocus(lua_State* state);
 int lua_Joystick_isRelative(lua_State* state);
 int lua_Joystick_isVisible(lua_State* state);
 int lua_Joystick_release(lua_State* state);

+ 0 - 36
gameplay/src/lua/lua_Label.cpp

@@ -73,7 +73,6 @@ void luaRegister_Label()
         {"getZIndex", lua_Label_getZIndex},
         {"isContainer", lua_Label_isContainer},
         {"isEnabled", lua_Label_isEnabled},
-        {"isInFocus", lua_Label_isInFocus},
         {"isVisible", lua_Label_isVisible},
         {"release", lua_Label_release},
         {"removeListener", lua_Label_removeListener},
@@ -2637,41 +2636,6 @@ int lua_Label_isEnabled(lua_State* state)
     return 0;
 }
 
-int lua_Label_isInFocus(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Label* instance = getInstance(state);
-                bool result = instance->isInFocus();
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Label_isInFocus - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Label_isVisible(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 1
gameplay/src/lua/lua_Label.h

@@ -55,7 +55,6 @@ int lua_Label_getY(lua_State* state);
 int lua_Label_getZIndex(lua_State* state);
 int lua_Label_isContainer(lua_State* state);
 int lua_Label_isEnabled(lua_State* state);
-int lua_Label_isInFocus(lua_State* state);
 int lua_Label_isVisible(lua_State* state);
 int lua_Label_release(lua_State* state);
 int lua_Label_removeListener(lua_State* state);

+ 2 - 2
gameplay/src/lua/lua_MaterialParameter.cpp

@@ -1984,7 +1984,7 @@ int lua_MaterialParameter_setVector3Array(lua_State* state)
 
                 MaterialParameter* instance = getInstance(state);
                 instance->setVector3Array(param1, param2);
-
+                
                 return 0;
             }
 
@@ -2016,7 +2016,7 @@ int lua_MaterialParameter_setVector3Array(lua_State* state)
 
                 MaterialParameter* instance = getInstance(state);
                 instance->setVector3Array(param1, param2, param3);
-
+                
                 return 0;
             }
 

+ 0 - 36
gameplay/src/lua/lua_RadioButton.cpp

@@ -78,7 +78,6 @@ void luaRegister_RadioButton()
         {"getZIndex", lua_RadioButton_getZIndex},
         {"isContainer", lua_RadioButton_isContainer},
         {"isEnabled", lua_RadioButton_isEnabled},
-        {"isInFocus", lua_RadioButton_isInFocus},
         {"isSelected", lua_RadioButton_isSelected},
         {"isVisible", lua_RadioButton_isVisible},
         {"release", lua_RadioButton_release},
@@ -2725,41 +2724,6 @@ int lua_RadioButton_isEnabled(lua_State* state)
     return 0;
 }
 
-int lua_RadioButton_isInFocus(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                RadioButton* instance = getInstance(state);
-                bool result = instance->isInFocus();
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_RadioButton_isInFocus - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_RadioButton_isSelected(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 1
gameplay/src/lua/lua_RadioButton.h

@@ -57,7 +57,6 @@ int lua_RadioButton_getY(lua_State* state);
 int lua_RadioButton_getZIndex(lua_State* state);
 int lua_RadioButton_isContainer(lua_State* state);
 int lua_RadioButton_isEnabled(lua_State* state);
-int lua_RadioButton_isInFocus(lua_State* state);
 int lua_RadioButton_isSelected(lua_State* state);
 int lua_RadioButton_isVisible(lua_State* state);
 int lua_RadioButton_release(lua_State* state);

+ 0 - 36
gameplay/src/lua/lua_Slider.cpp

@@ -80,7 +80,6 @@ void luaRegister_Slider()
         {"getZIndex", lua_Slider_getZIndex},
         {"isContainer", lua_Slider_isContainer},
         {"isEnabled", lua_Slider_isEnabled},
-        {"isInFocus", lua_Slider_isInFocus},
         {"isValueTextVisible", lua_Slider_isValueTextVisible},
         {"isVisible", lua_Slider_isVisible},
         {"release", lua_Slider_release},
@@ -2862,41 +2861,6 @@ int lua_Slider_isEnabled(lua_State* state)
     return 0;
 }
 
-int lua_Slider_isInFocus(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Slider* instance = getInstance(state);
-                bool result = instance->isInFocus();
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Slider_isInFocus - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Slider_isValueTextVisible(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 1
gameplay/src/lua/lua_Slider.h

@@ -61,7 +61,6 @@ int lua_Slider_getY(lua_State* state);
 int lua_Slider_getZIndex(lua_State* state);
 int lua_Slider_isContainer(lua_State* state);
 int lua_Slider_isEnabled(lua_State* state);
-int lua_Slider_isInFocus(lua_State* state);
 int lua_Slider_isValueTextVisible(lua_State* state);
 int lua_Slider_isVisible(lua_State* state);
 int lua_Slider_release(lua_State* state);

+ 0 - 36
gameplay/src/lua/lua_TextBox.cpp

@@ -75,7 +75,6 @@ void luaRegister_TextBox()
         {"getZIndex", lua_TextBox_getZIndex},
         {"isContainer", lua_TextBox_isContainer},
         {"isEnabled", lua_TextBox_isEnabled},
-        {"isInFocus", lua_TextBox_isInFocus},
         {"isVisible", lua_TextBox_isVisible},
         {"release", lua_TextBox_release},
         {"removeListener", lua_TextBox_removeListener},
@@ -2674,41 +2673,6 @@ int lua_TextBox_isEnabled(lua_State* state)
     return 0;
 }
 
-int lua_TextBox_isInFocus(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                TextBox* instance = getInstance(state);
-                bool result = instance->isInFocus();
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_TextBox_isInFocus - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_TextBox_isVisible(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 1
gameplay/src/lua/lua_TextBox.h

@@ -56,7 +56,6 @@ int lua_TextBox_getY(lua_State* state);
 int lua_TextBox_getZIndex(lua_State* state);
 int lua_TextBox_isContainer(lua_State* state);
 int lua_TextBox_isEnabled(lua_State* state);
-int lua_TextBox_isInFocus(lua_State* state);
 int lua_TextBox_isVisible(lua_State* state);
 int lua_TextBox_release(lua_State* state);
 int lua_TextBox_removeListener(lua_State* state);

+ 1 - 0
samples/browser/res/common/forms/formBasicControls.form

@@ -58,6 +58,7 @@ form basicControls
         position = 20, 450
         size = 250, 80
         text = This is a text box.
+		consumeInputEvents = true
     }
 
 	container radioButtonContainer