libyui  3.3.2
YOptionalWidgetFactory.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YOptionalWidgetFactory.h
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23 /-*/
24 
25 #ifndef YOptionalWidgetFactory_h
26 #define YOptionalWidgetFactory_h
27 
28 #include <string>
29 #include <vector>
30 #include <map>
31 
32 #include "YTypes.h"
33 #include "YWizard.h"
34 #include "YGraph.h"
35 
36 
37 class YBarGraph;
38 class YDateField;
39 class YDownloadProgress;
40 class YDumbTab;
41 class YDummySpecialWidget;
43 class YPartitionSplitter;
44 class YSlider;
45 class YTimeField;
46 class YWidget;
47 class YTimezoneSelector;
48 
49 /**
50  * Abstract widget factory for optional ("special") widgets.
51  *
52  * Remember to always check with the corresponding "has..()" method if the
53  * current UI actually provides the requested widget. Otherwise the
54  * "create...()" method will throw an exception.
55  **/
57 {
58 public:
59 
60  //
61  // Optional Widgets
62  //
63 
64  virtual bool hasWizard();
65  virtual YWizard * createWizard ( YWidget * parent,
66  const std::string & backButtonLabel,
67  const std::string & abortButtonLabel,
68  const std::string & nextButtonLabel,
69  YWizardMode wizardMode = YWizardMode_Standard );
70 
71  virtual bool hasDumbTab();
72  virtual YDumbTab * createDumbTab ( YWidget * parent );
73 
74  virtual bool hasSlider();
75  virtual YSlider * createSlider ( YWidget * parent,
76  const std::string & label,
77  int minVal,
78  int maxVal,
79  int initialVal );
80 
81  virtual bool hasDateField();
82  virtual YDateField * createDateField ( YWidget * parent, const std::string & label );
83 
84  virtual bool hasTimeField();
85  virtual YTimeField * createTimeField ( YWidget * parent, const std::string & label );
86 
87  virtual bool hasBarGraph();
88  virtual YBarGraph * createBarGraph ( YWidget * parent );
89 
90  virtual bool hasPatternSelector();
91  virtual YWidget * createPatternSelector ( YWidget * parent, long modeFlags = 0 );
92 
93  virtual bool hasSimplePatchSelector();
94  virtual YWidget * createSimplePatchSelector( YWidget * parent, long modeFlags = 0 );
95 
96  virtual bool hasMultiProgressMeter();
97  YMultiProgressMeter * createHMultiProgressMeter( YWidget * parent, const std::vector<float> & maxValues );
98  YMultiProgressMeter * createVMultiProgressMeter( YWidget * parent, const std::vector<float> & maxValues );
99  virtual YMultiProgressMeter * createMultiProgressMeter ( YWidget * parent, YUIDimension dim, const std::vector<float> & maxValues );
100 
101  virtual bool hasPartitionSplitter();
102  virtual YPartitionSplitter * createPartitionSplitter ( YWidget * parent,
103  int usedSize,
104  int totalFreeSize,
105  int newPartSize,
106  int minNewPartSize,
107  int minFreeSize,
108  const std::string & usedLabel,
109  const std::string & freeLabel,
110  const std::string & newPartLabel,
111  const std::string & freeFieldLabel,
112  const std::string & newPartFieldLabel );
113 
114 
115  virtual bool hasDownloadProgress();
116  virtual YDownloadProgress * createDownloadProgress ( YWidget * parent,
117  const std::string & label,
118  const std::string & filename,
119  YFileSize_t expectedFileSize );
120 
121  bool hasDummySpecialWidget();
122  YWidget * createDummySpecialWidget( YWidget * parent );
123 
124  virtual bool hasTimezoneSelector();
125  virtual YTimezoneSelector * createTimezoneSelector( YWidget * parent,
126  const std::string & pixmap,
127  const std::map<std::string,std::string> & timezones );
128 
129  virtual bool hasGraph();
130  virtual YGraph * createGraph( YWidget * parent, const std::string & filename,
131  const std::string & layoutAlgorithm );
132  virtual YGraph * createGraph( YWidget * parent, /* graph_t */ void * graph );
133 
134  virtual bool hasContextMenu();
135 
136 protected:
137 
138  friend class YUI;
139 
140  /**
141  * Constructor.
142  *
143  * Use YUI::optionalWidgetFactory() to get the singleton for this class.
144  **/
146 
147  /**
148  * Destructor.
149  **/
150  virtual ~YOptionalWidgetFactory();
151 
152 }; // class YOptionalWidgetFactory
153 
154 
155 
156 #endif // YOptionalWidgetFactory_h
Input field for entering a date.
Definition: YDateField.h:42
YWizardMode
Kind of the wizard layout.
Definition: YWizard.h:42
Abstract widget factory for optional ("special") widgets.
Author: Stefan Hundhammer sh@suse.de
Input field for entering a time in "hh:mm:ss" format.
Definition: YTimeField.h:41
Abstract base class of a libYUI user interface.
Definition: YUI.h:48
DownloadProgress: A progress bar that monitors downloading a file by repeatedly polling its size up t...
DumbTab: A very simple tab widget that can display and switch between a number of tabs...
Definition: YDumbTab.h:40
virtual ~YOptionalWidgetFactory()
Destructor.
PartitionSplitter: A (very custom) widget for easily splitting one existing partition into two...
Author: Stefan Hundhammer sh@suse.de
A graph showing partitioning of a whole.
Definition: YBarGraph.h:40
MultiProgressMeter: Progress bar with several segments that can indicate progress individually...
Normal wizard (help panel or nothing)
Definition: YWizard.h:44
A graph with nodes and edges, rendered with Graphviz.
Definition: YGraph.h:45
A wizard is a more complex frame typically used for multi-step workflows:
Definition: YWizard.h:96
A fancy widget with a world map.
Slider: Input widget for an integer value between a minimum and a maximum value.
Definition: YSlider.h:44
Abstract base class of all UI widgets.
Definition: YWidget.h:54