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