basetexteditor.h 19.1 KB
Newer Older
1
/**************************************************************************
con's avatar
con committed
2 3 4
**
** This file is part of Qt Creator
**
con's avatar
con committed
5
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
con's avatar
con committed
6
**
hjk's avatar
hjk committed
7
** Contact: Nokia Corporation (info@qt.nokia.com)
con's avatar
con committed
8
**
9
**
10
** GNU Lesser General Public License Usage
11
**
hjk's avatar
hjk committed
12 13 14 15 16 17
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18
**
con's avatar
con committed
19
** In addition, as a special exception, Nokia gives you certain additional
hjk's avatar
hjk committed
20
** rights. These rights are described in the Nokia Qt LGPL Exception
con's avatar
con committed
21 22
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
23 24 25 26 27
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
con's avatar
con committed
28
** If you have questions regarding the use of this file, please contact
Tobias Hunger's avatar
Tobias Hunger committed
29
** Nokia at info@qt.nokia.com.
con's avatar
con committed
30
**
31
**************************************************************************/
hjk's avatar
hjk committed
32

con's avatar
con committed
33 34 35
#ifndef BASETEXTEDITOR_H
#define BASETEXTEDITOR_H

36
#include "itexteditor.h"
Leandro Melo's avatar
Leandro Melo committed
37
#include "codeassist/assistenums.h"
con's avatar
con committed
38

39 40
#include <find/ifindsupport.h>

41 42
#include <coreplugin/editormanager/editormanager.h>

con's avatar
con committed
43 44 45 46
#include <QtGui/QPlainTextEdit>

QT_BEGIN_NAMESPACE
class QToolBar;
47
class QTimeLine;
con's avatar
con committed
48 49
QT_END_NAMESPACE

50 51
namespace Utils {
    class LineColumnLabel;
52
    class ChangeSet;
con's avatar
con committed
53 54 55
}

namespace TextEditor {
56
class TabSettings;
57
class TabPreferences;
58 59
class RefactorOverlay;
struct RefactorMarker;
Leandro Melo's avatar
Leandro Melo committed
60 61 62
class IAssistMonitorInterface;
class IAssistInterface;
class IAssistProvider;
63
class IFallbackPreferences;
con's avatar
con committed
64 65 66

namespace Internal {
    class BaseTextEditorPrivate;
67
    class TextEditorOverlay;
68
    typedef QList<RefactorMarker> RefactorMarkers;
69
    typedef QString (QString::*TransformationMethod)() const;
con's avatar
con committed
70 71 72 73 74
}

class ITextMarkable;

class BaseTextDocument;
75
class BaseTextEditor;
con's avatar
con committed
76
class FontSettings;
77 78 79 80
class BehaviorSettings;
class CompletionSettings;
class DisplaySettings;
class StorageSettings;
81
class Indenter;
82
class AutoCompleter;
83
class ExtraEncodingSettings;
con's avatar
con committed
84

85 86 87 88 89 90 91
class TEXTEDITOR_EXPORT BaseTextEditorAnimator : public QObject
{
    Q_OBJECT

public:
    BaseTextEditorAnimator(QObject *parent);

92 93
    inline void setPosition(int position) { m_position = position; }
    inline int position() const { return m_position; }
94 95 96 97 98 99

    void setData(QFont f, QPalette pal, const QString &text);

    void draw(QPainter *p, const QPointF &pos);
    QRectF rect() const;

100 101
    inline qreal value() const { return m_value; }
    inline QPointF lastDrawPos() const { return m_lastDrawPos; }
102 103 104

