/* property.h */ #ifndef TREE_H #define TREE_H #include #include #include #include class AST; class ParseSession; namespace ConnectModule { /* ----------------------------------------------------------------------- */ class TreeItem : public QTreeWidgetItem { public: KTextEditor::Range range; }; /* ----------------------------------------------------------------------- */ class TreeWidget : public QWidget { Q_OBJECT public: TreeWidget (QWidget * parent); virtual ~ TreeWidget (); // virtual void contextMenuEvent (QContextMenuEvent* e); private Q_SLOTS: void documentActivated (KDevelop::IDocument * doc); void documentClosed (KDevelop::IDocument * doc); void treeClick (QTreeWidgetItem * item, int column); private: TreeItem * showText (QTreeWidgetItem * branch, QString text); TreeItem * showAST (QTreeWidgetItem * branch, QString title, AST * ast); void showInternalContext (QTreeWidgetItem * branch, const KDevelop::DUContext * context); void showDecl (QTreeWidgetItem * branch, const KDevelop::Declaration * decl); public: void display (); private: QTreeWidget * m_tree; KDevelop::IDocument * m_doc; KDevelop::TopDUContext* m_topContext; ParseSession * m_session; }; /* ----------------------------------------------------------------------- */ class TreeFactory: public KDevelop::IToolViewFactory { public: TreeFactory () : m_widget (NULL) {} virtual QWidget* create (QWidget *parent = 0) { m_widget = new TreeWidget (parent); return m_widget; } virtual Qt::DockWidgetArea defaultPosition() { return Qt::RightDockWidgetArea; } virtual QString id() const { return "org.kdevelop.Connect.Tree"; } private: TreeWidget * m_widget; }; /* ----------------------------------------------------------------------- */ } // end of namespace #endif // TREE_H