kitchensync

partbar.h

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
00005     Copyright (c) 2002 Maximilian Reiß <harlekin@handhelds.org>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 #ifndef PARTBAR_H
00023 #define PARTBAR_H
00024 
00025 #include <klistbox.h>
00026 #include <kicontheme.h>
00027 
00028 #include <qlistbox.h>
00029 #include <qevent.h>
00030 
00031 namespace KSync {
00032 
00033 class PartBar;
00034 class ActionPart;
00035 
00039 class PartBarItem : public QListBoxPixmap
00040 {
00041   public:
00042     PartBarItem( PartBar *, ActionPart * );
00043     ~PartBarItem();
00044 
00048     ActionPart *part();
00049 
00055     void setIcon( const QString& icon, KIcon::Group group = KIcon::Panel );
00056 
00057 
00061     virtual int width( const QListBox * ) const;
00062 
00066     virtual int height( const QListBox * ) const;
00067 
00071     virtual const QPixmap * pixmap() const {
00072       return m_Pixmap;
00073     }
00074 
00075   protected:
00076     virtual void paint( QPainter *p);
00077 
00078   private:
00079     QPixmap *m_Pixmap;
00080     ActionPart *m_Part;
00081     PartBar *m_Parents;
00082     QPixmap mArrowPixmap;
00083 };
00084 
00085 
00090 class PartBar  : public QFrame
00091 {
00092     Q_OBJECT
00093   public:
00094     PartBar( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
00095     ~PartBar() {};
00096 
00097     virtual PartBarItem *insertItem( ActionPart *part, int pos = -1 );
00098 
00103     virtual void setListBox(  KListBox * );
00104 
00108     KListBox *listBox() const { return m_listBox; }
00109 
00113     virtual void clear();
00114 
00118     virtual QSize sizeHint() const;
00119 
00120     virtual QSize minimumSizeHint() const;
00121 
00125     PartBarItem *currentItem() const;
00126 
00127     void selectPart( const QString & );
00128 
00129   signals:
00130     void activated( ActionPart *part );
00131 
00132   protected slots:
00133     virtual void slotSelected( QListBoxItem * );
00134 
00135   protected:
00136     virtual void resizeEvent( QResizeEvent * );
00137 
00138   private:
00139     KListBox *m_listBox;
00140     PartBarItem *m_activeItem;
00141 };
00142 
00143 }
00144 
00145 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys