/* property.h */ #ifndef PROPERTY_H #define PROPERTY_H #include #include #include #include #ifdef PARSER #include "ast.h" #include "cppeditorintegrator.h" #endif class AST; class ParseSession; namespace ConnectModule { /* ----------------------------------------------------------------------- */ class PropertyItem : public QTreeWidgetItem { public: PropertyItem (); KTextEditor::Range range; }; /* ----------------------------------------------------------------------- */ class PropertyWidget : public QWidget { Q_OBJECT public: PropertyWidget (QWidget * parent); virtual ~ PropertyWidget (); // 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: PropertyItem * showText (QTreeWidgetItem * branch, QString text, QColor color = QColor ()); KTextEditor::Cursor convPosition (KDevelop::CursorInRevision cursor); KTextEditor::Range nodeRange (AST * node); QString nodeSource (AST * node); PropertyItem * showNode (QTreeWidgetItem * branch, AST * node, QColor color = QColor ()); QString tokenSource (int index); void showFunctionCall (PropertyItem * branch, PostfixExpressionAST * expr, FunctionCallAST * func); void showExpressionStatement (PropertyItem * branch, ExpressionStatementAST * stat); void showSimpleDeclaration (PropertyItem * branch, SimpleDeclarationAST * simple); void showDeclStatement (PropertyItem * branch, ExpressionOrDeclarationStatementAST * stat); void showStatement (PropertyItem * branch, StatementAST * ast); void showStatements (PropertyItem * branch, AST * ast); void showInternalContext (PropertyItem * 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; CppEditorIntegrator * m_editor; KDevelop::SimpleCursor m_position; }; /* ----------------------------------------------------------------------- */ class PropertyFactory: public KDevelop::IToolViewFactory { public: PropertyFactory () : m_widget (NULL) {} virtual QWidget* create (QWidget *parent = 0) { m_widget = new PropertyWidget (parent); return m_widget; } virtual Qt::DockWidgetArea defaultPosition() { return Qt::RightDockWidgetArea; } virtual QString id() const { return "org.kdevelop.Connect.Property"; } private: PropertyWidget * m_widget; }; /* ----------------------------------------------------------------------- */ } // end of namespace #endif // PROPERTY_H