summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/graphics/gui/CMakeLists.txt1
-rw-r--r--data/graphics/gui/Makefile.am1
-rw-r--r--data/graphics/gui/textfield_background.xml18
-rw-r--r--src/gui/widgets/textfield.cpp34
4 files changed, 22 insertions, 32 deletions
diff --git a/data/graphics/gui/CMakeLists.txt b/data/graphics/gui/CMakeLists.txt
index 89c51478f..dcd6ec8ce 100644
--- a/data/graphics/gui/CMakeLists.txt
+++ b/data/graphics/gui/CMakeLists.txt
@@ -40,6 +40,7 @@ SET (FILES
target-cursor-normal-l.png
target-cursor-normal-m.png
target-cursor-normal-s.png
+ textfield_background.xml
unknown-item.png
window.png
window.xml
diff --git a/data/graphics/gui/Makefile.am b/data/graphics/gui/Makefile.am
index 4bebd6b4f..cedb9011a 100644
--- a/data/graphics/gui/Makefile.am
+++ b/data/graphics/gui/Makefile.am
@@ -43,6 +43,7 @@ gui_DATA = \
target-cursor-normal-l.png \
target-cursor-normal-m.png \
target-cursor-normal-s.png \
+ textfield_background.xml \
unknown-item.png \
window.png \
window.xml
diff --git a/data/graphics/gui/textfield_background.xml b/data/graphics/gui/textfield_background.xml
new file mode 100644
index 000000000..4a63cf25c
--- /dev/null
+++ b/data/graphics/gui/textfield_background.xml
@@ -0,0 +1,18 @@
+<skinset name="Default" image="window.png">
+ <widget type="Window" xpos="41" ypos="186">
+ <!-- Top Row -->
+ <part type="top-left-corner" xpos="0" ypos="0" width="4" height="4" />
+ <part type="top-edge" xpos="3" ypos="0" width="26" height="4" />
+ <part type="top-right-corner" xpos="28" ypos="0" width="4" height="4" />
+
+ <!-- Middle Row -->
+ <part type="left-edge" xpos="0" ypos="3" width="4" height="26" />
+ <part type="bg-quad" xpos="3" ypos="3" width="26" height="26" />
+ <part type="right-edge" xpos="28" ypos="3" width="4" height="26" />
+
+ <!-- Bottom Row -->
+ <part type="bottom-left-corner" xpos="0" ypos="28" width="4" height="4" />
+ <part type="bottom-edge" xpos="3" ypos="28" width="26" height="4" />
+ <part type="bottom-right-corner" xpos="28" ypos="28" width="4" height="4" />
+ </widget>
+</skinset>
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 5dc0d4a6f..4b71bd795 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -67,35 +67,8 @@ TextField::TextField(const std::string &text, bool loseFocusOnTab,
if (instances == 0)
{
- // Load the skin
- Image *textbox = Theme::getImageFromTheme("deepbox.png");
- int gridx[4] = {0, 3, 28, 31};
- int gridy[4] = {0, 3, 28, 31};
- int a = 0, x, y;
-
- for (y = 0; y < 3; y++)
- {
- for (x = 0; x < 3; x++)
- {
- if (textbox)
- {
- skin.grid[a] = textbox->getSubImage(
- gridx[x], gridy[y],
- gridx[x + 1] - gridx[x] + 1,
- gridy[y + 1] - gridy[y] + 1);
- if (skin.grid[a])
- skin.grid[a]->setAlpha(Client::getGuiAlpha());
- }
- else
- {
- skin.grid[a] = nullptr;
- }
- a++;
- }
- }
-
- if (textbox)
- textbox->decRef();
+ if (Theme::instance())
+ Theme::instance()->loadRect(skin, "textfield_background.xml");
}
instances++;
@@ -110,9 +83,6 @@ TextField::TextField(const std::string &text, bool loseFocusOnTab,
TextField::~TextField()
{
instances--;
-
- if (instances == 0)
- for_each(skin.grid, skin.grid + 9, dtor<Image*>());
}
void TextField::updateAlpha()