summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-04 13:24:01 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-04 13:24:01 +0300
commit0c7a1466e8c2c2dd6e15779368c87b62b2da601f (patch)
tree24be0979382c8844c68365cac1d6de046da16681
parenteed0bccd09e5708eb9b629c14f69022e362f4aa4 (diff)
downloadmanaplus-0c7a1466e8c2c2dd6e15779368c87b62b2da601f.tar.gz
manaplus-0c7a1466e8c2c2dd6e15779368c87b62b2da601f.tar.bz2
manaplus-0c7a1466e8c2c2dd6e15779368c87b62b2da601f.tar.xz
manaplus-0c7a1466e8c2c2dd6e15779368c87b62b2da601f.zip
Add text fileds cursor (caret) color.
New theme colors: CARET
-rw-r--r--data/graphics/gui/colors.xml1
-rw-r--r--data/themes/blacknblack/colors.xml1
-rw-r--r--data/themes/blackwood/colors.xml1
-rw-r--r--data/themes/enchilado/colors.xml1
-rw-r--r--data/themes/mana/colors.xml1
-rw-r--r--data/themes/pink/colors.xml1
-rw-r--r--data/themes/unity/colors.xml1
-rw-r--r--data/themes/wood/colors.xml1
-rw-r--r--src/gui/theme.cpp1
-rw-r--r--src/gui/theme.h1
-rw-r--r--src/gui/widgets/textfield.cpp12
-rw-r--r--src/gui/widgets/textfield.h3
-rw-r--r--src/guichan/widgets/textfield.cpp8
13 files changed, 23 insertions, 10 deletions
diff --git a/data/graphics/gui/colors.xml b/data/graphics/gui/colors.xml
index ca3d61926..71b09b172 100644
--- a/data/graphics/gui/colors.xml
+++ b/data/graphics/gui/colors.xml
@@ -1,6 +1,7 @@
<colors>
<color id="BROWSERBOX" color="#000000" />
<color id="TEXT" color="#000000" />
+ <color id="CARET" color="#000000" />
<color id="SHADOW" color="#000000" />
<color id="OUTLINE" color="#000000" />
<color id="BORDER" color="#000000" />
diff --git a/data/themes/blacknblack/colors.xml b/data/themes/blacknblack/colors.xml
index e802e470f..aaf09d892 100644
--- a/data/themes/blacknblack/colors.xml
+++ b/data/themes/blacknblack/colors.xml
@@ -1,6 +1,7 @@
<colors>
<color id="BROWSERBOX" color="#ffffff" />
<color id="TEXT" color="#ffffff" />
+ <color id="CARET" color="#ffffff" />
<color id="SHADOW" color="#000000" />
<color id="OUTLINE" color="#555555" />
<color id="BORDER" color="#00c000" />
diff --git a/data/themes/blackwood/colors.xml b/data/themes/blackwood/colors.xml
index cbc7d1d69..3a21c5ef7 100644
--- a/data/themes/blackwood/colors.xml
+++ b/data/themes/blackwood/colors.xml
@@ -1,6 +1,7 @@
<colors>
<color id="BROWSERBOX" color="#7a7972" />
<color id="TEXT" color="#7a7972" />
+ <color id="CARET" color="#7a7972" />
<color id="SHADOW" color="#000000" />
<color id="OUTLINE" color="#000000" />
<color id="BORDER" color="#000000" />
diff --git a/data/themes/enchilado/colors.xml b/data/themes/enchilado/colors.xml
index cb64bfc95..47f49d240 100644
--- a/data/themes/enchilado/colors.xml
+++ b/data/themes/enchilado/colors.xml
@@ -1,6 +1,7 @@
<colors>
<color id="BROWSERBOX" color="#000000" />
<color id="TEXT" color="#000000" />
+ <color id="CARET" color="#000000" />
<color id="SHADOW" color="#000000" />
<color id="OUTLINE" color="#000000" />
<color id="BORDER" color="#000000" />
diff --git a/data/themes/mana/colors.xml b/data/themes/mana/colors.xml
index 59e87a047..bd001e28d 100644
--- a/data/themes/mana/colors.xml
+++ b/data/themes/mana/colors.xml
@@ -1,6 +1,7 @@
<colors>
<color id="BROWSERBOX" color="#000000" />
<color id="TEXT" color="#000000" />
+ <color id="CARET" color="#000000" />
<color id="SHADOW" color="#000000" />
<color id="OUTLINE" color="#000000" />
<color id="BORDER" color="#000000" />
diff --git a/data/themes/pink/colors.xml b/data/themes/pink/colors.xml
index b8a0139f9..52ea46d6f 100644
--- a/data/themes/pink/colors.xml
+++ b/data/themes/pink/colors.xml
@@ -1,6 +1,7 @@
<colors>
<color id="BROWSERBOX" color="#FF00FF" />
<color id="TEXT" color="#FF00FF" />
+ <color id="CARET" color="#FF00FF" />
<color id="SHADOW" color="#000000" />
<color id="OUTLINE" color="#000000" />
<color id="BORDER" color="#000000" />
diff --git a/data/themes/unity/colors.xml b/data/themes/unity/colors.xml
index eaddc0147..098451a5b 100644
--- a/data/themes/unity/colors.xml
+++ b/data/themes/unity/colors.xml
@@ -1,6 +1,7 @@
<colors>
<color id="BROWSERBOX" color="#E0E0E0" />
<color id="TEXT" color="#E0E0E0" />
+ <color id="CARET" color="#E0E0E0" />
<color id="SHADOW" color="#000000" />
<color id="OUTLINE" color="#000000" />
<color id="PROGRESS_BAR" color="#ffffff" />
diff --git a/data/themes/wood/colors.xml b/data/themes/wood/colors.xml
index b73b65e9c..2b07e8005 100644
--- a/data/themes/wood/colors.xml
+++ b/data/themes/wood/colors.xml
@@ -1,6 +1,7 @@
<colors>
<color id="BROWSERBOX" color="#000000" />
<color id="TEXT" color="#000000" />
+ <color id="CARET" color="#000000" />
<color id="SHADOW" color="#000000" />
<color id="OUTLINE" color="#000000" />
<color id="BORDER" color="#000000" />
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 7b85c8764..730471ceb 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -696,6 +696,7 @@ static int readColorType(const std::string &type)
{
"BROWSERBOX",
"TEXT",
+ "CARET",
"SHADOW",
"OUTLINE",
"BORDER",
diff --git a/src/gui/theme.h b/src/gui/theme.h
index a32237be1..ee9352794 100644
--- a/src/gui/theme.h
+++ b/src/gui/theme.h
@@ -166,6 +166,7 @@ class Theme final : public Palette, public ConfigListener
{
BROWSERBOX = 0,
TEXT,
+ CARET,
SHADOW,
OUTLINE,
BORDER,
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
diff --git a/src/guichan/widgets/textfield.cpp b/src/guichan/widgets/textfield.cpp
index 7a2bde46e..52aefee54 100644
--- a/src/guichan/widgets/textfield.cpp
+++ b/src/guichan/widgets/textfield.cpp
@@ -96,14 +96,6 @@ namespace gcn
void TextField::drawCaret(Graphics* graphics, int x)
{
- // Check the current clip area as a clip area with a different
- // size than the widget might have been pushed (which is the
- // case in the draw method when we push a clip area after we have
- // drawn a border).
- const Rectangle clipArea = graphics->getCurrentClipArea();
-
- graphics->setColor(mForegroundColor);
- graphics->drawLine(x, clipArea.height - 2, x, 1);
}
void TextField::mousePressed(MouseEvent& mouseEvent)