treeview.h

00001 /*
00002  * Silence
00003  *
00004  * Copyright (C) 2009 Manuel Unglaub
00005  *
00006  * This file is part of Silence.
00007  *
00008  * Silence is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, version GPLv2 only of the License.
00011  *
00012  * Silence is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016 
00017  * You should have received a copy of the GNU General Public License
00018  * along with Silence.  If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00021 #ifndef TREEVIEW_H
00022 #define TREEVIEW_H
00023 
00024 #include "src/data/model/treemodel.h"
00025 #include "src/gui/sidebar/nodepropertywidget.h"
00026 #include <QAction>
00027 #include <QDockWidget>
00028 #include <QFrame>
00029 #include <QGridLayout>
00030 #include <QGroupBox>
00031 #include <QLabel>
00032 #include <QList>
00033 #include <QModelIndex>
00034 #include <QToolBar>
00035 #include <QTreeView>
00036 #include <QVBoxLayout>
00037 
00038 
00048 class TreeView : public QDockWidget
00049 {
00050     Q_OBJECT
00051 
00052     public:
00063         TreeView(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
00064 
00069         ~TreeView();
00070 
00075         QList<QAction*>* getNodeActions() const;
00076 
00081         TreeModel* getTreeModel();
00082 
00087         void selectItem(QModelIndex &item);
00088 
00093         void selectItem(NodeId id);
00094 
00095     public slots:
00099         void updateActions();
00100 
00104         void selectItem();
00105 
00106     signals:
00111         void nodeSelected(Node* node);
00112 
00113     private slots:
00114         void addRow();
00115         void addChild();
00116         void removeTreeItem();
00117         void showTreeContextMenu();
00118         void nodeDropped(QModelIndex index);
00119                 
00120     private:
00121         QTreeView *tree;
00122         TreeModel *model;
00123 
00124         QToolBar *toolbar;
00125         QAction *addRowAction,
00126                 *addChildAction,
00127                 *removeAction,
00128                 *propertyAction;
00129 
00130         QLabel  *question,
00131                 *icon;
00132         QPushButton *yesButton,
00133                     *noButton;
00134 
00135         QFrame *frame;
00136         QGroupBox *questionFrame;
00137 
00138         QVBoxLayout *layout;
00139         QGridLayout *questionLayout;
00140 
00141         void addNode(QModelIndex &index, int row);
00142 
00143         void setupToolbar();
00144         void setupTree();
00145         void setupQuestionFrame();
00146 };
00147 
00148 #endif // TREEVIEW_H
00149 
Generated on Fri May 14 19:12:50 2010 for Silence by  doxygen 1.6.3