kivio

kivio_icon_view.h

00001 /*
00002  * Kivio - Visual Modelling and Flowcharting
00003  * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program 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
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  */
00019 #ifndef KIVIO_ICON_VIEW_H
00020 #define KIVIO_ICON_VIEW_H
00021 
00022 #include <qdom.h>
00023 #include <qiconview.h>
00024 #include <qptrlist.h>
00025 #include <qpainter.h>
00026 #include <qpalette.h>
00027 #include <qpixmap.h>
00028 #include <qdragobject.h>
00029 
00030 class KivioStencilSpawnerSet;
00031 class KivioStencilSpawner;
00032 
00033 class KivioIconView : public QIconView
00034 {
00035   Q_OBJECT
00036   protected:
00037     KivioStencilSpawnerSet *m_pSpawnerSet;
00038     static KivioStencilSpawner *m_pCurDrag;
00039 
00040     QDragObject *dragObject();
00041 
00042   protected slots:
00043     void slotDoubleClicked(QIconViewItem*);
00044     void slotClicked(QIconViewItem* item);
00045 
00046   signals:
00047     void createNewStencil(KivioStencilSpawner * );
00048     void stencilSelected(KivioStencilSpawner*);
00049 
00050   public:
00051     KivioIconView( bool _readWrite,QWidget *parent=0, const char *name=0 );
00052     virtual ~KivioIconView();
00053 
00054     static void clearCurrentDrag();
00055     static KivioStencilSpawner *curDragSpawner() { return m_pCurDrag; }
00056 
00057     void setStencilSpawnerSet(KivioStencilSpawnerSet*);
00058     KivioStencilSpawnerSet *spawnerSet() { return m_pSpawnerSet; }
00059 
00060   private:
00061     static QPtrList<KivioIconView> objList;
00062     bool isReadWrite;
00063 };
00064 
00065 class KivioIconViewItem : public QIconViewItem
00066 {
00067   friend class KivioIconView;
00068 
00069   protected:
00070     KivioStencilSpawner *m_pSpawner;
00071 
00072   public:
00073     KivioIconViewItem( QIconView *parent );
00074     virtual ~KivioIconViewItem();
00075 
00076     void setStencilSpawner(KivioStencilSpawner*);
00077     KivioStencilSpawner *spawner() { return m_pSpawner; }
00078 
00079     virtual bool acceptDrop( const QMimeSource *e ) const;
00080 };
00081 
00082 
00083 #endif
00084 
KDE Home | KDE Accessibility Home | Description of Access Keys