KDEUI
kactionselector.h
Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef _KACTION_SELECTOR_H_ 00020 #define _KACTION_SELECTOR_H_ 00021 00022 #include <kdeui_export.h> 00023 #include <QtGui/QWidget> 00024 00025 class QListWidget; 00026 class QListWidgetItem; 00027 class QKeyEvent; 00028 class QEvent; 00029 class QIcon; 00030 00031 class KActionSelectorPrivate; 00032 00080 class KDEUI_EXPORT KActionSelector : public QWidget { 00081 Q_OBJECT 00082 Q_ENUMS( InsertionPolicy MoveButton ) 00083 Q_PROPERTY( bool moveOnDoubleClick READ moveOnDoubleClick WRITE setMoveOnDoubleClick ) 00084 Q_PROPERTY( bool keyboardEnabled READ keyboardEnabled WRITE setKeyboardEnabled ) 00085 Q_PROPERTY( QString availableLabel READ availableLabel WRITE setAvailableLabel ) 00086 Q_PROPERTY( QString selectedLabel READ selectedLabel WRITE setSelectedLabel ) 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 explicit KActionSelector( QWidget *parent=0 ); 00093 ~KActionSelector(); 00094 00098 QListWidget *availableListWidget() const; 00099 00103 QListWidget *selectedListWidget() const; 00104 00108 enum MoveButton { 00109 ButtonAdd, 00110 ButtonRemove, 00111 ButtonUp, 00112 ButtonDown 00113 }; 00114 00127 enum InsertionPolicy { 00128 BelowCurrent, 00129 Sorted, 00130 AtTop, 00131 AtBottom 00132 }; 00133 00142 bool moveOnDoubleClick() const; 00143 00148 void setMoveOnDoubleClick( bool enable ); 00149 00168 bool keyboardEnabled() const; 00169 00174 void setKeyboardEnabled( bool enable ); 00175 00179 QString availableLabel() const; 00180 00187 void setAvailableLabel( const QString & text ); 00188 00192 QString selectedLabel() const; 00193 00200 void setSelectedLabel( const QString & text ); 00201 00207 InsertionPolicy availableInsertionPolicy() const; 00208 00213 void setAvailableInsertionPolicy( InsertionPolicy policy ); 00214 00220 InsertionPolicy selectedInsertionPolicy() const; 00221 00226 void setSelectedInsertionPolicy( InsertionPolicy policy ); 00227 00231 bool showUpDownButtons() const; 00232 00237 void setShowUpDownButtons( bool show ); 00238 00243 void setButtonIcon( const QString &icon, MoveButton button ); 00244 00251 void setButtonIconSet( const QIcon &iconset, MoveButton button ); 00252 00256 void setButtonTooltip( const QString &tip, MoveButton button ); 00257 00261 void setButtonWhatsThis( const QString &text, MoveButton button ); 00262 00270 void setButtonsEnabled(); 00271 00272 Q_SIGNALS: 00276 void added( QListWidgetItem *item ); 00277 00281 void removed( QListWidgetItem *item ); 00282 00286 void movedUp( QListWidgetItem *item ); 00287 00291 void movedDown( QListWidgetItem *item ); 00292 00296 // void addedToSelection( QListWidgetItem *item ); 00297 00298 public Q_SLOTS: 00303 void polish(); 00304 00305 protected: 00309 void keyPressEvent( QKeyEvent * ); 00310 00314 bool eventFilter( QObject *, QEvent * ); 00315 00316 private: 00320 Q_PRIVATE_SLOT(d, void buttonAddClicked()) 00321 00322 00325 Q_PRIVATE_SLOT(d, void buttonRemoveClicked()) 00326 00330 Q_PRIVATE_SLOT(d, void buttonUpClicked()) 00331 00335 Q_PRIVATE_SLOT(d, void buttonDownClicked()) 00336 00340 Q_PRIVATE_SLOT(d, void itemDoubleClicked( QListWidgetItem *item )) 00341 00345 Q_PRIVATE_SLOT(d, void slotCurrentChanged( QListWidgetItem * )) 00346 00347 private: 00348 00352 friend class KActionSelectorPrivate; 00353 KActionSelectorPrivate * const d; 00354 00355 Q_DISABLE_COPY(KActionSelector) 00356 }; 00357 00358 #endif // _KACTION_SELECTOR_H_
KDE 4.6 API Reference