Files
qt-creator/src/plugins/texteditor/texteditoractionhandler.h

59 lines
1.4 KiB
C
Raw Normal View History

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
2008-12-02 16:19:05 +01:00
#pragma once
2008-12-02 12:01:29 +01:00
#include "texteditor_global.h"
#include <utils/id.h>
#include <QObject>
2008-12-02 12:01:29 +01:00
#include <functional>
namespace Core {
class IEditor;
}
2008-12-02 12:01:29 +01:00
namespace TextEditor {
class TextEditorWidget;
2008-12-02 12:01:29 +01:00
namespace Internal { class TextEditorActionHandlerPrivate; }
2008-12-02 12:01:29 +01:00
// Redirects slots from global actions to the respective editor.
class TEXTEDITOR_EXPORT TextEditorActionHandler final
2008-12-02 12:01:29 +01:00
{
TextEditorActionHandler(const TextEditorActionHandler &) = delete;
TextEditorActionHandler &operator=(const TextEditorActionHandler &) = delete;
2008-12-02 12:01:29 +01:00
public:
enum OptionalActionsMask {
None = 0,
Format = 1,
UnCommentSelection = 2,
UnCollapseAll = 4,
FollowSymbolUnderCursor = 8,
JumpToFileUnderCursor = 16,
RenameSymbol = 32,
FindUsage = 64,
CallHierarchy = 128
2008-12-02 12:01:29 +01:00
};
using TextEditorWidgetResolver = std::function<TextEditorWidget *(Core::IEditor *)>;
2008-12-02 12:01:29 +01:00
TextEditorActionHandler(Utils::Id editorId,
Utils::Id contextId,
uint optionalActions = None,
const TextEditorWidgetResolver &resolver = {});
uint optionalActions() const;
~TextEditorActionHandler();
void updateCurrentEditor();
private:
Internal::TextEditorActionHandlerPrivate *d;
2008-12-02 12:01:29 +01:00
};
} // namespace TextEditor