cmakeeditor.h 3.05 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
2
**
3
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
hjk's avatar
hjk committed
4
** Contact: http://www.qt-project.org/legal
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
7
**
hjk's avatar
hjk committed
8 9 10 11 12 13 14
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
15 16
**
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17 18 19 20 21 22
** Alternatively, 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.
23
**
hjk's avatar
hjk committed
24 25
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
con's avatar
con committed
26 27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
28
****************************************************************************/
29 30 31 32 33 34

#ifndef CMAKEEDITOR_H
#define CMAKEEDITOR_H

#include <texteditor/basetextdocument.h>
#include <texteditor/basetexteditor.h>
35
#include <texteditor/codeassist/completionassistprovider.h>
36
#include <utils/uncommentselection.h>
37 38 39 40 41 42 43 44 45


namespace TextEditor {
class FontSettings;
}

namespace CMakeProjectManager {
namespace Internal {

46
class CMakeEditorWidget;
47
class CMakeHighlighter;
48
class CMakeManager;
49

50
class CMakeEditor : public TextEditor::BaseTextEditor
51
{
52
    Q_OBJECT
53

54
public:
55
    CMakeEditor(CMakeEditorWidget *);
56 57

    bool duplicateSupported() const { return true; }
58
    Core::IEditor *duplicate();
hjk's avatar
hjk committed
59
    Core::Id id() const;
60
    TextEditor::CompletionAssistProvider *completionAssistProvider();
61

62 63 64
private slots:
    void markAsChanged();
    void build();
65 66
};

67
class CMakeEditorWidget : public TextEditor::BaseTextEditorWidget
68 69 70 71
{
    Q_OBJECT

public:
72
    CMakeEditorWidget(QWidget *parent = 0);
73
    CMakeEditorWidget(CMakeEditorWidget *other);
74 75 76

    bool save(const QString &fileName = QString());

77
    Link findLinkAt(const QTextCursor &cursor, bool resolveTarget = true, bool inNextSplit = false);
78

79
protected:
80
    TextEditor::BaseTextEditor *createEditor();
81
    void contextMenuEvent(QContextMenuEvent *e);
82 83

public slots:
84
    void unCommentSelection();
85 86

private:
87 88
    CMakeEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
    void ctor();
89
    Utils::CommentDefinition m_commentDefinition;
90 91 92 93 94 95 96 97 98 99 100 101 102
};

class CMakeDocument : public TextEditor::BaseTextDocument
{
    Q_OBJECT

public:
    CMakeDocument();
    QString defaultPath() const;
    QString suggestedFileName() const;
};

} // namespace Internal
103
} // namespace CMakeProjectManager
104 105

#endif // CMAKEEDITOR_H