libyui-ncurses  2.54.5
NCWidgetFactory.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  Copyright (C) 2019 SUSE LLC
4  This library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU Lesser General Public License as
6  published by the Free Software Foundation; either version 2.1 of the
7  License, or (at your option) version 3.0 of the License. This library
8  is distributed in the hope that it will be useful, but WITHOUT ANY
9  WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
11  License for more details. You should have received a copy of the GNU
12  Lesser General Public License along with this library; if not, write
13  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
14  Floor, Boston, MA 02110-1301 USA
15 */
16 
17 
18 /*-/
19 
20  File: NCWidgetFactory.h
21 
22  Author: Gabriele Mohr <gs@suse.de>
23 
24 /-*/
25 
26 #ifndef NCWidgetFactory_h
27 #define NCWidgetFactory_h
28 
29 
30 #include <yui/YWidgetFactory.h>
31 
32 #include "NCAlignment.h"
33 #include "NCBusyIndicator.h"
34 #include "NCButtonBox.h"
35 #include "NCCheckBox.h"
36 #include "NCCheckBoxFrame.h"
37 #include "NCComboBox.h"
38 #include "NCCustomStatusItemSelector.h"
39 #include "NCDialog.h"
40 #include "NCEmpty.h"
41 #include "NCFrame.h"
42 #include "NCImage.h"
43 #include "NCInputField.h"
44 #include "NCIntField.h"
45 #include "NCItemSelector.h"
46 #include "NCLabel.h"
47 #include "NCLogView.h"
48 #include "NCMenuButton.h"
49 #include "NCMultiLineEdit.h"
50 #include "NCMultiSelectionBox.h"
51 #include "NCPackageSelectorPluginStub.h"
52 #include "NCProgressBar.h"
53 #include "NCPushButton.h"
54 #include "NCRadioButton.h"
55 #include "NCRadioButtonGroup.h"
56 #include "NCReplacePoint.h"
57 #include "NCRichText.h"
58 #include "NCSelectionBox.h"
59 #include "NCSpacing.h"
60 #include "NCSquash.h"
61 #include "NCTable.h"
62 #include "NCTree.h"
63 #include "NCLayoutBox.h"
64 
65 
66 /**
67  * Concrete widget factory for mandatory widgets.
68  **/
69 class NCWidgetFactory: public YWidgetFactory
70 {
71 public:
72  // Note: Using covariant return types for all createSomeWidget() methods
73  // (returning NCSomeWidget where the base class declares virtual methods that
74  // return YSomeWidget)
75 
76 
77  //
78  // Dialogs
79  //
80 
81  virtual NCDialog * createDialog ( YDialogType dialogType, YDialogColorMode colorMode = YDialogNormalColor );
82 
83  //
84  // Layout Boxes
85  //
86 
87  virtual NCLayoutBox * createLayoutBox ( YWidget * parent, YUIDimension dim );
88  virtual NCButtonBox * createButtonBox ( YWidget * parent );
89 
90 
91  //
92  // Common Leaf Widgets
93  //
94 
95  virtual NCPushButton * createPushButton ( YWidget * parent, const std::string & label );
96  virtual NCLabel * createLabel ( YWidget * parent, const std::string & text, bool isHeading = false, bool isOutputField = false );
97  virtual NCInputField * createInputField ( YWidget * parent, const std::string & label, bool passwordMode = false );
98  virtual NCCheckBox * createCheckBox ( YWidget * parent, const std::string & label, bool isChecked = false );
99  virtual NCRadioButton * createRadioButton ( YWidget * parent, const std::string & label, bool isChecked = false );
100  virtual NCComboBox * createComboBox ( YWidget * parent, const std::string & label, bool editable = false );
101  virtual NCSelectionBox * createSelectionBox ( YWidget * parent, const std::string & label );
102  virtual NCTree * createTree ( YWidget * parent, const std::string & label, bool multiselection = false, bool recursiveselection = false );
103  virtual NCTable * createTable ( YWidget * parent, YTableHeader * tableHeader, bool multiSelection = false );
104  virtual NCProgressBar * createProgressBar ( YWidget * parent, const std::string & label, int maxValue = 100 );
105  virtual NCRichText * createRichText ( YWidget * parent, const std::string & text = std::string(), bool plainTextMode = false );
106 
107 
108  //
109  // Less Common Leaf Widgets
110  //
111 
112  virtual NCIntField * createIntField ( YWidget * parent, const std::string & label, int minVal, int maxVal, int initialVal );
113  virtual NCMenuButton * createMenuButton ( YWidget * parent, const std::string & label );
114  virtual NCMultiLineEdit * createMultiLineEdit ( YWidget * parent, const std::string & label );
115  virtual NCImage * createImage ( YWidget * parent, const std::string & imagePath, bool animated = false );
116  virtual NCLogView * createLogView ( YWidget * parent, const std::string & label, int visibleLines, int storedLines = 0 );
117  virtual NCMultiSelectionBox*createMultiSelectionBox ( YWidget * parent, const std::string & label );
118  virtual YPackageSelector * createPackageSelector ( YWidget * parent, long ModeFlags = 0 );
119  virtual NCBusyIndicator * createBusyIndicator ( YWidget * parent, const std::string & label, int timeout = 1000 );
120 
121  // NCurses only
122  virtual YWidget * createPkgSpecial ( YWidget * parent, const std::string & subwidgetName );
123 
124 
125  //
126  // Layout Helpers
127  //
128 
129  virtual NCSpacing * createSpacing ( YWidget * parent, YUIDimension dim, bool stretchable = false, YLayoutSize_t size = 0.0 );
130  virtual NCEmpty * createEmpty ( YWidget * parent );
131  virtual NCAlignment * createAlignment ( YWidget * parent, YAlignmentType horAlignment, YAlignmentType vertAlignment );
132  virtual NCSquash * createSquash ( YWidget * parent, bool horSquash, bool vertSquash );
133 
134 
135  //
136  // Visual Grouping
137  //
138 
139  virtual NCFrame * createFrame ( YWidget * parent, const std::string & label );
140  virtual NCCheckBoxFrame * createCheckBoxFrame ( YWidget * parent, const std::string & label, bool checked );
141 
142 
143  //
144  // Logical Grouping
145  //
146 
147  virtual NCRadioButtonGroup *createRadioButtonGroup ( YWidget * parent );
148  virtual NCReplacePoint * createReplacePoint ( YWidget * parent );
149 
150 
151  //
152  // More leaf widgets (moved to the end to maintain ABI compatibility)
153  //
154 
155  virtual NCItemSelector * createItemSelector ( YWidget * parent, bool enforceSingleSelection = true );
156  virtual NCCustomStatusItemSelector * createCustomStatusItemSelector ( YWidget * parent, const YItemCustomStatusVector & customStates );
157 
158 
159 protected:
160 
161  friend class YNCursesUI;
162 
163  /**
164  * Constructor.
165  *
166  * Use YUI::widgetFactory() to get the singleton for this class.
167  **/
168  NCWidgetFactory();
169 
170  /**
171  * Destructor.
172  **/
173  virtual ~NCWidgetFactory();
174 
175 }; // class NCWidgetFactory
176 
177 
178 #endif // NCWidgetFactory_h
Concrete widget factory for mandatory widgets.
NCWidgetFactory()
Constructor.
virtual ~NCWidgetFactory()
Destructor.
Definition: NCTree.h:38