1
/* This file is part of the KDE project
3
Copyright (c) 2010 Cyril Oblikov <munknex@gmail.com>
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public
7
License as published by the Free Software Foundation; either
8
version 2 of the License, or (at your option) any later version.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Library General Public License for more details.
15
You should have received a copy of the GNU Library General Public License
16
along with this library; see the file COPYING.LIB. If not, write to
17
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
* Boston, MA 02110-1301, USA.
24
#include <KoInteractionTool.h>
30
class KoInteractionStrategy;
31
class TreeShapeMoveCommand;
36
* The Tree tool implements interactions you have with trees.
37
* <p>Note that the implementation of those different strategies are delegated
38
* to the InteractionStrategy class and its subclasses.
40
class TreeTool : public KoInteractionTool
45
* Constructor for basic interaction tool where user actions are translated
46
* and handled by interaction strategies of type KoInteractionStrategy.
47
* @param canvas the canvas this tool will be working for.
49
explicit TreeTool(KoCanvasBase *canvas);
51
virtual void paint(QPainter &painter, const KoViewConverter &converter);
52
virtual void repaintDecorations();
54
virtual void copy() const;
55
virtual void deleteSelection();
57
virtual QStringList supportedPasteMimeTypes() const;
59
virtual KoToolSelection* selection();
62
void updateConfigWidget(TreeShape *tree);
65
virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
67
void changeStructure(int index);
68
void changeShape(int index);
69
void changeConnectionType(int index);
72
/// Grabs TreeShapes from selection on selection change
77
virtual void mousePressEvent(KoPointerEvent *event);
78
virtual void mouseMoveEvent(KoPointerEvent *event);
79
virtual void mouseReleaseEvent(KoPointerEvent *event);
80
virtual void mouseDoubleClickEvent(KoPointerEvent *event);
82
virtual void keyPressEvent(QKeyEvent *event);
85
virtual KoInteractionStrategy *createStrategy(KoPointerEvent *event);
86
virtual QMap<QString, QWidget *> createOptionWidgets();
90
void updateConfigWidget();
91
bool moveSelection(int direction, Qt::KeyboardModifiers modifiers);
93
// convenience method;
94
KoSelection * koSelection();
96
QList<TreeShape*> m_selectedTrees;
97
KoFlake::Position m_hotPosition;
98
bool m_mouseWasInsideHandles;
99
TreeShapeMoveCommand *m_moveCommand;
101
KoToolSelection *m_selectionHandler;
102
friend class SelectionHandler;
103
KoInteractionStrategy * m_customEventStrategy;