karbon

vgradienttool.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 __VGRADIENTTOOL_H__
21#define __VGRADIENTTOOL_H__
22
23#include <kdialogbase.h>
24
25#include "vtool.h"
26#include "vgradient.h"
27#include "KoRect.h"
28
29class VGradientTabWidget;
30
31class VGradientTool : public VTool
32{
33 TQ_OBJECT
34
35
36public:
37 VGradientTool( KarbonView *view );
38 virtual ~VGradientTool();
39
40 virtual void activate();
41 virtual void deactivate();
42
43 virtual void setup(TDEActionCollection *collection);
44 virtual TQString uiname() { return i18n( "Gradient Tool" ); }
45 virtual TQString statusText();
46
47 virtual TQString contextHelp();
48 virtual bool showDialog() const;
49
50 virtual void draw( VPainter* painter );
51
52protected:
53
54 virtual void draw();
55 virtual void mouseButtonRelease();
56 virtual void mouseButtonPress();
57 virtual void mouseDragRelease();
58 virtual void mouseDrag();
59 virtual void cancel();
60 virtual void setCursor() const;
61 virtual bool keyReleased( TQt::Key key );
62
69 bool getGradient( VGradient &gradient );
70
71 bool getOpacity( double &opacity );
72
73protected slots:
74 void targetChanged();
75
76private:
77 enum { normal, moveOrigin, moveVector, moveCenter, createNew } m_state;
78
79 class VGradientOptionsWidget : public KDialogBase
80 {
81 public:
82 VGradientOptionsWidget( VGradient& gradient );
83 VGradientTabWidget *gradientWidget() { return m_gradientWidget; }
84 private:
85 VGradientTabWidget *m_gradientWidget;
86 };
87 VGradient m_gradient;
88 KoPoint m_current;
89 KoPoint m_fixed;
90 VGradientOptionsWidget* m_optionsWidget;
91 KoRect m_origin;
92 KoRect m_vector;
93 KoRect m_center;
94 int m_handleSize;
95 bool m_active;
96};
97
98#endif
99
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 bool keyReleased(TQt::Key)
Specified key released.
Definition vtool.h:250
virtual void mouseButtonRelease()
Left mouse button release.
Definition vtool.h:195
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 deactivate()
Deactivates the tool.
Definition vtool.h:83
virtual void activate()
Called during the tool activation.
Definition vtool.cpp:252
virtual TQString contextHelp()
The context help of the tool.
Definition vtool.h:98
virtual void setup(TDEActionCollection *)
Called after tool creation.
Definition vtool.h:144
virtual void setCursor() const
This function is called on each mouse event the tool receives.
Definition vtool.h:180
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