int TextArea::width() { if (_width == 0) { if (_calculatedWidth == 0) _calculateSize(); return _calculatedWidth; } return _width; }
int TextArea::height() { if (_height == 0) { if (_calculatedHeight == 0) _calculateSize(); return _calculatedHeight; } return _height; }
bool Input::keyDown(int key, int mask, WindowManager*) { osgText::String& s = _text->getText(); if(key == osgGA::GUIEventAdapter::KEY_BackSpace) { if(_index >= 1) { // s.erase(s.begin() + (_index - 1)); s[_index - 1] = ' '; _text->update(); _calculateCursorOffsets(); _index--; } } else { if(key > 255 || _index >= _maxSize) return false; // else if(_index < s.size()) s.insert(s.begin() + _index, key); // else if(_index == s.size()) s.push_back(key); s[_index] = key; _text->update(); _calculateCursorOffsets(); _index++; } // _text->update(); _calculateSize(getTextSize()); getParent()->resize(); return false; }