Scribus
Open source desktop publishing at your fingertips
sctreewidget.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8  sctreewidget.h - description
9  -------------------
10  begin : Wed Jun 18 2008
11  copyright : (C) 2008 by Franz Schmid
12  email : Franz.Schmid@altmuehlnet.de
13  ***************************************************************************/
14 
15 /***************************************************************************
16  * *
17  * This program is free software; you can redistribute it and/or modify *
18  * it under the terms of the GNU General Public License as published by *
19  * the Free Software Foundation; either version 2 of the License, or *
20  * (at your option) any later version. *
21  * *
22  ***************************************************************************/
23 
24 #ifndef SCTREEWIDGET_H
25 #define SCTREEWIDGET_H
26 
27 #include <QItemDelegate>
28 #include <QTreeWidget>
29 #include <QString>
30 #include <QWidget>
31 #include <QHash>
32 #include <QEvent>
33 #include "scribusapi.h"
34 
35 class SCRIBUS_API ScTreeWidgetDelegate : public QItemDelegate
36 {
37  Q_OBJECT
38 public:
39  ScTreeWidgetDelegate(QTreeWidget *view, QWidget *parent);
40  virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
41  virtual QSize sizeHint(const QStyleOptionViewItem &opt, const QModelIndex &index) const;
42 
43 private:
44  QTreeWidget *m_view;
45 };
46 
47 
48 class SCRIBUS_API ScTreeWidget : public QTreeWidget
49 {
50  Q_OBJECT
51 public:
52  ScTreeWidget(QWidget* pa);
53  ~ScTreeWidget() {};
54  QTreeWidgetItem* addWidget(QString title, QWidget* widget);
55  void setToolBoxMode(bool enable);
56  int addItem(QWidget* widget, QString title);
57  QWidget* widget(int index);
58  void setItemEnabled(int index, bool enable);
59  bool isItemEnabled(int index);
60  void setCurrentIndex(int index);
61  int currentIndex();
62  void setItemText(int index, QString text);
63 
64 private slots:
65  void handleMousePress(QTreeWidgetItem *item);
66 
67 signals:
68  void currentChanged2(int);
69 
70 private:
71  bool m_toolbox_mode;
72  QHash<int, QTreeWidgetItem*> keySList;
73 
74 protected:
75  bool event(QEvent *e);
76 };
77 #endif
Definition: sctreewidget.h:35
Definition: sctreewidget.h:48