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"
26 #include <QScrollArea>
27 #include <QHBoxLayout>
28 #include <QVBoxLayout>
36 class ItemView
: public QFrame
41 ItemView(Shopper::Item
&it
, Shopper::List
&l
);
43 virtual void setVisible(bool vis
);
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
53 SLabel
*desc
; /* This displays the item description */
54 LabelEntry
*note
; /* This displays the notes. When
55 * clicked on it transforms into a
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
);
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
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
84 ListView(Shopper::List
&l
);
87 void filter_by(Shopper::Category
&c
); // Only view certain categories
88 void update(); // should be private but show_all() is buggy AFAICT
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
107 #endif /* __SHOPPERVIEW_H__ */