summaryrefslogtreecommitdiffstats
path: root/kmymoney2/widgets/kmymoneylistviewitem.h
blob: 72e41ea85aecbdb0aac042a1acd945de792da99c (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
84
85
86
87
88
89
/***************************************************************************
                          kmymoneylistviewitem.h
                             -------------------
    begin                : Wed Jun 28 2006
    copyright            : (C) 2006 by Thomas Baumgart
    email                : Thomas Baumgart <[email protected]>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KMYMONEYLISTVIEWITEM_H
#define KMYMONEYLISTVIEWITEM_H

// ----------------------------------------------------------------------------
// QT Includes

#include <tqobject.h>

// ----------------------------------------------------------------------------
// KDE Includes

#include <klistview.h>

// ----------------------------------------------------------------------------
// Project Includes

class KMyMoneyCheckListItem;

/**
  * This class implements a derived version of a TQListViewItem that
  * allows the storage of an engine object id with the object
  *
  * @author Thomas Baumgart
  */
class KMyMoneyListViewItem : public TQObject, public KListViewItem
{
  friend class KMyMoneyCheckListItem;

  Q_OBJECT
  TQ_OBJECT
public:
  KMyMoneyListViewItem(TQListView *parent, const TQString& txt, const TQString& key, const TQString& id);
  KMyMoneyListViewItem(TQListViewItem *parent, const TQString& txt, const TQString& key, const TQString& id);
  ~KMyMoneyListViewItem();

  const TQString& id(void) const { return m_id; };

  /**
    * use my own paint method
    */
  void paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int tqalignment);

  /**
    * use my own backgroundColor method
    */
  const TQColor backgroundColor();

  /**
    * This method returns a const reference to the key passed to the constructor. The column
    * defines what is returned: For @a column equals 0, the first character passed as @a key to
    * the constructor concatenated with the value returned by text(0) is returned. For @a column
    * equals to 1, the @a key as passed to the constructor except the first character is returned.
    */
  TQString key(int column, bool ascending) const;


  /**
    * Reimplemented for internal reasons
    */
  bool isAlternate(void);

private:
  TQString              m_key;
  TQString             m_id;
  // copied from KListViewItem()
  unsigned int         m_isOdd : 1;
  unsigned int         m_isKnown : 1;
  unsigned int         m_unused : 30;

};

#endif