diff options
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/avatarlistbox.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/button.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/checkbox.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/dropdown.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/emoteshortcutcontainer.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/itemshortcutcontainer.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/playerbox.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/popup.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/progressbar.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/progressindicator.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/radiobutton.cpp | 16 | ||||
-rw-r--r-- | src/gui/widgets/resizegrip.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/resizegrip.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/scrollarea.cpp | 24 | ||||
-rw-r--r-- | src/gui/widgets/slider.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/tab.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/textfield.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 2 |
19 files changed, 61 insertions, 81 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index f5a9ea18..92386739 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -25,6 +25,7 @@ #include "gui/chat.h" #include "gui/gui.h" #include "gui/palette.h" +#include "gui/skin.h" #include "resources/image.h" #include "resources/resourcemanager.h" @@ -44,8 +45,8 @@ AvatarListBox::AvatarListBox(AvatarListModel *model): if (instances == 1) { - onlineIcon = ResourceManager::getInstance()->getImage("graphics/gui/circle-green.png"); - offlineIcon = ResourceManager::getInstance()->getImage("graphics/gui/circle-gray.png"); + onlineIcon = SkinLoader::getImageFromTheme("circle-green.png"); + offlineIcon = SkinLoader::getImageFromTheme("circle-gray.png"); } setWidth(200); diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 6589c96e..36a47859 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -28,7 +28,6 @@ #include "gui/skin.h" #include "resources/image.h" -#include "resources/resourcemanager.h" #include "utils/dtor.h" @@ -54,10 +53,10 @@ struct ButtonData }; static ButtonData const data[BUTTON_COUNT] = { - { "graphics/gui/button.png", 0, 0 }, - { "graphics/gui/buttonhi.png", 9, 4 }, - { "graphics/gui/buttonpress.png", 16, 19 }, - { "graphics/gui/button_disabled.png", 25, 23 } + { "button.png", 0, 0 }, + { "buttonhi.png", 9, 4 }, + { "buttonpress.png", 16, 19 }, + { "button_disabled.png", 25, 23 } }; ImageRect Button::button[BUTTON_COUNT]; @@ -85,14 +84,13 @@ void Button::init() if (mInstances == 0) { // Load the skin - ResourceManager *resman = ResourceManager::getInstance(); Image *btn[BUTTON_COUNT]; int a, x, y, mode; for (mode = 0; mode < BUTTON_COUNT; mode++) { - btn[mode] = resman->getImage(data[mode].file); + btn[mode] = SkinLoader::getImageFromTheme(data[mode].file); a = 0; for (y = 0; y < 3; y++) { diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index dc6d94b3..d5253d7c 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -28,7 +28,6 @@ #include "gui/skin.h" #include "resources/image.h" -#include "resources/resourcemanager.h" int CheckBox::instances = 0; float CheckBox::mAlpha = 1.0; @@ -45,8 +44,7 @@ CheckBox::CheckBox(const std::string &caption, bool selected): { if (instances == 0) { - ResourceManager *resman = ResourceManager::getInstance(); - Image *checkBox = resman->getImage("graphics/gui/checkbox.png"); + Image *checkBox = SkinLoader::getImageFromTheme("checkbox.png"); checkBoxNormal = checkBox->getSubImage(0, 0, 9, 10); checkBoxChecked = checkBox->getSubImage(9, 0, 9, 10); checkBoxDisabled = checkBox->getSubImage(18, 0, 9, 10); diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 32b42553..eb0cdef2 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -32,7 +32,6 @@ #include "gui/widgets/scrollarea.h" #include "resources/image.h" -#include "resources/resourcemanager.h" #include "utils/dtor.h" @@ -54,17 +53,16 @@ DropDown::DropDown(gcn::ListModel *listModel): if (instances == 0) { // Load the background skin - ResourceManager *resman = ResourceManager::getInstance(); // Get the button skin buttons[1][0] = - resman->getImage("graphics/gui/vscroll_up_default.png"); + SkinLoader::getImageFromTheme("vscroll_up_default.png"); buttons[0][0] = - resman->getImage("graphics/gui/vscroll_down_default.png"); + SkinLoader::getImageFromTheme("vscroll_down_default.png"); buttons[1][1] = - resman->getImage("graphics/gui/vscroll_up_pressed.png"); + SkinLoader::getImageFromTheme("vscroll_up_pressed.png"); buttons[0][1] = - resman->getImage("graphics/gui/vscroll_down_pressed.png"); + SkinLoader::getImageFromTheme("vscroll_down_pressed.png"); buttons[0][0]->setAlpha(mAlpha); buttons[0][1]->setAlpha(mAlpha); @@ -72,7 +70,7 @@ DropDown::DropDown(gcn::ListModel *listModel): buttons[1][1]->setAlpha(mAlpha); // get the border skin - Image *boxBorder = resman->getImage("graphics/gui/deepbox.png"); + Image *boxBorder = SkinLoader::getImageFromTheme("deepbox.png"); int gridx[4] = {0, 3, 28, 31}; int gridy[4] = {0, 3, 28, 31}; int a = 0, x, y; diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 41be172f..dd13c679 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -32,10 +32,10 @@ #include "log.h" #include "gui/palette.h" +#include "gui/skin.h" #include "resources/emotedb.h" #include "resources/image.h" -#include "resources/resourcemanager.h" #include "utils/dtor.h" @@ -49,9 +49,7 @@ EmoteShortcutContainer::EmoteShortcutContainer(): addMouseListener(this); addWidgetListener(this); - ResourceManager *resman = ResourceManager::getInstance(); - - mBackgroundImg = resman->getImage("graphics/gui/item_shortcut_bgr.png"); + mBackgroundImg = SkinLoader::getImageFromTheme("item_shortcut_bgr.png"); mBackgroundImg->setAlpha(config.getValue("guialpha", 0.8)); diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index f801822c..b4270912 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -32,6 +32,7 @@ #include "gui/outfitwindow.h" #include "gui/palette.h" #include "gui/sdlinput.h" +#include "gui/skin.h" #include "gui/viewport.h" #include "net/net.h" @@ -39,7 +40,6 @@ #include "resources/image.h" #include "resources/iteminfo.h" -#include "resources/resourcemanager.h" #include "utils/stringutils.h" @@ -67,9 +67,7 @@ ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity): mItemPopup = new ItemPopup; setFocusable(true); - ResourceManager *resman = ResourceManager::getInstance(); - - mSelImg = resman->getImage("graphics/gui/selection.png"); + mSelImg = SkinLoader::getImageFromTheme("selection.png"); if (!mSelImg) logger->error("Unable to load selection.png"); diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 66e053d8..92a3e7d0 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -32,11 +32,11 @@ #include "gui/inventorywindow.h" #include "gui/itempopup.h" #include "gui/palette.h" +#include "gui/skin.h" #include "gui/viewport.h" #include "resources/image.h" #include "resources/iteminfo.h" -#include "resources/resourcemanager.h" #include "utils/stringutils.h" @@ -50,9 +50,7 @@ ItemShortcutContainer::ItemShortcutContainer(): mItemPopup = new ItemPopup; - ResourceManager *resman = ResourceManager::getInstance(); - - mBackgroundImg = resman->getImage("graphics/gui/item_shortcut_bgr.png"); + mBackgroundImg = SkinLoader::getImageFromTheme("item_shortcut_bgr.png"); mMaxItems = itemShortcut->getItemCount(); mBackgroundImg->setAlpha(config.getValue("guialpha", 0.8)); diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 23da2afd..24395db7 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -26,8 +26,9 @@ #include "graphics.h" #include "player.h" +#include "gui/skin.h" + #include "resources/image.h" -#include "resources/resourcemanager.h" #include "utils/dtor.h" @@ -43,8 +44,7 @@ PlayerBox::PlayerBox(const Player *player): if (instances == 0) { // Load the background skin - ResourceManager *resman = ResourceManager::getInstance(); - Image *textbox = resman->getImage("graphics/gui/deepbox.png"); + Image *textbox = SkinLoader::getImageFromTheme("deepbox.png"); int bggridx[4] = {0, 3, 28, 31}; int bggridy[4] = {0, 3, 28, 31}; int a = 0, x, y; diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index 449c2f7b..d63b59ca 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -55,7 +55,7 @@ class Popup : public Container * @param skin The location where the Popup's skin XML can be found. */ Popup(const std::string &name = "", - const std::string &skin = "graphics/gui/gui.xml"); + const std::string &skin = "gui.xml"); /** * Destructor. Deletes all the added widgets. diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index db2a8692..31c32132 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -30,7 +30,6 @@ #include "gui/skin.h" #include "resources/image.h" -#include "resources/resourcemanager.h" #include "utils/dtor.h" @@ -59,8 +58,7 @@ ProgressBar::ProgressBar(float progress, if (mInstances == 0) { - ResourceManager *resman = ResourceManager::getInstance(); - Image *dBorders = resman->getImage("graphics/gui/vscroll_grey.png"); + Image *dBorders = SkinLoader::getImageFromTheme("vscroll_grey.png"); mBorder.grid[0] = dBorders->getSubImage(0, 0, 4, 4); mBorder.grid[1] = dBorders->getSubImage(4, 0, 3, 4); mBorder.grid[2] = dBorders->getSubImage(7, 0, 4, 4); diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index d1b6bb87..f88f6045 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -20,6 +20,8 @@ #include "progressindicator.h" +#include "gui/skin.h" + #include "resources/animation.h" #include "resources/imageset.h" #include "resources/resourcemanager.h" @@ -31,9 +33,8 @@ ProgressIndicator::ProgressIndicator() { - ResourceManager *rm = ResourceManager::getInstance(); - ImageSet *images = rm->getImageSet("graphics/gui/progress-indicator.png", - 32, 32); + ImageSet *images = + SkinLoader::getImageSetFromTheme("progress-indicator.png", 32, 32); Animation *anim = new Animation; for (ImageSet::size_type i = 0; i < images->size(); ++i) diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index adbc4dd7..41c8faf7 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -24,8 +24,9 @@ #include "configuration.h" #include "graphics.h" +#include "gui/skin.h" + #include "resources/image.h" -#include "resources/resourcemanager.h" int RadioButton::instances = 0; float RadioButton::mAlpha = 1.0; @@ -43,13 +44,12 @@ RadioButton::RadioButton(const std::string &caption, const std::string &group, { if (instances == 0) { - ResourceManager *resman = ResourceManager::getInstance(); - radioNormal = resman->getImage("graphics/gui/radioout.png"); - radioChecked = resman->getImage("graphics/gui/radioin.png"); - radioDisabled = resman->getImage("graphics/gui/radioout.png"); - radioDisabledChecked = resman->getImage("graphics/gui/radioin.png"); - radioNormalHi = resman->getImage("graphics/gui/radioout_highlight.png"); - radioCheckedHi = resman->getImage("graphics/gui/radioin_highlight.png"); + radioNormal = SkinLoader::getImageFromTheme("radioout.png"); + radioChecked = SkinLoader::getImageFromTheme("radioin.png"); + radioDisabled = SkinLoader::getImageFromTheme("radioout.png"); + radioDisabledChecked = SkinLoader::getImageFromTheme("radioin.png"); + radioNormalHi = SkinLoader::getImageFromTheme("radioout_highlight.png"); + radioCheckedHi = SkinLoader::getImageFromTheme("radioin_highlight.png"); radioNormal->setAlpha(mAlpha); radioChecked->setAlpha(mAlpha); radioDisabled->setAlpha(mAlpha); diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp index 106118da..d0b9b845 100644 --- a/src/gui/widgets/resizegrip.cpp +++ b/src/gui/widgets/resizegrip.cpp @@ -24,8 +24,9 @@ #include "configuration.h" #include "graphics.h" +#include "gui/skin.h" + #include "resources/image.h" -#include "resources/resourcemanager.h" #include <guichan/graphics.hpp> @@ -38,8 +39,7 @@ ResizeGrip::ResizeGrip(const std::string &image) if (mInstances == 0) { // Load the grip image - ResourceManager *resman = ResourceManager::getInstance(); - gripImage = resman->getImage(image); + gripImage = SkinLoader::getImageFromTheme(image); gripImage->setAlpha(mAlpha); } diff --git a/src/gui/widgets/resizegrip.h b/src/gui/widgets/resizegrip.h index 4cc195cc..5ef93f29 100644 --- a/src/gui/widgets/resizegrip.h +++ b/src/gui/widgets/resizegrip.h @@ -39,7 +39,7 @@ class ResizeGrip : public gcn::Widget /** * Constructor. */ - ResizeGrip(const std::string &image = "graphics/gui/resize.png"); + ResizeGrip(const std::string &image = "resize.png"); /** * Destructor. diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index b3e28329..dea99e8e 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -27,7 +27,6 @@ #include "gui/skin.h" #include "resources/image.h" -#include "resources/resourcemanager.h" #include "utils/dtor.h" @@ -96,8 +95,7 @@ void ScrollArea::init() if (instances == 0) { // Load the background skin - ResourceManager *resman = ResourceManager::getInstance(); - Image *textbox = resman->getImage("graphics/gui/deepbox.png"); + Image *textbox = SkinLoader::getImageFromTheme("deepbox.png"); const int bggridx[4] = {0, 3, 28, 31}; const int bggridy[4] = {0, 3, 28, 31}; int a = 0, x, y; @@ -118,8 +116,8 @@ void ScrollArea::init() textbox->decRef(); // Load vertical scrollbar skin - Image *vscroll = resman->getImage("graphics/gui/vscroll_grey.png"); - Image *vscrollHi = resman->getImage("graphics/gui/vscroll_highlight.png"); + Image *vscroll = SkinLoader::getImageFromTheme("vscroll_grey.png"); + Image *vscrollHi = SkinLoader::getImageFromTheme("vscroll_highlight.png"); int vsgridx[4] = {0, 4, 7, 11}; int vsgridy[4] = {0, 4, 15, 19}; @@ -147,21 +145,21 @@ void ScrollArea::init() vscrollHi->decRef(); buttons[UP][0] = - resman->getImage("graphics/gui/vscroll_up_default.png"); + SkinLoader::getImageFromTheme("vscroll_up_default.png"); buttons[DOWN][0] = - resman->getImage("graphics/gui/vscroll_down_default.png"); + SkinLoader::getImageFromTheme("vscroll_down_default.png"); buttons[LEFT][0] = - resman->getImage("graphics/gui/hscroll_left_default.png"); + SkinLoader::getImageFromTheme("hscroll_left_default.png"); buttons[RIGHT][0] = - resman->getImage("graphics/gui/hscroll_right_default.png"); + SkinLoader::getImageFromTheme("hscroll_right_default.png"); buttons[UP][1] = - resman->getImage("graphics/gui/vscroll_up_pressed.png"); + SkinLoader::getImageFromTheme("vscroll_up_pressed.png"); buttons[DOWN][1] = - resman->getImage("graphics/gui/vscroll_down_pressed.png"); + SkinLoader::getImageFromTheme("vscroll_down_pressed.png"); buttons[LEFT][1] = - resman->getImage("graphics/gui/hscroll_left_pressed.png"); + SkinLoader::getImageFromTheme("hscroll_left_pressed.png"); buttons[RIGHT][1] = - resman->getImage("graphics/gui/hscroll_right_pressed.png"); + SkinLoader::getImageFromTheme("hscroll_right_pressed.png"); } instances++; diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index f02c6b5c..af36518a 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -27,7 +27,6 @@ #include "gui/skin.h" #include "resources/image.h" -#include "resources/resourcemanager.h" Image *Slider::hStart, *Slider::hMid, *Slider::hEnd, *Slider::hGrip; Image *Slider::vStart, *Slider::vMid, *Slider::vEnd, *Slider::vGrip; @@ -83,9 +82,8 @@ void Slider::init() // Load resources if (mInstances == 0) { - ResourceManager *resman = ResourceManager::getInstance(); - Image *slider = resman->getImage("graphics/gui/slider.png"); - Image *sliderHi = resman->getImage("graphics/gui/slider_hilight.png"); + Image *slider = SkinLoader::getImageFromTheme("slider.png"); + Image *sliderHi = SkinLoader::getImageFromTheme("slider_hilight.png"); x = 0; y = 0; w = 15; h = 6; diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 68dc2190..17145eae 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -30,7 +30,6 @@ #include "gui/widgets/tabbedarea.h" #include "resources/image.h" -#include "resources/resourcemanager.h" #include "utils/dtor.h" @@ -55,10 +54,10 @@ struct TabData }; static TabData const data[TAB_COUNT] = { - { "graphics/gui/tab.png", 0, 0 }, - { "graphics/gui/tab_hilight.png", 9, 4 }, - { "graphics/gui/tabselected.png", 16, 19 }, - { "graphics/gui/tab.png", 25, 23 } + { "tab.png", 0, 0 }, + { "tab_hilight.png", 9, 4 }, + { "tabselected.png", 16, 19 }, + { "tab.png", 25, 23 } }; ImageRect Tab::tabImg[TAB_COUNT]; @@ -91,14 +90,13 @@ void Tab::init() if (mInstances == 0) { // Load the skin - ResourceManager *resman = ResourceManager::getInstance(); Image *tab[TAB_COUNT]; int a, x, y, mode; for (mode = 0; mode < TAB_COUNT; mode++) { - tab[mode] = resman->getImage(data[mode].file); + tab[mode] = SkinLoader::getImageFromTheme(data[mode].file); a = 0; for (y = 0; y < 3; y++) { diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 278b4cb9..e599c37d 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -29,7 +29,6 @@ #include "gui/skin.h" #include "resources/image.h" -#include "resources/resourcemanager.h" #include "utils/copynpaste.h" #include "utils/dtor.h" @@ -53,8 +52,7 @@ TextField::TextField(const std::string &text, bool loseFocusOnTab): if (instances == 0) { // Load the skin - ResourceManager *resman = ResourceManager::getInstance(); - Image *textbox = resman->getImage("graphics/gui/deepbox.png"); + Image *textbox = SkinLoader::getImageFromTheme("deepbox.png"); int gridx[4] = {0, 3, 28, 31}; int gridy[4] = {0, 3, 28, 31}; int a = 0, x, y; diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index a54016bc..fd7fd6b7 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -57,7 +57,7 @@ class Window : public gcn::Window, gcn::WidgetListener * @param skin The location where the window's skin XML can be found. */ Window(const std::string &caption = "Window", bool modal = false, - Window *parent = NULL, const std::string &skin = "graphics/gui/gui.xml"); + Window *parent = NULL, const std::string &skin = "gui.xml"); /** * Destructor. Deletes all the added widgets. |