File indexing completed on 2024-05-19 04:36:35

0001 /* This file is part of the TikZKit project.
0002  *
0003  * Copyright (C) 2014-2016 Dominik Haumann <dhaumann@kde.org>
0004  * Copyright (C) 2014 Christoph Cullmann <cullmann@kde.org>
0005  *
0006  * This library is free software; you can redistribute it and/or modify
0007  * it under the terms of the GNU Library General Public License as published
0008  * by the Free Software Foundation, either version 2 of the License, or
0009  * (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU Library General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Library General Public License
0017  * along with this library; see the file COPYING.LIB.  If not, see
0018  * <http://www.gnu.org/licenses/>.
0019  */
0020 
0021 #include "MainWindow.h"
0022 
0023 namespace tikz {
0024 namespace ui {
0025 
0026 class Document;
0027 class View;
0028 
0029 MainWindow::MainWindow(QObject *parent)
0030     : QObject(parent)
0031     , d(nullptr)
0032 {
0033 }
0034 
0035 MainWindow::~MainWindow()
0036 {
0037 }
0038 
0039 QVector<tikz::ui::View *> MainWindow::views() const
0040 {
0041     /**
0042      * dispatch to parent
0043      */
0044     QVector<tikz::ui::View *> views;
0045     QMetaObject::invokeMethod(parent()
0046                               , "views"
0047                               , Qt::DirectConnection
0048                               , Q_RETURN_ARG(QVector<tikz::ui::View *>, views));
0049     return views;
0050 }
0051 
0052 tikz::ui::View * MainWindow::activeView()
0053 {
0054     /**
0055      * dispatch to parent
0056      */
0057     tikz::ui::View *view = nullptr;
0058     QMetaObject::invokeMethod(parent()
0059                               , "activeView"
0060                               , Qt::DirectConnection
0061                               , Q_RETURN_ARG(tikz::ui::View *, view));
0062     return view;
0063 }
0064 
0065 tikz::ui::View * MainWindow::activateView(tikz::ui::Document *document)
0066 {
0067     /**
0068      * dispatch to parent
0069      */
0070     tikz::ui::View *view = nullptr;
0071     QMetaObject::invokeMethod(parent()
0072                               , "activateView"
0073                               , Qt::DirectConnection
0074                               , Q_RETURN_ARG(tikz::ui::View *, view)
0075                               , Q_ARG(tikz::ui::Document *, document));
0076     return view;
0077 }
0078 
0079 tikz::ui::View * MainWindow::openUrl(const QUrl &url)
0080 {
0081     /**
0082      * dispatch to parent
0083      */
0084     tikz::ui::View *view = nullptr;
0085     QMetaObject::invokeMethod(parent()
0086                               , "openUrl"
0087                               , Qt::DirectConnection
0088                               , Q_RETURN_ARG(tikz::ui::View *, view)
0089                               , Q_ARG(const QUrl &, url));
0090     return view;
0091 }
0092 
0093 bool MainWindow::closeView(tikz::ui::View *view)
0094 {
0095     /**
0096      * dispatch to parent
0097      */
0098     bool success = false;
0099     QMetaObject::invokeMethod(parent()
0100                               , "closeView"
0101                               , Qt::DirectConnection
0102                               , Q_RETURN_ARG(bool, success)
0103                               , Q_ARG(tikz::ui::View *, view));
0104     return success;
0105 }
0106 
0107 }
0108 }
0109 
0110 // kate: indent-width 4; replace-tabs on;