00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YQSelectionBox.h 00014 00015 Author: Mathias Kettner <kettner@suse.de> 00016 Maintainer: Stefan Hundhammer <sh@suse.de> 00017 00018 /-*/ 00019 00020 // -*- c++ -*- 00021 00022 #ifndef YQSelectionBox_h 00023 #define YQSelectionBox_h 00024 00025 #include <qvbox.h> 00026 #include <qtimer.h> 00027 #include <ycp/YCPString.h> 00028 00029 #include "YSelectionBox.h" 00030 00031 00032 class QLabel; 00033 class QListBox; 00034 class QListBoxItem; 00035 00036 class YQSelectionBox : public QVBox, public YSelectionBox 00037 { 00038 Q_OBJECT 00039 00040 public: 00041 00042 YQSelectionBox( QWidget * parent, const YWidgetOpt & opt, const YCPString & label ); 00043 00049 void setEnabling( bool enabled ); 00050 00056 long nicesize( YUIDimension dim ); 00057 00061 void setSize( long newWidth, long newHeight ); 00062 00066 void setLabel( const YCPString & label ); 00067 00073 void itemAdded( const YCPString & itemText, int itemIndex, bool selected ); 00074 00079 int getCurrentItem(); 00080 00084 void setCurrentItem( int index ); 00085 00089 virtual bool setKeyboardFocus(); 00090 00094 bool eventFilter( QObject * obj, QEvent * ev ); 00095 00101 virtual void deleteAllItems(); 00102 00103 protected slots: 00104 00109 void slotSelected( int index ); 00110 00114 void slotActivated( QListBoxItem * item ); 00115 00120 void returnDelayed(); 00121 00126 void returnImmediately(); 00127 00128 00129 protected: 00130 00131 // 00132 // Data members 00133 // 00134 00135 // Widgets 00136 00137 QLabel * _qt_label; 00138 QListBox * _qt_listbox; 00139 00140 00141 // Very small default size if specified 00142 bool _shrinkable; 00143 00144 // Don't use a timer to collect events 00145 bool _immediateMode; 00146 00147 // Timer to collect multiple events before returning 00148 QTimer _timer; 00149 }; 00150 00151 #endif // YQLabel_h