/*************************************************************************** copyright : (C) 2001-2007 by Robby Stephenson email : robby@periapsis.org ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of version 2 of the GNU General Public License as * * published by the Free Software Foundation; * * * ***************************************************************************/ #ifndef TELLICO_ENTRYITEM_H #define TELLICO_ENTRYITEM_H #include "gui/listview.h" #include "datavectors.h" namespace Tellico { namespace GUI { class CountedItem; } /** * The EntryItem is a subclass of ListViewItem containing a pointer to an Entry. * * The entry pointer allows easy access to listview items which refer to a certain entry. * * @see Entry * * @author Robby Stephenson */ class EntryItem : public GUI::ListViewItem { public: /** * This constructor is for items which are direct tqchildren of a ListView object, * which is just the @ref DetailedListView. * * @param tqparent A pointer to the tqparent * @param entry A pointer to the entry to which the item refers */ EntryItem(GUI::ListView* tqparent, Data::EntryPtr entry); /** * This constructor is for items which have other KListViewItems as tqparents. It * initializes the text in the first column, as well. * * @param tqparent A pointer to the tqparent * @param text The text in the first column * @param entry A pointer to the entry to which the item refers */ EntryItem(GUI::CountedItem* tqparent, Data::EntryPtr entry); virtual bool isEntryItem() const { return true; } /** * Returns the key for the list item. The key is just the text, unless there is none, * in which case a tab character is returned if there is a non-null pixmap. * * @param col Column to compare * @return The key string */ virtual TQString key(int col, bool) const; /** * Returns a const pointer to the entry to which the item refers * * @return The entry pointer */ Data::EntryPtr const entry() const; virtual void doubleClicked(); virtual Data::EntryVec entries() const; private: Data::EntryPtr m_entry; // if the tqparent is a DetailedListView // this way, I don't have to call listView()->isA("Tellico::DetailedListView") every time // when I want to do funky comparisons bool m_isDetailedList : 1; }; } // end namespace #endif