forked from vnotex/vnote
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathveditoperations.h
More file actions
79 lines (58 loc) · 1.83 KB
/
veditoperations.h
File metadata and controls
79 lines (58 loc) · 1.83 KB
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
#ifndef VEDITOPERATIONS_H
#define VEDITOPERATIONS_H
#include <QPointer>
#include <QString>
#include <QObject>
#include <QList>
#include "vfile.h"
#include "utils/vvim.h"
class VEditor;
class VEditConfig;
class QMimeData;
class QKeyEvent;
class VEditOperations: public QObject
{
Q_OBJECT
public:
VEditOperations(VEditor *p_editor, VFile *p_file);
virtual ~VEditOperations();
virtual bool insertImageFromMimeData(const QMimeData *source) = 0;
virtual bool insertImage() = 0;
virtual bool insertImageFromURL(const QUrl &p_imageUrl) = 0;
virtual bool insertLink(const QString &p_linkText,
const QString &p_linkUrl) = 0;
virtual void insertText(const QString &p_text);
// Return true if @p_event has been handled and no need to be further
// processed.
virtual bool handleKeyPressEvent(QKeyEvent *p_event) = 0;
// Request to propogate Vim status.
void requestUpdateVimStatus();
// Insert decoration markers or decorate selected text.
virtual void decorateText(TextDecoration p_decoration, int p_level = -1)
{
Q_UNUSED(p_decoration);
Q_UNUSED(p_level);
}
// Set Vim mode if not NULL.
void setVimMode(VimMode p_mode);
VVim *getVim() const;
signals:
// Want to display a template message in status bar.
void statusMessage(const QString &p_msg);
// Propogate Vim status.
void vimStatusUpdated(const VVim *p_vim);
protected slots:
// Handle the update of VEditConfig of the editor.
virtual void handleEditConfigUpdated();
// Vim mode changed.
void handleVimModeChanged(VimMode p_mode);
private:
// Update m_editConfig->m_cursorLineBg.
void updateCursorLineBg();
protected:
VEditor *m_editor;
QPointer<VFile> m_file;
VEditConfig *m_editConfig;
VVim *m_vim;
};
#endif // VEDITOPERATIONS_H