karbon

vpatterntool.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 __VPATTERNTOOL_H__
21#define __VPATTERNTOOL_H__
22
23#include <kdialogbase.h>
24
25#include "vtool.h"
26#include "vpattern.h"
27#include "KoRect.h"
28
29class TQHButtonGroup;
30class TQToolButton;
31class KoIconChooser;
32
33class VPatternWidget : public KDialogBase
34{
35TQ_OBJECT
36
37
38public:
39 VPatternWidget( TQPtrList<KoIconItem>* patterns, VTool* tool, TQWidget* parent = 0L );
40 ~VPatternWidget();
41
42 VPattern* selectedPattern();
43
44public slots:
45 void importPattern();
46 void deletePattern();
47
48 void slotButtonClicked( int id );
49 void patternSelected( KoIconItem* );
50
51private:
52 KoIconChooser* m_patternChooser;
53 TQHButtonGroup* m_buttonGroup;
54 TQToolButton* m_importPatternButton;
55 TQToolButton* m_deletePatternButton;
56 VTool* m_tool;
57 VPattern* m_pattern;
58}; // VPatternWidget
59
60
61class VPatternTool : public VTool
62{
63 TQ_OBJECT
64
65
66public:
67 VPatternTool( KarbonView *view );
68 virtual ~VPatternTool();
69
70 virtual void activate();
71 virtual void deactivate();
72
73 virtual void setup(TDEActionCollection *collection);
74 virtual TQString uiname() { return i18n( "Pattern Tool" ); }
75 virtual TQString contextHelp();
76 virtual bool showDialog() const;
77
78 virtual void draw( VPainter* painter );
79
80protected:
81 virtual void draw();
82
83 virtual void mouseButtonRelease();
84 virtual void mouseButtonPress();
85 virtual void mouseDragRelease();
86 virtual void mouseDrag();
87 /*virtual void mouseDragShiftPressed(); // To use to scale the pattern.
88 virtual void mouseDragShiftReleased(); */
89 virtual void cancel();
90 virtual void setCursor() const;
91 virtual bool keyReleased( TQt::Key key );
92
99 bool getPattern( VPattern &pattern );
100
101protected slots:
102 void targetChanged();
103
104private:
105 enum { normal, moveOrigin, moveVector, createNew } m_state;
106
107 VPattern m_pattern;
108 KoPoint m_current;
109 KoPoint m_fixed;
110 VPatternWidget* m_optionsWidget;
111 KoRect m_origin;
112 KoRect m_vector;
113 int m_handleSize;
114 bool m_active;
115}; // VPatternTool
116
117#endif /* __VPATTERNTOOL_H__ */
118
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 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 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 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