From 83b7d186c7a26fa6fb7f6d1bd10a80f16afef8bf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 8 Jul 2012 23:36:21 +0300 Subject: Change textfield theming. --- data/graphics/gui/CMakeLists.txt | 1 + data/graphics/gui/Makefile.am | 1 + data/graphics/gui/textfield_background.xml | 18 ++++++++++++++++ src/gui/widgets/textfield.cpp | 34 ++---------------------------- 4 files changed, 22 insertions(+), 32 deletions(-) create mode 100644 data/graphics/gui/textfield_background.xml 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 @@ + + + + + + + + + + + + + + + + + + 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()); } void TextField::updateAlpha() -- cgit v1.2.3-70-g09d2