1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQOptionalWidgetFactory.cc
15 Author: Stefan Hundhammer <sh@suse.de>
21 #include "YQOptionalWidgetFactory.h"
23 #include "YUIException.h"
24 #include "YQPackageSelectorPlugin.h"
27 #define THROW_UNSUPPORTED( WIDGET_TYPE ) \
28 YUI_THROW( YUIUnsupportedWidgetException( WIDGET_TYPE ) ); \
33 YQOptionalWidgetFactory::YQOptionalWidgetFactory()
34 : YOptionalWidgetFactory()
39 YQOptionalWidgetFactory::~YQOptionalWidgetFactory()
46 bool YQOptionalWidgetFactory::hasWizard()
52 YQOptionalWidgetFactory::createWizard( YWidget * parent,
53 const string & backButtonLabel,
54 const string & abortButtonLabel,
55 const string & nextButtonLabel,
56 YWizardMode wizardMode )
58 YQWizard * wizard = new YQWizard( parent,
63 YUI_CHECK_NEW( wizard );
70 bool YQOptionalWidgetFactory::hasDumbTab()
76 YQOptionalWidgetFactory::createDumbTab( YWidget * parent )
78 YQDumbTab * dumbTab = new YQDumbTab( parent );
79 YUI_CHECK_NEW( dumbTab );
86 bool YQOptionalWidgetFactory::hasSlider()
92 YQOptionalWidgetFactory::createSlider( YWidget * parent,
98 YQSlider * slider = new YQSlider( parent, label, minVal, maxVal, initialVal );
99 YUI_CHECK_NEW( slider );
106 bool YQOptionalWidgetFactory::hasDateField()
112 YQOptionalWidgetFactory::createDateField( YWidget * parent, const string & label )
114 YQDateField * dateField = new YQDateField( parent, label );
115 YUI_CHECK_NEW( dateField );
122 bool YQOptionalWidgetFactory::hasTimeField()
128 YQOptionalWidgetFactory::createTimeField( YWidget * parent, const string & label )
130 YQTimeField * timeField = new YQTimeField( parent, label );
131 YUI_CHECK_NEW( timeField );
138 bool YQOptionalWidgetFactory::hasBarGraph()
144 YQOptionalWidgetFactory::createBarGraph( YWidget * parent )
146 YQBarGraph * barGraph = new YQBarGraph( parent );
147 YUI_CHECK_NEW( barGraph );
154 bool YQOptionalWidgetFactory::hasPatternSelector()
160 YQOptionalWidgetFactory::createPatternSelector( YWidget * parent, long modeFlags )
162 YQPackageSelectorPlugin * plugin = YQUI::ui()->packageSelectorPlugin();
165 return plugin->createPatternSelector( parent, modeFlags );
172 bool YQOptionalWidgetFactory::hasSimplePatchSelector()
177 YQSimplePatchSelector *
178 YQOptionalWidgetFactory::createSimplePatchSelector( YWidget * parent, long modeFlags )
180 YQPackageSelectorPlugin * plugin = YQUI::ui()->packageSelectorPlugin();
183 return plugin->createSimplePatchSelector( parent, modeFlags );
190 bool YQOptionalWidgetFactory::hasMultiProgressMeter()
195 YQMultiProgressMeter *
196 YQOptionalWidgetFactory::createMultiProgressMeter( YWidget * parent, YUIDimension dim, const vector<float> & maxValues )
198 YQMultiProgressMeter * multiProgressMeter = new YQMultiProgressMeter( parent, dim, maxValues );
199 YUI_CHECK_NEW( multiProgressMeter );
201 return multiProgressMeter;
206 bool YQOptionalWidgetFactory::hasPartitionSplitter()
211 YQPartitionSplitter *
212 YQOptionalWidgetFactory::createPartitionSplitter( YWidget * parent,
218 const string & usedLabel,
219 const string & freeLabel,
220 const string & newPartLabel,
221 const string & freeFieldLabel,
222 const string & newPartFieldLabel )
224 YQPartitionSplitter * partitionSplitter = new YQPartitionSplitter( parent,
235 YUI_CHECK_NEW( partitionSplitter );
237 return partitionSplitter;
242 bool YQOptionalWidgetFactory::hasDownloadProgress()
248 YQOptionalWidgetFactory::createDownloadProgress( YWidget * parent,
249 const string & label,
250 const string & filename,
251 YFileSize_t expectedSize )
253 YQDownloadProgress * downloadProgress = new YQDownloadProgress( parent,
257 YUI_CHECK_NEW( downloadProgress );
259 return downloadProgress;