OpenMW
apps/openmw/mwgui/sortfilteritemmodel.hpp
Go to the documentation of this file.
00001 #ifndef MWGUI_SORT_FILTER_ITEM_MODEL_H
00002 #define MWGUI_SORT_FILTER_ITEM_MODEL_H
00003 
00004 #include "itemmodel.hpp"
00005 
00006 namespace MWGui
00007 {
00008 
00009     class SortFilterItemModel : public ProxyItemModel
00010     {
00011     public:
00012         SortFilterItemModel (ItemModel* sourceModel);
00013 
00014         virtual void update();
00015 
00016         bool filterAccepts (const ItemStack& item);
00017 
00018         virtual ItemStack getItem (ModelIndex index);
00019         virtual size_t getItemCount();
00020 
00022         void addDragItem (const MWWorld::Ptr& dragItem, size_t count);
00023         void clearDragItems();
00024 
00025         void setCategory (int category);
00026         void setFilter (int filter);
00027         void setShowEquipped (bool show) { mShowEquipped = show; }
00028 
00029         static const int Category_Weapon = (1<<1);
00030         static const int Category_Apparel = (1<<2);
00031         static const int Category_Misc = (1<<3);
00032         static const int Category_Magic = (1<<4);
00033         static const int Category_All = 255;
00034 
00035         static const int Filter_OnlyIngredients = (1<<0);
00036         static const int Filter_OnlyEnchanted = (1<<1);
00037         static const int Filter_OnlyEnchantable = (1<<2);
00038         static const int Filter_OnlyChargedSoulstones = (1<<3);
00039 
00040 
00041     private:
00042         std::vector<ItemStack> mItems;
00043 
00044         std::vector<std::pair<MWWorld::Ptr, size_t> > mDragItems;
00045 
00046         int mCategory;
00047         int mFilter;
00048         bool mShowEquipped;
00049     };
00050 
00051 }
00052 
00053 #endif