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 keyEvents; 00123 YBoolOpt easterEgg; 00124 YBoolOpt testMode; 00125 00126 YLongOpt hWeight; // from YUIInterpreter::createWeight() 00127 YLongOpt vWeight; // from YUIInterpreter::createWeight() 00128 00129 00130 // Widget-specific options 00131 // 00132 // See the respective widget doc in YUIInterpreter::create???() 00133 // or ../../doc/autodocs/???-widget.html 00134 00135 YBoolOpt isDefaultButton; // YPushButton 00136 YBoolOpt isOutputField; // YLabel 00137 YBoolOpt isHeading; // YLabel 00138 YBoolOpt autoScrollDown; // YRichText 00139 YBoolOpt plainTextMode; // YRichText 00140 YBoolOpt passwordMode; // YTextEntry 00141 YBoolOpt isShrinkable; // YTextEntry 00142 YBoolOpt isEditable; // YComboBox 00143 YBoolOpt immediateMode; // YTable 00144 YBoolOpt keepSorting; // YTable 00145 YBoolOpt debugLayoutMode; // YSplit 00146 YBoolOpt zeroWidth; // YImage 00147 YBoolOpt zeroHeight; // YImage 00148 YBoolOpt animated; // YImage 00149 YBoolOpt tiled; // YImage 00150 YBoolOpt scaleToFit; // YImage 00151 YBoolOpt countShowDelta; // YPartitionSplitter 00152 YLongOpt key_Fxx; // YPushButton: No. of F-Key (1..24), 0 if none 00153 00154 YBoolOpt searchMode; // YPackageSelector 00155 YBoolOpt updateMode; // YPackageSelector 00156 YBoolOpt youMode; // YPackageSelector 00157 YBoolOpt stepsEnabled; // YWizard 00158 YBoolOpt treeEnabled; // YWizard 00159 00160 // YDialog-specific options 00161 // 00162 // These are multiplexed into YWidgetOpt since YDialog inherits 00163 // YContainerWidget which in turn inherits YWidget. 00164 00165 YBoolOpt hasDefaultSize; 00166 YBoolOpt hasWarnColor; 00167 YBoolOpt hasInfoColor; 00168 YBoolOpt isDecorated; 00169 YBoolOpt isCentered; 00170 YBoolOpt hasSmallDecorations; 00171 }; 00172 00173 00174 #endif // YWidgetOpt_h