libyui
3.0.10
|
00001 /* 00002 Copyright (C) 2000-2012 Novell, Inc 00003 This library is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU Lesser General Public License as 00005 published by the Free Software Foundation; either version 2.1 of the 00006 License, or (at your option) version 3.0 of the License. This library 00007 is distributed in the hope that it will be useful, but WITHOUT ANY 00008 WARRANTY; without even the implied warranty of MERCHANTABILITY or 00009 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00010 License for more details. You should have received a copy of the GNU 00011 Lesser General Public License along with this library; if not, write 00012 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 00013 Floor, Boston, MA 02110-1301 USA 00014 */ 00015 00016 00017 /*-/ 00018 00019 File: YOptionalWidgetFactory.h 00020 00021 Author: Stefan Hundhammer <sh@suse.de> 00022 00023 /-*/ 00024 00025 #ifndef YOptionalWidgetFactory_h 00026 #define YOptionalWidgetFactory_h 00027 00028 #include <string> 00029 #include <vector> 00030 #include <map> 00031 00032 #include "YTypes.h" 00033 #include "YWizard.h" 00034 #include "YGraph.h" 00035 00036 00037 class YBarGraph; 00038 class YDateField; 00039 class YDownloadProgress; 00040 class YDumbTab; 00041 class YDummySpecialWidget; 00042 class YMultiProgressMeter; 00043 class YPartitionSplitter; 00044 class YSlider; 00045 class YTimeField; 00046 class YWidget; 00047 class YTimezoneSelector; 00048 00049 /** 00050 * Abstract widget factory for optional ("special") widgets. 00051 * 00052 * Remember to always check with the corresponding "has..()" method if the 00053 * current UI actually provides the requested widget. Otherwise the 00054 * "create...()" method will throw an exception. 00055 **/ 00056 class YOptionalWidgetFactory 00057 { 00058 public: 00059 00060 // 00061 // Optional Widgets 00062 // 00063 00064 virtual bool hasWizard(); 00065 virtual YWizard * createWizard ( YWidget * parent, 00066 const std::string & backButtonLabel, 00067 const std::string & abortButtonLabel, 00068 const std::string & nextButtonLabel, 00069 YWizardMode wizardMode = YWizardMode_Standard ); 00070 00071 virtual bool hasDumbTab(); 00072 virtual YDumbTab * createDumbTab ( YWidget * parent ); 00073 00074 virtual bool hasSlider(); 00075 virtual YSlider * createSlider ( YWidget * parent, 00076 const std::string & label, 00077 int minVal, 00078 int maxVal, 00079 int initialVal ); 00080 00081 virtual bool hasDateField(); 00082 virtual YDateField * createDateField ( YWidget * parent, const std::string & label ); 00083 00084 virtual bool hasTimeField(); 00085 virtual YTimeField * createTimeField ( YWidget * parent, const std::string & label ); 00086 00087 virtual bool hasBarGraph(); 00088 virtual YBarGraph * createBarGraph ( YWidget * parent ); 00089 00090 virtual bool hasPatternSelector(); 00091 virtual YWidget * createPatternSelector ( YWidget * parent, long modeFlags = 0 ); 00092 00093 virtual bool hasSimplePatchSelector(); 00094 virtual YWidget * createSimplePatchSelector( YWidget * parent, long modeFlags = 0 ); 00095 00096 virtual bool hasMultiProgressMeter(); 00097 YMultiProgressMeter * createHMultiProgressMeter( YWidget * parent, const std::vector<float> & maxValues ); 00098 YMultiProgressMeter * createVMultiProgressMeter( YWidget * parent, const std::vector<float> & maxValues ); 00099 virtual YMultiProgressMeter * createMultiProgressMeter ( YWidget * parent, YUIDimension dim, const std::vector<float> & maxValues ); 00100 00101 virtual bool hasPartitionSplitter(); 00102 virtual YPartitionSplitter * createPartitionSplitter ( YWidget * parent, 00103 int usedSize, 00104 int totalFreeSize, 00105 int newPartSize, 00106 int minNewPartSize, 00107 int minFreeSize, 00108 const std::string & usedLabel, 00109 const std::string & freeLabel, 00110 const std::string & newPartLabel, 00111 const std::string & freeFieldLabel, 00112 const std::string & newPartFieldLabel ); 00113 00114 00115 virtual bool hasDownloadProgress(); 00116 virtual YDownloadProgress * createDownloadProgress ( YWidget * parent, 00117 const std::string & label, 00118 const std::string & filename, 00119 YFileSize_t expectedFileSize ); 00120 00121 bool hasDummySpecialWidget(); 00122 YWidget * createDummySpecialWidget( YWidget * parent ); 00123 00124 virtual bool hasTimezoneSelector(); 00125 virtual YTimezoneSelector * createTimezoneSelector( YWidget * parent, 00126 const std::string & pixmap, 00127 const std::map<std::string,std::string> & timezones ); 00128 00129 virtual bool hasGraph(); 00130 virtual YGraph * createGraph( YWidget * parent, const std::string & filename, 00131 const std::string & layoutAlgorithm ); 00132 virtual YGraph * createGraph( YWidget * parent, /* graph_t */ void * graph ); 00133 00134 virtual bool hasContextMenu(); 00135 00136 protected: 00137 00138 friend class YUI; 00139 00140 /** 00141 * Constructor. 00142 * 00143 * Use YUI::optionalWidgetFactory() to get the singleton for this class. 00144 **/ 00145 YOptionalWidgetFactory(); 00146 00147 /** 00148 * Destructor. 00149 **/ 00150 virtual ~YOptionalWidgetFactory(); 00151 00152 }; // class YOptionalWidgetFactory 00153 00154 00155 00156 #endif // YOptionalWidgetFactory_h