blob: 46958ac3787205c47fd95b14ebc9fd8f869c3f20 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/***************************************************************************
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
|