1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 12:53:51 +00:00

implemented filters (no gui yet)

This commit is contained in:
scrawl 2012-05-12 20:35:50 +02:00
parent 24e54a81bd
commit fd18c95c5f
2 changed files with 11 additions and 1 deletions

View file

@ -29,6 +29,7 @@ using namespace Widgets;
ContainerBase::ContainerBase(WindowManager& parWindowManager,DragAndDrop* dragAndDrop,std::string guiFile)
: WindowBase(guiFile, parWindowManager),
mDragAndDrop(dragAndDrop),
mFilter(MWWorld::ContainerStore::Type_All),
mContainer()
{
getWidget(mContainerWidget, "Items");
@ -95,6 +96,12 @@ void ContainerBase::setName(std::string contName)
adjustWindowCaption();
}
void ContainerBase::setFilter(int filter)
{
mFilter = filter;
drawItems();
}
void ContainerBase::open(MWWorld::Ptr container)
{
mContainer = container;
@ -117,7 +124,7 @@ void ContainerBase::drawItems()
int index = 0;
for (MWWorld::ContainerStoreIterator iter (containerStore.begin()); iter!=containerStore.end(); ++iter)
for (MWWorld::ContainerStoreIterator iter (containerStore.begin(mFilter)); iter!=containerStore.end(); ++iter)
{
index++;
if(iter->getRefData().getCount() > 0)

View file

@ -52,6 +52,7 @@ namespace MWGui
void open(MWWorld::Ptr container);
void setName(std::string contName);
void setFilter(int filter); ///< set category filter
void Update();
protected:
@ -61,6 +62,8 @@ namespace MWGui
DragAndDrop* mDragAndDrop;
MWWorld::Ptr mContainer;
int mFilter;
void onSelectedItem(MyGUI::Widget* _sender);
void onContainerClicked(MyGUI::Widget* _sender);