From 0647852f65598ef9cb9ebff6dfb508e8b1a98c1c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 3 Aug 2012 02:11:25 +0300 Subject: Add support for default theme file names. --- src/gui/widgets/avatarlistbox.cpp | 4 ++-- src/gui/widgets/button.cpp | 5 ++++- src/gui/widgets/checkbox.cpp | 2 +- src/gui/widgets/dropdown.cpp | 8 ++++++-- src/gui/widgets/dropshortcutcontainer.cpp | 2 +- src/gui/widgets/emoteshortcutcontainer.cpp | 2 +- src/gui/widgets/itemcontainer.cpp | 2 +- src/gui/widgets/itemshortcutcontainer.cpp | 2 +- src/gui/widgets/playerbox.cpp | 3 ++- src/gui/widgets/popup.cpp | 2 +- src/gui/widgets/progressbar.cpp | 2 +- src/gui/widgets/radiobutton.cpp | 2 +- src/gui/widgets/resizegrip.cpp | 2 +- src/gui/widgets/scrollarea.cpp | 10 ++++++---- src/gui/widgets/slider.cpp | 5 ++++- src/gui/widgets/spellshortcutcontainer.cpp | 2 +- src/gui/widgets/tab.cpp | 5 ++++- src/gui/widgets/textfield.cpp | 2 +- src/gui/widgets/window.cpp | 2 +- 19 files changed, 40 insertions(+), 24 deletions(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 914437281..ad139159a 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -58,8 +58,8 @@ AvatarListBox::AvatarListBox(AvatarListModel *model): if (instances == 1) { - onlineIcon = Theme::getImageFromThemeXml("circle-on.xml"); - offlineIcon = Theme::getImageFromThemeXml("circle-off.xml"); + onlineIcon = Theme::getImageFromThemeXml("circle-on.xml", ""); + offlineIcon = Theme::getImageFromThemeXml("circle-off.xml", ""); } setWidth(200); diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 15b4abdc2..51d4efc6c 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -176,7 +176,10 @@ void Button::init() if (Theme::instance()) { for (int mode = 0; mode < BUTTON_COUNT; mode ++) - Theme::instance()->loadRect(button[mode], data[mode]); + { + Theme::instance()->loadRect(button[mode], + data[mode], "button.xml"); + } } updateAlpha(); diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index ab08a95d0..04ac998bf 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -56,7 +56,7 @@ CheckBox::CheckBox(const std::string &caption, bool selected, if (Theme::instance()) { ImageRect rect; - Theme::instance()->loadRect(rect, "checkbox.xml", 0, 5); + Theme::instance()->loadRect(rect, "checkbox.xml", "", 0, 5); checkBoxNormal = rect.grid[0]; checkBoxChecked = rect.grid[1]; checkBoxDisabled = rect.grid[2]; diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index dd9bbb4e5..7e810390a 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -70,7 +70,8 @@ DropDown::DropDown(gcn::ListModel *listModel, gcn::ActionListener* listener, // Load the background skin for (int i = 0; i < 2; i ++) { - Skin *skin = Theme::instance()->load(dropdownFiles[i]); + Skin *skin = Theme::instance()->load( + dropdownFiles[i], "dropdown.xml"); if (skin) { const ImageRect &rect = skin->getBorder(); @@ -98,7 +99,10 @@ DropDown::DropDown(gcn::ListModel *listModel, gcn::ActionListener* listener, // get the border skin if (Theme::instance()) - Theme::instance()->loadRect(skinRect, "dropdown_background.xml"); + { + Theme::instance()->loadRect(skinRect, + "dropdown_background.xml", ""); + } } instances++; diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index d70f153d7..a471ab8ff 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -57,7 +57,7 @@ DropShortcutContainer::DropShortcutContainer(): addWidgetListener(this); mBackgroundImg = Theme::getImageFromThemeXml( - "item_shortcut_background.xml"); + "item_shortcut_background.xml", "background.xml"); if (dropShortcut) mMaxItems = dropShortcut->getItemCount(); else diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index d3de9e8de..17d825909 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -57,7 +57,7 @@ EmoteShortcutContainer::EmoteShortcutContainer(): addWidgetListener(this); mBackgroundImg = Theme::getImageFromThemeXml( - "item_shortcut_background.xml"); + "item_shortcut_background.xml", "background.xml"); if (mBackgroundImg) mBackgroundImg->setAlpha(Client::getGuiAlpha()); diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 6963bad31..e315a336c 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -157,7 +157,7 @@ ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity): mInventory(inventory), mGridColumns(1), mGridRows(1), - mSelImg(Theme::getImageFromThemeXml("item_selection.xml")), + mSelImg(Theme::getImageFromThemeXml("item_selection.xml", "")), mSelectedIndex(-1), mHighlightedIndex(-1), mLastUsedSlot(-1), diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index e27d5efd6..50fc0de0f 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -64,7 +64,7 @@ ItemShortcutContainer::ItemShortcutContainer(unsigned number): addWidgetListener(this); mBackgroundImg = Theme::getImageFromThemeXml( - "item_shortcut_background.xml"); + "item_shortcut_background.xml", "background.xml"); if (itemShortcut[mNumber]) mMaxItems = itemShortcut[mNumber]->getItemCount(); else diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 423f26563..b9f6657a9 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -73,7 +73,8 @@ void PlayerBox::init(std::string skin) { if (skin.empty()) skin = "playerbox_background.xml"; - mSkin = Theme::instance()->loadSkinRect(mBackground, skin); + mSkin = Theme::instance()->loadSkinRect(mBackground, + skin, "background.xml"); if (mSkin) mDrawBackground = (mSkin->getOption("drawbackground") != 0); } diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index e206a3246..34079afb2 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -64,7 +64,7 @@ Popup::Popup(const std::string &name, std::string skin): // Loads the skin if (Theme::instance()) { - mSkin = Theme::instance()->load(skin); + mSkin = Theme::instance()->load(skin, "popup.xml"); if (mSkin) setPadding(mSkin->getPadding()); } diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 2ddd2b0b9..0d0211bcc 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -75,7 +75,7 @@ ProgressBar::ProgressBar(float progress, mBorder.grid[f] = nullptr; if (Theme::instance()) - Theme::instance()->loadRect(mBorder, "progressbar.xml"); + Theme::instance()->loadRect(mBorder, "progressbar.xml", ""); } mInstances++; diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index e0e01d4ed..6a89b3080 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -54,7 +54,7 @@ RadioButton::RadioButton(const std::string &caption, const std::string &group, if (Theme::instance()) { ImageRect rect; - Theme::instance()->loadRect(rect, "radio.xml", 0, 3); + Theme::instance()->loadRect(rect, "radio.xml", "", 0, 3); radioChecked = rect.grid[0]; radioDisabledChecked = rect.grid[0]; radioCheckedHi = rect.grid[1]; diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp index 4b299a5dc..53254193d 100644 --- a/src/gui/widgets/resizegrip.cpp +++ b/src/gui/widgets/resizegrip.cpp @@ -43,7 +43,7 @@ ResizeGrip::ResizeGrip(const std::string &image) if (mInstances == 0) { // Load the grip image - gripImage = Theme::getImageFromThemeXml(image); + gripImage = Theme::getImageFromThemeXml(image, ""); if (gripImage) gripImage->setAlpha(mAlpha); diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 6bc75d5a2..2906ab641 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -127,7 +127,7 @@ void ScrollArea::init(std::string skinName) if (skinName == "") skinName = "scroll_background.xml"; - Theme::instance()->loadRect(background, skinName); + Theme::instance()->loadRect(background, skinName, "scroll_background.xml"); if (instances == 0) { for (int f = 0; f < 9; f ++) @@ -139,13 +139,15 @@ void ScrollArea::init(std::string skinName) if (Theme::instance()) { - Theme::instance()->loadRect(vMarker, "scroll.xml"); - Theme::instance()->loadRect(vMarkerHi, "scroll_highlighted.xml"); + Theme::instance()->loadRect(vMarker, "scroll.xml", ""); + Theme::instance()->loadRect(vMarkerHi, "scroll_highlighted.xml", + "scroll.xml"); } for (int i = 0; i < 2; i ++) { - Skin *skin = Theme::instance()->load(buttonFiles[i]); + Skin *skin = Theme::instance()->load( + buttonFiles[i], "scrollbuttons.xml"); if (skin) { const ImageRect &rect = skin->getBorder(); diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index d97e3e57d..630bd7e28 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -79,7 +79,10 @@ void Slider::init() if (Theme::instance()) { for (int mode = 0; mode < 2; mode ++) - Theme::instance()->loadRect(buttons[mode], data[mode], 0, 8); + { + Theme::instance()->loadRect(buttons[mode], + data[mode], "slider.xml", 0, 8); + } } updateAlpha(); } diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index c3e3b1495..25dd3fb6d 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -64,7 +64,7 @@ SpellShortcutContainer::SpellShortcutContainer(unsigned number): mSpellPopup = new SpellPopup; mBackgroundImg = Theme::getImageFromThemeXml( - "item_shortcut_background.xml"); + "item_shortcut_background.xml", "background.xml"); if (spellShortcut) mMaxItems = spellShortcut->getSpellsCount(); else diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 3faa874ca..81b43445c 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -102,7 +102,10 @@ void Tab::init() if (Theme::instance()) { for (int mode = 0; mode < TAB_COUNT; mode ++) - Theme::instance()->loadRect(tabImg[mode], data[mode]); + { + Theme::instance()->loadRect(tabImg[mode], + data[mode], "tab.xml"); + } } updateAlpha(); } diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 1c054f04b..d5fb58cb9 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -67,7 +67,7 @@ TextField::TextField(const std::string &text, bool loseFocusOnTab, if (instances == 0) { if (Theme::instance()) - Theme::instance()->loadRect(skin, "textfield_background.xml"); + Theme::instance()->loadRect(skin, "textfield_background.xml", ""); } instances++; diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 3fb0649c2..bfb4d883c 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -85,7 +85,7 @@ Window::Window(const std::string &caption, bool modal, Window *parent, // Loads the skin if (Theme::instance()) { - mSkin = Theme::instance()->load(skin); + mSkin = Theme::instance()->load(skin, "window.xml"); if (mSkin) setPadding(mSkin->getPadding()); } -- cgit v1.2.3-70-g09d2