karbon

vgradienttool.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 __VGRADIENTTOOL_H__
00021 #define __VGRADIENTTOOL_H__
00022 
00023 #include <kdialogbase.h>
00024 
00025 #include "vtool.h"
00026 #include "vgradient.h"
00027 #include "KoRect.h"
00028 
00029 class VGradientTabWidget;
00030 
00031 class VGradientTool : public VTool
00032 {
00033     Q_OBJECT
00034 
00035 public:
00036     VGradientTool( KarbonView *view );
00037     virtual ~VGradientTool();
00038 
00039     virtual void activate();
00040     virtual void deactivate();
00041 
00042     virtual void setup(KActionCollection *collection);
00043     virtual QString uiname() { return i18n( "Gradient Tool" ); }
00044     virtual QString statusText();
00045 
00046     virtual QString contextHelp();
00047     virtual bool showDialog() const;
00048 
00049     virtual void draw( VPainter* painter );
00050 
00051 protected:
00052 
00053     virtual void draw();
00054     virtual void mouseButtonRelease();
00055     virtual void mouseButtonPress();
00056     virtual void mouseDragRelease();
00057     virtual void mouseDrag();
00058     virtual void cancel();
00059     virtual void setCursor() const;
00060     virtual bool keyReleased( Qt::Key key );
00061 
00068     bool getGradient( VGradient &gradient );
00069 
00070     bool getOpacity( double &opacity );
00071 
00072 protected slots:
00073     void targetChanged();
00074 
00075 private:
00076     enum { normal, moveOrigin, moveVector, moveCenter, createNew } m_state;
00077 
00078     class VGradientOptionsWidget : public KDialogBase
00079     {
00080     public:
00081         VGradientOptionsWidget( VGradient& gradient );
00082         VGradientTabWidget *gradientWidget() { return m_gradientWidget; }
00083     private:
00084         VGradientTabWidget *m_gradientWidget;
00085     };
00086     VGradient            m_gradient; 
00087     KoPoint              m_current;  
00088     KoPoint              m_fixed;    
00089     VGradientOptionsWidget*  m_optionsWidget; 
00090     KoRect               m_origin;   
00091     KoRect               m_vector;   
00092     KoRect               m_center;   
00093     int                  m_handleSize; 
00094     bool                 m_active;   
00095 };
00096 
00097 #endif
00098 
KDE Home | KDE Accessibility Home | Description of Access Keys