Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ktexteditor.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
00003    Copyright (C) 2002 Joseph Wenninger <jowenn@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library 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 library 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    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef __ktexteditor_h__
00022 #define __ktexteditor_h__
00023 
00024 #include <qwidget.h>
00025 #include <qlist.h>
00026 
00059 namespace KTextEditor
00060 {
00061 
00062 class Document;
00063 
00068 class View : public QWidget
00069 {
00070   Q_OBJECT
00071                 
00072 public:
00076   View( Document *doc, QWidget *parent, const char *name = 0 );
00077   virtual ~View();
00078 
00082   virtual Document *document() const; // XXX fix when renaming KXMLGUIClient::document
00083 
00084   virtual void setCursorPosition( int line, int col, bool mark = false ) = 0;
00085   virtual void getCursorPosition( int *line, int *col ) = 0;
00086 
00090   virtual void insertText( const QString &text, bool mark = false );
00091 
00096   virtual bool isOverwriteMode() const = 0;
00097 
00105   virtual void setInternalContextMenuEnabled( bool b );
00106   virtual bool internalContextMenuEnabled() const;
00107 
00108 public slots:
00109   virtual void setOverwriteMode( bool b ) = 0;
00110 
00111 signals:
00115   void contextPopupMenu( const QPoint &p );
00116 
00122   void scrollValueChanged( int value );
00123   
00124 private:
00125   class ViewPrivate;
00126   ViewPrivate *d;
00127 };
00128 
00129 class Document : public QObject
00130 {
00131   Q_OBJECT
00132 public:
00133   Document( QObject *parent = 0, const char *name = 0 );
00134   virtual ~Document();
00135 
00141   virtual View *createView( QWidget *parent, const char *name = 0 ) = 0;
00142 
00143   /*
00144    * Accessor to the list of views.
00145    */
00146   virtual QList<View> views() const;
00147 
00151   virtual QString textLine( int line ) const = 0;
00152 
00153   virtual void setSelection( int row_from, int col_from, int row_to, int col_t ) = 0;
00154   virtual bool hasSelection() const = 0;
00155   virtual QString selection() const = 0;
00156 
00160   virtual int numLines() const = 0;
00161 
00166   virtual void insertLine( const QString &s, int line = -1 ) = 0;
00167 
00171   virtual void insertAt( const QString &s, int line, int col, bool mark = FALSE ) = 0;
00172 
00173   virtual void removeLine( int line ) = 0;
00174 
00178   virtual QString text() const = 0;
00179 
00183   virtual int length() const = 0;
00184 
00185 public slots:
00190   virtual void setText( const QString &t ) = 0;
00191 
00192 signals:
00193 
00198   void textChanged();
00199 
00202   void deleted( int startLine, int endLine );
00203   
00206   void inserted( int startLine, int endLine );
00207 
00208 protected:
00214   virtual void addView( View *view );
00215 
00219   virtual void removeView( View *view );
00220 
00221   QList<View> m_views;
00222 
00223 private slots:
00224                 
00230   void slotViewDestroyed();
00231 
00232 private:
00233   class DocumentPrivate;
00234   DocumentPrivate *d;
00235 };
00236 
00237 };
00238 
00239 #endif

Generated on Sat Nov 5 16:17:11 2005 for OPIE by  doxygen 1.4.2