Move from SLabel to ActiveLabel
[shopper.git] / src / ui / ItemView.h
blobd93c3bf957fa49fd9446ad3e804aab49a913ff61
1 /* Shopper
2 * Copyright (C) 2008 David Greaves <david@dgreaves.com>
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 SHOPPER_UI_ITEMVIEW_H
20 #define SHOPPER_UI_ITEMVIEW_H
22 #include <QWidget>
23 #include <QHBoxLayout>
25 class QCheckBox;
26 class QContextMenuEvent;
28 namespace Shopper
30 class Item;
31 class List;
32 class ActiveLabel;
33 class NoteWidget;
34 class ItemView: public QWidget
36 Q_OBJECT;
38 public:
39 ItemView(Shopper::Item &it, Shopper::List &l, QWidget *parent);
41 virtual void setVisible(bool vis);
42 QCheckBox *tick; /* display either the 'bought/not
43 * bought' or the 'wanted/not wanted'
44 * state depending on the current
45 * mode. This also includes the
46 * label
48 QHBoxLayout outer_b;
49 QHBoxLayout inner_b;
50 ActiveLabel *desc; /* This displays the item description */
51 NoteWidget *note; /* This displays the notes. When
52 * clicked on it transforms into a
53 * textEntry */
54 Item *myitem; /* the item being displayed */
55 List *mylist; /* the parent list */
57 // This handles right clicks (or equiv)
58 void contextMenuEvent( QContextMenuEvent * event );
59 static const int BASEFONTSIZE, MINFONTSIZE, MAXFONTSIZE;
61 public slots:
62 // signal handlers
63 void desc_clicked(); // toggles the check
64 void tick_changed(int s);// changes the state when check changes
65 void note_changed(); // EntryLabel calls to change note
66 void edit_item(); // menu calls this to open edit dialog
67 void delete_item(); // menu calls this to removes item
68 void setZoom(int);
70 // data monitors
71 void updateVisibility();
75 #endif // SHOPPER_UI_ITEMVIEW_H