libyui
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 <shundhammer@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 YMenuBar;
52 class YMenuButton;
53 class YMultiLineEdit;
54 class YMultiSelectionBox;
55 class YPackageSelector;
56 class YProgressBar;
57 class YPushButton;
58 class YRadioButton;
59 class YRadioButtonGroup;
60 class YReplacePoint;
61 class YRichText;
62 class YSelectionBox;
63 class YSpacing;
64 class YSquash;
65 class YTable;
66 class YTableHeader;
67 class YTimeField;
68 class YTree;
69 
70 
71 
80 {
81 public:
82 
83  //
84  // Dialogs
85  //
86 
87  YDialog * createMainDialog ( YDialogColorMode colorMode = YDialogNormalColor );
88  YDialog * createPopupDialog ( YDialogColorMode colorMode = YDialogNormalColor );
89  virtual YDialog * createDialog ( YDialogType dialogType, YDialogColorMode colorMode = YDialogNormalColor ) = 0;
90 
91  //
92  // Layout Boxes
93  //
94 
95  YLayoutBox * createVBox ( YWidget * parent );
96  YLayoutBox * createHBox ( YWidget * parent );
97  virtual YLayoutBox * createLayoutBox ( YWidget * parent, YUIDimension dimension ) = 0;
98  virtual YButtonBox * createButtonBox ( YWidget * parent ) = 0;
99 
100  //
101  // Common Leaf Widgets
102  //
103 
104  virtual YPushButton * createPushButton ( YWidget * parent, const std::string & label ) = 0;
105  virtual YLabel * createLabel ( YWidget * parent, const std::string & text, bool isHeading = false, bool isOutputField = false ) = 0;
106  YLabel * createHeading ( YWidget * parent, const std::string & label );
107  virtual YInputField * createInputField ( YWidget * parent, const std::string & label, bool passwordMode = false ) = 0;
108  virtual YCheckBox * createCheckBox ( YWidget * parent, const std::string & label, bool isChecked = false ) = 0;
109  virtual YRadioButton * createRadioButton ( YWidget * parent, const std::string & label, bool isChecked = false ) = 0;
110  virtual YComboBox * createComboBox ( YWidget * parent, const std::string & label, bool editable = false ) = 0;
111  virtual YSelectionBox * createSelectionBox ( YWidget * parent, const std::string & label ) = 0;
112  virtual YTree * createTree ( YWidget * parent, const std::string & label, bool multiselection = false, bool recursiveselection = false ) = 0;
113  virtual YTable * createTable ( YWidget * parent, YTableHeader * header_disown, bool multiSelection = false ) = 0;
114  virtual YProgressBar * createProgressBar ( YWidget * parent, const std::string & label, int maxValue = 100 ) = 0;
115  virtual YRichText * createRichText ( YWidget * parent, const std::string & text = std::string(), bool plainTextMode = false ) = 0;
116  virtual YBusyIndicator * createBusyIndicator ( YWidget * parent, const std::string & label, int timeout = 1000 ) = 0;
117 
118  //
119  // Less Common Leaf Widgets
120  //
121 
122  YPushButton * createIconButton ( YWidget * parent, const std::string & iconName, const std::string & fallbackTextLabel );
123  YLabel * createOutputField ( YWidget * parent, const std::string & label );
124  virtual YIntField * createIntField ( YWidget * parent, const std::string & label, int minVal, int maxVal, int initialVal ) = 0;
125  YInputField * createPasswordField ( YWidget * parent, const std::string & label );
126 
127  virtual YMenuButton * createMenuButton ( YWidget * parent, const std::string & label ) = 0;
128  virtual YMultiLineEdit * createMultiLineEdit ( YWidget * parent, const std::string & label ) = 0;
129  virtual YImage * createImage ( YWidget * parent, const std::string & imageFileName, bool animated = false ) = 0;
130  virtual YLogView * createLogView ( YWidget * parent, const std::string & label, int visibleLines, int storedLines = 0 ) = 0;
131  virtual YMultiSelectionBox *createMultiSelectionBox ( YWidget * parent, const std::string & label ) = 0;
132 
133  virtual YPackageSelector * createPackageSelector ( YWidget * parent, long ModeFlags = 0 ) = 0;
134  virtual YWidget * createPkgSpecial ( YWidget * parent, const std::string & subwidgetName ) = 0; // NCurses only
135 
136  //
137  // Layout Helpers
138  //
139 
140  YSpacing * createHStretch ( YWidget * parent );
141  YSpacing * createVStretch ( YWidget * parent );
142  YSpacing * createHSpacing ( YWidget * parent, YLayoutSize_t size = 1.0 );
143  YSpacing * createVSpacing ( YWidget * parent, YLayoutSize_t size = 1.0 );
144  virtual YSpacing * createSpacing ( YWidget * parent, YUIDimension dim, bool stretchable = false, YLayoutSize_t size = 0.0 ) = 0;
145  virtual YEmpty * createEmpty ( YWidget * parent ) = 0;
146 
147  YAlignment * createLeft ( YWidget * parent );
148  YAlignment * createRight ( YWidget * parent );
149  YAlignment * createTop ( YWidget * parent );
150  YAlignment * createBottom ( YWidget * parent );
151  YAlignment * createHCenter ( YWidget * parent );
152  YAlignment * createVCenter ( YWidget * parent );
153  YAlignment * createHVCenter ( YWidget * parent );
154 
155  YAlignment * createMarginBox ( YWidget * parent, YLayoutSize_t horMargin, YLayoutSize_t vertMargin );
156  YAlignment * createMarginBox ( YWidget * parent,
157  YLayoutSize_t leftMargin, YLayoutSize_t rightMargin,
158  YLayoutSize_t topMargin, YLayoutSize_t bottomMargin );
159 
160  YAlignment * createMinWidth ( YWidget * parent, YLayoutSize_t minWidth );
161  YAlignment * createMinHeight ( YWidget * parent, YLayoutSize_t minHeight );
162  YAlignment * createMinSize ( YWidget * parent, YLayoutSize_t minWidth, YLayoutSize_t minHeight );
163 
164  virtual YAlignment * createAlignment ( YWidget * parent, YAlignmentType horAlignment, YAlignmentType vertAlignment ) = 0;
165 
166  YSquash * createHSquash ( YWidget * parent );
167  YSquash * createVSquash ( YWidget * parent );
168  YSquash * createHVSquash ( YWidget * parent );
169  virtual YSquash * createSquash ( YWidget * parent, bool horSquash, bool vertSquash ) = 0;
170 
171  //
172  // Visual Grouping
173  //
174 
175  virtual YFrame * createFrame ( YWidget * parent, const std::string & label ) = 0;
176  virtual YCheckBoxFrame * createCheckBoxFrame ( YWidget * parent, const std::string & label, bool checked ) = 0;
177 
178  //
179  // Logical Grouping
180  //
181 
182  virtual YRadioButtonGroup * createRadioButtonGroup ( YWidget * parent ) = 0;
183  virtual YReplacePoint * createReplacePoint ( YWidget * parent ) = 0;
184 
185  //
186  // More leaf widgets (moved to the end to maintain ABI compatibility)
187  //
188 
189  virtual YItemSelector * createItemSelector ( YWidget * parent, bool enforceSingleSelection = true );
190  YItemSelector * createSingleItemSelector ( YWidget * parent );
191  YItemSelector * createMultiItemSelector ( YWidget * parent );
192  virtual YItemSelector * createCustomStatusItemSelector ( YWidget * parent, const YItemCustomStatusVector & customStates );
193 
194  virtual YMenuBar * createMenuBar ( YWidget * parent );
195 
196 
197 protected:
198 
204  YWidgetFactory();
205 
209  virtual ~YWidgetFactory();
210 
211 }; // class YWidgetFactory
212 
213 
214 #endif // YWidgetFactory_h
Definition: YRadioButton.h:51
Definition: YSelectionBox.h:56
YWidgetFactory()
Definition: YWidgetFactory.cc:37
Definition: YTimeField.h:41
Definition: YLayoutBox.h:37
YDialogType
Definition: YTypes.h:66
Definition: YLabel.h:38
Definition: YReplacePoint.h:33
virtual ~YWidgetFactory()
Definition: YWidgetFactory.cc:43
Definition: YTableHeader.h:43
Definition: YMenuBar.h:50
Definition: YRadioButtonGroup.h:41
Definition: YMenuButton.h:47
Definition: YFrame.h:38
Definition: YSquash.h:41
Definition: YMultiSelectionBox.h:36
Definition: YEmpty.h:37
Definition: YTable.h:59
Definition: YComboBox.h:53
Definition: YPushButton.h:37
Definition: YMultiLineEdit.h:35
Definition: YAlignment.h:41
Definition: YItemSelector.h:43
Definition: YCheckBoxFrame.h:39
Definition: YSpacing.h:37
Definition: YLogView.h:37
Definition: YBusyIndicator.h:38
Definition: YPackageSelector.h:43
Definition: YIntField.h:38
Definition: YTree.h:57
Definition: YRichText.h:40
Definition: YInputField.h:46
Definition: YDialog.h:47
Definition: YProgressBar.h:36
Definition: YWidgetFactory.h:79
Definition: YButtonBox.h:148
Definition: YCheckBox.h:46
Definition: YImage.h:37
Definition: YWidget.h:54