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

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     void setValue( T newValue ) { _defined = true; _value = newValue; }
00038 
00043     void undef()                { _defined = false;     }
00044 
00049     bool defined() const        { return _defined;      }
00050 
00055     T value() const             { return _defined ? _value : defaultValue(); }
00056 
00057 protected:
00058 
00064     virtual T defaultValue() const = 0;
00065 
00066     bool _defined;
00067     T   _value;
00068 };
00069 
00070 
00074 class YBoolOpt: public YAnyOpt<bool>
00075 {
00076     virtual bool defaultValue() const { return false; }
00077 };
00078 
00079 
00083 class YLongOpt: public YAnyOpt<long>
00084 {
00085     virtual long defaultValue() const { return 0L; }
00086 };
00087 
00088 
00111 struct YWidgetOpt
00112 {
00113     // Common options for all widgets.
00114     // See the inline doc in YUIInterpreter::createWidget() for details
00115     // or ../../doc/autodocs/YWidget-widget.html
00116 
00117     YBoolOpt isDisabled;
00118     YBoolOpt notifyMode;
00119     YBoolOpt isHStretchable;
00120     YBoolOpt isVStretchable;
00121     YBoolOpt autoShortcut;
00122     YBoolOpt autoAdvance;
00123     YBoolOpt keyEvents; 
00124     YBoolOpt easterEgg;
00125     YBoolOpt testMode;
00126 
00127     YLongOpt hWeight;           // from YUIInterpreter::createWeight()
00128     YLongOpt vWeight;           // from YUIInterpreter::createWeight()
00129 
00130 
00131     // Widget-specific options
00132     //
00133     // See the respective widget doc in YUIInterpreter::create???()
00134     // or ../../doc/autodocs/???-widget.html
00135 
00136     YBoolOpt isDefaultButton;   // YPushButton
00137     YBoolOpt isOutputField;     // YLabel
00138     YBoolOpt isHeading;         // YLabel
00139     YBoolOpt autoScrollDown;    // YRichText
00140     YBoolOpt plainTextMode;     // YRichText
00141     YBoolOpt passwordMode;      // YTextEntry
00142     YBoolOpt isShrinkable;      // YTextEntry
00143     YBoolOpt isEditable;        // YComboBox
00144     YBoolOpt immediateMode;     // YTable
00145     YBoolOpt keepSorting;       // YTable
00146     YBoolOpt debugLayoutMode;   // YSplit
00147     YBoolOpt zeroWidth;         // YImage
00148     YBoolOpt zeroHeight;        // YImage
00149     YBoolOpt animated;          // YImage
00150     YBoolOpt tiled;             // YImage
00151     YBoolOpt scaleToFit;        // YImage
00152     YBoolOpt countShowDelta;    // YPartitionSplitter
00153     YLongOpt key_Fxx;           // YPushButton: No. of F-Key (1..24), 0 if none
00154 
00155     YBoolOpt searchMode;        // YPackageSelector
00156     YBoolOpt summaryMode;       // YPackageSelector
00157     YBoolOpt updateMode;        // YPackageSelector
00158     YBoolOpt youMode;           // YPackageSelector
00159     YBoolOpt stepsEnabled;      // YWizard
00160     YBoolOpt treeEnabled;       // YWizard
00161     
00162     // YDialog-specific options
00163     //
00164     // These are multiplexed into YWidgetOpt since YDialog inherits
00165     // YContainerWidget which in turn inherits YWidget.
00166 
00167     YBoolOpt hasDefaultSize;
00168     YBoolOpt hasWarnColor;
00169     YBoolOpt hasInfoColor;
00170     YBoolOpt isDecorated;
00171     YBoolOpt isCentered;
00172     YBoolOpt hasSmallDecorations;
00173 };
00174 
00175 
00176 #endif // YWidgetOpt_h

Generated on Tue Mar 22 11:35:48 2005 for yast2-core by  doxygen 1.4.1