kactionselector.h
/* This file is part of the KDE project
Copyright (C) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KACTION_SELECTOR_H_
#define _KACTION_SELECTOR_H_
#include <qwidget.h>
#include <kdelibs_export.h>
class QListBox;
class QListBoxItem;
class QKeyEvent;
class QEvent;
class QIconSet;
class KActionSelectorPrivate;
class KDEUI_EXPORT KActionSelector : public QWidget {
Q_OBJECT
Q_ENUMS( ButtonIconSize InsertionPolicy )
Q_PROPERTY( bool moveOnDoubleClick READ moveOnDoubleClick WRITE setMoveOnDoubleClick )
Q_PROPERTY( bool keyboardEnabled READ keyboardEnabled WRITE setKeyboardEnabled )
Q_PROPERTY( QString availableLabel READ availableLabel WRITE setAvailableLabel )
Q_PROPERTY( QString selectedLabel READ selectedLabel WRITE setSelectedLabel )
Q_PROPERTY( ButtonIconSize buttonIconSize READ buttonIconSize WRITE setButtonIconSize )
Q_PROPERTY( InsertionPolicy availableInsertionPolicy READ availableInsertionPolicy WRITE setAvailableInsertionPolicy )
Q_PROPERTY( InsertionPolicy selectedInsertionPolicy READ selectedInsertionPolicy WRITE setSelectedInsertionPolicy )
Q_PROPERTY( bool showUpDownButtons READ showUpDownButtons WRITE setShowUpDownButtons )
public:
KActionSelector( QWidget *parent=0, const char *name=0 );
~KActionSelector();
QListBox *availableListBox() const;
QListBox *selectedListBox() const;
enum MoveButton {
ButtonAdd,
ButtonRemove,
ButtonUp,
ButtonDown
};
enum ButtonIconSize {
SmallIcon,
Small,
Medium,
Large,
XLarge
};
enum InsertionPolicy {
BelowCurrent,
Sorted,
AtTop,
AtBottom
};
bool moveOnDoubleClick() const;
void setMoveOnDoubleClick( bool enable );
bool keyboardEnabled() const;
void setKeyboardEnabled( bool enable );
QString availableLabel() const;
void setAvailableLabel( const QString & text );
QString selectedLabel() const;
void setSelectedLabel( const QString & text );
ButtonIconSize buttonIconSize() const;
void setButtonIconSize( ButtonIconSize size );
InsertionPolicy availableInsertionPolicy() const;
void setAvailableInsertionPolicy( InsertionPolicy policy );
InsertionPolicy selectedInsertionPolicy() const;
void setSelectedInsertionPolicy( InsertionPolicy policy );
bool showUpDownButtons() const;
void setShowUpDownButtons( bool show );
void setButtonIcon( const QString &icon, MoveButton button );
void setButtonIconSet( const QIconSet &iconset, MoveButton button );
void setButtonTooltip( const QString &tip, MoveButton button );
void setButtonWhatsThis( const QString &text, MoveButton button );
void setButtonsEnabled();
signals:
void added( QListBoxItem *item );
void removed( QListBoxItem *item );
void movedUp( QListBoxItem *item );
void movedDown( QListBoxItem *item );
// void addedToSelection( QListBoxItem *item );
public slots:
void polish();
protected:
void keyPressEvent( QKeyEvent * );
bool eventFilter( QObject *, QEvent * );
private slots:
void buttonAddClicked();
void buttonRemoveClicked();
void buttonUpClicked();
void buttonDownClicked();
void itemDoubleClicked( QListBoxItem *item );
void slotCurrentChanged( QListBoxItem * ) { setButtonsEnabled(); }
private:
void moveItem( QListBoxItem *item );
void loadIcons();
int insertionIndex( QListBox *lb, InsertionPolicy policy );
KActionSelectorPrivate *d;
};
#endif // _KACTION_SELECTOR_H_
KActionSelector::InsertionPolicy
InsertionPolicy
This enum defines policies for where to insert moved items in a listbox.
Definition: kactionselector.h:145
KActionSelector::ButtonIconSize
ButtonIconSize
This enum identifies the icon sizes, used for the move buttons.
Definition: kactionselector.h:125
KActionSelector
A widget for selecting and arranging actions/objects.
Definition: kactionselector.h:79
KActionSelector::MoveButton
MoveButton
This enum indentifies the moving buttons.
Definition: kactionselector.h:108

KDE Home | KDE Accessibility Home | Description of Access Keys