karbon

vselection.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001, The Karbon Developers
00003    Copyright (C) 2002, The Karbon Developers
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef __VSELECTION_H__
00022 #define __VSELECTION_H__
00023 
00024 
00025 #include <qptrlist.h>
00026 
00027 #include <KoRect.h>
00028 
00029 #include "vobject.h"
00030 #include "vvisitor.h"
00031 #include <koffice_export.h>
00032 class KoPoint;
00033 class QObject;
00034 class VPainter;
00035 class VVisitor;
00036 class VSegment;
00037 
00038 typedef QPtrList<VObject> VObjectList;
00039 typedef QPtrListIterator<VObject> VObjectListIterator;
00040 
00041 
00043 enum VHandleNode
00044 {
00045     node_none = 0,
00046     node_lt = 1,
00047     node_mt = 2,
00048     node_rt = 3,
00049     node_lm = 4,
00050     node_mm = 5,
00051     node_rm = 6,
00052     node_lb = 7,
00053     node_mb = 8,
00054     node_rb = 9
00055 };
00056 
00057 
00061 class KARBONBASE_EXPORT VSelection : public VObject, public VVisitor
00062 {
00063 public:
00069     VSelection( VObject* parent = 0L );
00070 
00076     VSelection( const VSelection& selection );
00077 
00081     virtual ~VSelection();
00082 
00086     void draw( VPainter* painter, double zoomFactor ) const;
00087 
00088     virtual const KoRect& boundingBox() const;
00089 
00090     virtual VSelection* clone() const;
00091 
00092     virtual void accept( VVisitor& visitor );
00093 
00097     void append();
00098 
00102     void append( VObject* object );
00103 
00109     void append( const VObjectList &objects );
00110 
00115     bool append( const KoRect& rect, bool selectObjects = true, bool exclusive = true );
00116 
00120     void take( VObject& object );
00121 
00126     bool take( const KoRect& rect, bool selectObjects = true, bool exclusive = true );
00127 
00131     void clear();
00132 
00136     const VObjectList& objects() const { return m_objects; }
00137 
00144     QPtrList<VSegment> getSegments( const KoRect& rect );
00145 
00151     void selectNodes( bool select = true );
00152 
00159     VHandleNode handleNode( const KoPoint &point ) const;
00160 
00166     void showHandle( bool handle = true ) { m_showhandle = handle; }
00167 
00173     virtual void setSelectObjects( bool selectObjects = true ) { m_selectObjects = selectObjects; }
00174 
00175     static void setHandleSize( uint size )
00176         { m_handleNodeSize = size; }
00177 
00178     static uint handleSize()
00179         { return m_handleNodeSize; }
00180 private:
00184     bool m_showhandle;
00185 
00189     bool m_selectObjects;
00190 
00194     VObjectList m_objects;
00195 
00200     KoRect *m_handleRect;
00201 
00205     static uint m_handleNodeSize;
00206 };
00207 
00208 #endif
00209 
KDE Home | KDE Accessibility Home | Description of Access Keys