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 #ifndef TIKZUI_VIEW_H 0022 #define TIKZUI_VIEW_H 0023 0024 #include "tikzui_export.h" 0025 #include "tikzui.h" 0026 0027 #include <tikz/core/Pos.h> 0028 0029 #include <QWidget> 0030 0031 class TikzItem; 0032 0033 namespace tikz { 0034 namespace ui { 0035 0036 class Document; 0037 class MainWindow; 0038 class ViewPrivate; 0039 class ZoomController; 0040 0041 class TIKZKITUI_EXPORT View : public QWidget 0042 { 0043 Q_OBJECT 0044 0045 protected: 0046 /** 0047 * Constructor. 0048 * 0049 * Create a view attached to the widget \p parent. 0050 * 0051 * Pass it the internal implementation to store a d-pointer. 0052 * 0053 * \param impl d-pointer to use 0054 * \param parent parent widget 0055 * \see Document::createView() 0056 */ 0057 View(ViewPrivate *impl, QWidget *parent); 0058 0059 public: 0060 /** 0061 * Virtual destructor. 0062 */ 0063 virtual ~View(); 0064 0065 // 0066 // Accessor for the document 0067 // 0068 public: 0069 /** 0070 * Get the view's \e Document, that means the view is a view of the 0071 * returned document. 0072 * \return the view's document 0073 */ 0074 virtual tikz::ui::Document *document() const = 0; 0075 0076 /* 0077 * General information about this view 0078 */ 0079 public: 0080 /** 0081 * Get the view's main window, if any 0082 * \return the view's main window. The returned pointer is always valid, 0083 * since a dummy interface is returned in case a proper main 0084 * window isn't set. 0085 */ 0086 virtual tikz::ui::MainWindow *mainWindow() const = 0; 0087 0088 /** 0089 * Returns this View's ZoomContrller object. 0090 */ 0091 virtual tikz::ui::ZoomController * zoomController() const = 0; 0092 0093 /** 0094 * Returns the edit mode. 0095 */ 0096 virtual TikzEditMode editMode() const = 0; 0097 0098 public Q_SLOTS: 0099 /** 0100 * Set the edit mode. 0101 */ 0102 virtual void setEditMode(TikzEditMode mode) const = 0; 0103 0104 /* 0105 * SIGNALS 0106 * following signals should be emitted by the editor view 0107 */ 0108 Q_SIGNALS: 0109 /** 0110 * This signal is emitted whenever the \p view gets the focus. 0111 * \param view view which gets focus 0112 * \see focusOut() 0113 */ 0114 void focusIn(tikz::ui::View *view); 0115 0116 /** 0117 * This signal is emitted whenever the \p view loses the focus. 0118 * \param view view which lost focus 0119 * \see focusIn() 0120 */ 0121 void focusOut(tikz::ui::View *view); 0122 0123 /** 0124 * This signal is emitted whenever the mouse moved on the view. 0125 * The current mouse position is @p pos. 0126 */ 0127 void mousePositionChanged(const tikz::Pos & pos); 0128 0129 // 0130 // Selection methodes. 0131 // 0132 public: 0133 /** 0134 * Check whether the view has selected items. 0135 */ 0136 virtual bool hasSelection() const = 0; 0137 0138 /** 0139 * Unselect all selected items (without deleting the selected items). 0140 */ 0141 virtual void clearSelection() = 0; 0142 0143 /** 0144 * Returns the selected items in the scene. 0145 */ 0146 virtual QList<TikzItem *> selectedItems() const = 0; 0147 0148 Q_SIGNALS: 0149 /** 0150 * This signal is emitted whenever the \p view's selection changes. 0151 */ 0152 void selectionChanged(tikz::ui::View * view); 0153 0154 private: 0155 /** 0156 * private d-pointer, pointing to the internal implementation 0157 */ 0158 ViewPrivate * const d; 0159 }; 0160 0161 } 0162 } 0163 0164 #endif // TIKZUI_VIEW_H 0165 0166 // kate: indent-width 4; replace-tabs on;