Added a Notify class
[shopper.git] / src / ui / shopperView.h
blob0f8e769512b72664e79f2d526f421b683ce55597
1 /* Shopper
2 * Copyright (C) 2008 David Greaves
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
19 #ifndef __SHOPPERVIEW_H__
20 #define __SHOPPERVIEW_H__
22 #include "shopperList.h"
23 #include "LabelEntry.h"
24 #include <map>
26 #include <QScrollArea>
27 #include <QHBoxLayout>
28 #include <QVBoxLayout>
29 #include <QLabel>
30 #include <QLineEdit>
31 #include <QCheckBox>
33 using namespace std;
34 namespace Shopper
36 class ItemView: public QFrame
38 Q_OBJECT;
40 public:
41 ItemView(Shopper::Item &it, Shopper::List &l);
43 virtual void setVisible(bool vis);
44 void update();
45 QCheckBox *tick; /* display either the 'bought/not
46 * bought' or the 'wanted/not wanted'
47 * state depending on the current
48 * mode. This also includes the
49 * label
51 QHBoxLayout outer_b;
52 QHBoxLayout inner_b;
53 SLabel *desc; /* This displays the item description */
54 LabelEntry *note; /* This displays the notes. When
55 * clicked on it transforms into a
56 * textEntry */
57 Item *myitem; /* the item being displayed */
58 List *mylist; /* the parent list */
60 // This handles right clicks (or equiv)
61 void contextMenuEvent( QContextMenuEvent * event );
63 public slots:
64 // signal handlers
65 void desc_clicked(); // toggles the check
66 void tick_changed(int s);// changes the state when check changes
67 void note_changed(); // EntryLabel calls to change note
68 void edit_item(); // menu calls this to open edit dialog
69 void delete_item(); // menu calls this to removes item
71 // data monitors
72 void item_changed();
73 void item_deleted();
76 // This class displays and manages a list.
78 // possibly use scrolledwindow or an viewport for finger scrolling
79 // class ListView: public QVBoxLayout
80 class ListView: public QScrollArea
82 Q_OBJECT;
83 public:
84 ListView(Shopper::List &l);
85 ~ListView();
87 void filter_by(Shopper::Category &c); // Only view certain categories
88 void update(); // should be private but show_all() is buggy AFAICT
89 private:
90 Shopper::List *mylist;
91 std::map<const int, ItemView*> shownItemVs; // Items currently being
92 // displayed (may be hidden
93 // in what's left mode)
94 // sigc::connection watch_item;
95 // sigc::connection watch_list;
97 QFrame *contents; // This widget has a layout and contains all the items
98 QVBoxLayout *vbox; // and is scrolled by this widget
101 public slots:
102 // signal handlers
103 void list_changed();
107 #endif /* __SHOPPERVIEW_H__ */