classbrowser_part.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 2003 by Roberto Raggi * 00003 * roberto@kdevelop.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 ***************************************************************************/ 00011 #ifndef __KDEVPART_CLASSBROWSER_H__ 00012 #define __KDEVPART_CLASSBROWSER_H__ 00013 00014 #include <qguardedptr.h> 00015 #include <kdevplugin.h> 00016 00017 #include <tag.h> 00018 #include <catalog.h> 00019 00020 class ClassBrowserWidget; 00021 class KListViewAction; 00022 class QListViewItem; 00023 00024 namespace ClassBrowserUtils 00025 { 00026 inline QValueList<Tag> simplifyNamespaces( const QValueList<Tag>& tags ) 00027 { 00028 QMap<QString, Tag> map; 00029 QValueList<Tag>::ConstIterator it = tags.begin(); 00030 while( it != tags.end() ){ 00031 const Tag& tag = *it; 00032 ++it; 00033 00034 QString name = tag.name(); 00035 00036 if( !name.isEmpty() && !map.contains(name) ) 00037 map.insert( name, tag ); 00038 } 00039 return map.values(); 00040 } 00041 00042 } 00043 00044 class ClassBrowserPart : public KDevPlugin 00045 { 00046 Q_OBJECT 00047 public: 00048 ClassBrowserPart(QObject *parent, const char *name, const QStringList &); 00049 virtual ~ClassBrowserPart(); 00050 00051 public slots: 00052 void refresh(); 00053 void selectNamespace( const QListViewItem * it ); 00054 void selectClass( const QListViewItem * it ); 00055 void selectMethod( QListViewItem * it ); 00056 00057 private slots: 00058 void slotProjectOpened(); 00059 void slotProjectClosed(); 00060 void slotCatalogAdded( Catalog* catalog ); 00061 void slotCatalogRemoved( Catalog* catalog ); 00062 void slotCatalogChanged( Catalog* catalog ); 00063 void refreshClasses(); 00064 void refreshMethods(); 00065 00066 private: 00067 void setupActions(); 00068 void adjust(); 00069 00070 private: 00071 QGuardedPtr<ClassBrowserWidget> m_widget; 00072 KListViewAction* m_actionNamespaces; 00073 KListViewAction* m_actionClasses; 00074 KListViewAction* m_actionMethods; 00075 QString m_selectedFileName; 00076 }; 00077 00078 00079 #endif