From 376c7e4a46c2c18d117db49b143a3f138d6a81c7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 20 Oct 2012 01:49:19 +0300 Subject: Add palette inheritance to itemcontainer class. --- src/gui/inventorywindow.cpp | 2 +- src/gui/tradewindow.cpp | 4 ++-- src/gui/widgets/itemcontainer.cpp | 5 +++-- src/gui/widgets/itemcontainer.h | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 1844ab39c..ea53ee48a 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -144,7 +144,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): setMinHeight(179); addKeyListener(this); - mItems = new ItemContainer(mInventory); + mItems = new ItemContainer(this, mInventory); mItems->addSelectionListener(this); gcn::ScrollArea *const invenScroll = new ScrollArea( diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp index a9083abaf..f5f593b2e 100644 --- a/src/gui/tradewindow.cpp +++ b/src/gui/tradewindow.cpp @@ -65,8 +65,8 @@ TradeWindow::TradeWindow(): gcn::SelectionListener(), mMyInventory(new Inventory(Inventory::TRADE)), mPartnerInventory(new Inventory(Inventory::TRADE)), - mMyItemContainer(new ItemContainer(mMyInventory.get())), - mPartnerItemContainer(new ItemContainer(mPartnerInventory.get())), + mMyItemContainer(new ItemContainer(this, mMyInventory.get())), + mPartnerItemContainer(new ItemContainer(this, mPartnerInventory.get())), mMoneyLabel(new Label(strprintf(_("You get %s"), ""))), mAddButton(new Button(this, _("Add"), "add", this)), mOkButton(new Button(this, "", "", this)), // Will be filled in later diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index adf1188e4..159a06d19 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -151,10 +151,11 @@ class SortItemTypeFunctor final } } itemTypeSorter; -ItemContainer::ItemContainer(Inventory *const inventory, +ItemContainer::ItemContainer(const Widget2 *const widget, + Inventory *const inventory, const bool forceQuantity) : gcn::Widget(), - Widget2(), + Widget2(widget), gcn::KeyListener(), gcn::MouseListener(), gcn::WidgetListener(), diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index 7801e0cc9..87ccfe7df 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -65,7 +65,8 @@ class ItemContainer final : public gcn::Widget, * @param gridRows Amount of rows in grid. * @param offset Index offset */ - ItemContainer(Inventory *const inventory, + ItemContainer(const Widget2 *const widget, + Inventory *const inventory, const bool forceQuantity = false); A_DELETE_COPY(ItemContainer) -- cgit v1.2.3-60-g2f50