Added a Notify class
[shopper.git] / src / ui / CategoryDialog.h
blobb286042b63dc2ece205844a162c8197a3d5b5d02
1 /* Shopper
2 * Copyright (C) 2008 David Greaves
4 * This software is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation; either version 2.1 of
7 * the License, or (at your option) any later version.
9 * This software is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this software; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 * 02110-1301 USA
21 #include "shopperList.h"
22 #include <QtGui>
23 #include "LabelEntry.h"
25 namespace Shopper
27 // private helper class
28 class CatView : public QWidget
30 Q_OBJECT;
31 public:
32 CatView(Category &it, List &l,QWidget * parent = 0) ;
34 Category* get_cat();
35 void set_pos(int, int);
36 // virtual void setVisible(bool vis);
38 public slots:
39 void name_changed();
40 void delete_category();
42 signals:
43 void move_up();
44 void move_down();
46 private:
47 LabelEntry *name;
48 // UI
49 QPushButton *up_b;
50 QPushButton *down_b;
52 // member data
53 Category *mycat;
54 List *mylist;
57 // private base for adding/editing an Category
58 class CategoryDialog : public QDialog
60 Q_OBJECT;
61 protected:
62 CategoryDialog(QWidget * parent, Shopper::List*, Shopper::Category*);
64 public slots:
65 void update_area();
66 void add_category();
67 void move_up();
68 void move_down();
70 private:
71 void move(Shopper::CatView *c, int direction);
73 // Data
74 Shopper::List *mylist;
75 Shopper::Category *mycat;
77 // UI
78 QVBoxLayout *vbox;
79 QDialogButtonBox *bbox;
80 QPushButton *doneB;
81 QPushButton *addB;
83 QScrollArea *areaS;
84 QVBoxLayout *areaL;
85 QWidget *area;
89 // Public classes for managing
90 class CategoryManage : public CategoryDialog
92 public:
93 CategoryManage(QWidget * parent, Shopper::List* mylist);