KDevelop API Documentation

editors/qeditor/qeditor_part.h

Go to the documentation of this file.
00001 /* $Id: qeditor_part.h,v 1.28 2003/10/08 16:45:50 aclu Exp $ -*-c++-*- 00002 * 00003 * Copyright (C) 2001 Roberto Raggi (roberto@kdevelop.org) 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; see the file COPYING. If not, write to 00017 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 * Boston, MA 02111-1307, USA. 00019 * 00020 */ 00021 00022 #ifndef QEDITORPART_H 00023 #define QEDITORPART_H 00024 00025 #include <kdeversion.h> 00026 #include <ktexteditor/editor.h> 00027 #include <ktexteditor/document.h> 00028 #include <ktexteditor/editinterface.h> 00029 #include <ktexteditor/undointerface.h> 00030 #include <ktexteditor/cursorinterface.h> 00031 #include <ktexteditor/selectioninterface.h> 00032 #include <ktexteditor/highlightinginterface.h> 00033 #include <ktexteditor/searchinterface.h> 00034 #include <ktexteditor/markinterface.h> 00035 #include <ktexteditor/configinterface.h> 00036 #if (KDE_VERSION > 305) 00037 # include <ktexteditor/markinterfaceextension.h> 00038 #else 00039 # include "kde30x_markinterfaceextension.h" 00040 #endif 00041 #include <qptrlist.h> 00042 00043 #include "qeditor_factory.h" 00044 00045 class QWidget; 00046 class QPainter; 00047 class KURL; 00048 class QEditorView; 00049 class QEditorIndenter; 00050 class QEditorBrowserExtension; 00051 class KAboutData; 00052 class HLMode; 00053 class KConfig; 00054 class QSourceColorizer; 00055 class KDialogBase; 00056 00057 class QEditorPart: 00058 public KTextEditor::Document, 00059 public KTextEditor::EditInterface, 00060 public KTextEditor::UndoInterface, 00061 public KTextEditor::CursorInterface, 00062 public KTextEditor::SelectionInterface, 00063 public KTextEditor::HighlightingInterface, 00064 public KTextEditor::SearchInterface, 00065 public KTextEditor::MarkInterface, 00066 public KTextEditor::MarkInterfaceExtension, 00067 public KTextEditor::ConfigInterface 00068 { 00069 Q_OBJECT 00070 public: 00074 QEditorPart(QWidget *parentWidget, const char *widgetName, 00075 QObject *parent, const char *name, const QStringList &args); 00076 00080 virtual ~QEditorPart(); 00081 00087 virtual void setReadWrite(bool rw); 00088 00092 virtual void setModified(bool modified); 00093 00094 QSourceColorizer* colorizer() const; 00095 QEditorIndenter* indenter() const; 00096 00097 signals: 00098 void fileNameChanged(); 00099 void configWidget( KDialogBase* ); 00100 00101 // -- ConfigInterface ---------------------------------------------------------------------- 00102 public slots: 00108 virtual void readConfig (); 00109 virtual void writeConfig (); 00110 00115 virtual void readConfig (KConfig *); 00116 virtual void writeConfig (KConfig *); 00117 00121 virtual void readSessionConfig (KConfig *); 00122 virtual void writeSessionConfig (KConfig *); 00123 00127 virtual void configDialog(); 00128 00129 // -- MarkInterface ------------------------------------------------------------------------ 00130 public: 00131 virtual uint mark (uint line); 00132 00133 virtual void setMark (uint line, uint markType); 00134 virtual void clearMark (uint line); 00135 00136 virtual void addMark (uint line, uint markType); 00137 virtual void removeMark (uint line, uint markType); 00138 00139 virtual QPtrList<KTextEditor::Mark> marks (); 00140 virtual void clearMarks (); 00141 00142 signals: 00143 void marksChanged(); 00144 00145 // -- MarkInterfaceExtension---------------------------------------------------------------- 00146 public: 00147 virtual void setPixmap(MarkInterface::MarkTypes, const QPixmap &); 00148 virtual void setDescription(MarkInterface::MarkTypes, const QString &); 00149 virtual void setMarksUserChangable(uint markMask); 00150 00151 signals: 00152 virtual void markChanged (KTextEditor::Mark mark, 00153 KTextEditor::MarkInterfaceExtension::MarkChangeAction action); 00154 00155 // -- SearchInterface ---------------------------------------------------------------------- 00156 public: 00157 virtual bool searchText (unsigned int startLine, unsigned int startCol, 00158 const QString &text, unsigned int *foundAtLine, unsigned int *foundAtCol, 00159 unsigned int *matchLen, bool casesensitive = true, bool backwards = false); 00160 00161 virtual bool searchText (unsigned int startLine, unsigned int startCol, 00162 const QRegExp &regexp, unsigned int *foundAtLine, 00163 unsigned int *foundAtCol, unsigned int *matchLen, bool backwards = false); 00164 00165 // -- Document ------------------------------------------------------------------------------ 00166 public: 00167 QEditorView* currentView() const { return m_currentView; } 00168 00174 virtual KTextEditor::View *createView ( QWidget *parent, const char *name = 0 ); 00175 00176 00177 00178 /* 00179 * Accessor to the list of views. 00180 */ 00181 virtual QPtrList<KTextEditor::View> views () const; 00182 00183 // -- HighlightingInterface --------------------------------------------------------------------- 00184 public: 00188 virtual unsigned int hlMode (); 00189 00193 virtual bool setHlMode (unsigned int mode); 00194 00198 virtual unsigned int hlModeCount (); 00199 00203 virtual QString hlModeName (unsigned int mode); 00204 00208 virtual QString hlModeSectionName (unsigned int mode); 00209 00210 signals: 00211 void hlChanged (); 00212 00213 private: 00214 void setupHighlighting(); 00215 int findMode( const QString& ); 00216 00217 private: 00218 QPtrList<HLMode> m_modes; 00219 unsigned int m_currentMode; 00220 00221 // -- UndoInterface ----------------------------------------------------------------------------- 00222 public: 00223 virtual void clearUndo (); 00224 virtual void clearRedo (); 00225 virtual unsigned int undoCount () const; 00226 virtual unsigned int redoCount () const; 00227 virtual unsigned int undoSteps () const; 00228 virtual void setUndoSteps ( unsigned int steps ); 00229 00230 public slots: 00231 virtual void undo (); 00232 virtual void redo (); 00233 00234 signals: 00235 void undoChanged (); 00236 00237 // -- EditInterface ---------------------------------------------------------------------- 00238 public: 00242 virtual QString text () const; 00243 00247 virtual QString text ( unsigned int startLine, unsigned int startCol, unsigned int endLine, unsigned int endCol ) const; 00248 00252 virtual QString textLine ( unsigned int line ) const; 00253 00257 virtual unsigned int numLines () const; 00258 00262 virtual unsigned int length () const; 00263 00267 virtual int lineLength ( unsigned int line ) const; 00268 00273 virtual bool setText ( const QString &text ); 00274 00279 virtual bool clear (); 00280 00285 virtual bool insertText ( unsigned int line, unsigned int col, const QString &text ); 00286 00291 virtual bool removeText ( unsigned int startLine, unsigned int startCol, unsigned int endLine, unsigned int endCol ); 00292 00297 virtual bool insertLine ( unsigned int line, const QString &text ); 00298 00303 virtual bool removeLine ( unsigned int line ); 00304 00305 signals: 00306 void textChanged (); 00307 void newStatus (); 00308 void charactersInteractivelyInserted(int ,int ,const QString&); 00309 00310 // -- CursorInterface ------------------------------------------------------------------------ 00311 public: 00315 virtual KTextEditor::Cursor *createCursor ( ); 00316 00317 /* 00318 * Accessor to the list of views. 00319 */ 00320 virtual QPtrList<KTextEditor::Cursor> cursors () const; 00321 00322 // -- SelectionInterface ---------------------------------------------------------------------- 00323 public: 00327 virtual bool setSelection ( unsigned int startLine, unsigned int startCol, unsigned int endLine, unsigned int endCol ); 00328 00332 virtual bool clearSelection (); 00333 00337 virtual bool hasSelection () const; 00338 00342 virtual QString selection () const; 00343 00347 virtual bool removeSelectedText (); 00348 00352 virtual bool selectAll(); 00353 00354 signals: 00355 void selectionChanged (); 00356 00357 protected: 00361 virtual bool openFile(); 00362 00366 virtual bool saveFile(); 00367 00368 public slots: 00369 void fileReload(); 00370 00371 protected slots: 00372 void fileOpen(); 00373 void fileSaveAs(); 00374 00375 private: 00376 QEditorView* m_currentView; 00377 QPtrList<KTextEditor::View> m_views; 00378 QPtrList<KTextEditor::Cursor> m_cursors; 00379 QPtrList<KTextEditor::Mark> m_marks; 00380 QEditorBrowserExtension* m_extension; 00381 }; 00382 00383 #endif // QEDITORPART_H
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:38:56 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003