summaryrefslogtreecommitdiffstats
path: root/src/loanview.h
blob: 60ee88af2ced7d6ad197e5574748ed8b71589f7b (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
/***************************************************************************
    copyright            : (C) 2005-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_LOANVIEW_H
#define TELLICO_LOANVIEW_H

#include "gui/listview.h"
#include "observer.h"
#include "borroweritem.h"

#include <tqdict.h>

namespace Tellico {
  namespace Data {
    class Borrower;
  }

/**
 * @author Robby Stephenson
 */
class LoanView : public GUI::ListView, public Observer {
Q_OBJECT
  TQ_OBJECT

public:
  LoanView(TQWidget* tqparent, const char* name=0);

  virtual bool isSelectable(GUI::ListViewItem*) const;

  virtual void addCollection(Data::CollPtr coll);

  virtual void addField(Data::CollPtr, Data::FieldPtr);
  virtual void modifyField(Data::CollPtr, Data::FieldPtr, Data::FieldPtr);
  virtual void removeField(Data::CollPtr, Data::FieldPtr);

  virtual void    addBorrower(Data::BorrowerPtr);
  virtual void modifyBorrower(Data::BorrowerPtr);

private slots:
  /**
   * Handles the appearance of the popup menu.
   *
   * @param item A pointer to the item underneath the mouse
   * @param point The location point
   * @param col The column number, not currently used
   */
  void contextMenuRequested(TQListViewItem* item, const TQPoint& point, int col);
  void slotExpanded(TQListViewItem* item);
  void slotCollapsed(TQListViewItem* item);
  void slotCheckIn();
  void slotModifyLoan();

private:
  virtual void setSorting(int column, bool ascending = true);
  void resetComparisons();

  bool m_notSortedYet;
  TQDict<BorrowerItem> m_itemDict;
};

} // end namespace

#endif