summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/textfield.cpp12
-rw-r--r--src/gui/widgets/textfield.h3
2 files changed, 13 insertions, 2 deletions
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);
+}
diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h
index 72d679052..97048ccba 100644
--- a/src/gui/widgets/textfield.h
+++ b/src/gui/widgets/textfield.h
@@ -104,6 +104,8 @@ class TextField : public gcn::TextField
{ mSendAlwaysEvents = b; }
protected:
+ void drawCaret(gcn::Graphics* graphics, int x) override;
+
bool mSendAlwaysEvents;
private:
@@ -119,6 +121,7 @@ class TextField : public gcn::TextField
unsigned mMaximum;
bool mLoseFocusOnTab;
int mLastEventPaste;
+ const gcn::Color *mCaretColor;
};
#endif