The class declaration should be the first header in the cc file for
[shopper.git] / src / ui / ItemView.h
blobf803e92b99f63fb3a92a9b3a6b69dbc9b5d7d6cf
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., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
19 #ifndef __ITEMVIEW_H__
20 #define __ITEMVIEW_H__
22 #include "shopperList.h"
23 #include "LabelEntry.h"
24 #include <map>
26 #include "QFingerScrollArea.h"
27 #include <QScrollArea>
28 #include <QHBoxLayout>
29 #include <QVBoxLayout>
30 #include <QLabel>
31 #include <QLineEdit>
32 #include <QCheckBox>
34 using namespace std;
35 namespace Shopper
37 class ItemView: public QWidget
39 Q_OBJECT;
41 public:
42 ItemView(Shopper::Item &it, Shopper::List &l, QWidget *parent);
44 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
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
70 void setZoom(int);
72 // data monitors
73 void updateVisibility();
77 #endif /* __ITEMVIEW_H__ */