Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 91027a65b19a23a46424080fe64a30154afd1b78
  • master par défaut
  • script
  • new-devel
  • devel
  • timingView-edit
  • fix-mpv
7 résultats

AbstractDocumentView.hh

Blame
  • 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;
    };
    }