From 0c7a1466e8c2c2dd6e15779368c87b62b2da601f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 4 Oct 2012 13:24:01 +0300 Subject: Add text fileds cursor (caret) color. New theme colors: CARET --- src/gui/widgets/textfield.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/gui/widgets/textfield.cpp') diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index eb4e2f7cb..ac29eac25 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -56,10 +56,10 @@ TextField::TextField(const std::string &text, const bool loseFocusOnTab, mMinimum(0), mMaximum(0), mLoseFocusOnTab(loseFocusOnTab), - mLastEventPaste(false) + mLastEventPaste(false), + mCaretColor(&Theme::getThemeColor(Theme::CARET)) { setFrameSize(2); - mForegroundColor = Theme::getThemeColor(Theme::TEXTFIELD); if (instances == 0) @@ -440,3 +440,11 @@ void TextField::handleCopy() const std::string text = getText(); sendBuffer(text); } + +void TextField::drawCaret(gcn::Graphics* graphics, int x) +{ + const gcn::Rectangle clipArea = graphics->getCurrentClipArea(); + + graphics->setColor(*mCaretColor); + graphics->drawLine(x, clipArea.height - 2, x, 1); +} -- cgit v1.2.3-70-g09d2