YSelectionWidget.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013   File:       YSelectionWidget.h
00014 
00015   Author:     Holger Macht <hmacht@suse.de>
00016 
00017 /-*/
00018 
00019 #ifndef YSelectionWidget_h
00020 #define YSelectionWidget_h
00021 
00022 #include "YWidget.h"
00023 #include <ycp/YCPString.h>
00024 #include <ycp/YCPList.h>
00025 
00026 
00031 class YSelectionWidget : public YWidget
00032 {
00033 public:
00034 
00040     YSelectionWidget( const YWidgetOpt & opt, YCPString label );
00041 
00046     virtual char *widgetClass() { return "YSelectionWidget"; }
00047 
00052     virtual const char *shortcutProperty() { return YUIProperty_Label; }
00053 
00057     void parseItemList( const YCPList & itemlist );
00058 
00059 
00081     static bool parseItem( const YCPTerm & itemTerm,
00082                            YCPValue      & item_id_ret,
00083                            YCPString     & item_label_ret,
00084                            YCPString     & item_icon_ret,
00085                            YCPBoolean    & item_selected_ret,
00086                            YCPList       & sub_item_list_ret );
00087 
00088 
00089 protected:
00090 
00098     virtual void itemAdded( const YCPString & string, int index, bool selected ) = 0;
00099 
00106     int itemWithId( const YCPValue & id, bool report_error );
00107 
00111     YCPString label;
00112 
00116     YCPList item_ids;
00117 
00121     YCPList item_labels;
00122 
00126     int numItems() const;
00127 
00132     virtual void setLabel( const YCPString & label );
00133 
00139     YCPString getLabel();
00140 
00144     virtual void addItem( const YCPValue  & id,
00145                           const YCPString & text,
00146                           const YCPString & icon,
00147                           bool selected );
00148 
00153     virtual void deleteAllItems();
00154 
00159     virtual YCPValue changeLabel( const YCPValue & newValue );
00160 
00165     virtual YCPValue changeItems ( const YCPValue & newValue );
00166 
00167 
00172     YCPString itemIcon( int item_no ) const;
00173 
00177     bool hasIcons() const { return _hasIcons; }
00178 
00179 
00180 private:
00181 
00186     YCPList item_icons;
00187 
00188     bool _hasIcons;
00189 
00190 };
00191 
00192 
00193 #endif // YSelectionWidget_h

Generated on Fri Jun 16 18:07:45 2006 for yast2-core by  doxygen 1.4.6