File indexing completed on 2025-02-02 05:43:19

0001 /*
0002     This file is part of the Kasten Framework, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef KASTEN_IF_VIEWAREASPLITABLE_HPP
0010 #define KASTEN_IF_VIEWAREASPLITABLE_HPP
0011 
0012 // Qt
0013 #include <QtPlugin>
0014 
0015 template <typename C> class QVector;
0016 
0017 namespace Kasten {
0018 
0019 class AbstractViewArea;
0020 
0021 namespace If {
0022 
0023 // TODO: should split(Qt::Orientation) be a method of AbstractViewArea?
0024 // TODO: split or add? difference in semantics?
0025 // TODO: areas could be tabbed/stacked, too, also recursively. Support that?
0026 // TODO: should views to part/sub-models be restricted to overview of document? No, or?
0027 // TODO: where to decide what to do with the contained views of a area that is closed?
0028 // TODO: where to decide what to do on a split, e.g. add a new view copy of the current one?
0029 class ViewAreaSplitable
0030 {
0031 public:
0032     virtual ~ViewAreaSplitable();
0033 
0034 public: // set/action
0035     /// returns the new view area
0036     virtual AbstractViewArea* splitViewArea(AbstractViewArea* viewArea, Qt::Orientation orientation) = 0;
0037     virtual void closeViewArea(AbstractViewArea* viewArea) = 0;   // TODO: or report success with bool?
0038     virtual void setViewAreaFocus(AbstractViewArea* viewArea) = 0;
0039 
0040 public: // get
0041     virtual AbstractViewArea* viewAreaFocus() const = 0;
0042 //     virtual QVector<Kasten::AbstractViewArea*> viewAreas() const = 0;
0043     virtual int viewAreasCount() const = 0;
0044 
0045 public: // signal
0046     virtual void viewAreasAdded(const QVector<Kasten::AbstractViewArea*>& viewAreas) = 0;
0047     virtual void viewAreasRemoved(const QVector<Kasten::AbstractViewArea*>& viewAreas) = 0;
0048     virtual void viewAreaFocusChanged(Kasten::AbstractViewArea* viewArea) = 0;
0049 };
0050 
0051 inline ViewAreaSplitable::~ViewAreaSplitable() = default;
0052 
0053 }
0054 }
0055 
0056 Q_DECLARE_INTERFACE(Kasten::If::ViewAreaSplitable, "org.kde.kasten.if.viewareasplitable/1.0")
0057 
0058 #endif