From db4361d9f7652104e818cf9a2a0f326e1c607fb8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 11 Sep 2011 04:24:30 +0300 Subject: Add own xml configuration for missing windows. --- src/gui/beingpopup.cpp | 4 ++-- src/gui/confirmdialog.cpp | 2 +- src/gui/editdialog.cpp | 2 +- src/gui/emotepopup.cpp | 3 ++- src/gui/inventorywindow.cpp | 2 +- src/gui/itemamountwindow.cpp | 2 +- src/gui/itempopup.cpp | 2 +- src/gui/ministatuswindow.cpp | 2 +- src/gui/okdialog.cpp | 2 +- src/gui/popupmenu.cpp | 2 +- src/gui/shortcutwindow.cpp | 3 ++- src/gui/spellpopup.cpp | 2 +- src/gui/statuspopup.cpp | 2 +- src/gui/statuswindow.cpp | 2 +- src/gui/textdialog.cpp | 2 +- src/gui/textpopup.cpp | 2 +- src/gui/widgets/popup.cpp | 22 +++++++++++++++++++--- src/gui/widgets/popup.h | 3 +-- 18 files changed, 39 insertions(+), 22 deletions(-) (limited to 'src/gui') diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp index 8d7b26c1b..98df1ca9a 100644 --- a/src/gui/beingpopup.cpp +++ b/src/gui/beingpopup.cpp @@ -39,8 +39,8 @@ #include "debug.h" -BeingPopup::BeingPopup(): - Popup("BeingPopup") +BeingPopup::BeingPopup() : + Popup("BeingPopup", "beingpopup.xml") { // Being Name mBeingName = new Label("A"); diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp index 661168dd9..f7f81bd2f 100644 --- a/src/gui/confirmdialog.cpp +++ b/src/gui/confirmdialog.cpp @@ -37,7 +37,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg, bool ignore, bool modal, Window *parent): - Window(title, modal, parent) + Window(title, modal, parent, "confirm.xml") { mTextBox = new TextBox; mTextBox->setEditable(false); diff --git a/src/gui/editdialog.cpp b/src/gui/editdialog.cpp index da1d98e81..84f4f6ddf 100644 --- a/src/gui/editdialog.cpp +++ b/src/gui/editdialog.cpp @@ -37,7 +37,7 @@ EditDialog::EditDialog(const std::string &title, const std::string &msg, std::string eventOk, int width, Window *parent, bool modal): - Window(title, modal, parent) + Window(title, modal, parent, "edit.xml") { mTextField = new TextField; mTextField->setText(msg); diff --git a/src/gui/emotepopup.cpp b/src/gui/emotepopup.cpp index 348a97952..6d2bf7be2 100644 --- a/src/gui/emotepopup.cpp +++ b/src/gui/emotepopup.cpp @@ -48,7 +48,8 @@ const int EmotePopup::gridHeight = 36; // emote icon height + 4 static const int MAX_COLUMNS = 6; -EmotePopup::EmotePopup(): +EmotePopup::EmotePopup() : + Popup("EmotePopup", "emotepopup.xml"), mSelectedEmoteIndex(-1), mHoveredEmoteIndex(-1), mRowCount(1), diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index c6afaaf1d..cd02a6732 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -96,7 +96,7 @@ public: InventoryWindow::WindowList InventoryWindow::instances; InventoryWindow::InventoryWindow(Inventory *inventory): - Window(), + Window("Inventory", false, 0, "inventory.xml"), mInventory(inventory), mDropButton(0), mSplit(false) diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp index d85b38ccb..7c5b19415 100644 --- a/src/gui/itemamountwindow.cpp +++ b/src/gui/itemamountwindow.cpp @@ -137,7 +137,7 @@ void ItemAmountWindow::finish(Item *item, int amount, int price, Usage usage) ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item, int maxRange): - Window("", true, parent), + Window("", true, parent, "amount.xml"), mItemPriceTextField(0), mGPLabel(0), mItem(item), diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 4d401a627..b05d7fe28 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -49,7 +49,7 @@ #include "debug.h" ItemPopup::ItemPopup(): - Popup("ItemPopup"), + Popup("ItemPopup", "itempopup.xml"), mIcon(0), mLastName(""), mLastColor(1) diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp index e3f441b60..3e66f42cb 100644 --- a/src/gui/ministatuswindow.cpp +++ b/src/gui/ministatuswindow.cpp @@ -52,7 +52,7 @@ extern volatile int tick_time; MiniStatusWindow::MiniStatusWindow(): - Popup("MiniStatus") + Popup("MiniStatus", "ministatus.xml") { listen(Mana::CHANNEL_ATTRIBUTES); diff --git a/src/gui/okdialog.cpp b/src/gui/okdialog.cpp index 122d7176f..5a6ee4846 100644 --- a/src/gui/okdialog.cpp +++ b/src/gui/okdialog.cpp @@ -35,7 +35,7 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg, bool modal, bool showCenter, Window *parent): - Window(title, modal, parent) + Window(title, modal, parent, "ok.xml") { mTextBox = new TextBox; mTextBox->setEditable(false); diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index e43ab35bc..daf1757c3 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -83,7 +83,7 @@ std::string tradePartnerName(""); PopupMenu::PopupMenu(): - Popup("PopupMenu"), + Popup("PopupMenu", "popupmenu.xml"), mBeingId(0), mFloorItem(0), mItem(0), diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index 0492afce0..cf491c9f0 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -52,7 +52,8 @@ class ShortcutTab : public Tab ShortcutWindow::ShortcutWindow(const std::string &title, ShortcutContainer *content, - int width, int height) + int width, int height) : + Window("Window", false, 0, "shortcuts.xml") { setWindowName(title); // no title presented, title bar is padding so window can be moved. diff --git a/src/gui/spellpopup.cpp b/src/gui/spellpopup.cpp index f87e691de..c7d25e257 100644 --- a/src/gui/spellpopup.cpp +++ b/src/gui/spellpopup.cpp @@ -42,7 +42,7 @@ #include "debug.h" SpellPopup::SpellPopup(): - Popup("SpellPopup") + Popup("SpellPopup", "spellpopup.xml") { // Item Name mItemName = new Label; diff --git a/src/gui/statuspopup.cpp b/src/gui/statuspopup.cpp index 9214f1406..5c28641dc 100644 --- a/src/gui/statuspopup.cpp +++ b/src/gui/statuspopup.cpp @@ -46,7 +46,7 @@ #include "debug.h" StatusPopup::StatusPopup(): - Popup("StatusPopup") + Popup("StatusPopup", "statuspopup.xml") { const int fontHeight = getFont()->getHeight(); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 97130b103..0cad8732a 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -123,7 +123,7 @@ class ChangeDisplay : public AttrDisplay, gcn::ActionListener }; StatusWindow::StatusWindow(): - Window(player_node ? player_node->getName() : "?") + Window(player_node ? player_node->getName() : "?", false, 0, "status.xml") { listen(Mana::CHANNEL_ATTRIBUTES); diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp index a80e25260..c1539684c 100644 --- a/src/gui/textdialog.cpp +++ b/src/gui/textdialog.cpp @@ -39,7 +39,7 @@ int TextDialog::instances = 0; TextDialog::TextDialog(const std::string &title, const std::string &msg, Window *parent, bool isPassword): - Window(title, true, parent), + Window(title, true, parent, "textdialog.xml"), mTextField(0), mPasswordField(0) { diff --git a/src/gui/textpopup.cpp b/src/gui/textpopup.cpp index 65c712461..15b2618da 100644 --- a/src/gui/textpopup.cpp +++ b/src/gui/textpopup.cpp @@ -41,7 +41,7 @@ #include "debug.h" TextPopup::TextPopup(): - Popup("TextPopup") + Popup("TextPopup", "textpopup.xml") { const int fontHeight = getFont()->getHeight(); diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index ebfdbe303..ac282b088 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -40,7 +40,7 @@ #include "debug.h" -Popup::Popup(const std::string &name, const std::string &skin): +Popup::Popup(const std::string &name, std::string skin): mPopupName(name), mMinWidth(100), mMinHeight(40), @@ -58,8 +58,20 @@ Popup::Popup(const std::string &name, const std::string &skin): setPadding(3); + if (skin == "") + skin = "popup.xml"; + // Loads the skin - mSkin = Theme::instance()->load(skin); + if (Theme::instance()) + { + mSkin = Theme::instance()->load(skin); + if (mSkin) + setPadding(mSkin->getPadding()); + } + else + { + mSkin = 0; + } // Add this window to the window container windowContainer->add(this); @@ -76,7 +88,11 @@ Popup::~Popup() mVertexes = 0; if (mSkin) - mSkin->instances--; + { + if (Theme::instance()) + Theme::instance()->unload(mSkin); + mSkin = 0; + } } void Popup::setWindowContainer(WindowContainer *wc) diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index 0ac50f69e..9d4343ba3 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -66,8 +66,7 @@ class Popup : public Container, public gcn::MouseListener, * debugging purposes. * @param skin The location where the Popup's skin XML can be found. */ - Popup(const std::string &name = "", - const std::string &skin = "window.xml"); + Popup(const std::string &name = "", std::string skin = ""); /** * Destructor. Deletes all the added widgets. -- cgit v1.2.3-70-g09d2