File indexing completed on 2024-05-19 05:42:27

0001 // ct_lvtqtw_tabwidget.h                                             -*-C++-*-
0002 
0003 /*
0004 // Copyright 2023 Codethink Ltd <codethink@codethink.co.uk>
0005 // SPDX-License-Identifier: Apache-2.0
0006 //
0007 // Licensed under the Apache License, Version 2.0 (the "License");
0008 // you may not use this file except in compliance with the License.
0009 // You may obtain a copy of the License at
0010 //
0011 //     http://www.apache.org/licenses/LICENSE-2.0
0012 //
0013 // Unless required by applicable law or agreed to in writing, software
0014 // distributed under the License is distributed on an "AS IS" BASIS,
0015 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0016 // See the License for the specific language governing permissions and
0017 // limitations under the License.
0018 */
0019 
0020 #ifndef INCLUDED_LVTQTW_SPLITTERVIEW
0021 #define INCLUDED_LVTQTW_SPLITTERVIEW
0022 
0023 #include <lvtqtw_export.h>
0024 
0025 #include <ct_lvtqtw_tabwidget.h>
0026 
0027 #include <ct_lvtldr_lakosiannode.h>
0028 #include <ct_lvtplg_pluginmanager.h>
0029 
0030 #include <QSplitter>
0031 
0032 #include <memory>
0033 
0034 namespace Codethink::lvtqtc {
0035 class GraphicsView;
0036 class UndoManager;
0037 }
0038 
0039 namespace Codethink::lvtprj {
0040 class ProjectFile;
0041 }
0042 
0043 class QGraphicsView;
0044 class QString;
0045 
0046 namespace Codethink::lvtqtw {
0047 
0048 class LVTQTW_EXPORT SplitterView : public QSplitter
0049 // Visualizes a Tree model and reacts to changes
0050 {
0051     Q_OBJECT
0052   public:
0053     explicit SplitterView(lvtldr::NodeStorage& nodeStorage,
0054                           lvtprj::ProjectFile& projectFile,
0055                           lvtplg::PluginManager *pluginManager = nullptr,
0056                           QWidget *parent = nullptr);
0057     ~SplitterView() override;
0058 
0059     void setCurrentIndex(int idx);
0060     void setUndoManager(lvtqtc::UndoManager *undoManager);
0061     void closeAllTabs();
0062 
0063     Q_SIGNAL void currentTabChanged(Codethink::lvtqtw::TabWidget *wdg);
0064 
0065     void toggle();
0066 
0067     lvtqtc::GraphicsView *graphicsView();
0068     int totalOpenTabs();
0069 
0070   protected:
0071     bool eventFilter(QObject *watched, QEvent *event) override;
0072 
0073   private:
0074     struct Private;
0075     std::unique_ptr<Private> d;
0076 };
0077 
0078 } // end namespace Codethink::lvtqtw
0079 
0080 #endif