00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YSelectionBox.h 00014 00015 Author: Stefan Hundhammer <sh@suse.de> 00016 00017 /-*/ 00018 00019 #ifndef YMultiSelectionBox_h 00020 #define YMultiSelectionBox_h 00021 00022 #include "YWidget.h" 00023 #include <ycp/YCPString.h> 00024 #include <ycp/YCPList.h> 00025 #include <ycp/YCPVoid.h> 00026 00027 class YMacroRecorder; 00028 00032 class YMultiSelectionBox : public YWidget 00033 { 00034 public: 00035 00041 YMultiSelectionBox( const YWidgetOpt & opt, YCPString label ); 00042 00047 virtual char *widgetClass() { return "YMultiSelectionBox"; } 00048 00052 void addItem( const YCPString & text, 00053 const YCPValue & id = YCPVoid(), 00054 bool selected = false ); 00055 00059 YCPValue changeWidget( const YCPSymbol & property, const YCPValue & newvalue ); 00060 00064 YCPValue queryWidget( const YCPSymbol & property ); 00065 00070 virtual void setLabel( const YCPString & label ); 00071 00077 YCPString getLabel(); 00078 00085 virtual void deleteAllItems(); 00086 00091 const char *shortcutProperty() { return YUIProperty_Label; } 00092 00093 00094 protected: 00103 virtual void itemAdded( const YCPString & text, bool selected ) = 0; 00104 00110 virtual bool itemIsSelected( int index ) = 0; 00111 00117 virtual void selectItem( int index ) = 0; 00118 00124 virtual void deselectAllItems() = 0; 00125 00131 virtual int getCurrentItem() = 0; 00132 00138 virtual void setCurrentItem( int index ) = 0; 00139 00143 int numItems() const; 00144 00151 int itemWithId( const YCPValue & id, bool report_error ); 00152 00156 YCPString label; 00157 00162 YCPList item_ids; 00163 00168 YCPList item_labels; 00169 00170 00171 private: 00177 virtual void saveUserInput( YMacroRecorder *macroRecorder ); 00178 }; 00179 00180 00181 #endif // YMultiSelectionBox_h