    void finish();

mae's avatar
mae committed
105 106
    bool isRunning() const;

107
signals:
108
    void updateRequest(int position, QPointF lastPos, QRectF rect);
109 110 111 112 113 114 115 116 117


private slots:
    void step(qreal v);

private:
    QTimeLine *m_timeline;
    qreal m_value;
    int m_position;
118
    QPointF m_lastDrawPos;
119 120 121 122 123 124 125
    QFont m_font;
    QPalette m_palette;
    QString m_text;
    QSizeF m_size;
};


126
class TEXTEDITOR_EXPORT BaseTextEditorWidget : public QPlainTextEdit
con's avatar
con committed
127 128
{
    Q_OBJECT
mae's avatar
mae committed
129 130
    Q_PROPERTY(int verticalBlockSelectionFirstColumn READ verticalBlockSelectionFirstColumn)
    Q_PROPERTY(int verticalBlockSelectionLastColumn READ verticalBlockSelectionLastColumn)
con's avatar
con committed
131
public:
132 133
    BaseTextEditorWidget(QWidget *parent);
    ~BaseTextEditorWidget();
con's avatar
con committed
134

135
    static ITextEditor *openEditorAt(const QString &fileName, int line, int column = 0,
136 137
                                     const QString &editorId =  QString(),
                                     Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::IgnoreNavigationHistory,
138
                                     bool *newEditor = 0);
con's avatar
con committed
139

140 141 142
    const Utils::ChangeSet &changeSet() const;
    void setChangeSet(const Utils::ChangeSet &changeSet);

con's avatar
con committed
143 144 145
    // EditorInterface
    Core::IFile * file();
    bool createNew(const QString &contents);
146
    virtual bool open(QString *errorString, const QString &fileName, const QString &realFileName);
con's avatar
con committed
147 148 149 150 151 152
    QByteArray saveState() const;
    bool restoreState(const QByteArray &state);
    QString displayName() const;

    // ITextEditor

153
    void gotoLine(int line, int column = 0);
con's avatar
con committed
154 155 156 157 158 159

    int position(
        ITextEditor::PositionOperation posOp = ITextEditor::Current
        , int at = -1) const;
    void convertPosition(int pos, int *line, int *column) const;

160
    BaseTextEditor *editor() const;
con's avatar
con committed
161 162 163 164 165 166 167 168
    ITextMarkable *markableInterface() const;

    QChar characterAt(int pos) const;

    void print(QPrinter *);

    void setSuggestedFileName(const QString &suggestedFileName);
    QString mimeType() const;
Erik Verbruggen's avatar
Erik Verbruggen committed
169
    virtual void setMimeType(const QString &mt);
con's avatar
con committed
170 171


172 173
    void appendStandardContextMenuActions(QMenu *menu);

con's avatar
con committed
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
    // Works only in conjunction with a syntax highlighter that puts
    // parentheses into text block user data
    void setParenthesesMatchingEnabled(bool b);
    bool isParenthesesMatchingEnabled() const;

    void setHighlightCurrentLine(bool b);
    bool highlightCurrentLine() const;

    void setLineNumbersVisible(bool b);
    bool lineNumbersVisible() const;

    void setMarksVisible(bool b);
    bool marksVisible() const;

    void setRequestMarkEnabled(bool b);
    bool requestMarkEnabled() const;

    void setLineSeparatorsAllowed(bool b);
    bool lineSeparatorsAllowed() const;

194
    void updateCodeFoldingVisible();
con's avatar
con committed
195 196
    bool codeFoldingVisible() const;

197 198 199
    void setCodeFoldingSupported(bool b);
    bool codeFoldingSupported() const;

200 201 202
    void setMouseNavigationEnabled(bool b);
    bool mouseNavigationEnabled() const;

203 204 205
    void setScrollWheelZoomingEnabled(bool b);
    bool scrollWheelZoomingEnabled() const;

206 207 208
    void setConstrainTooltips(bool b);
    bool constrainTooltips() const;

con's avatar
con committed
209 210 211 212 213 214
    void setRevisionsVisible(bool b);
    bool revisionsVisible() const;

    void setVisibleWrapColumn(int column);
    int visibleWrapColumn() const;

215 216 217
    int columnCount() const;
    int rowCount() const;

con's avatar
con committed
218 219 220 221 222 223 224 225
    void setActionHack(QObject *);
    QObject *actionHack() const;

    void setTextCodec(QTextCodec *codec);
    QTextCodec *textCodec() const;

    void setReadOnly(bool b);

226 227
    void setTextCursor(const QTextCursor &cursor);

mae's avatar
mae committed
228
    void insertCodeSnippet(const QTextCursor &cursor, const QString &snippet);
229

230 231
    void setBlockSelection(bool on);
    bool hasBlockSelection() const;
232

mae's avatar
mae committed
233 234
    int verticalBlockSelectionFirstColumn() const;
    int verticalBlockSelectionLastColumn() const;
235

236 237
    QRegion translatedLineRegion(int lineStart, int lineEnd) const;

238
    void setIndenter(Indenter *indenter);
239
    Indenter *indenter() const;
240

241 242 243
    void setAutoCompleter(AutoCompleter *autoCompleter);
    AutoCompleter *autoCompleter() const;

244 245
    QPoint toolTipPosition(const QTextCursor &c) const;

Leandro Melo's avatar
Leandro Melo committed
246 247 248 249 250
    void invokeAssist(AssistKind assistKind, IAssistProvider *provider = 0);

    virtual IAssistInterface *createAssistInterface(AssistKind assistKind,
                                                    AssistReason assistReason) const;

con's avatar
con committed
251 252 253
public slots:
    void setDisplayName(const QString &title);

mae's avatar
mae committed
254 255
    virtual void paste();
    virtual void cut();
con's avatar
con committed
256 257 258

    void zoomIn(int range = 1);
    void zoomOut(int range = 1);
mae's avatar
mae committed
259
    void zoomReset();
con's avatar
con committed
260

261
    void cutLine();
262
    void copyLine();
con's avatar
con committed
263
    void deleteLine();
mae's avatar
mae committed
264 265 266
    void unfoldAll();
    void fold();
    void unfold();
con's avatar
con committed
267 268
    void selectEncoding();

269 270 271 272 273
    void gotoBlockStart();
    void gotoBlockEnd();
    void gotoBlockStartWithSelection();
    void gotoBlockEndWithSelection();

mae's avatar
mae committed
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
    void gotoLineStart();
    void gotoLineStartWithSelection();
    void gotoLineEnd();
    void gotoLineEndWithSelection();
    void gotoNextLine();
    void gotoNextLineWithSelection();
    void gotoPreviousLine();
    void gotoPreviousLineWithSelection();
    void gotoPreviousCharacter();
    void gotoPreviousCharacterWithSelection();
    void gotoNextCharacter();
    void gotoNextCharacterWithSelection();
    void gotoPreviousWord();
    void gotoPreviousWordWithSelection();
    void gotoNextWord();
    void gotoNextWordWithSelection();
mae's avatar
mae committed
290 291 292 293
    void gotoPreviousWordCamelCase();
    void gotoPreviousWordCamelCaseWithSelection();
    void gotoNextWordCamelCase();
    void gotoNextWordCamelCaseWithSelection();
294

295 296 297
    void selectBlockUp();
    void selectBlockDown();

298 299 300
    void moveLineUp();
    void moveLineDown();

301 302 303
    void copyLineUp();
    void copyLineDown();

304
    void joinLines();
305

306 307 308
    void insertLineAbove();
    void insertLineBelow();

309 310 311
    void uppercaseSelection();
    void lowercaseSelection();

312 313
    void cleanWhitespace();

con's avatar
con committed
314 315 316 317 318 319 320 321 322 323 324
signals:
    void changed();

    // ITextEditor
    void contentsChanged();

protected:
    bool event(QEvent *e);
    void keyPressEvent(QKeyEvent *e);
    void wheelEvent(QWheelEvent *e);
    void changeEvent(QEvent *e);
325
    void focusInEvent(QFocusEvent *e);
mae's avatar
mae committed
326
    void focusOutEvent(QFocusEvent *e);
con's avatar
con committed
327

mae's avatar
mae committed
328 329
    void showEvent(QShowEvent *);

con's avatar
con committed
330 331 332 333 334
    // reimplemented to support block selection
    QMimeData *createMimeDataFromSelection() const;
    bool canInsertFromMimeData(const QMimeData *source) const;
    void insertFromMimeData(const QMimeData *source);

335 336
    static QString msgTextTooLarge(quint64 size);

337 338
private:
    void maybeSelectLine();
339
    void updateCannotDecodeInfo();
340

con's avatar
con committed
341
public:
342
    void duplicateFrom(BaseTextEditorWidget *editor);
343

con's avatar
con committed
344 345 346 347 348 349
protected:
    BaseTextDocument *baseTextDocument() const;
    void setBaseTextDocument(BaseTextDocument *doc);

    void setDefaultPath(const QString &defaultPath);

350
    virtual BaseTextEditor *createEditor() = 0;
con's avatar
con committed
351 352 353

private slots:
    void editorContentsChange(int position, int charsRemoved, int charsAdded);
mae's avatar
mae committed
354 355
    void documentAboutToBeReloaded();
    void documentReloaded();
356
    void highlightSearchResults(const QString &txt, Find::FindFlags findFlags);
mae's avatar
mae committed
357 358 359
    void setFindScope(const QTextCursor &start, const QTextCursor &end, int, int);
    bool inFindScope(const QTextCursor &cursor);
    bool inFindScope(int selectionStart, int selectionEnd);
360
    void inSnippetMode(bool *active);
361 362
    void onTabPreferencesDestroyed();
    void onCodeStylePreferencesDestroyed();
con's avatar
con committed
363 364 365 366

private:
    Internal::BaseTextEditorPrivate *d;
    friend class Internal::BaseTextEditorPrivate;
367
    friend class Internal::TextEditorOverlay;
368
    friend class RefactorOverlay;
con's avatar
con committed
369 370 371 372 373 374

public:
    QWidget *extraArea() const;
    virtual int extraAreaWidth(int *markWidthPtr = 0) const;
    virtual void extraAreaPaintEvent(QPaintEvent *);
    virtual void extraAreaLeaveEvent(QEvent *);
375
    virtual void extraAreaMouseEvent(QMouseEvent *);
con's avatar
con committed
376 377

    const TabSettings &tabSettings() const;
378 379 380 381 382 383
    void setLanguageSettingsId(const QString &settingsId);
    QString languageSettingsId() const;

    void setTabPreferences(TabPreferences *preferences);
    void setCodeStylePreferences(IFallbackPreferences *settings);

con's avatar
con committed
384 385 386 387 388 389
    const DisplaySettings &displaySettings() const;

    void markBlocksAsChanged(QList<int> blockNumbers);

    void ensureCursorVisible();

390 391 392 393 394
    enum ExtraSelectionKind {
        CurrentLineSelection,
        ParenthesesMatchingSelection,
        CodeWarningsSelection,
        CodeSemanticsSelection,
395
        UndefinedSymbolSelection,
Roberto Raggi's avatar
Roberto Raggi committed
396
        UnusedSymbolSelection,
hjk's avatar
hjk committed
397
        FakeVimSelection,
Roberto Raggi's avatar
Roberto Raggi committed
398
        OtherSelection,
399
        SnippetPlaceholderSelection,
Erik Verbruggen's avatar
Erik Verbruggen committed
400
        ObjCSelection,
401 402 403 404
        NExtraSelectionKinds
    };
    void setExtraSelections(ExtraSelectionKind kind, const QList<QTextEdit::ExtraSelection> &selections);
    QList<QTextEdit::ExtraSelection> extraSelections(ExtraSelectionKind kind) const;
405
    QString extraSelectionTooltip(int pos) const;
con's avatar
con committed
406

407 408 409

    void setRefactorMarkers(const Internal::RefactorMarkers &markers);
signals:
410
    void refactorMarkerClicked(const TextEditor::RefactorMarker &marker);
411 412 413

public:

414 415 416 417 418 419
    struct BlockRange
    {
        BlockRange() : first(0), last(-1) {}
        BlockRange(int first_position, int last_position)
          : first(first_position), last(last_position)
        {}
con's avatar
con committed
420 421 422 423 424 425
        int first;
        int last;
        inline bool isNull() const { return last < first; }
    };

    // the blocks list must be sorted
426
    void setIfdefedOutBlocks(const QList<BlockRange> &blocks);
con's avatar
con committed
427 428

public slots:
429
    virtual void format();
430
    virtual void rewrapParagraph();
431 432
    virtual void unCommentSelection();
    virtual void setFontSettings(const TextEditor::FontSettings &);
mae's avatar
mae committed
433
    void setFontSettingsIfVisible(const TextEditor::FontSettings &);
con's avatar
con committed
434 435
    virtual void setTabSettings(const TextEditor::TabSettings &);
    virtual void setDisplaySettings(const TextEditor::DisplaySettings &);
436
    virtual void setBehaviorSettings(const TextEditor::BehaviorSettings &);
437
    virtual void setStorageSettings(const TextEditor::StorageSettings &);
438
    virtual void setCompletionSettings(const TextEditor::CompletionSettings &);
439
    virtual void setExtraEncodingSettings(const TextEditor::ExtraEncodingSettings &);
con's avatar
con committed
440 441 442 443 444 445 446 447 448

protected:
    bool viewportEvent(QEvent *event);

    void resizeEvent(QResizeEvent *);
    void paintEvent(QPaintEvent *);
    void timerEvent(QTimerEvent *);
    void mouseMoveEvent(QMouseEvent *);
    void mousePressEvent(QMouseEvent *);
449 450 451
    void mouseReleaseEvent(QMouseEvent *);
    void leaveEvent(QEvent *);
    void keyReleaseEvent(QKeyEvent *);
con's avatar
con committed
452

453 454
    void dragEnterEvent(QDragEnterEvent *e);

455
public:
456
    void indentInsertedText(const QTextCursor &tc);
457 458
    void indent(QTextDocument *doc, const QTextCursor &cursor, QChar typedChar);
    void reindent(QTextDocument *doc, const QTextCursor &cursor);
con's avatar
con committed
459

460 461 462 463 464
    struct Link
    {
        Link(const QString &fileName = QString(),
             int line = 0,
             int column = 0)
465 466
            : begin(-1)
            , end(-1)
467 468 469 470 471 472
            , fileName(fileName)
            , line(line)
            , column(column)
        {}

        bool isValid() const
473
        { return begin != end; }
474

475
        bool operator==(const Link &other) const
476
        { return begin == other.begin && end == other.end; }
477

478 479
        int begin;           // Link position
        int end;           // Link end position
480 481 482 483 484 485

        QString fileName;  // Target file
        int line;          // Target line
        int column;        // Target column
    };

486
protected:
487 488 489 490 491 492 493 494 495 496
    /*!
       Reimplement this function to enable code navigation.

       \a resolveTarget is set to true when the target of the link is relevant
       (it isn't until the link is used).
     */
    virtual Link findLinkAt(const QTextCursor &, bool resolveTarget = true);

    /*!
       Reimplement this function if you want to customize the way a link is
Tobias Hunger's avatar
Tobias Hunger committed
497
       opened. Returns whether the link was opened successfully.
498 499 500
     */
    virtual bool openLink(const Link &link);

501 502
    void maybeClearSomeExtraSelections(const QTextCursor &cursor);

con's avatar
con committed
503 504 505 506 507 508
protected slots:
    virtual void slotUpdateExtraAreaWidth();
    virtual void slotModificationChanged(bool);
    virtual void slotUpdateRequest(const QRect &r, int dy);
    virtual void slotCursorPositionChanged();
    virtual void slotUpdateBlockNotify(const QTextBlock &);
509
    virtual void slotCodeStyleSettingsChanged(const QVariant &);
con's avatar
con committed
510 511

signals:
mae's avatar
mae committed
512 513
    void requestFontZoom(int zoom);
    void requestZoomReset();
con's avatar
con committed
514 515 516 517 518 519
    void requestBlockUpdate(const QTextBlock &);

private:
    void indentOrUnindent(bool doIndent);
    void handleHomeKey(bool anchor);
    void handleBackspaceKey();
520
    void moveLineUpDown(bool up);
521
    void copyLineUpDown(bool up);
522
    void saveCurrentCursorPositionForNavigation();
con's avatar
con committed
523
    void updateHighlights();
524
    void updateCurrentLineHighlight();
con's avatar
con committed
525

526 527 528 529 530
    void drawFoldingMarker(QPainter *painter, const QPalette &pal,
                           const QRect &rect,
                           bool expanded,
                           bool active,
                           bool hovered) const;
531

532 533 534 535 536
    void drawCollapsedBlockPopup(QPainter &painter,
                                 const QTextBlock &block,
                                 QPointF offset,
                                 const QRect &clip);

con's avatar
con committed
537
    void toggleBlockVisible(const QTextBlock &block);
mae's avatar
mae committed
538
    QRect foldBox();
con's avatar
con committed
539

mae's avatar
mae committed
540
    QTextBlock foldedBlockAt(const QPoint &pos, QRect *box = 0) const;
con's avatar
con committed
541

542
    void updateLink(QMouseEvent *e);
543 544
    void showLink(const Link &);
    void clearLink();
mae's avatar
mae committed
545

546 547
    void universalHelper(); // test function for development

548 549 550 551
    bool cursorMoveKeyEvent(QKeyEvent *e);
    bool camelCaseRight(QTextCursor &cursor, QTextCursor::MoveMode mode);
    bool camelCaseLeft(QTextCursor &cursor, QTextCursor::MoveMode mode);

552
    void transformSelection(Internal::TransformationMethod method);
553

con's avatar
con committed
554
private slots:
mae's avatar
mae committed
555 556
    void handleBlockSelection(int diff_row, int diff_col);

557
    // parentheses matcher
con's avatar
con committed
558
    void _q_matchParentheses();
559
    void _q_highlightBlocks();
con's avatar
con committed
560
    void slotSelectionChanged();
561
    void _q_animateUpdate(int position, QPointF lastPos, QRectF rect);
562
    void doFoo();
con's avatar
con committed
563 564 565
};


566
class TEXTEDITOR_EXPORT BaseTextEditor : public ITextEditor
con's avatar
con committed
567 568
{
    Q_OBJECT
569

con's avatar
con committed
570
public:
571 572
    BaseTextEditor(BaseTextEditorWidget *editorWidget);
    ~BaseTextEditor();
con's avatar
con committed
573

574 575
    friend class BaseTextEditorWidget;
    BaseTextEditorWidget *editorWidget() const { return e; }
con's avatar
con committed
576 577

    // EditorInterface
578
    //QWidget *widget() { return e; }
579 580
    Core::IFile * file() { return e->file(); }
    bool createNew(const QString &contents) { return e->createNew(contents); }
581
    bool open(QString *errorString, const QString &fileName, const QString &realFileName) { return e->open(errorString, fileName, realFileName); }
582 583
    QString displayName() const { return e->displayName(); }
    void setDisplayName(const QString &title) { e->setDisplayName(title); emit changed(); }
con's avatar
con committed
584

585 586 587
    QByteArray saveState() const { return e->saveState(); }
    bool restoreState(const QByteArray &state) { return e->restoreState(state); }
    QWidget *toolBar();
con's avatar
con committed
588

589 590 591
    enum Side { Left, Right };
    void insertExtraToolBarWidget(Side side, QWidget *widget);

con's avatar
con committed
592 593 594 595
    // ITextEditor
    int find(const QString &string) const;
    int currentLine() const;
    int currentColumn() const;
596
    void gotoLine(int line, int column = 0) { e->gotoLine(line, column); }
597 598
    int columnCount() const;
    int rowCount() const;
con's avatar
con committed
599

600 601 602 603
    int position(PositionOperation posOp = Current, int at = -1) const
    { return e->position(posOp, at); }
    void convertPosition(int pos, int *line, int *column) const
    { e->convertPosition(pos, line, column); }
con's avatar
con committed
604 605 606 607 608 609 610 611 612 613 614 615
    QRect cursorRect(int pos = -1) const;

    QString contents() const;
    QString selectedText() const;
    QString textAt(int pos, int length) const;
    inline QChar characterAt(int pos) const { return e->characterAt(pos); }

    inline ITextMarkable *markableInterface() { return e->markableInterface(); }

    void setContextHelpId(const QString &id) { m_contextHelpId = id; }
    QString contextHelpId() const; // from IContext

616
    inline void setTextCodec(QTextCodec *codec, TextCodecReason = TextCodecOtherReason) { e->setTextCodec(codec); }
con's avatar
con committed
617 618 619
    inline QTextCodec *textCodec() const { return e->textCodec(); }


620
    // ITextEditor
con's avatar
con committed
621 622 623
    void remove(int length);
    void insert(const QString &string);
    void replace(int length, const QString &string);
624
    void setCursorPosition(int pos);
con's avatar
con committed
625 626 627 628 629 630
    void select(int toPos);

private slots:
    void updateCursorPosition();

private:
631
    BaseTextEditorWidget *e;
con's avatar
con committed
632 633
    mutable QString m_contextHelpId;
    QToolBar *m_toolBar;
634 635
    QWidget *m_stretchWidget;
    QAction *m_cursorPositionLabelAction;
636
    Utils::LineColumnLabel *m_cursorPositionLabel;
con's avatar
con committed
637 638 639 640
};

} // namespace TextEditor

641
Q_DECLARE_METATYPE(TextEditor::BaseTextEditorWidget::Link)
642

con's avatar
con committed
643
#endif // BASETEXTEDITOR_H