Subversion Repositories Scribus

Rev

Rev 17798 | Rev 22601 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
12293 fschmid 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>
17383 fschmid 31
#include <QHash>
32
#include <QEvent>
12293 fschmid 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);
17383 fschmid 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);
17798 craig 63
 
12293 fschmid 64
private slots:
65
        void handleMousePress(QTreeWidgetItem *item);
17798 craig 66
 
17383 fschmid 67
signals:
17936 craig 68
        void currentChanged2(int);
17798 craig 69
 
17383 fschmid 70
private:
71
        bool m_toolbox_mode;
72
        QHash<int, QTreeWidgetItem*> keySList;
17798 craig 73
 
17383 fschmid 74
protected:
75
        bool event(QEvent *e);
12293 fschmid 76
};
77
#endif