Warning, file /graphics/tikzkit/src/ui/tools/ProxyTool.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the TikZKit project. 0002 * 0003 * Copyright (C) 2014 Dominik Haumann <dhaumann@kde.org> 0004 * 0005 * This library is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU Library General Public License as published 0007 * by the Free Software Foundation, either version 2 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, see 0017 * <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef TIKZ_UI_PROXY_TOOL_H 0021 #define TIKZ_UI_PROXY_TOOL_H 0022 0023 #include "AbstractTool.h" 0024 0025 namespace tikz { 0026 namespace ui { 0027 0028 /** 0029 * Depending on the selected items in the graphics scene, the ProxyTool 0030 * redirects all events to the correct tool. For instance, if a NodeItem 0031 * is selected, all events are redirected to the NodeTool. 0032 */ 0033 class ProxyTool : public AbstractTool 0034 { 0035 Q_OBJECT 0036 0037 public: 0038 /** 0039 * Constructor with graphics scene @p scene. 0040 */ 0041 ProxyTool(tikz::ui::Document * doc, QGraphicsScene * scene); 0042 0043 /** 0044 * Virtual destructor. 0045 */ 0046 virtual ~ProxyTool(); 0047 0048 // 0049 // sub classes: reimplement as needed 0050 // 0051 public: 0052 /** 0053 * This function is called whenever the mouse enters the graphics scene. 0054 * The default implementation does nothing. 0055 */ 0056 void mouseEnteredScene() override; 0057 0058 /** 0059 * This function is called whenever the mouse leaves the graphics scene. 0060 * The default implementation does nothing. 0061 */ 0062 void mouseLeftScene() override; 0063 0064 /** 0065 * This function is called whenever the mouse moves in the graphics 0066 * scene. 0067 */ 0068 void mouseMoveEvent(QGraphicsSceneMouseEvent * event) override; 0069 0070 /** 0071 * This function is called whenever a mouse button is pressed in the 0072 * graphics scene. 0073 */ 0074 void mousePressEvent(QGraphicsSceneMouseEvent * event) override; 0075 0076 /** 0077 * This function is called whenever a mouse button is released in the 0078 * graphics scene. 0079 */ 0080 void mouseReleaseEvent(QGraphicsSceneMouseEvent * event) override; 0081 0082 /** 0083 * This function is called whenever a key is pressed. 0084 * By default, the key press event is ignored. 0085 * @param event key event 0086 */ 0087 void keyPressEvent(QKeyEvent * event) override; 0088 0089 // 0090 // internal to ProxyTool 0091 // 0092 protected Q_SLOTS: 0093 /** 0094 * This slot is called whenever the selection in the scene() changed. 0095 * The correct tool to forward all events needs to be instantiated then. 0096 */ 0097 void updateTool(); 0098 0099 private: 0100 // all events are redirected to this tool 0101 AbstractTool * m_tool; 0102 }; 0103 0104 } 0105 } 0106 0107 #endif // TIKZ_UI_PROXY_TOOL_H 0108 0109 // kate: indent-width 4; replace-tabs on;