diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-07-09 02:17:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-07-13 01:02:41 +0300 |
commit | 25ebec2265b2b995bb85ce74f25db8137ea9db87 (patch) | |
tree | 4d45452669ecf787d814b7bfa0180e88841e2a4f /src/gui/widgets | |
parent | 9a36ae42e55ee9403d631dd7c027967350931fa6 (diff) | |
download | manaplus-25ebec2265b2b995bb85ce74f25db8137ea9db87.tar.gz manaplus-25ebec2265b2b995bb85ce74f25db8137ea9db87.tar.bz2 manaplus-25ebec2265b2b995bb85ce74f25db8137ea9db87.tar.xz manaplus-25ebec2265b2b995bb85ce74f25db8137ea9db87.zip |
Change tab theming.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/tab.cpp | 54 |
1 files changed, 11 insertions, 43 deletions
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 4dbfe45e4..f7b353c7e 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -53,24 +53,18 @@ enum TAB_COUNT // 4 - Must be last. }; -struct TabData +static std::string const data[TAB_COUNT] = { - char const *file; - int gridX; - int gridY; -}; - -static TabData const data[TAB_COUNT] = -{ - { "tab.png", 0, 0 }, - { "tab_hilight.png", 9, 4 }, - { "tabselected.png", 16, 19 }, - { "tab.png", 25, 23 } + "tab.xml", + "tab_highlighted.xml", + "tab_selected.xml", + "tab_unused.xml" }; ImageRect Tab::tabImg[TAB_COUNT]; -Tab::Tab() : gcn::Tab(), +Tab::Tab() : + gcn::Tab(), mTabColor(&Theme::getThemeColor(Theme::TAB)), mVertexes(new GraphicsVertexes()), mRedraw(true), @@ -84,12 +78,6 @@ Tab::Tab() : gcn::Tab(), Tab::~Tab() { mInstances--; - - if (mInstances == 0) - { - for (int mode = 0; mode < TAB_COUNT; mode++) - for_each(tabImg[mode].grid, tabImg[mode].grid + 9, dtor<Image*>()); - } delete mVertexes; mVertexes = nullptr; } @@ -105,32 +93,12 @@ void Tab::init() if (mInstances == 0) { // Load the skin - Image *tab[TAB_COUNT]; - - int a, x, y, mode; - - for (mode = 0; mode < TAB_COUNT; mode++) + if (Theme::instance()) { - tab[mode] = Theme::getImageFromTheme(data[mode].file); - if (!tab[mode]) - continue; - - a = 0; - for (y = 0; y < 3; y++) - { - for (x = 0; x < 3; x++) - { - tabImg[mode].grid[a] = tab[mode]->getSubImage( - data[x].gridX, data[y].gridY, - data[x + 1].gridX - data[x].gridX + 1, - data[y + 1].gridY - data[y].gridY + 1); - if (tabImg[mode].grid[a]) - tabImg[mode].grid[a]->setAlpha(mAlpha); - a++; - } - } - tab[mode]->decRef(); + for (int mode = 0; mode < TAB_COUNT; mode ++) + Theme::instance()->loadRect(tabImg[mode], data[mode]); } + updateAlpha(); } mInstances++; } |