diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-21 19:33:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-21 19:33:46 +0300 |
commit | dfb302bb66f032eb0c7eb4bc0934fdf0571a1d3a (patch) | |
tree | 4d312704c7d42bc0d3a0f2ab44e8071a7058d6bb /src/guichan/widgets/textfield.cpp | |
parent | c29b91939d1c8e8f7772a660ad4d4bee83dec668 (diff) | |
download | plus-dfb302bb66f032eb0c7eb4bc0934fdf0571a1d3a.tar.gz plus-dfb302bb66f032eb0c7eb4bc0934fdf0571a1d3a.tar.bz2 plus-dfb302bb66f032eb0c7eb4bc0934fdf0571a1d3a.tar.xz plus-dfb302bb66f032eb0c7eb4bc0934fdf0571a1d3a.zip |
Extend textfield theming.
New theme options:
padding
frameSize
Diffstat (limited to 'src/guichan/widgets/textfield.cpp')
-rw-r--r-- | src/guichan/widgets/textfield.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/guichan/widgets/textfield.cpp b/src/guichan/widgets/textfield.cpp index 64d647631..c0575eace 100644 --- a/src/guichan/widgets/textfield.cpp +++ b/src/guichan/widgets/textfield.cpp @@ -115,46 +115,18 @@ namespace gcn void TextField::adjustSize() { - setWidth(getFont()->getWidth(mText) + 7); - adjustHeight(); - - fixScroll(); } void TextField::adjustHeight() { - setHeight(getFont()->getHeight() + 4); } void TextField::fixScroll() { - if (isFocused()) - { - const int caretX = getFont()->getWidth( - mText.substr(0, mCaretPosition)); - - if (caretX - mXScroll >= getWidth() - 4) - { - mXScroll = caretX - getWidth() + 4; - } - else if (caretX - mXScroll <= 0) - { - mXScroll = caretX - getWidth() / 2; - - if (mXScroll < 0) - mXScroll = 0; - } - } } void TextField::setCaretPosition(unsigned int position) { - if (position > mText.size()) - mCaretPosition = static_cast<int>(mText.size()); - else - mCaretPosition = position; - - fixScroll(); } unsigned int TextField::getCaretPosition() const @@ -169,6 +141,5 @@ namespace gcn void TextField::fontChanged() { - fixScroll(); } } |