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: Mathias Kettner <kettner@suse.de> 00016 Maintainer: Stefan Hundhammer <sh@suse.de> 00017 00018 /-*/ 00019 00020 #ifndef YSelectionBox_h 00021 #define YSelectionBox_h 00022 00023 #include "YWidget.h" 00024 #include <ycp/YCPString.h> 00025 #include <ycp/YCPList.h> 00026 00027 class YMacroRecorder; 00028 00032 class YSelectionBox : public YWidget 00033 { 00034 public: 00035 00041 YSelectionBox( const YWidgetOpt & opt, YCPString label ); 00042 00047 virtual char *widgetClass() { return "YSelectionBox"; } 00048 00052 void addItem( const YCPValue & id, const YCPString & text, bool selected ); 00053 00057 YCPValue changeWidget( const YCPSymbol & property, const YCPValue & newvalue ); 00058 00062 YCPValue queryWidget( const YCPSymbol & property ); 00063 00068 virtual void setLabel( const YCPString & label ); 00069 00075 YCPString getLabel(); 00076 00081 const char *shortcutProperty() { return YUIProperty_Label; } 00082 00083 00084 protected: 00092 virtual void itemAdded( const YCPString & string, int index, bool selected ); 00093 00098 virtual int getCurrentItem() = 0; 00099 00103 virtual void setCurrentItem( int index ) = 0; 00104 00108 int numItems() const; 00109 00116 int itemWithId( const YCPValue & id, bool report_error ); 00117 00121 YCPString label; 00122 00127 YCPList item_ids; 00128 00133 YCPList item_labels; 00134 00135 private: 00141 virtual void saveUserInput( YMacroRecorder *macroRecorder ); 00142 }; 00143 00144 00145 #endif // YSelectionBox_h