kdeui Library API Documentation

kactionselector.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
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 version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00016    Boston, MA 02111-1307, USA.
00017 */
00018 
00019 #ifndef _KACTION_SELECTOR_H_
00020 #define _KACTION_SELECTOR_H_
00021 
00022 #include <qwidget.h>
00023 
00024 class QListBox;
00025 class QListBoxItem;
00026 class QKeyEvent;
00027 class QEvent;
00028 class QIconSet;
00029 
00030 class KActionSelectorPrivate;
00031 
00076 class KActionSelector : public QWidget {
00077   Q_OBJECT
00078   Q_ENUMS( ButtonIconSize InsertionPolicy )
00079   Q_PROPERTY( bool moveOnDoubleClick READ moveOnDoubleClick WRITE setMoveOnDoubleClick )
00080   Q_PROPERTY( bool keyboardEnabled READ keyboardEnabled WRITE setKeyboardEnabled )
00081   Q_PROPERTY( QString availableLabel READ availableLabel WRITE setAvailableLabel )
00082   Q_PROPERTY( QString selectedLabel READ selectedLabel WRITE setSelectedLabel )
00083   Q_PROPERTY( ButtonIconSize buttonIconSize READ buttonIconSize WRITE setButtonIconSize )
00084   Q_PROPERTY( InsertionPolicy availableInsertionPolicy READ availableInsertionPolicy WRITE setAvailableInsertionPolicy )
00085   Q_PROPERTY( InsertionPolicy selectedInsertionPolicy READ selectedInsertionPolicy WRITE setSelectedInsertionPolicy )
00086   Q_PROPERTY( bool showUpDownButtons READ showUpDownButtons WRITE setShowUpDownButtons )
00087 
00088 public:
00089   KActionSelector( QWidget *parent=0, const char *name=0 );
00090   ~KActionSelector();
00091 
00095   QListBox *availableListBox() const;
00096 
00100   QListBox *selectedListBox() const;
00101 
00105   enum MoveButton {
00106     ButtonAdd,
00107     ButtonRemove,
00108     ButtonUp,
00109     ButtonDown
00110   };
00111 
00122   enum ButtonIconSize {
00123     SmallIcon,
00124     Small,
00125     Medium,
00126     Large,
00127     XLarge
00128   };
00129 
00142   enum InsertionPolicy {
00143     BelowCurrent,
00144     Sorted,
00145     AtTop,
00146     AtBottom
00147   };
00148 
00156   bool moveOnDoubleClick() const;
00157 
00162   void setMoveOnDoubleClick( bool enable );
00163 
00182   bool keyboardEnabled() const;
00183 
00188   void setKeyboardEnabled( bool enable );
00189 
00193   QString availableLabel() const;
00194 
00201   void setAvailableLabel( const QString & text );
00202 
00206   QString selectedLabel() const;
00207 
00214   void setSelectedLabel( const QString & text );
00215 
00219   ButtonIconSize buttonIconSize() const;
00220 
00225   void setButtonIconSize( ButtonIconSize size );
00226 
00232   InsertionPolicy availableInsertionPolicy() const;
00233 
00238   void setAvailableInsertionPolicy( InsertionPolicy policy );
00239 
00245   InsertionPolicy selectedInsertionPolicy() const;
00246 
00251   void setSelectedInsertionPolicy( InsertionPolicy policy );
00252 
00256   bool showUpDownButtons() const;
00257 
00262   void setShowUpDownButtons( bool show );
00263 
00268   void setButtonIcon( const QString &icon, MoveButton button );
00269 
00276   void setButtonIconSet( const QIconSet &iconset, MoveButton button );
00277 
00281   void setButtonTooltip( const QString &tip, MoveButton button );
00282 
00286   void setButtonWhatsThis( const QString &text, MoveButton button );
00287 
00295   void setButtonsEnabled();
00296 
00297 signals:
00301   void added( QListBoxItem *item );
00302 
00306   void removed( QListBoxItem *item );
00307 
00311   void movedUp( QListBoxItem *item );
00312 
00316   void movedDown( QListBoxItem *item );
00317 
00321 //  void addedToSelection( QListBoxItem *item );
00322 
00323 public slots:
00328   void polish();
00329 
00330 protected:
00334   void keyPressEvent( QKeyEvent * );
00335 
00339   bool eventFilter( QObject *, QEvent * );
00340 
00341 private slots:
00345   void buttonAddClicked();
00346 
00350   void buttonRemoveClicked();
00351 
00355   void buttonUpClicked();
00356 
00360   void buttonDownClicked();
00361 
00365   void  itemDoubleClicked( QListBoxItem *item );
00366 
00370   void slotCurrentChanged( QListBoxItem * ) { setButtonsEnabled(); };
00371 
00372 private:
00373 
00377   void moveItem( QListBoxItem *item );
00378 
00382   void loadIcons();
00383 
00391   int insertionIndex( QListBox *lb, InsertionPolicy policy );
00392 
00396   KActionSelectorPrivate *d;
00397 };
00398 
00399 #endif // _KACTION_SELECTOR_H_
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Jan 15 13:32:49 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003