Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Examples

YComboBox.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:       YComboBox.h
00014 
00015   Author:     Stefan Hundhammer <sh@suse.de>
00016 
00017 /-*/
00018 
00019 #ifndef YComboBox_h
00020 #define YComboBox_h
00021 
00022 #include "YWidget.h"
00023 #include <ycp/YCPString.h>
00024 #include <ycp/YCPList.h>
00025 
00026 class YMacroRecorder;
00027 
00031 class YComboBox : public YWidget
00032 {
00033 public:
00037     YComboBox( const YWidgetOpt & opt, YCPString label );
00038 
00043     bool editable() const { return _editable; }
00044 
00049     virtual char *widgetClass() { return "YComboBox"; }
00050 
00054     void addItem( const YCPValue & id, const YCPString & text, bool selected );
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 setValidChars( const YCPString & validChars );
00086 
00090     YCPString getValidChars();
00091 
00096     const char *shortcutProperty() { return YUIProperty_Label; }
00097     
00098 
00099 protected:
00107     virtual void itemAdded( const YCPString & string, int index, bool selected );
00108 
00112     virtual YCPString getValue() const = 0;
00113 
00118     virtual void setValue( const YCPString & new_value ) = 0;
00119 
00124     virtual int getCurrentItem() const = 0;
00125 
00130     virtual void setCurrentItem( int index ) = 0;
00131 
00132 
00133 private:
00137     int numItems() const;
00138 
00145     int itemWithId( const YCPValue & id, bool report_error );
00146 
00152     virtual void saveUserInput( YMacroRecorder *macroRecorder );
00153 
00157     YCPString label;
00158 
00162     YCPString validChars;
00163 
00168     YCPList item_ids;
00169 
00174     YCPList item_labels;
00175 
00179     bool _editable;
00180 };
00181 
00182 
00183 #endif // YComboBox_h

Generated on Fri Nov 9 18:15:22 2007 for yast2-core by doxygen 1.3.6