blob: 68e9fd50ad0d3ec4ecbc62e17832337667e57e41 (
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
|
/***************************************************************************
copyright : (C) 2005-2006 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 ENTRYGROUPITEM_H
#define ENTRYGROUPITEM_H
#include "gui/counteditem.h"
#include <tqpixmap.h>
#include <tqguardedptr.h>
namespace Tellico {
namespace Data {
class EntryGroup;
}
/**
* @author Robby Stephenson
*/
class EntryGroupItem : public GUI::CountedItem {
public:
EntryGroupItem(GUI::ListView* parent, Data::EntryGroup* group, int fieldType);
virtual bool isEntryGroupItem() const { return true; }
Data::EntryGroup* group() const { return m_group; }
void setGroup(Data::EntryGroup* group) { m_group = group; }
TQPixmap ratingPixmap();
virtual void setPixmap(int col, const TQPixmap& pix);
virtual void paintCell(TQPainter* p, const TQColorGroup& cg,
int column, int width, int align);
/**
* Returns the key for sorting the listitems. The text used for an empty
* value should be sorted first, so the returned key is "\t". Since the text may
* have the number of entries or something added to the name, only check if the
* text begins with the empty name. Maybe there should be something better.
*
* @param col The column number
* @return The key
*/
virtual TQString key(int col, bool) const;
virtual int count() const;
virtual Data::EntryVec entries() const;
private:
TQGuardedPtr<Data::EntryGroup> m_group;
int m_fieldType;
TQPixmap m_pix;
bool m_emptyGroup : 1;
// since I do an expensive RegExp match for the surname prefixes, I want to
// cache the text and the resulting key
mutable TQString m_text;
mutable TQString m_key;
};
}
#endif
|