• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KTextEditor

view.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
00003    Copyright (C) 2005 Dominik Haumann (dhdev@gmx.de) (documentation)
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 version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KDELIBS_KTEXTEDITOR_VIEW_H
00021 #define KDELIBS_KTEXTEDITOR_VIEW_H
00022 
00023 #include <ktexteditor/ktexteditor_export.h>
00024 #include <ktexteditor/range.h>
00025 
00026 // gui merging
00027 #include <kxmlguiclient.h>
00028 
00029 // widget
00030 #include <QtGui/QWidget>
00031 
00032 class QMenu;
00033 
00034 namespace KTextEditor
00035 {
00036 
00037 class Document;
00038 
00141 class KTEXTEDITOR_EXPORT View :  public QWidget, public KXMLGUIClient
00142 {
00143   Q_OBJECT
00144 
00145   public:
00153     View ( QWidget *parent );
00154 
00158     virtual ~View ();
00159 
00160   /*
00161    * Accessor for the document
00162    */
00163   public:
00169     virtual Document *document () const = 0;
00170 
00178     bool isActiveView() const;
00179 
00180   /*
00181    * General information about this view
00182    */
00183   public:
00194     virtual QString viewMode () const = 0;
00195 
00200     enum EditMode {
00201       EditInsert = 0,   
00202       EditOverwrite = 1 
00203     };
00204 
00214     virtual enum EditMode viewEditMode() const = 0;
00215 
00216   /*
00217    * SIGNALS
00218    * following signals should be emitted by the editor view
00219    */
00220   Q_SIGNALS:
00226     void focusIn ( KTextEditor::View *view );
00227 
00233     void focusOut ( KTextEditor::View *view );
00234 
00240     void viewModeChanged ( KTextEditor::View *view );
00241 
00249     void viewEditModeChanged ( KTextEditor::View *view,
00250                                enum KTextEditor::View::EditMode mode );
00251 
00259     void informationMessage ( KTextEditor::View *view, const QString &message );
00260 
00269     void textInserted ( KTextEditor::View *view,
00270                         const KTextEditor::Cursor &position,
00271                         const QString &text );
00272 
00273   /*
00274    * Context menu handling
00275    */
00276   public:
00286     virtual void setContextMenu ( QMenu *menu ) = 0;
00287 
00294     virtual QMenu *contextMenu () const = 0;
00295 
00306     virtual QMenu* defaultContextMenu(QMenu* menu = 0L) const = 0;
00307 
00308   Q_SIGNALS:
00313     void contextMenuAboutToShow(KTextEditor::View* view, QMenu* menu);
00314 
00315   /*
00316    * Cursor handling
00317    */
00318   public:
00326     virtual bool setCursorPosition (Cursor position) = 0;
00327 
00334     virtual Cursor cursorPosition () const = 0;
00335 
00346     virtual Cursor cursorPositionVirtual () const = 0;
00347 
00356     virtual QPoint cursorToCoordinate(const KTextEditor::Cursor& cursor) const = 0;
00357 
00362     virtual QPoint cursorPositionCoordinates () const = 0;
00363 
00364   /*
00365    * SIGNALS
00366    * following signals should be emitted by the editor view
00367    * if the cursor position changes
00368    */
00369   Q_SIGNALS:
00377     void cursorPositionChanged (KTextEditor::View *view,
00378                                 const KTextEditor::Cursor& newPosition);
00379 
00385     void verticalScrollPositionChanged (KTextEditor::View *view, const KTextEditor::Cursor& newPos);
00386   
00391     void horizontalScrollPositionChanged (KTextEditor::View *view);
00392   /*
00393    * Mouse position
00394    */
00395   public:
00404     virtual bool mouseTrackingEnabled() const = 0;
00405 
00421     virtual bool setMouseTrackingEnabled(bool enable) = 0;
00422 
00423   Q_SIGNALS:
00435     void mousePositionChanged (KTextEditor::View *view,
00436                                const KTextEditor::Cursor& newPosition);
00437 
00438   /*
00439    * Selection methodes.
00440    * This deals with text selection and copy&paste
00441    */
00442   public:
00451     virtual bool setSelection ( const Range &range ) = 0;
00452 
00469     virtual bool setSelection ( const Cursor &position,
00470                                 int length,
00471                                 bool wrap = true );
00472 
00479     virtual bool selection() const = 0;
00480 
00486     virtual const Range &selectionRange() const = 0;
00487 
00493     virtual QString selectionText () const = 0;
00494 
00501     virtual bool removeSelection () = 0;
00502 
00508     virtual bool removeSelectionText () = 0;
00509 
00510   /*
00511    * Blockselection stuff
00512    */
00513   public:
00520     virtual bool setBlockSelection (bool on) = 0;
00521 
00530     virtual bool blockSelection () const = 0;
00531 
00532   /*
00533    * SIGNALS
00534    * following signals should be emitted by the editor view for selection
00535    * handling.
00536    */
00537   Q_SIGNALS:
00545     void selectionChanged (KTextEditor::View *view);
00546 
00547   public:
00556     virtual bool insertText (const QString &text);
00557 
00558   private:
00559     class ViewPrivate* const d;
00560 };
00561 
00596 class KTEXTEDITOR_EXPORT CoordinatesToCursorInterface
00597 {
00598   public:
00600     virtual ~CoordinatesToCursorInterface();
00601 
00613     virtual KTextEditor::Cursor coordinatesToCursor(const QPoint& coord) const = 0;
00614 };
00615 
00616 }
00617 
00618 Q_DECLARE_INTERFACE(KTextEditor::CoordinatesToCursorInterface, "org.kde.KTextEditor.CoordinatesToCursorInterface")
00619 
00620 #endif
00621 
00622 // kate: space-indent on; indent-width 2; replace-tabs on;

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal