123 for (
ModelItemIter i = items->begin(); i != items->end(); ++i) {
139 retval->push_back(mi);
156 retval->push_back(mi);
177 retval->push_back(mi);
232 if (slot(*(*i).second))
256 if (slot(*(*i).second))
269 retval = (*i).second;
282 retval = (*i).second;
305 retval->push_back(cat);
330 if (!((*i).second)->is_deleted()) {
331 retval->push_back((*i).second);
348 if (!((*i).second)->is_deleted() && functor(*(*i).second)) {
349 retval->push_back((*i).second);
383 std::pair<long, ModelItem*> pair = std::make_pair(item->
get_id(), item);
389 g_warning(
"category id %ld was not found - unable to associate item", cat_id);
400 assert(cat_id != -1);
411 targetItems.push_back((
ModelItem*) (*i));
415 sort(sourceItems.begin(), sourceItems.end());
418 sort(targetItems.begin(), targetItems.end());
424 std::back_insert_iterator<ModelItemContainer>(newItems)
430 for (
ModelItemIter i = newItems.begin(); i != newItems.end(); ++i) {
434 g_error(
"Warning: category id %ld was not found - unable to copy items",
448 case ALL :
return true;
virtual bool filter(bool checked)
Applies the current filter.
ModelItemContainer::iterator ModelItemIter
Class encapsulating state of an object in the data model.
sigc::slot< bool, ModelItem & > SlotForeachModelItem
void foreach_category_iter(const SlotForeachCategoryIter &slot)
Calls the provided slot for each category in the map.
Represents a Category combined with GuiState attributes.
ItemMap * m_removed_children
List of items removed from the Category.
CategoryMap * m_category_map
Map allowing categories to be located by ID.
ItemContainer m_items
List of associated items.
ItemContainer::iterator ItemIter
virtual void add_item(Item *item)
Associates the passed item with this Category.
sigc::slot< bool, ModelCategory & > SlotForeachCategory
void set_dirty(bool dirty=true)
void foreach_item_iter(const SlotForeachModelItemIter &slot)
Calls the provided slot for each item in the map.
void foreach_category(const SlotForeachCategory &slot)
Calls the provided slot for each category in the map.
KitModel()
Creates an empty data model.
ItemMap::iterator ItemMapIter
virtual void add_category(ModelCategory *category)
Add a category to the model.
virtual ModelItem * find_item(long id)
Finds an item by it's unique ID.
std::vector< Item * > ItemContainer
virtual ModelCategory * find_category(long id)
Finds a Category by it's unique ID.
virtual void remove_items(ModelItemContainer *items)
Removes all the passed items from this ModelCategory.
virtual ItemContainer * get_items()
Returns the list of items belonging to the Category.
sigc::slot< bool, const ItemMap::iterator & > SlotForeachModelItemIter
std::vector< ModelItem * > ModelItemContainer
enum item_filter_types m_item_filter
Indicates whether and how items are currently filtered.
virtual ItemContainer * get_all_items()
Returns a list of all items.
ItemMap * m_item_map
Map allowing items to be located by ID.
virtual ModelItemContainer * get_model_items()
virtual void reset()
resets the state of each flag to it's default.
CategoryMap::iterator CategoryMapIter
virtual void remove_item(Item *item)
Removes the association of the passed item from this Category.
Represents an Item combined with GuiState attributes.
virtual CategoryContainer * get_categories()
Returns a list of all categories.
ItemMap * m_added_children
List of items added to the Category.
bool m_dirty
Indicates whether the model needs saving. I.e it's state has changed.
void foreach_item(const SlotForeachModelItem &slot)
Calls the provided slot for each item in the map.
virtual void add_item(Item *)
Adds the passed item to this ModelCategory.
std::vector< Category * > CategoryContainer
virtual void add_item(ModelItem *item)
Adds an item to the model.
virtual void purge()
Purges deleted categories and items from the model.
virtual void reset()
Resets all contained objects to their default states.
std::map< long, ModelCategory * > CategoryMap
Functor for processing items.
std::map< long, ModelItem * > ItemMap
sigc::slot< bool, const CategoryMap::iterator & > SlotForeachCategoryIter
virtual void reset()
Resets the Category state.
virtual void remove_item(Item *item)
Removes the passed item from this ModelCategory.
virtual void copy_items(const ModelItemContainer &items, long cat_id=-1)
Copies items to the specified category.