summaryrefslogtreecommitdiffstats
path: root/objects/basetexteditor.h
blob: 7ac9b756042d09f85f5e978f1bddfe6a7e10339b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (C) 2011 Kläralvdalens Datakonsult AB, a KDAB Group company.
**
** Contact: Kläralvdalens Datakonsult AB (info@kdab.com)
**
**
** GNU Lesser General Public License Usage
**
** 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.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** 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.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/

#ifndef TEXTEDITORWRAPPER_H
#define TEXTEDITORWRAPPER_H

#include "editor.h"


namespace TextEditor {
    class BaseTextEditor;
    class BaseTextEditorWidget;
}

namespace Scripting {
namespace Internal {

class BaseTextEditor : public Editor
{
    Q_OBJECT
public:
    explicit BaseTextEditor(QObject *parent=0);

public slots:
    void copy();
    void paste();
    void cut();
    void cutLine();
    void copyLine();

    void deleteSelection();
    void deleteLine(int count=1);
    void deleteEndOfWord(int count=1);
    void deleteEndOfWordCamelCase(int count=1);
    void deleteStartOfWord(int count=1);
    void deleteStartOfWordCamelCase(int count=1);

    void gotoBlockStart(int count=1);
    void gotoBlockEnd(int count=1);
    void gotoLineStart(int count=1);
    void gotoLineEnd(int count=1);
    void gotoNextLine(int count=1);
    void gotoPreviousLine(int count=1);
    void gotoPreviousCharacter(int count=1);
    void gotoNextCharacter(int count=1);
    void gotoPreviousWord(int count=1);
    void gotoNextWord(int count=1);
    void gotoPreviousWordCamelCase(int count=1);
    void gotoNextWordCamelCase(int count=1);

    void clearSelection();
    bool hasSelection();
    void selectAll();

    void selectBlockStart(int count=1);
    void selectBlockEnd(int count=1);
    void selectLineStart(int count=1);
    void selectLineEnd(int count=1);
    void selectNextLine(int count=1);
    void selectPreviousLine(int count=1);
    void selectPreviousCharacter(int count=1);
    void selectNextCharacter(int count=1);
    void selectPreviousWord(int count=1);
    void selectNextWord(int count=1);
    void selectPreviousWordCamelCase(int count=1);
    void selectNextWordCamelCase(int count=1);
    void selectBlockUp(int count=1);
    void selectBlockDown(int count=1);

    void moveLineUp(int count=1);
    void moveLineDown(int count=1);
    void copyLineUp(int count=1);
    void copyLineDown(int count=1);
    void joinLines(int count=1);

    void insertLineAbove(int count=1);
    void insertLineBelow(int count=1);

    void uppercaseSelection();
    void lowercaseSelection();

    void cleanWhitespace();

    void insertText(const QString &text);
    QString selectedText();
    QString text();

protected:
    TextEditor::BaseTextEditorWidget *textEditorWidget();
};

} // namespace Internal
} // namespace Scripting

Q_DECLARE_METATYPE(Scripting::Internal::BaseTextEditor*)

#endif // TEXTEDITORWRAPPER_H