00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YQMultiSelectionBox.h 00014 00015 Author: Stefan Hundhammer <sh@suse.de> 00016 00017 /-*/ 00018 00019 // -*- c++ -*- 00020 00021 #ifndef YQMultiSelectionBox_h 00022 #define YQMultiSelectionBox_h 00023 00024 #include <qvbox.h> 00025 #include <qlistview.h> 00026 #include <ycp/YCPString.h> 00027 00028 #include "YMultiSelectionBox.h" 00029 00030 00031 class QLabel; 00032 00033 class YQMultiSelectionBox : public QVBox, public YMultiSelectionBox 00034 { 00035 Q_OBJECT 00036 00037 public: 00038 00042 YQMultiSelectionBox( QWidget * parent, 00043 const YWidgetOpt & opt, 00044 const YCPString & label ); 00045 00051 void setEnabling( bool enabled ); 00052 00058 long nicesize( YUIDimension dim ); 00059 00063 void setSize( long newWidth, long newHeight ); 00064 00068 virtual void setLabel( const YCPString & label ); 00069 00075 virtual void itemAdded( const YCPString & itemText, bool selected ); 00076 00082 virtual int getCurrentItem(); 00083 00089 virtual void setCurrentItem( int index ); 00090 00094 virtual bool setKeyboardFocus(); 00095 00101 virtual void deleteAllItems(); 00102 00106 void sendValueChanged(); 00107 00108 00109 signals: 00110 00114 void valueChanged(); 00115 00116 00117 protected: 00118 00124 virtual bool itemIsSelected( int index ); 00125 00131 virtual void selectItem( int index ); 00132 00138 virtual void deselectAllItems(); 00139 00140 00141 00142 protected slots: 00143 00147 void slotSelected(); 00148 00152 void slotValueChanged(); 00153 00154 00155 protected: 00156 00157 QLabel * _qt_label; 00158 QListView * _qt_listview; 00159 00160 bool _shrinkable; 00161 }; 00162 00163 00164 00165 class YQMultiSelectionBoxItem: public QCheckListItem 00166 { 00167 public: 00171 YQMultiSelectionBoxItem( YQMultiSelectionBox * parent, 00172 QListView * listView, 00173 const QString & text ); 00174 00178 virtual ~YQMultiSelectionBoxItem() {} 00179 00180 00181 protected: 00182 00189 void stateChange( bool newState ); 00190 00199 virtual QString key ( int column, 00200 bool ascending ) const; 00201 00202 00203 // Data members 00204 00205 int _serial; 00206 YQMultiSelectionBox * _multiSelectionBox; 00207 00208 00212 static int _item_count; 00213 }; 00214 00215 #endif // YQLabel_h