libyui-qt
YQSelectionBox.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YQSelectionBox.h
20 
21  Author: Stefan Hundhammer <shundhammer@suse.de>
22 
23 /-*/
24 
25 
26 #ifndef YQSelectionBox_h
27 #define YQSelectionBox_h
28 
29 #include <QFrame>
30 #include <QTimer>
31 
32 #include <yui/YSelectionBox.h>
33 
34 class YQWidgetCaption;
35 class QListWidget;
36 class QListWidgetItem;
37 
38 
39 class YQSelectionBox : public QFrame, public YSelectionBox
40 {
41  Q_OBJECT
42 
43 public:
44 
48  YQSelectionBox( YWidget * parent, const std::string & label );
49 
53  virtual ~YQSelectionBox();
54 
60  virtual void setLabel( const std::string & label );
61 
67  virtual void addItem( YItem * item );
68 
74  virtual void addItems( const YItemCollection & itemCollection );
75 
81  virtual void selectItem( YItem * item, bool selected = true );
82 
88  virtual void deselectAllItems();
89 
95  virtual void deleteAllItems();
96 
102  virtual void setEnabled( bool enabled );
103 
109  virtual int preferredWidth();
110 
116  virtual int preferredHeight();
117 
123  virtual void setSize( int newWidth, int newHeight );
124 
130  virtual bool setKeyboardFocus();
131 
137  virtual bool eventFilter( QObject * obj, QEvent * ev );
138 
139 
140 protected slots:
141 
146  void slotSelectionChanged();
147 
151  void slotActivated( QListWidgetItem * item );
152 
157  void returnDelayed();
158 
163  void returnImmediately();
164 
165 
166 protected:
167 
171  void selectItem( int index );
172 
177  void addItem( YItem * item, bool batchMode );
178 
179 
180  //
181  // Data members
182  //
183 
184  YQWidgetCaption * _caption;
185  QListWidget * _qt_listWidget;
186  QTimer _timer;
187 };
188 
189 #endif // YQLabel_h
virtual bool eventFilter(QObject *obj, QEvent *ev)
Definition: YQSelectionBox.cc:266
virtual void deleteAllItems()
Definition: YQSelectionBox.cc:213
virtual bool setKeyboardFocus()
Definition: YQSelectionBox.cc:258
virtual void addItems(const YItemCollection &itemCollection)
Definition: YQSelectionBox.cc:104
void slotActivated(QListWidgetItem *item)
Definition: YQSelectionBox.cc:350
virtual void addItem(YItem *item)
Definition: YQSelectionBox.cc:119
YQSelectionBox(YWidget *parent, const std::string &label)
Definition: YQSelectionBox.cc:53
virtual void setSize(int newWidth, int newHeight)
Definition: YQSelectionBox.cc:243
void returnDelayed()
Definition: YQSelectionBox.cc:382
virtual void deselectAllItems()
Definition: YQSelectionBox.cc:189
virtual int preferredWidth()
Definition: YQSelectionBox.cc:223
virtual int preferredHeight()
Definition: YQSelectionBox.cc:232
virtual ~YQSelectionBox()
Definition: YQSelectionBox.cc:91
virtual void setEnabled(bool enabled)
Definition: YQSelectionBox.cc:249
virtual void selectItem(YItem *item, bool selected=true)
Definition: YQSelectionBox.cc:162
void slotSelectionChanged()
Definition: YQSelectionBox.cc:307
Definition: YQWidgetCaption.h:38
virtual void setLabel(const std::string &label)
Definition: YQSelectionBox.cc:97
Definition: YQSelectionBox.h:39
void returnImmediately()
Definition: YQSelectionBox.cc:359