kaddressbook

kaddressbookiconview.h

00001 /*
00002     This file is part of KAddressBook.
00003     Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (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     As a special exception, permission is given to link this program
00020     with any edition of TQt, and distribute the resulting executable,
00021     without including the source code for TQt in the source distribution.
00022 */
00023 
00024 #ifndef KADDRESSBOOKICONVIEW_H
00025 #define KADDRESSBOOKICONVIEW_H
00026 
00027 #include <tqstring.h>
00028 #include <kiconview.h>
00029 #include "kaddressbookview.h"
00030 
00031 class TQIconViewItem;
00032 class KConfig;
00033 class AddresseeIconView;
00034 class AddresseeIconViewItem;
00035 
00036 namespace KABC { class AddressBook; }
00037 
00042 class KAddressBookIconView : public KAddressBookView
00043 {
00044   Q_OBJECT
00045   TQ_OBJECT
00046 
00047   public:
00048     KAddressBookIconView( KAB::Core *core, TQWidget *parent,
00049                           const char *name = 0 );
00050     virtual ~KAddressBookIconView();
00051 
00052     virtual TQStringList selectedUids();
00053     virtual TQString type() const { return "Icon"; }
00054     virtual KABC::Field *sortField() const;
00055     virtual void readConfig( KConfig *config );
00056 
00057     void scrollUp();
00058     void scrollDown();
00059 
00060   public slots:
00061     void refresh( const TQString &uid = TQString() );
00062     void setSelected( const TQString &uid = TQString(), bool selected = true );
00063     virtual void setFirstSelected( bool selected = true );
00064 
00065   protected slots:
00066     void addresseeExecuted( TQIconViewItem *item );
00067     void addresseeSelected();
00068     void rmbClicked( TQIconViewItem*, const TQPoint& );
00069 
00070   private:
00071     AddresseeIconView *mIconView;
00072     TQPtrList<AddresseeIconViewItem> mIconList;
00073 };
00074 
00075 
00076 class AddresseeIconView : public KIconView
00077 {
00078   Q_OBJECT
00079   TQ_OBJECT
00080 
00081   public:
00082     AddresseeIconView( TQWidget *parent, const char *name = 0 );
00083     ~AddresseeIconView();
00084 
00085   signals:
00086     void addresseeDropped( TQDropEvent* );
00087     void startAddresseeDrag();
00088 
00089   protected:
00090     virtual TQDragObject *dragObject();
00091 
00092   protected slots:
00093     void itemDropped( TQDropEvent*, const TQValueList<TQIconDragItem>& );
00094 };
00095 #endif