summaryrefslogtreecommitdiffstats
path: root/src/filterview.h
blob: 59391aefdb5a3024eb4fc7131b052566c35e7b23 (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
/***************************************************************************
    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 TELLICO_FILTERVIEW_H
#define TELLICO_FILTERVIEW_H

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

#include <tqdict.h>

namespace Tellico {

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

public:
  FilterView(TQWidget* parent, const char* name=0);

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

  void addCollection(Data::CollPtr coll);

  virtual void    addEntries(Data::EntryVec entries);
  virtual void modifyEntry(Data::EntryPtr entry);
  virtual void modifyEntries(Data::EntryVec entries);
  virtual void removeEntries(Data::EntryVec entries);

  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    addFilter(FilterPtr filter);
  virtual void modifyFilter(FilterPtr) {}
  virtual void removeFilter(FilterPtr filter);

protected slots:
  virtual void slotSelectionChanged();

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);

  /**
   * Modify a saved filter
   */
  void slotModifyFilter();
  /**
   * Delete a saved filter
   */
  void slotDeleteFilter();

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

  bool m_notSortedYet;
  TQDict<FilterItem> m_itemDict;
};

} // end namespace

#endif