tbx  0.7.5
Public Member Functions | List of all members
tbx::view::ViewItems< T > Class Template Reference

Template class to store a list of items for an item view and to call the item view update routines automatically where possible. More...

#include <viewitems.h>

Public Member Functions

 ViewItems (ItemView *v=0)
 Construct the view items. More...
 
void view (ItemView *v)
 Set view for the items.
 
unsigned int size () const
 Return size of items.
 
void item (unsigned int index, const T &item)
 Set the item at a specified index.
 
const T & item (unsigned int index) const
 Get the item at the specified index.
 
const T & operator[] (unsigned int index) const
 Get item at specified index.
 
void changing (unsigned int index, unsigned int how_many=1)
 If the items contain method and fields that can be changed call this function prior to a change to inform the view that a change is about to occur. More...
 
void changed (unsigned int index, unsigned int how_many=1)
 If the items contain method and fields that can be changed call this function after a change to inform the view that a change has occurred. More...
 
void add (const T &item)
 Add an item to the end of the list. More...
 
void insert (unsigned int index, const T &item)
 Insert an item in the list. More...
 
void erase (unsigned int index)
 Delete an item from a list.
 
void clear ()
 Clear the whole list.
 

Detailed Description

template<class T>
class tbx::view::ViewItems< T >

Template class to store a list of items for an item view and to call the item view update routines automatically where possible.

Constructor & Destructor Documentation

◆ ViewItems()

template<class T >
tbx::view::ViewItems< T >::ViewItems ( ItemView v = 0)
inline

Construct the view items.

Parameters
vview for items (default to 0 so view will be set later)

Member Function Documentation

◆ add()

template<class T >
void tbx::view::ViewItems< T >::add ( const T &  item)
inline

Add an item to the end of the list.

Parameters
itemthe item to add

◆ changed()

template<class T >
void tbx::view::ViewItems< T >::changed ( unsigned int  index,
unsigned int  how_many = 1 
)
inline

If the items contain method and fields that can be changed call this function after a change to inform the view that a change has occurred.

Parameters
indexfirst index of item changed
how_manynumber of items changed

◆ changing()

template<class T >
void tbx::view::ViewItems< T >::changing ( unsigned int  index,
unsigned int  how_many = 1 
)
inline

If the items contain method and fields that can be changed call this function prior to a change to inform the view that a change is about to occur.

Parameters
indexfirst index of item changed
how_manynumber of items changed

◆ insert()

template<class T >
void tbx::view::ViewItems< T >::insert ( unsigned int  index,
const T &  item 
)
inline

Insert an item in the list.

Parameters
indexfor insert (if the same as size() will add to the end of the list)
itemitem to insert

The documentation for this class was generated from the following file: