1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQSelectionBox.h
15 Author: Stefan Hundhammer <sh@suse.de>
20 #ifndef YQSelectionBox_h
21 #define YQSelectionBox_h
26 #include "YSelectionBox.h"
28 class YQWidgetCaption;
30 class QListWidgetItem;
33 class YQSelectionBox : public QFrame, public YSelectionBox
42 YQSelectionBox( YWidget * parent, const string & label );
47 virtual ~YQSelectionBox();
50 * Change the label text.
52 * Reimplemented from YSelectionWidget.
54 virtual void setLabel( const string & label );
59 * Reimplemented from YSelectionWidget.
61 virtual void addItem( YItem * item );
64 * Select or deselect an item.
66 * Reimplemented from YSelectionWidget.
68 virtual void selectItem( YItem * item, bool selected = true );
73 * Reimplemented from YSelectionWidget.
75 virtual void deselectAllItems();
80 * Reimplemented from YSelectionWidget.
82 virtual void deleteAllItems();
85 * Set enabled/disabled state.
87 * Reimplemented from YWidget.
89 virtual void setEnabled( bool enabled );
92 * Preferred width of the widget.
94 * Reimplemented from YWidget.
96 virtual int preferredWidth();
99 * Preferred height of the widget.
101 * Reimplemented from YWidget.
103 virtual int preferredHeight();
106 * Set the new size of the widget.
108 * Reimplemented from YWidget.
110 virtual void setSize( int newWidth, int newHeight );
113 * Accept the keyboard focus.
115 * Reimplemented from YWidget.
117 virtual bool setKeyboardFocus();
122 * Reimplemented from QWidget.
124 virtual bool eventFilter( QObject * obj, QEvent * ev );
130 * Notification that an item has been selected.
131 * This is only relevant if `opt(`notify ) is set.
133 void slotSelected( int index );
136 * Notification that an item has been activated (double clicked).
138 void slotActivated( QListWidgetItem * item );
141 * Return after some millseconds delay - collect multiple events.
142 * This is only relevant if `opt( `notify ) is set.
144 void returnDelayed();
147 * Return immediately.
148 * This is only relevant if `opt( `notify ) is set.
150 void returnImmediately();
156 * Select an item by index.
158 void selectItem( int index );
165 YQWidgetCaption * _caption;
166 QListWidget * _qt_listBox;