kdeui Library: kactionselector.h Source File (kdeui Library)

| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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 #include <kdelibs_export.h>
    00025
    00026 class QListBox;
    00027 class QListBoxItem;
    00028 class QKeyEvent;
    00029 class QEvent;
    00030 class QIconSet;
    00031
    00032 class KActionSelectorPrivate;
    00033
    00079 class KDEUI_EXPORT KActionSelector : public QWidget {
    00080   Q_OBJECT
    00081   Q_ENUMS( ButtonIconSize InsertionPolicy )
    00082   Q_PROPERTY( bool moveOnDoubleClick READ moveOnDoubleClick WRITE setMoveOnDoubleClick )
    00083   Q_PROPERTY( bool keyboardEnabled READ keyboardEnabled WRITE setKeyboardEnabled )
    00084   Q_PROPERTY( QString availableLabel READ availableLabel WRITE setAvailableLabel )
    00085   Q_PROPERTY( QString selectedLabel READ selectedLabel WRITE setSelectedLabel )
    00086   Q_PROPERTY( ButtonIconSize buttonIconSize READ buttonIconSize WRITE setButtonIconSize )
    00087   Q_PROPERTY( InsertionPolicy availableInsertionPolicy READ availableInsertionPolicy WRITE setAvailableInsertionPolicy )
    00088   Q_PROPERTY( InsertionPolicy selectedInsertionPolicy READ selectedInsertionPolicy WRITE setSelectedInsertionPolicy )
    00089   Q_PROPERTY( bool showUpDownButtons READ showUpDownButtons WRITE setShowUpDownButtons )
    00090
    00091 public:
    00092   KActionSelector( QWidget *parent=0, const char *name=0 );
    00093   ~KActionSelector();
    00094
    00098   QListBox *availableListBox() const;
    00099
    00103   QListBox *selectedListBox() const;
    00104
    00108   enum MoveButton {
    00109     ButtonAdd,
    00110     ButtonRemove,
    00111     ButtonUp,
    00112     ButtonDown
    00113   };
    00114
    00125   enum ButtonIconSize {
    00126     SmallIcon,
    00127     Small,
    00128     Medium,
    00129     Large,
    00130     XLarge
    00131   };
    00132
    00145   enum InsertionPolicy {
    00146     BelowCurrent,
    00147     Sorted,
    00148     AtTop,
    00149     AtBottom
    00150   };
    00151
    00159   bool moveOnDoubleClick() const;
    00160
    00165   void setMoveOnDoubleClick( bool enable );
    00166
    00185   bool keyboardEnabled() const;
    00186
    00191   void setKeyboardEnabled( bool enable );
    00192
    00196   QString availableLabel() const;
    00197
    00204   void setAvailableLabel( const QString & text );
    00205
    00209   QString selectedLabel() const;
    00210
    00217   void setSelectedLabel( const QString & text );
    00218
    00222   ButtonIconSize buttonIconSize() const;
    00223
    00228   void setButtonIconSize( ButtonIconSize size );
    00229
    00235   InsertionPolicy availableInsertionPolicy() const;
    00236
    00241   void setAvailableInsertionPolicy( InsertionPolicy policy );
    00242
    00248   InsertionPolicy selectedInsertionPolicy() const;
    00249
    00254   void setSelectedInsertionPolicy( InsertionPolicy policy );
    00255
    00259   bool showUpDownButtons() const;
    00260
    00265   void setShowUpDownButtons( bool show );
    00266
    00271   void setButtonIcon( const QString &icon, MoveButton button );
    00272
    00279   void setButtonIconSet( const QIconSet &iconset, MoveButton button );
    00280
    00284   void setButtonTooltip( const QString &tip, MoveButton button );
    00285
    00289   void setButtonWhatsThis( const QString &text, MoveButton button );
    00290
    00298   void setButtonsEnabled();
    00299
    00300 signals:
    00304   void added( QListBoxItem *item );
    00305
    00309   void removed( QListBoxItem *item );
    00310
    00314   void movedUp( QListBoxItem *item );
    00315
    00319   void movedDown( QListBoxItem *item );
    00320
    00324 //  void addedToSelection( QListBoxItem *item );
    00325
    00326 public slots:
    00331   void polish();
    00332
    00333 protected:
    00337   void keyPressEvent( QKeyEvent * );
    00338
    00342   bool eventFilter( QObject *, QEvent * );
    00343
    00344 private slots:
    00348   void buttonAddClicked();
    00349
    00353   void buttonRemoveClicked();
    00354
    00358   void buttonUpClicked();
    00359
    00363   void buttonDownClicked();
    00364
    00368   void  itemDoubleClicked( QListBoxItem *item );
    00369
    00373   void slotCurrentChanged( QListBoxItem * ) { setButtonsEnabled(); };
    00374
    00375 private:
    00376
    00380   void moveItem( QListBoxItem *item );
    00381
    00385   void loadIcons();
    00386
    00394   int insertionIndex( QListBox *lb, InsertionPolicy policy );
    00395
    00399   KActionSelectorPrivate *d;
    00400 };
    00401
    00402 #endif // _KACTION_SELECTOR_H_

This file is part of the documentation for kdeui Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:20:13 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003