summaryrefslogtreecommitdiffstats
path: root/kmymoney2/views/kscheduledlistitem.h
blob: 62df861b84e86afcb636bcaccb2ec48acc7cf37d (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/***************************************************************************
                          kscheduledlistitem.h  -  description
                             -------------------
    begin                : Sun Jan 27 2002
    copyright            : (C) 2000-2002 by Michael Edwardes
    email                : mte@users.sourceforge.net
                           Javier Campos Morales <javi_c@users.sourceforge.net>
                           Felix Rodriguez <frodriguez@users.sourceforge.net>
                           John C <thetacoturtle@users.sourceforge.net>
                           Thomas Baumgart <ipwizard@users.sourceforge.net>
                           Kevin Tambascio <ktambascio@users.sourceforge.net>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 KSCHEDULEDLISTITEM_H
#define KSCHEDULEDLISTITEM_H

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

#include <tqpixmap.h>

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

#include <klistview.h>

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

#include <kmymoney/mymoneyscheduled.h>

/**
  * The list view item that describes a scheduled transaction.
  *
  * @author Michael Edwardes
  */
class KScheduledListItem : public KListViewItem
{
public:
  /**
    * This constructor is used to create a child of the main list view widget.
    *
    * The child should be a descriptor for the schedule type and one of
    * Bill,
    * Deposit or
    * Transfer.
    *
    * Other types may be added in the future.
    *
    * @param tqparent The list view to be a child of.
    * @param description The (translated) description.
    * @param pixmap A pixmap for the entry
    * @param sortKey a sortkey, if empty, @c description will be used.
    *
    * @see MyMoneySchedule
    */
  KScheduledListItem(KListView *tqparent, const TQString& description, const TQPixmap& pixmap = TQPixmap(), const TQString& sortKey = TQString());

  /**
    * This constructor is used to create a child of one of the tqchildren
    * created by the above method.
    *
    * This child describes a schedule and represents the data in schedule.
    *
    * @param tqparent The list view item to be a child of.
    * @param schedule The schedule to be represented.
    *
    * @see MyMoneySchedule
    */
  KScheduledListItem(KScheduledListItem *tqparent, const MyMoneySchedule& schedule/*, bool even*/);

  /**
    * Standard destructor.
    */
  ~KScheduledListItem();

  /**
    * Returns the schedule id for the instance being represented.  To be used
    * selection slots by the view.
    *
    * Returns an empty string for the top level items.
    *
    * @return The schedule id.
    */
  const TQString& scheduleId(void) const { return m_schedule.id(); }

  int compare(TQListViewItem* i, int col, bool ascending) const;

protected:
  void paintCell(TQPainter* p, const TQColorGroup& cg, int column, int width, int align);

private:
  MyMoneySchedule m_schedule;
  TQString         m_sortKey;
  MyMoneyMoney    m_amount;
};

#endif