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 | |
parent | 9a36ae42e55ee9403d631dd7c027967350931fa6 (diff) | |
download | manaplus-25ebec2265b2b995bb85ce74f25db8137ea9db87.tar.gz manaplus-25ebec2265b2b995bb85ce74f25db8137ea9db87.tar.bz2 manaplus-25ebec2265b2b995bb85ce74f25db8137ea9db87.tar.xz manaplus-25ebec2265b2b995bb85ce74f25db8137ea9db87.zip |
Change tab theming.
-rw-r--r-- | data/graphics/gui/CMakeLists.txt | 7 | ||||
-rw-r--r-- | data/graphics/gui/Makefile.am | 7 | ||||
-rw-r--r-- | data/graphics/gui/tab.png | bin | 329 -> 0 bytes | |||
-rw-r--r-- | data/graphics/gui/tab.xml | 18 | ||||
-rw-r--r-- | data/graphics/gui/tab_highlighted.xml | 18 | ||||
-rw-r--r-- | data/graphics/gui/tab_hilight.png | bin | 316 -> 0 bytes | |||
-rw-r--r-- | data/graphics/gui/tab_selected.xml | 18 | ||||
-rw-r--r-- | data/graphics/gui/tab_unused.xml | 18 | ||||
-rw-r--r-- | data/graphics/gui/tabselected.png | bin | 313 -> 0 bytes | |||
-rw-r--r-- | data/graphics/gui/window.png | bin | 11901 -> 12406 bytes | |||
-rw-r--r-- | src/gui/widgets/tab.cpp | 54 |
11 files changed, 91 insertions, 49 deletions
diff --git a/data/graphics/gui/CMakeLists.txt b/data/graphics/gui/CMakeLists.txt index 83a1ff902..b03b856c7 100644 --- a/data/graphics/gui/CMakeLists.txt +++ b/data/graphics/gui/CMakeLists.txt @@ -34,9 +34,10 @@ SET (FILES slider_hilight.png speechbubble.xml sticky_button.png - tab.png - tab_hilight.png - tabselected.png + tab.xml + tab_highlighted.xml + tab_selected.xml + tab_unused.xml target-cursor-in-range-l.png target-cursor-in-range-m.png target-cursor-in-range-s.png diff --git a/data/graphics/gui/Makefile.am b/data/graphics/gui/Makefile.am index 42d58b3e4..b8591a783 100644 --- a/data/graphics/gui/Makefile.am +++ b/data/graphics/gui/Makefile.am @@ -37,9 +37,10 @@ gui_DATA = \ slider_hilight.png \ speechbubble.xml \ sticky_button.png \ - tab.png \ - tab_hilight.png \ - tabselected.png \ + tab.xml \ + tab_highlighted.xml \ + tab_selected.xml \ + tab_unused.xml \ target-cursor-in-range-l.png \ target-cursor-in-range-m.png \ target-cursor-in-range-s.png \ diff --git a/data/graphics/gui/tab.png b/data/graphics/gui/tab.png Binary files differdeleted file mode 100644 index 91eadf08f..000000000 --- a/data/graphics/gui/tab.png +++ /dev/null diff --git a/data/graphics/gui/tab.xml b/data/graphics/gui/tab.xml new file mode 100644 index 000000000..e00f7f907 --- /dev/null +++ b/data/graphics/gui/tab.xml @@ -0,0 +1,18 @@ +<skinset name="Default" image="window.png"> + <widget type="Window" xpos="68" ypos="0"> + <!-- Top Row --> + <part type="top-left-corner" xpos="0" ypos="0" width="10" height="5" /> + <part type="top-edge" xpos="9" ypos="0" width="8" height="5" /> + <part type="top-right-corner" xpos="16" ypos="0" width="10" height="5" /> + + <!-- Middle Row --> + <part type="left-edge" xpos="0" ypos="4" width="10" height="16" /> + <part type="bg-quad" xpos="9" ypos="4" width="8" height="16" /> + <part type="right-edge" xpos="16" ypos="4" width="10" height="16" /> + + <!-- Bottom Row --> + <part type="bottom-left-corner" xpos="0" ypos="19" width="10" height="5" /> + <part type="bottom-edge" xpos="9" ypos="19" width="8" height="5" /> + <part type="bottom-right-corner" xpos="16" ypos="19" width="10" height="5" /> + </widget> +</skinset> diff --git a/data/graphics/gui/tab_highlighted.xml b/data/graphics/gui/tab_highlighted.xml new file mode 100644 index 000000000..479a883fb --- /dev/null +++ b/data/graphics/gui/tab_highlighted.xml @@ -0,0 +1,18 @@ +<skinset name="Default" image="window.png"> + <widget type="Window" xpos="68" ypos="25"> + <!-- Top Row --> + <part type="top-left-corner" xpos="0" ypos="0" width="10" height="5" /> + <part type="top-edge" xpos="9" ypos="0" width="8" height="5" /> + <part type="top-right-corner" xpos="16" ypos="0" width="10" height="5" /> + + <!-- Middle Row --> + <part type="left-edge" xpos="0" ypos="4" width="10" height="16" /> + <part type="bg-quad" xpos="9" ypos="4" width="8" height="16" /> + <part type="right-edge" xpos="16" ypos="4" width="10" height="16" /> + + <!-- Bottom Row --> + <part type="bottom-left-corner" xpos="0" ypos="19" width="10" height="5" /> + <part type="bottom-edge" xpos="9" ypos="19" width="8" height="5" /> + <part type="bottom-right-corner" xpos="16" ypos="19" width="10" height="5" /> + </widget> +</skinset> diff --git a/data/graphics/gui/tab_hilight.png b/data/graphics/gui/tab_hilight.png Binary files differdeleted file mode 100644 index f6b39942d..000000000 --- a/data/graphics/gui/tab_hilight.png +++ /dev/null diff --git a/data/graphics/gui/tab_selected.xml b/data/graphics/gui/tab_selected.xml new file mode 100644 index 000000000..f3869b9d0 --- /dev/null +++ b/data/graphics/gui/tab_selected.xml @@ -0,0 +1,18 @@ +<skinset name="Default" image="window.png"> + <widget type="Window" xpos="68" ypos="50"> + <!-- Top Row --> + <part type="top-left-corner" xpos="0" ypos="0" width="10" height="5" /> + <part type="top-edge" xpos="9" ypos="0" width="8" height="5" /> + <part type="top-right-corner" xpos="16" ypos="0" width="10" height="5" /> + + <!-- Middle Row --> + <part type="left-edge" xpos="0" ypos="4" width="10" height="16" /> + <part type="bg-quad" xpos="9" ypos="4" width="8" height="16" /> + <part type="right-edge" xpos="16" ypos="4" width="10" height="16" /> + + <!-- Bottom Row --> + <part type="bottom-left-corner" xpos="0" ypos="19" width="10" height="5" /> + <part type="bottom-edge" xpos="9" ypos="19" width="8" height="5" /> + <part type="bottom-right-corner" xpos="16" ypos="19" width="10" height="5" /> + </widget> +</skinset> diff --git a/data/graphics/gui/tab_unused.xml b/data/graphics/gui/tab_unused.xml new file mode 100644 index 000000000..95b48e695 --- /dev/null +++ b/data/graphics/gui/tab_unused.xml @@ -0,0 +1,18 @@ +<skinset name="Default" image="window.png"> + <widget type="Window" xpos="68" ypos="75"> + <!-- Top Row --> + <part type="top-left-corner" xpos="0" ypos="0" width="10" height="5" /> + <part type="top-edge" xpos="9" ypos="0" width="8" height="5" /> + <part type="top-right-corner" xpos="16" ypos="0" width="10" height="5" /> + + <!-- Middle Row --> + <part type="left-edge" xpos="0" ypos="4" width="10" height="16" /> + <part type="bg-quad" xpos="9" ypos="4" width="8" height="16" /> + <part type="right-edge" xpos="16" ypos="4" width="10" height="16" /> + + <!-- Bottom Row --> + <part type="bottom-left-corner" xpos="0" ypos="19" width="10" height="5" /> + <part type="bottom-edge" xpos="9" ypos="19" width="8" height="5" /> + <part type="bottom-right-corner" xpos="16" ypos="19" width="10" height="5" /> + </widget> +</skinset> diff --git a/data/graphics/gui/tabselected.png b/data/graphics/gui/tabselected.png Binary files differdeleted file mode 100644 index e2983060c..000000000 --- a/data/graphics/gui/tabselected.png +++ /dev/null diff --git a/data/graphics/gui/window.png b/data/graphics/gui/window.png Binary files differindex 1bdee4931..37395d0a2 100644 --- a/data/graphics/gui/window.png +++ b/data/graphics/gui/window.png 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++; } |