YWidgetOpt.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:       YWidgetOpt.h
00014 
00015   Author:     Stefan Hundhammer <sh@suse.de>
00016 
00017 /-*/
00018 
00019 #ifndef YWidgetOpt_h
00020 #define YWidgetOpt_h
00021 
00022 
00026 template<class T> class YAnyOpt
00027 {
00028 public:
00032     YAnyOpt()                   { _defined = false; }
00033     
00037     virtual ~YAnyOpt() {}
00038 
00042     void setValue( T newValue ) { _defined = true; _value = newValue; }
00043 
00048     void undef()                { _defined = false;     }
00049 
00054     bool defined() const        { return _defined;      }
00055 
00060     T value() const             { return _defined ? _value : defaultValue(); }
00061 
00062 protected:
00063 
00069     virtual T defaultValue() const = 0;
00070 
00071     bool _defined;
00072     T   _value;
00073 };
00074 
00075 
00079 class YBoolOpt: public YAnyOpt<bool>
00080 {
00081     virtual bool defaultValue() const { return false; }
00082 };
00083 
00084 
00088 class YLongOpt: public YAnyOpt<long>
00089 {
00090     virtual long defaultValue() const { return 0L; }
00091 };
00092 
00093 
00116 struct YWidgetOpt
00117 {
00118     // Common options for all widgets.
00119     // See the inline doc in YUIInterpreter::createWidget() for details
00120     // or ../../doc/autodocs/YWidget-widget.html
00121 
00122     YBoolOpt isDisabled;
00123     YBoolOpt notifyMode;
00124     YBoolOpt isHStretchable;
00125     YBoolOpt isVStretchable;
00126     YBoolOpt autoShortcut;
00127     YBoolOpt autoAdvance;
00128     YBoolOpt keyEvents; 
00129     YBoolOpt easterEgg;
00130     YBoolOpt testMode;
00131     YBoolOpt boldFont;          // YCheckBox, YRadioButton, YLabel
00132 
00133     YLongOpt hWeight;           // from YUIInterpreter::createWeight()
00134     YLongOpt vWeight;           // from YUIInterpreter::createWeight()
00135 
00136 
00137     // Widget-specific options
00138     //
00139     // See the respective widget doc in YUIInterpreter::create???()
00140     // or ../../doc/autodocs/???-widget.html
00141 
00142     YBoolOpt isDefaultButton;   // YPushButton
00143     YBoolOpt isOutputField;     // YLabel
00144     YBoolOpt isHeading;         // YLabel
00145     YBoolOpt autoScrollDown;    // YRichText
00146     YBoolOpt plainTextMode;     // YRichText
00147     YBoolOpt passwordMode;      // YTextEntry
00148     YBoolOpt isShrinkable;      // YTextEntry
00149     YBoolOpt isEditable;        // YComboBox
00150     YBoolOpt immediateMode;     // YTable
00151     YBoolOpt keepSorting;       // YTable
00152     YBoolOpt debugLayoutMode;   // YSplit
00153     YBoolOpt zeroWidth;         // YImage
00154     YBoolOpt zeroHeight;        // YImage
00155     YBoolOpt animated;          // YImage
00156     YBoolOpt tiled;             // YImage
00157     YBoolOpt scaleToFit;        // YImage
00158     YBoolOpt countShowDelta;    // YPartitionSplitter
00159     YLongOpt key_Fxx;           // YPushButton: No. of F-Key (1..24), 0 if none
00160 
00161     YBoolOpt searchMode;        // YPackageSelector
00162     YBoolOpt summaryMode;       // YPackageSelector
00163     YBoolOpt updateMode;        // YPackageSelector
00164     YBoolOpt youMode;           // YPackageSelector
00165     YBoolOpt instSourcesMode;   // YPackageSelector
00166     YBoolOpt stepsEnabled;      // YWizard
00167     YBoolOpt treeEnabled;       // YWizard
00168     
00169     // YDialog-specific options
00170     //
00171     // These are multiplexed into YWidgetOpt since YDialog inherits
00172     // YContainerWidget which in turn inherits YWidget.
00173 
00174     YBoolOpt hasDefaultSize;
00175     YBoolOpt hasWarnColor;
00176     YBoolOpt hasInfoColor;
00177     YBoolOpt isDecorated;
00178     YBoolOpt isCentered;
00179     YBoolOpt hasSmallDecorations;
00180 };
00181 
00182 
00183 #endif // YWidgetOpt_h

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