karbon

vselecttool.h
1/* This file is part of the KDE project
2 Copyright (C) 2001, 2002, 2003 The Karbon Developers
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef __VSELECTTOOL_H__
21#define __VSELECTTOOL_H__
22
23#include <kdialogbase.h>
24#include <tdelocale.h>
25
26#include "vtool.h"
27
28class KarbonView;
29
30class VSelectOptionsWidget : public KDialogBase
31{
32TQ_OBJECT
33
34
35public:
36 VSelectOptionsWidget( KarbonPart* part );
37
38public slots:
39 void modeChange( int mode );
40
41private:
42 KarbonPart* m_part;
43}; // VSelectOptionsWidget
44
45class VSelectTool : public VTool
46{
47TQ_OBJECT
48
49
50public:
51 VSelectTool( KarbonView *view );
52 virtual ~VSelectTool();
53
54 virtual void setup(TDEActionCollection *collection);
55 virtual bool showDialog() const;
56 virtual TQString uiname() { return i18n( "Select Tool" ); }
57 virtual enumToolType toolType() { return TOOL_SELECT; }
58 virtual TQString statusText();
59 virtual uint priority() { return 0; }
60 virtual TQString contextHelp();
61
62 virtual void refreshUnit();
63
64 virtual void activate();
65
66protected:
67 virtual void draw();
68
69 virtual void setCursor() const;
70
71 virtual void mouseButtonPress();
72 virtual void rightMouseButtonPress();
73 virtual void mouseButtonRelease();
74 virtual void rightMouseButtonRelease();
75 virtual void mouseDrag();
76 virtual void mouseDragRelease();
77 virtual void mouseDragCtrlPressed();
78 virtual void mouseDragCtrlReleased();
79 virtual void mouseDragShiftPressed();
80 virtual void mouseDragShiftReleased();
81 virtual void arrowKeyReleased( TQt::Key );
82 virtual bool keyReleased( TQt::Key );
83
84 virtual void cancel();
85
86protected slots:
87 void updateStatusBar() const;
88
89private:
90 enum { normal, moving, scaling, rotating } m_state;
91 bool m_lock;
92 // controls if objects are added to or removed from the selection
93 bool m_add;
94 double m_s1;
95 double m_s2;
96 double m_distx;
97 double m_disty;
98 KoPoint m_sp;
99 KoPoint m_current;
100
101 VHandleNode m_activeNode;
102
103 void recalc();
104
105 // A list of temporary objects:
106 VObjectList m_objects;
107 // The options widget.
108 VSelectOptionsWidget *m_optionsWidget;
109};
110
111#endif
112
The base class for all karbon tools.
Definition vtool.h:52
virtual void mouseDragRelease()
Mouse button release.
Definition vtool.h:220
virtual void mouseButtonPress()
Left mouse button press.
Definition vtool.h:185
virtual void rightMouseButtonRelease()
Right mouse button release.
Definition vtool.h:200
virtual void mouseButtonRelease()
Left mouse button release.
Definition vtool.h:195
virtual void mouseDragCtrlReleased()
"Ctrl" key released while mouse drag.
Definition vtool.h:240
virtual TQString uiname()
The name of the tool.
Definition vtool.h:93
virtual void cancel()
Cancels all tool operations.
Definition vtool.h:255
virtual TQString statusText()
The tool status text.
Definition vtool.h:108
virtual void activate()
Called during the tool activation.
Definition vtool.cpp:252
virtual void mouseDragCtrlPressed()
Mouse drag with "Ctrl" key pressed at the same time.
Definition vtool.h:230
virtual uint priority()
Position in toolbox.
Definition vtool.h:114
virtual void mouseDragShiftPressed()
Mouse drag with "Shift" key pressed at the same time.
Definition vtool.h:225
virtual void refreshUnit()
This function is called when the documents unit setting were changed.
Definition vtool.h:138
virtual void mouseDragShiftReleased()
"Shift" key released while mouse drag.
Definition vtool.h:235
virtual TQString contextHelp()
The context help of the tool.
Definition vtool.h:98
virtual void setCursor() const
This function is called on each mouse event the tool receives.
Definition vtool.h:180
virtual enumToolType toolType()
The tool type.
Definition vtool.h:103
virtual void rightMouseButtonPress()
Right mouse button press.
Definition vtool.h:190
virtual void mouseDrag()
Mouse drag.
Definition vtool.h:215
KarbonView * view() const
Returns the connected karbon part.
Definition vtool.cpp:66
virtual bool showDialog() const
Shows the tools option dialog.
Definition vtool.h:88