kate Library API Documentation

KActionSelector Class Reference

A widget for selecting and arranging actions/objects This widget allows the user to select from a set of objects and arrange the order of the selected ones using two list boxes labeled "Available" and "Used" with horizontal arrows in between to move selected objects between the two, and vertical arrows on the right to arrange the order of the selected objects. More...

#include <kactionselector.h>

List of all members.

Public Types

enum  MoveButton { ButtonAdd, ButtonRemove, ButtonUp, ButtonDown }
enum  ButtonIconSize {
  SmallIcon, Small, Medium, Large,
  XLarge
}
enum  InsertionPolicy { BelowCurrent, Sorted, AtTop, AtBottom }

Public Slots

void polish ()

Signals

void added (QListBoxItem *item)
void removed (QListBoxItem *item)
void movedUp (QListBoxItem *item)
void movedDown (QListBoxItem *item)

Public Member Functions

 KActionSelector (QWidget *parent=0, const char *name=0)
QListBox * availableListBox () const
QListBox * selectedListBox () const
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 ()

Protected Member Functions

void keyPressEvent (QKeyEvent *)
bool eventFilter (QObject *, QEvent *)

Properties

bool moveOnDoubleClick
bool keyboardEnabled
QString availableLabel
QString selectedLabel
ButtonIconSize buttonIconSize
InsertionPolicy availableInsertionPolicy
InsertionPolicy selectedInsertionPolicy
bool showUpDownButtons


Detailed Description

A widget for selecting and arranging actions/objects This widget allows the user to select from a set of objects and arrange the order of the selected ones using two list boxes labeled "Available" and "Used" with horizontal arrows in between to move selected objects between the two, and vertical arrows on the right to arrange the order of the selected objects.

The widget moves objects to the other listbox when doubleclicked if the property moveOnDoubleClick is set to true (default). See moveOnDoubleClick() and setMoveOnDoubleClick().

The user control the widget using the keyboard if enabled (default), see keyboardEnabled.

Note that this may conflist with keyboard selection in the selected list box, if you set that to anything else than QListBox::Single (which is the default).

To use it, simply construct an instance and then add items to the two listboxes, available through lbAvailable() and lbSelected(). Whenever you want, you can retrieve the selected options using QListBox methods on lbSelected().

This way, you can use your own QListBoxItem class, allowing you to easily store object data in those.

When an item is moved to a listbox, it is placed below the current item of that listbox.

Standard arrow icons are used, but you can use icons of your own choice if desired, see setButtonIcon(). It is also possible to set tooltips and whatsthis help for the buttons. See setButtonTooltip() and setButtonWhatsThis().

To set whatsthis or tooltips for the listboxes, access them through availableListbox() and selectedListBox().

All the moving buttons are automatically set enabled as expected.

Signals are sent each time an item is moved, allowing you to follow the users actions if you need to. See addedToSelection(), removedFromSelection(), movedUp() and movedDown()

Author:
Anders Lund <anders@alweb.dk>

Definition at line 76 of file kactionselector.h.


Member Enumeration Documentation

enum KActionSelector::MoveButton
 

This enum indentifies the moving buttons.

Definition at line 105 of file kactionselector.h.

enum KActionSelector::ButtonIconSize
 

This enum identifies the icon sizes, used for the move buttons.

The values correspond to the following pixel sizes:

  • SmallIcon - the return value of IconSize( KIcon::Small ), the user defined size of a small icon in KDE. This is the default setting.
  • Small - 16px
  • Medium - 22px
  • Large - 32px
  • XLarge - 48px

Definition at line 122 of file kactionselector.h.

enum KActionSelector::InsertionPolicy
 

This enum defines policies for where to insert moved items in a listbox.

The following policies are currently defined:

  • BelowCurrent - The item is inserted below the listbox' currentItem() or at the end if there is no curent item.
  • Sorted - The listbox is sort()ed after one or more items are inserted.
  • AtTop - The item is inserted at index 0 in the listbox.
  • AtBottom - The item is inserted at the end of the listbox.
See also:
availableInsertionPolicy(), setAvailableInsertionPolicy(), selectedInsertionPolicy(), setSelectedInsertionPolicy().

Definition at line 142 of file kactionselector.h.


Member Function Documentation

QListBox * KActionSelector::availableListBox  )  const
 

Returns:
The QListBox holding the available actions

Definition at line 125 of file kactionselector.cpp.

QListBox * KActionSelector::selectedListBox  )  const
 

Returns:
The QListBox holding the selected actions

Definition at line 130 of file kactionselector.cpp.

bool KActionSelector::moveOnDoubleClick  )  const
 

Returns:
Wheather moveOnDoubleClcik is enabled.
If enabled, an item in any listbox will be moved to the other one whenever doubleclicked.
See also:
setMoveOnDoubleClick()

void KActionSelector::setMoveOnDoubleClick bool  enable  ) 
 

Sets moveOnDoubleClick to enable.

See also:
moveOnDoubleClick()

Definition at line 241 of file kactionselector.cpp.

References setMoveOnDoubleClick().

Referenced by setMoveOnDoubleClick().

bool KActionSelector::keyboardEnabled  )  const
 

Returns:
Weather keyboard control is enabled.
When Keyboard control is enabled, the widget will react to the following keyboard actions:
  • CTRL + Right - simulate clicking the add button
  • CTRL + Left - simulate clicking the remove button
  • CTRL + Up - simulate clicking the up button
  • CTRL + Down - simulate clicking the down button
Additionally, pressing RETURN or ENTER on one of the list boxes will cause the current item of that listbox to be moved to the other listbox.

The keyboard actions are enabled by default.

See also:
setKeyboardEnabled()

void KActionSelector::setKeyboardEnabled bool  enable  ) 
 

