summaryrefslogtreecommitdiffstats
path: root/src/entryitem.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-03-01 19:17:32 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-03-01 19:17:32 +0000
commite38d2351b83fa65c66ccde443777647ef5cb6cff (patch)
tree1897fc20e9f73a81c520a5b9f76f8ed042124883 /src/entryitem.h
downloadtellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.tar.gz
tellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.zip
Added KDE3 version of Tellico
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1097620 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/entryitem.h')
-rw-r--r--src/entryitem.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/entryitem.h b/src/entryitem.h
new file mode 100644
index 0000000..4e529c8
--- /dev/null
+++ b/src/entryitem.h
@@ -0,0 +1,83 @@
+/***************************************************************************
+ copyright : (C) 2001-2007 by Robby Stephenson
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 KListViewItems 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 QString 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