karbon

vselecttool.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001, 2002, 2003 The Karbon Developers
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef __VSELECTTOOL_H__
00021 #define __VSELECTTOOL_H__
00022 
00023 #include <kdialogbase.h>
00024 #include <klocale.h>
00025 
00026 #include "vtool.h"
00027 
00028 class KarbonView;
00029 
00030 class VSelectOptionsWidget : public KDialogBase
00031 {
00032 Q_OBJECT
00033 
00034 public:
00035     VSelectOptionsWidget( KarbonPart* part );
00036 
00037 public slots:
00038     void modeChange( int mode );
00039 
00040 private:
00041     KarbonPart*     m_part;
00042 }; // VSelectOptionsWidget
00043 
00044 class VSelectTool : public VTool
00045 {
00046 Q_OBJECT
00047 
00048 public:
00049     VSelectTool( KarbonView *view );
00050     virtual ~VSelectTool();
00051 
00052     virtual void setup(KActionCollection *collection);
00053     virtual bool showDialog() const;
00054     virtual QString uiname() { return i18n( "Select Tool" ); }
00055     virtual enumToolType toolType() { return TOOL_SELECT; }
00056     virtual QString statusText();
00057     virtual uint priority() { return 0; }
00058     virtual QString contextHelp();
00059 
00060     virtual void refreshUnit();
00061 
00062     virtual void activate();
00063 
00064 protected:
00065     virtual void draw();
00066 
00067     virtual void setCursor() const;
00068 
00069     virtual void mouseButtonPress();
00070     virtual void rightMouseButtonPress();
00071     virtual void mouseButtonRelease();
00072     virtual void rightMouseButtonRelease();
00073     virtual void mouseDrag();
00074     virtual void mouseDragRelease();
00075     virtual void mouseDragCtrlPressed();
00076     virtual void mouseDragCtrlReleased();
00077     virtual void mouseDragShiftPressed();
00078     virtual void mouseDragShiftReleased();
00079     virtual void arrowKeyReleased( Qt::Key );
00080     virtual bool keyReleased( Qt::Key );
00081 
00082     virtual void cancel();
00083 
00084 protected slots:
00085     void updateStatusBar() const;
00086 
00087 private:
00088     enum { normal, moving, scaling, rotating } m_state;
00089     bool m_lock;
00090     // controls if objects are added to or removed from the selection
00091     bool m_add;
00092     double m_s1;
00093     double m_s2;
00094     double m_distx;
00095     double m_disty;
00096     KoPoint m_sp;
00097     KoPoint m_current;
00098 
00099     VHandleNode m_activeNode;
00100 
00101     void recalc();
00102 
00103     // A list of temporary objects:
00104     VObjectList m_objects;
00105     // The options widget.
00106     VSelectOptionsWidget    *m_optionsWidget;
00107 };
00108 
00109 #endif
00110 
KDE Home | KDE Accessibility Home | Description of Access Keys