Sélectionner une révision Git
AbstractDocumentView.hh
AbstractDocumentView.hh 1,61 Kio
#pragma once
#ifndef __cplusplus
#error "This is a C++ header"
#endif
#include "../Lib/Utils.hh"
#include "../Lib/AbstractDocument.hh"
#include <QMainWindow>
#include <QDockWidget>
#include <QAction>
namespace Vivy
{
// Any document added to the tabs in the main window must inherit from the
// AbstractDocumentView widget. This widget will permit to query the type of
// the document in the tab.
class AbstractDocumentView : public QMainWindow {
Q_OBJECT
VIVY_UNMOVABLE_OBJECT(AbstractDocumentView)
public:
enum class Type : quint64 {
Vivy = Utils::toUnderlying(Utils::DocumentType::Vivy),
Script = Utils::toUnderlying(Utils::DocumentType::VivyScript)
};
protected:
explicit AbstractDocumentView(Type, QWidget *parent = nullptr) noexcept;
public:
virtual void closeDocument() noexcept = 0;
virtual void openProperties() noexcept = 0;
virtual QString getDocumentTabName() const noexcept = 0;
virtual QString getDocumentTabToolTip() const noexcept = 0;
virtual QIcon getDocumentTabIcon() const noexcept = 0;
virtual AbstractDocument *getDocument() const noexcept = 0;
Type getType() const noexcept;
bool isType(const Utils::DocumentType t) const noexcept;
const QList<QAction *> &getViewsActions() const noexcept;
signals:
void viewActionsChanged();
void documentPropertyChanged();
protected:
void deleteAllContent() noexcept;
void delDockWidget(QDockWidget **) noexcept;
void addDockWidget(Qt::DockWidgetArea, QDockWidget *, Qt::Orientation) noexcept;
QList<QAction *> viewsActions{};
private:
const Type documentType;
};
}