1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQOptionalWidgetFactory.cc
15 Author: Stefan Hundhammer <sh@suse.de>
19 #include "YQOptionalWidgetFactory.h"
21 #include "YUIException.h"
22 #include "YQPackageSelectorPlugin.h"
25 #define THROW_UNSUPPORTED( WIDGET_TYPE ) \
26 YUI_THROW( YUIUnsupportedWidgetException( WIDGET_TYPE ) ); \
31 YQOptionalWidgetFactory::YQOptionalWidgetFactory()
32 : YOptionalWidgetFactory()
37 YQOptionalWidgetFactory::~YQOptionalWidgetFactory()
44 bool YQOptionalWidgetFactory::hasWizard()
50 YQOptionalWidgetFactory::createWizard( YWidget * parent,
51 const string & backButtonLabel,
52 const string & abortButtonLabel,
53 const string & nextButtonLabel,
54 YWizardMode wizardMode )
56 YQWizard * wizard = new YQWizard( parent,
61 YUI_CHECK_NEW( wizard );
68 bool YQOptionalWidgetFactory::hasDumbTab()
74 YQOptionalWidgetFactory::createDumbTab( YWidget * parent )
76 YQDumbTab * dumbTab = new YQDumbTab( parent );
77 YUI_CHECK_NEW( dumbTab );
84 bool YQOptionalWidgetFactory::hasSlider()
90 YQOptionalWidgetFactory::createSlider( YWidget * parent,
96 YQSlider * slider = new YQSlider( parent, label, minVal, maxVal, initialVal );
97 YUI_CHECK_NEW( slider );
104 bool YQOptionalWidgetFactory::hasDateField()
110 YQOptionalWidgetFactory::createDateField( YWidget * parent, const string & label )
112 YQDateField * dateField = new YQDateField( parent, label );
113 YUI_CHECK_NEW( dateField );
120 bool YQOptionalWidgetFactory::hasTimeField()
126 YQOptionalWidgetFactory::createTimeField( YWidget * parent, const string & label )
128 YQTimeField * timeField = new YQTimeField( parent, label );
129 YUI_CHECK_NEW( timeField );
136 bool YQOptionalWidgetFactory::hasBarGraph()
142 YQOptionalWidgetFactory::createBarGraph( YWidget * parent )
144 YQBarGraph * barGraph = new YQBarGraph( parent );
145 YUI_CHECK_NEW( barGraph );
152 bool YQOptionalWidgetFactory::hasPatternSelector()
158 YQOptionalWidgetFactory::createPatternSelector( YWidget * parent, long modeFlags )
160 YQPackageSelectorPlugin * plugin = YQUI::ui()->packageSelectorPlugin();
163 return plugin->createPatternSelector( parent, modeFlags );
170 bool YQOptionalWidgetFactory::hasSimplePatchSelector()
175 YQSimplePatchSelector *
176 YQOptionalWidgetFactory::createSimplePatchSelector( YWidget * parent, long modeFlags )
178 YQPackageSelectorPlugin * plugin = YQUI::ui()->packageSelectorPlugin();
181 return plugin->createSimplePatchSelector( parent, modeFlags );
188 bool YQOptionalWidgetFactory::hasMultiProgressMeter()
193 YQMultiProgressMeter *
194 YQOptionalWidgetFactory::createMultiProgressMeter( YWidget * parent, YUIDimension dim, const vector<float> & maxValues )
196 YQMultiProgressMeter * multiProgressMeter = new YQMultiProgressMeter( parent, dim, maxValues );
197 YUI_CHECK_NEW( multiProgressMeter );
199 return multiProgressMeter;
204 bool YQOptionalWidgetFactory::hasPartitionSplitter()
209 YQPartitionSplitter *
210 YQOptionalWidgetFactory::createPartitionSplitter( YWidget * parent,
216 const string & usedLabel,
217 const string & freeLabel,
218 const string & newPartLabel,
219 const string & freeFieldLabel,
220 const string & newPartFieldLabel )
222 YQPartitionSplitter * partitionSplitter = new YQPartitionSplitter( parent,
233 YUI_CHECK_NEW( partitionSplitter );
235 return partitionSplitter;
240 bool YQOptionalWidgetFactory::hasDownloadProgress()
246 YQOptionalWidgetFactory::createDownloadProgress( YWidget * parent,
247 const string & label,
248 const string & filename,
249 YFileSize_t expectedSize )
251 YQDownloadProgress * downloadProgress = new YQDownloadProgress( parent,
255 YUI_CHECK_NEW( downloadProgress );
257 return downloadProgress;