summaryrefslogtreecommitdiffstats
blob: db2004412ce0af6843bae0008af9fcef8ee29c2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef SWIFT_QtTreeWidgetFactory_H
#define SWIFT_QtTreeWidgetFactory_H

#include "Swiften/Roster/TreeWidgetFactory.h"
#include "Swiften/Roster/TreeWidget.h"
#include "Swiften/Roster/TreeWidgetItem.h"
#include "Swift/QtUI/Roster/QtTreeWidgetItem.h"
#include "Swift/QtUI/Roster/QtTreeWidget.h"

namespace Swift {

class QtTreeWidgetFactory : public TreeWidgetFactory {
	public:
		QtTreeWidgetFactory() {
		}

		TreeWidget* createTreeWidget() {
			return new QtTreeWidget();
		}

		TreeWidgetItem* createTreeWidgetItem(TreeWidgetItem* item) {
			QtTreeWidgetItem* qtItem = dynamic_cast<QtTreeWidgetItem*>(item);
			assert(qtItem);
			QtTreeWidgetItem* newItem = new QtTreeWidgetItem(qtItem);
			qtItem->addChild(newItem);
			return newItem;
		}

		TreeWidgetItem* createTreeWidgetItem(TreeWidget* item) {
			QtTreeWidget* treeItem = dynamic_cast<QtTreeWidget*>(item);
			assert(treeItem);
			QtTreeWidgetItem* qtItem = treeItem->getRoot();
			QtTreeWidgetItem* newItem = new QtTreeWidgetItem(qtItem);
			//qtItem->setItemWidget(newItem, 0, newItem->getCollapsedRosterWidget());
			qtItem->addChild(newItem);
			newItem->setExpanded(true);
			return newItem;
		}
};

}
#endif