5c4ec801329a85277fbbef504a1a67d1113737b7
[family-shop-mgr] / code / family-shop-mgr / model / ShoppingTreeItem.h
1 /*\r
2  * This file is part of family-shop-mgr.\r
3  *\r
4  * family-shop-mgr is free software: you can redistribute it and/or modify\r
5  * it under the terms of the GNU General Public License as published by\r
6  * the Free Software Foundation, either version 3 of the License, or\r
7  * (at your option) any later version.\r
8  *\r
9  * family-shop-mgr is distributed in the hope that it will be useful,\r
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
12  * GNU General Public License for more details.\r
13  *\r
14  * You should have received a copy of the GNU General Public License\r
15  * along with family-shop-mgr.  If not, see <http://www.gnu.org/licenses/>.\r
16  *\r
17  * Author: Unai IRIGOYEN\r
18  * Date: 12/07/2009\r
19  *\r
20  */\r
21 \r
22 #ifndef SHOPPINGTREEITEM_H\r
23 #define SHOPPINGTREEITEM_H\r
24 \r
25 #include <QDomNode>\r
26 #include <QHash>\r
27 \r
28 class ShoppingTreeItem\r
29 {\r
30 public:\r
31     ShoppingTreeItem(QDomNode &node, ShoppingTreeItem *parent = 0);\r
32     ~ShoppingTreeItem();\r
33     ShoppingTreeItem *child(int i);\r
34     ShoppingTreeItem *parent();\r
35     QDomNode node() const;\r
36     bool addChild(ShoppingTreeItem* item, int row = 0);\r
37     bool removeChild(int row);\r
38     void offsetChildAtAdd(int row);\r
39     void offsetChildAtRemove(int row);\r
40     int row();\r
41 \r
42 private:\r
43     QDomNode domNode;\r
44     QHash<int,ShoppingTreeItem*> childItems;\r
45     ShoppingTreeItem *parentItem;\r
46 };\r
47 \r
48 #endif // SHOPPINGTREEITEM_H\r