You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tellico/src/entryitem.h

84 lines
2.7 KiB

/***************************************************************************
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 children of a ListView object,
* which is just the @ref DetailedListView.
*
* @param parent A pointer to the parent
* @param entry A pointer to the entry to which the item refers
*/
EntryItem(GUI::ListView* parent, Data::EntryPtr entry);
/**
* This constructor is for items which have other TDEListViewItems as parents. It
* initializes the text in the first column, as well.
*
* @param parent A pointer to the parent
* @param text The text in the first column
* @param entry A pointer to the entry to which the item refers
*/
EntryItem(GUI::CountedItem* parent, 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 parent 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