• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • interfaces
  • ktexteditor
view.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
3  Copyright (C) 2005 Dominik Haumann (dhdev@gmx.de) (documentation)
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef KDELIBS_KTEXTEDITOR_VIEW_H
21 #define KDELIBS_KTEXTEDITOR_VIEW_H
22 
23 #include <ktexteditor/ktexteditor_export.h>
24 #include <ktexteditor/range.h>
25 
26 // gui merging
27 #include <kxmlguiclient.h>
28 
29 // widget
30 #include <QtGui/QWidget>
31 
32 class QMenu;
33 
34 namespace KTextEditor
35 {
36 
37 class Document;
38 
141 class KTEXTEDITOR_EXPORT View : public QWidget, public KXMLGUIClient
142 {
143  Q_OBJECT
144 
145  public:
153  View ( QWidget *parent );
154 
158  virtual ~View ();
159 
160  /*
161  * Accessor for the document
162  */
163  public:
169  virtual Document *document () const = 0;
170 
178  bool isActiveView() const;
179 
180  /*
181  * General information about this view
182  */
183  public:
194  virtual QString viewMode () const = 0;
195 
200  enum EditMode {
201  EditInsert = 0,
202  EditOverwrite = 1
203  };
204 
214  virtual enum EditMode viewEditMode() const = 0;
215 
216  /*
217  * SIGNALS
218  * following signals should be emitted by the editor view
219  */
220  Q_SIGNALS:
226  void focusIn ( KTextEditor::View *view );
227 
233  void focusOut ( KTextEditor::View *view );
234 
240  void viewModeChanged ( KTextEditor::View *view );
241 
249  void viewEditModeChanged ( KTextEditor::View *view,
250  enum KTextEditor::View::EditMode mode );
251 
259  void informationMessage ( KTextEditor::View *view, const QString &message );
260 
269  void textInserted ( KTextEditor::View *view,
270  const KTextEditor::Cursor &position,
271  const QString &text );
272 
273  /*
274  * Context menu handling
275  */
276  public:
290  virtual void setContextMenu ( QMenu *menu ) = 0;
291 
300  virtual QMenu *contextMenu () const = 0;
301 
335  virtual QMenu* defaultContextMenu(QMenu* menu = 0L) const = 0;
336 
337  Q_SIGNALS:
342  void contextMenuAboutToShow(KTextEditor::View* view, QMenu* menu);
343 
344  /*
345  * Cursor handling
346  */
347  public:
355  virtual bool setCursorPosition (Cursor position) = 0;
356 
363  virtual Cursor cursorPosition () const = 0;
364 
375  virtual Cursor cursorPositionVirtual () const = 0;
376 
385  virtual QPoint cursorToCoordinate(const KTextEditor::Cursor& cursor) const = 0;
386 
391  virtual QPoint cursorPositionCoordinates () const = 0;
392 
393  /*
394  * SIGNALS
395  * following signals should be emitted by the editor view
396  * if the cursor position changes
397  */
398  Q_SIGNALS:
406  void cursorPositionChanged (KTextEditor::View *view,
407  const KTextEditor::Cursor& newPosition);
408 
414  void verticalScrollPositionChanged (KTextEditor::View *view, const KTextEditor::Cursor& newPos);
415 
420  void horizontalScrollPositionChanged (KTextEditor::View *view);
421  /*
422  * Mouse position
423  */
424  public:
433  virtual bool mouseTrackingEnabled() const = 0;
434 
450  virtual bool setMouseTrackingEnabled(bool enable) = 0;
451 
452  Q_SIGNALS:
464  void mousePositionChanged (KTextEditor::View *view,
465  const KTextEditor::Cursor& newPosition);
466 
467  /*
468  * Selection methodes.
469  * This deals with text selection and copy&paste
470  */
471  public:
480  virtual bool setSelection ( const Range &range ) = 0;
481 
498  virtual bool setSelection ( const Cursor &position,
499  int length,
500  bool wrap = true );
501 
508  virtual bool selection() const = 0;
509 
515  virtual const Range &selectionRange() const = 0;
516 
522  virtual QString selectionText () const = 0;
523 
530  virtual bool removeSelection () = 0;
531 
537  virtual bool removeSelectionText () = 0;
538 
539  /*
540  * Blockselection stuff
541  */
542  public:
549  virtual bool setBlockSelection (bool on) = 0;
550 
559  virtual bool blockSelection () const = 0;
560 
561  /*
562  * SIGNALS
563  * following signals should be emitted by the editor view for selection
564  * handling.
565  */
566  Q_SIGNALS:
574  void selectionChanged (KTextEditor::View *view);
575 
576  public:
585  virtual bool insertText (const QString &text);
586 
587  private:
588  class ViewPrivate* const d;
589 };
590 
625 class KTEXTEDITOR_EXPORT CoordinatesToCursorInterface
626 {
627  public:
629  virtual ~CoordinatesToCursorInterface();
630 
642  virtual KTextEditor::Cursor coordinatesToCursor(const QPoint& coord) const = 0;
643 };
644 
645 }
646 
647 Q_DECLARE_INTERFACE(KTextEditor::CoordinatesToCursorInterface, "org.kde.KTextEditor.CoordinatesToCursorInterface")
648 
649 #endif
650 
651 // kate: space-indent on; indent-width 2; replace-tabs on;
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Fri Jul 12 2013 08:57:36 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KTextEditor

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

kdelibs-4.10.5 API Reference

Skip menu "kdelibs-4.10.5 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal