editorproxy.h
Go to the documentation of this file.00001 #ifndef __EDITORPROXY_H__ 00002 #define __EDITORPROXY_H__ 00003 00004 00005 #include <qobject.h> 00006 #include <qmemarray.h> 00007 #include <qguardedptr.h> 00008 00009 class QPopupMenu; 00010 00011 #include <kparts/part.h> 00012 #include <ktexteditor/markinterface.h> 00013 #include <kdeversion.h> 00014 # include <ktexteditor/markinterfaceextension.h> 00015 00016 #include <qwidgetstack.h> 00017 00018 class EditorWrapper : public QWidgetStack 00019 { 00020 Q_OBJECT 00021 00022 public: 00023 EditorWrapper(KTextEditor::Document* editor, bool activate, QWidget* parent, const char* name = 0L); 00024 virtual ~EditorWrapper(); 00025 00026 KTextEditor::Document* document() const; 00027 00028 void setLine(int line); 00029 void setCol(int col); 00030 00031 public slots: 00032 virtual void show(); 00033 00034 private: 00035 QGuardedPtr<KTextEditor::Document> m_doc; 00036 QGuardedPtr<KTextEditor::View> m_view; 00037 int m_line; 00038 int m_col; 00039 bool m_first; 00040 }; 00041 00042 class EditorProxy : public QObject 00043 { 00044 Q_OBJECT 00045 00046 public: 00047 00048 static EditorProxy *getInstance(); 00049 00050 void setLineNumber(KParts::Part *part, int lineNum, int col); 00051 00052 void installPopup(KParts::Part *part); 00053 00054 void registerEditor(EditorWrapper* wrapper); 00055 void deregisterEditor(EditorWrapper* wrapper); 00056 00057 QWidget * widgetForPart( KParts::Part * part ); 00058 QWidget * topWidgetForPart( KParts::Part * part ); 00059 00060 bool isDelayedViewCapable(); 00061 00062 private slots: 00063 00064 void popupAboutToShow(); 00065 void showPopup(); 00066 00067 private: 00068 00069 EditorProxy(); 00070 00071 static EditorProxy *s_instance; 00072 00073 QMemArray<int> m_popupIds; 00074 00075 // This list is used to save line/col information for not yet activated editor views. 00076 QValueList< EditorWrapper* > m_editorParts; 00077 00078 bool m_delayedViewCreationCompatibleUI; 00079 }; 00080 00081 00082 #endif