mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 10:36:42 +00:00
working filters
This commit is contained in:
parent
0114bf948c
commit
902309a554
4 changed files with 58 additions and 0 deletions
|
@ -140,4 +140,12 @@ namespace MWClass
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Book::getEnchantment (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Book>();
|
||||||
|
|
||||||
|
return ref->base->enchant;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,9 @@ namespace MWClass
|
||||||
|
|
||||||
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return name of inventory icon.
|
///< Return name of inventory icon.
|
||||||
|
|
||||||
|
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,38 @@ namespace MWGui
|
||||||
getWidget(mFilterApparel, "ApparelButton");
|
getWidget(mFilterApparel, "ApparelButton");
|
||||||
getWidget(mFilterMagic, "MagicButton");
|
getWidget(mFilterMagic, "MagicButton");
|
||||||
getWidget(mFilterMisc, "MiscButton");
|
getWidget(mFilterMisc, "MiscButton");
|
||||||
|
|
||||||
|
mFilterAll->setCaption (MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sAllTab")->str);
|
||||||
|
mFilterWeapon->setCaption (MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sWeaponTab")->str);
|
||||||
|
mFilterApparel->setCaption (MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sApparelTab")->str);
|
||||||
|
mFilterMagic->setCaption (MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sMagicTab")->str);
|
||||||
|
mFilterMisc->setCaption (MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sMiscTab")->str);
|
||||||
|
|
||||||
|
// adjust size of buttons to fit text
|
||||||
|
int curX = 0;
|
||||||
|
mFilterAll->setSize( mFilterAll->getTextSize().width + 24, mFilterAll->getSize().height );
|
||||||
|
curX += mFilterAll->getTextSize().width + 24 + 4;
|
||||||
|
|
||||||
|
mFilterWeapon->setPosition(curX, mFilterWeapon->getPosition().top);
|
||||||
|
mFilterWeapon->setSize( mFilterWeapon->getTextSize().width + 24, mFilterWeapon->getSize().height );
|
||||||
|
curX += mFilterWeapon->getTextSize().width + 24 + 4;
|
||||||
|
|
||||||
|
mFilterApparel->setPosition(curX, mFilterApparel->getPosition().top);
|
||||||
|
mFilterApparel->setSize( mFilterApparel->getTextSize().width + 24, mFilterApparel->getSize().height );
|
||||||
|
curX += mFilterApparel->getTextSize().width + 24 + 4;
|
||||||
|
|
||||||
|
mFilterMagic->setPosition(curX, mFilterMagic->getPosition().top);
|
||||||
|
mFilterMagic->setSize( mFilterMagic->getTextSize().width + 24, mFilterMagic->getSize().height );
|
||||||
|
curX += mFilterMagic->getTextSize().width + 24 + 4;
|
||||||
|
|
||||||
|
mFilterMisc->setPosition(curX, mFilterMisc->getPosition().top);
|
||||||
|
mFilterMisc->setSize( mFilterMisc->getTextSize().width + 24, mFilterMisc->getSize().height );
|
||||||
|
|
||||||
|
mFilterAll->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
|
||||||
|
mFilterWeapon->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
|
||||||
|
mFilterApparel->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
|
||||||
|
mFilterMagic->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
|
||||||
|
mFilterMisc->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InventoryWindow::openInventory()
|
void InventoryWindow::openInventory()
|
||||||
|
@ -48,4 +80,18 @@ namespace MWGui
|
||||||
drawItems();
|
drawItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InventoryWindow::onFilterChanged(MyGUI::Widget* _sender)
|
||||||
|
{
|
||||||
|
if (_sender == mFilterAll)
|
||||||
|
setFilter(ContainerBase::Filter_All);
|
||||||
|
else if (_sender == mFilterWeapon)
|
||||||
|
setFilter(ContainerBase::Filter_Weapon);
|
||||||
|
else if (_sender == mFilterApparel)
|
||||||
|
setFilter(ContainerBase::Filter_Apparel);
|
||||||
|
else if (_sender == mFilterMagic)
|
||||||
|
setFilter(ContainerBase::Filter_Magic);
|
||||||
|
else if (_sender == mFilterMisc)
|
||||||
|
setFilter(ContainerBase::Filter_Misc);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace MWGui
|
||||||
MyGUI::Button* mFilterMisc;
|
MyGUI::Button* mFilterMisc;
|
||||||
|
|
||||||
void onWindowResize(MyGUI::Window* _sender);
|
void onWindowResize(MyGUI::Window* _sender);
|
||||||
|
void onFilterChanged(MyGUI::Widget* _sender);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // Inventory_H
|
#endif // Inventory_H
|
||||||
|
|
Loading…
Reference in a new issue