Sets the keyboard enabled depending on enable.

See also:
keyboardEnabled()

Definition at line 251 of file kactionselector.cpp.

References setKeyboardEnabled().

Referenced by setKeyboardEnabled().

QString KActionSelector::availableLabel  )  const
 

Returns:
The text of the label for the available items listbox.

void KActionSelector::setAvailableLabel const QString &  text  ) 
 

Sets the label for the available items listbox to text.

Note that this label has the listbox as its buddy, so that if you have a single ampersand in the text, the following character will become the accellerator to focus te listbox.

Definition at line 261 of file kactionselector.cpp.

References setAvailableLabel().

Referenced by setAvailableLabel().

QString KActionSelector::selectedLabel  )  const
 

Returns:
the label of the selected items listbox.

void KActionSelector::setSelectedLabel const QString &  text  ) 
 

Sets the label for the selected items listbox to text.

Note that this label has the listbox as its buddy, so that if you have a single ampersand in the text, the following character will become the accellerator to focus te listbox.

Definition at line 271 of file kactionselector.cpp.

References setSelectedLabel().

Referenced by setSelectedLabel().

ButtonIconSize KActionSelector::buttonIconSize  )  const
 

Returns:
the current ButtonIconSize.

void KActionSelector::setButtonIconSize ButtonIconSize  size  ) 
 

Sets the button icon size.

See ButtonIconSize for the possible values and their pixel meaning.

Definition at line 281 of file kactionselector.cpp.

References setButtonIconSize().

Referenced by setButtonIconSize().

InsertionPolicy KActionSelector::availableInsertionPolicy  )  const
 

Returns:
The current insertion policy for the available listbox. The default policy for the available listbox is Sorted. See also InsertionPolicy, setAvailableInsertionPolicy().

void KActionSelector::setAvailableInsertionPolicy InsertionPolicy  policy  ) 
 

Sets the insertion policy for the available listbox.

See also InsertionPolicy, availableInsertionPolicy().

Definition at line 293 of file kactionselector.cpp.

References setAvailableInsertionPolicy().

Referenced by setAvailableInsertionPolicy().

InsertionPolicy KActionSelector::selectedInsertionPolicy  )  const
 

Returns:
The current insertion policy for the selected listbox. The default policy for the selected listbox is BelowCurrent. See also InsertionPolicy, setSelectedInsertionPolicy().

void KActionSelector::setSelectedInsertionPolicy InsertionPolicy  policy  ) 
 

Sets the insertion policy for the selected listbox.

See also InsertionPolicy, selectedInsertionPolicy().

Definition at line 303 of file kactionselector.cpp.

References setSelectedInsertionPolicy().

Referenced by setSelectedInsertionPolicy().

bool KActionSelector::showUpDownButtons  )  const
 

Returns:
wheather the Up and Down buttons should be displayed.

void KActionSelector::setShowUpDownButtons bool  show  ) 
 

Sets wheather the Up and Down buttons should be displayed according to show.

Definition at line 313 of file kactionselector.cpp.

References setShowUpDownButtons().

Referenced by setShowUpDownButtons().

void KActionSelector::setButtonIcon const QString &  icon,
MoveButton  button
 

Sets the pixmap of the button button to icon.

It calls SmallIconSet(pm) to generate the icon set.

Definition at line 135 of file kactionselector.cpp.

References setButtonIcon().

Referenced by setButtonIcon().

void KActionSelector::setButtonIconSet const QIconSet &  iconset,
MoveButton  button
 

Sets the iconset for button button to iconset.

You can use this method to et a costum icon set. Either created by QIconSet, or use the application instance of KIconLoader (recommended).

Definition at line 160 of file kactionselector.cpp.

References setButtonIconSet().

Referenced by setButtonIconSet().

void KActionSelector::setButtonTooltip const QString &  tip,
MoveButton  button
 

Sets the tooltip for the button button to tip.

Definition at line 181 of file kactionselector.cpp.

References setButtonTooltip().

Referenced by setButtonTooltip().

void KActionSelector::setButtonWhatsThis const QString &  text,
MoveButton  button
 

Sets the whatsthis help for button button to text.

Definition at line 202 of file kactionselector.cpp.

References setButtonWhatsThis().

Referenced by setButtonWhatsThis().

void KActionSelector::setButtonsEnabled  ) 
 

Sets the enabled state of all moving buttons to reflect the current options.

Be sure to call this if you add or removes items to either listbox after the widget is show()n

Definition at line 223 of file kactionselector.cpp.

Referenced by polish().

void KActionSelector::added QListBoxItem *  item  )  [signal]
 

Emitted when an item is moved to the "selected" listbox.

void KActionSelector::removed QListBoxItem *  item  )  [signal]
 

Emitted when an item is moved out of the "selected" listbox.

void KActionSelector::movedUp QListBoxItem *  item  )  [signal]
 

Emitted when an item is moved upwards in the "selected" listbox.

void KActionSelector::movedDown QListBoxItem *  item  )  [signal]
 

Emitted when an item is moved downwards in the "selected" listbox.

void KActionSelector::polish  )  [slot]
 

Reimplemented for internal reasons.

(calls setButtonsEnabled())

Definition at line 332 of file kactionselector.cpp.

References setButtonsEnabled().

void KActionSelector::keyPressEvent QKeyEvent *   )  [protected]
 

Reimplamented for internal reasons.

Definition at line 340 of file kactionselector.cpp.

References keyPressEvent().

Referenced by keyPressEvent().

bool KActionSelector::eventFilter QObject *  ,
QEvent * 
[protected]
 

Reimplemented for internal reasons.

Definition at line 366 of file kactionselector.cpp.

References eventFilter().

Referenced by eventFilter().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kate Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Dec 16 19:08:37 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003