libyui  3.10.0
YWidgetFactory.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: YWidgetFactory.h
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23 /-*/
24 
25 #ifndef YWidgetFactory_h
26 #define YWidgetFactory_h
27 
28 #include <string>
29 
30 #include "YTypes.h"
31 #include "YItemCustomStatus.h"
32 
33 
34 class YWidget;
35 class YAlignment;
36 class YBusyIndicator;
37 class YButtonBox;
38 class YCheckBox;
39 class YCheckBoxFrame;
40 class YComboBox;
41 class YDialog;
42 class YEmpty;
43 class YFrame;
44 class YImage;
45 class YInputField;
46 class YIntField;
47 class YItemSelector;
48 class YLabel;
49 class YLayoutBox;
50 class YLogView;
51 class YMenuButton;
52 class YMultiLineEdit;
53 class YMultiSelectionBox;
54 class YPackageSelector;
55 class YProgressBar;
56 class YPushButton;
57 class YRadioButton;
58 class YRadioButtonGroup;
59 class YReplacePoint;
60 class YRichText;
61 class YSelectionBox;
62 class YSpacing;
63 class YSquash;
64 class YTable;
65 class YTableHeader;
66 class YTimeField;
67 class YTree;
68 
69 
70 
71 /**
72  * Abstract widget factory for mandatory widgets.
73  * Use YOptionalWidgetFactory for optional ("special") widgets.
74  *
75  * Refer to the respective widget's documentation (in the header file) for
76  * documentation about the function parameters.
77  **/
79 {
80 public:
81 
82  //
83  // Dialogs
84  //
85 
86  YDialog * createMainDialog ( YDialogColorMode colorMode = YDialogNormalColor );
87  YDialog * createPopupDialog ( YDialogColorMode colorMode = YDialogNormalColor );
88  virtual YDialog * createDialog ( YDialogType dialogType, YDialogColorMode colorMode = YDialogNormalColor ) = 0;
89 
90  //
91  // Layout Boxes
92  //
93 
94  YLayoutBox * createVBox ( YWidget * parent );
95  YLayoutBox * createHBox ( YWidget * parent );
96  virtual YLayoutBox * createLayoutBox ( YWidget * parent, YUIDimension dimension ) = 0;
97  virtual YButtonBox * createButtonBox ( YWidget * parent ) = 0;
98 
99  //
100  // Common Leaf Widgets
101  //
102 
103  virtual YPushButton * createPushButton ( YWidget * parent, const std::string & label ) = 0;
104  virtual YLabel * createLabel ( YWidget * parent, const std::string & text, bool isHeading = false, bool isOutputField = false ) = 0;
105  YLabel * createHeading ( YWidget * parent, const std::string & label );
106  virtual YInputField * createInputField ( YWidget * parent, const std::string & label, bool passwordMode = false ) = 0;
107  virtual YCheckBox * createCheckBox ( YWidget * parent, const std::string & label, bool isChecked = false ) = 0;
108  virtual YRadioButton * createRadioButton ( YWidget * parent, const std::string & label, bool isChecked = false ) = 0;
109  virtual YComboBox * createComboBox ( YWidget * parent, const std::string & label, bool editable = false ) = 0;
110  virtual YSelectionBox * createSelectionBox ( YWidget * parent, const std::string & label ) = 0;
111  virtual YTree * createTree ( YWidget * parent, const std::string & label, bool multiselection = false, bool recursiveselection = false ) = 0;
112  virtual YTable * createTable ( YWidget * parent, YTableHeader * header, bool multiSelection = false ) = 0;
113  virtual YProgressBar * createProgressBar ( YWidget * parent, const std::string & label, int maxValue = 100 ) = 0;
114  virtual YRichText * createRichText ( YWidget * parent, const std::string & text = std::string(), bool plainTextMode = false ) = 0;
115  virtual YBusyIndicator * createBusyIndicator ( YWidget * parent, const std::string & label, int timeout = 1000 ) = 0;
116 
117  //
118  // Less Common Leaf Widgets
119  //
120 
121  YPushButton * createIconButton ( YWidget * parent, const std::string & iconName, const std::string & fallbackTextLabel );
122  YLabel * createOutputField ( YWidget * parent, const std::string & label );
123  virtual YIntField * createIntField ( YWidget * parent, const std::string & label, int minVal, int maxVal, int initialVal ) = 0;
124  YInputField * createPasswordField ( YWidget * parent, const std::string & label );
125 
126  virtual YMenuButton * createMenuButton ( YWidget * parent, const std::string & label ) = 0;
127  virtual YMultiLineEdit * createMultiLineEdit ( YWidget * parent, const std::string & label ) = 0;
128  virtual YImage * createImage ( YWidget * parent, const std::string & imageFileName, bool animated = false ) = 0;
129  virtual YLogView * createLogView ( YWidget * parent, const std::string & label, int visibleLines, int storedLines = 0 ) = 0;
130  virtual YMultiSelectionBox *createMultiSelectionBox ( YWidget * parent, const std::string & label ) = 0;
131 
132  virtual YPackageSelector * createPackageSelector ( YWidget * parent, long ModeFlags = 0 ) = 0;
133  virtual YWidget * createPkgSpecial ( YWidget * parent, const std::string & subwidgetName ) = 0; // NCurses only
134 
135  //
136  // Layout Helpers
137  //
138 
139  YSpacing * createHStretch ( YWidget * parent );
140  YSpacing * createVStretch ( YWidget * parent );
141  YSpacing * createHSpacing ( YWidget * parent, YLayoutSize_t size = 1.0 );
142  YSpacing * createVSpacing ( YWidget * parent, YLayoutSize_t size = 1.0 );
143  virtual YSpacing * createSpacing ( YWidget * parent, YUIDimension dim, bool stretchable = false, YLayoutSize_t size = 0.0 ) = 0;
144  virtual YEmpty * createEmpty ( YWidget * parent ) = 0;
145 
146  YAlignment * createLeft ( YWidget * parent );
147  YAlignment * createRight ( YWidget * parent );
148  YAlignment * createTop ( YWidget * parent );
149  YAlignment * createBottom ( YWidget * parent );
150  YAlignment * createHCenter ( YWidget * parent );
151  YAlignment * createVCenter ( YWidget * parent );
152  YAlignment * createHVCenter ( YWidget * parent );
153 
154  YAlignment * createMarginBox ( YWidget * parent, YLayoutSize_t horMargin, YLayoutSize_t vertMargin );
155  YAlignment * createMarginBox ( YWidget * parent,
156  YLayoutSize_t leftMargin, YLayoutSize_t rightMargin,
157  YLayoutSize_t topMargin, YLayoutSize_t bottomMargin );
158 
159  YAlignment * createMinWidth ( YWidget * parent, YLayoutSize_t minWidth );
160  YAlignment * createMinHeight ( YWidget * parent, YLayoutSize_t minHeight );
161  YAlignment * createMinSize ( YWidget * parent, YLayoutSize_t minWidth, YLayoutSize_t minHeight );
162 
163  virtual YAlignment * createAlignment ( YWidget * parent, YAlignmentType horAlignment, YAlignmentType vertAlignment ) = 0;
164 
165  YSquash * createHSquash ( YWidget * parent );
166  YSquash * createVSquash ( YWidget * parent );
167  YSquash * createHVSquash ( YWidget * parent );
168  virtual YSquash * createSquash ( YWidget * parent, bool horSquash, bool vertSquash ) = 0;
169 
170  //
171  // Visual Grouping
172  //
173 
174  virtual YFrame * createFrame ( YWidget * parent, const std::string & label ) = 0;
175  virtual YCheckBoxFrame * createCheckBoxFrame ( YWidget * parent, const std::string & label, bool checked ) = 0;
176 
177  //
178  // Logical Grouping
179  //
180 
181  virtual YRadioButtonGroup * createRadioButtonGroup ( YWidget * parent ) = 0;
182  virtual YReplacePoint * createReplacePoint ( YWidget * parent ) = 0;
183 
184  //
185  // More leaf widgets (moved to the end to maintain ABI compatibility)
186  //
187 
188  virtual YItemSelector * createItemSelector ( YWidget * parent, bool enforceSingleSelection = true );
189  YItemSelector * createSingleItemSelector ( YWidget * parent );
190  YItemSelector * createMultiItemSelector ( YWidget * parent );
191  virtual YItemSelector * createCustomStatusItemSelector ( YWidget * parent, const YItemCustomStatusVector & customStates );
192 
193 protected:
194 
195  /**
196  * Constructor.
197  *
198  * Use YUI::widgetFactory() to get the singleton for this class.
199  **/
200  YWidgetFactory();
201 
202  /**
203  * Destructor.
204  **/
205  virtual ~YWidgetFactory();
206 
207 }; // class YWidgetFactory
208 
209 
210 #endif // YWidgetFactory_h
Author: Stefan Hundhammer sh@suse.de
YDialogType
Type of dialog: Main / Popup / Wizard.
Definition: YTypes.h:67
Implementation of all the alignment widgets:
Definition: YAlignment.h:42
Indicates that something is in progress and has not frozen yet.
Container widget for dialog buttons that abstracts the button order depending on the desktop environm...
Definition: YButtonBox.h:149
A frame with a check-box, may auto-disable frame contents based on the check.
A tri-state check box.
Definition: YCheckBox.h:47
ComboBox (or "drop down box", "drop down selection"); may be editable.
Definition: YComboBox.h:54
A window in the desktop environment.
Definition: YDialog.h:48
A widget with zero size, useful as a placeholder.
Definition: YEmpty.h:38
A labeled framed container.
Definition: YFrame.h:39
A picture, possibly animated, loaded from a file.
Definition: YImage.h:38
InputField: General purpose one line input field for entering text and other data.
Definition: YInputField.h:47
IntField: Input field for integer values.
Definition: YIntField.h:39
Scrollable item selector widget with not only a label for each item, but also a (possible multi-line)...
Definition: YItemSelector.h:44
Implementation of the Label, Heading and OutputField widgets.
Definition: YLabel.h:39
A vertical or horizontal stacking of widgets, implementing HBox and VBox.
Definition: YLayoutBox.h:38
LogView: A scrollable (output-only) text to display a growing log, very much like the "tail -f" shell...
Definition: YLogView.h:38
MenuButton: Similar to PushButton, but with several actions: Upon clicking on a MenuButton (or activa...
Definition: YMenuButton.h:49
A multi-line plain-text area.
A variant of YSelectionBox where more than one item can be selected.
A simple wrapper for an insanely complex UI for installing software.
A progress bar, showing completion of value() out of maxValue() parts.
Definition: YProgressBar.h:37
A push button; may have an icon, and a F-key shortcut.
Definition: YPushButton.h:38
A group of YRadioButton widgets.
RadioButton: Widget for one-out-of-many selection.
Definition: YRadioButton.h:52
A placeholder that can have its contents exchanged, using ReplaceWidget.
Definition: YReplacePoint.h:34
Text formatted with simple HTML-like tags, with "links" generating events.
Definition: YRichText.h:41
Selection box: List box that displays a (scrollable) list of items from which the user can select exa...
Definition: YSelectionBox.h:57
HSpacing, VSpacing, HStretch, VStretch.
Definition: YSpacing.h:38
HSquash, VSquash HVSquash: reduce child to its preferred size.
Definition: YSquash.h:42
Helper class for YTable for table column properties:
Definition: YTableHeader.h:44
Table: Selection list with multiple columns.
Definition: YTable.h:57
Input field for entering a time in "hh:mm:ss" format.
Definition: YTimeField.h:42
Tree: List box that displays a (scrollable) list of hierarchical items from which the user can select...
Definition: YTree.h:57
Abstract widget factory for mandatory widgets.
virtual ~YWidgetFactory()
Destructor.
YWidgetFactory()
Constructor.
Abstract base class of all UI widgets.
Definition: YWidget.h:55