editorinterface.h 1.71 KB
Newer Older
victor's avatar
 
victor committed
1 2 3 4 5 6 7 8
#ifndef EDITOR_INTERFACE
#define EDITOR_INTERFACE

#include "interfaces/analizerinterface.h"

namespace Shared
{

victor's avatar
 
victor committed
9 10 11 12 13
struct EditorComponent {
    int id;
    class QWidget * widget;
    QList<class QMenu*> menus;
    QList<class QAction*> toolbarActions;
victor's avatar
 
victor committed
14
    QList<class QWidget*> statusbarWidgets;
victor's avatar
 
victor committed
15 16
};

victor's avatar
 
victor committed
17 18 19
class EditorInterface
{
public:
20 21 22 23
    virtual struct EditorComponent newDocument(const QString & analizerName,
            const QString & initialText,
            const QString & documentDir,
            bool initiallyNotSaved
victor's avatar
 
victor committed
24
            ) = 0;
victor's avatar
 
victor committed
25
    virtual void closeDocument(int documentId) = 0;
victor's avatar
 
victor committed
26
    virtual int analizerDocumentId(int editorDocumentId) const = 0;
victor's avatar
 
victor committed
27 28
    virtual bool hasUnsavedChanges(int documentId) const = 0;
    virtual void setDocumentChangesSaved(int documentId) = 0;
victor's avatar
 
victor committed
29
    virtual QString saveDocument(int documentId, const QString & fileName) = 0;
victor's avatar
 
victor committed
30
    virtual AnalizerInterface * analizer(int documentId) = 0;
victor's avatar
 
victor committed
31
    virtual quint32 errorsLinesCount(int documentId) const = 0;
victor's avatar
 
victor committed
32 33 34
    virtual void highlightLineGreen(int documentId, int lineNo) = 0;
    virtual void highlightLineRed(int documentId, int lineNo) = 0;
    virtual void unhighlightLine(int documentId) = 0;
victor's avatar
 
victor committed
35
    virtual void appendMarginText(int documentId, int lineNo, const QString & text) = 0;
victor's avatar
 
victor committed
36
    virtual void setMarginText(int documentId, int lineNo, const QString & text) = 0;
victor's avatar
 
victor committed
37 38
    virtual void clearMargin(int documentId) = 0;
    virtual void clearMargin(int documentId, int fromLine, int toLine) = 0;
victor's avatar
 
victor committed
39
    virtual void ensureAnalized(int documentId) = 0;
victor's avatar
 
victor committed
40 41
    virtual QByteArray saveState(int documentId) = 0;
    virtual void restoreState(int documentId, const QByteArray & data) = 0;
victor's avatar
 
victor committed
42 43 44 45
};

}

victor's avatar
 
victor committed
46 47
Q_DECLARE_INTERFACE(Shared::EditorInterface, "kumir2.editor")

victor's avatar
 
victor committed
48
#endif