summaryrefslogtreecommitdiffstats
path: root/kmymoney2/views/kinvestmentlistitem.h
blob: cb0d9447f0576a5c2a122ddb952c10c1cc05c557 (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
/***************************************************************************
                          kinvestmentlistitem.h  -  description
                             -------------------
    begin                : Wed Feb 6 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 KINVESTMENTLISTITEM_H
#define KINVESTMENTLISTITEM_H

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

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

#include <klistview.h>

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

#include <kmymoney/mymoneysecurity.h>
#include <kmymoney/mymoneyaccount.h>
#include <kmymoney/mymoneytransaction.h>
#include <kmymoney/mymoneyobserver.h>

//indexes for the various columns on the summary view
#define COLUMN_NAME_INDEX       0
#define COLUMN_SYMBOL_INDEX     1
#define COLUMN_VALUE_INDEX      2
#define COLUMN_QUANTITY_INDEX   3
#define COLUMN_PRICE_INDEX      4
#define COLUMN_COSTBASIS_INDEX  5
#define COLUMN_RAWGAIN_INDEX    6
#define COLUMN_1WEEKGAIN_INDEX  7
#define COLUMN_4WEEKGAIN_INDEX  8
#define COLUMN_3MONGAIN_INDEX   9
#define COLUMN_YTDGAIN_INDEX    10

/**
  * @author Kevin Tambascio
  * @author Thomas Baumgart
  */
class KInvestmentListItem : public KListViewItem
{
public:
  KInvestmentListItem(KListView* tqparent, const MyMoneyAccount& security);
  ~KInvestmentListItem();

  TQString securityId() const { return m_account.currencyId(); };
  const MyMoneyAccount& account(void) const { return m_account; };
  const MyMoneySecurity tradingCurrency(void) const { return m_tradingCurrency; };

 /**
   * Helper method to show the right order
   */
  int compare(TQListViewItem* i, int col, bool ascending) const;


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

private:
  // FIXME PRICE
#if 0
  const TQString calculate1WeekGain(const equity_price_history& history);
  const TQString calculate4WeekGain(const equity_price_history& history);
  const TQString calculate3MonthGain(const equity_price_history& history);
  const TQString calculateYTDGain(const equity_price_history& history);
  const TQString calculateGain(const equity_price_history& history, int dayDifference, int monthDifference, bool YTD, bool& bNegative);
#endif

private:
  KListView*        m_listView;
  MyMoneyAccount    m_account;
  MyMoneySecurity   m_tradingCurrency;
  bool bColumn5Negative, bColumn6Negative, bColumn7Negative, bColumn8Negative, bColumn9Negative;
};

#endif