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 00096 00097 protected slots: 00098 00103 void slotSelected( int index ); 00104 00108 void slotActivated( QListBoxItem * item ); 00109 00114 void returnDelayed(); 00115 00120 void returnImmediately(); 00121 00122 00123 protected: 00124 00125 // 00126 // Data members 00127 // 00128 00129 // Widgets 00130 00131 QLabel * _qt_label; 00132 QListBox * _qt_listbox; 00133 00134 00135 // Very small default size if specified 00136 bool _shrinkable; 00137 00138 // Don't use a timer to collect events 00139 bool _immediateMode; 00140 00141 // Timer to collect multiple events before returning 00142 QTimer _timer; 00143 }; 00144 00145 #endif // YQLabel_h