libyui-ncurses  2.57.2
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 "NCMenuBar.h"
49 #include "NCMenuButton.h"
50 #include "NCMultiLineEdit.h"
51 #include "NCMultiSelectionBox.h"
52 #include "NCPackageSelectorPluginStub.h"
53 #include "NCProgressBar.h"
54 #include "NCPushButton.h"
55 #include "NCRadioButton.h"
56 #include "NCRadioButtonGroup.h"
57 #include "NCReplacePoint.h"
58 #include "NCRichText.h"
59 #include "NCSelectionBox.h"
60 #include "NCSpacing.h"
61 #include "NCSquash.h"
62 #include "NCTable.h"
63 #include "NCTree.h"
64 #include "NCLayoutBox.h"
65 
66 
67 /**
68  * Concrete widget factory for mandatory widgets.
69  **/
70 class NCWidgetFactory: public YWidgetFactory
71 {
72 public:
73  // Note: Using covariant return types for all createSomeWidget() methods
74  // (returning NCSomeWidget where the base class declares virtual methods that
75  // return YSomeWidget)
76 
77 
78  //
79  // Dialogs
80  //
81 
82  virtual NCDialog * createDialog ( YDialogType dialogType, YDialogColorMode colorMode = YDialogNormalColor );
83 
84  //
85  // Layout Boxes
86  //
87 
88  virtual NCLayoutBox * createLayoutBox ( YWidget * parent, YUIDimension dim );
89  virtual NCButtonBox * createButtonBox ( YWidget * parent );
90 
91 
92  //
93  // Common Leaf Widgets
94  //
95 
96  virtual NCPushButton * createPushButton ( YWidget * parent, const std::string & label );
97  virtual NCLabel * createLabel ( YWidget * parent, const std::string & text, bool isHeading = false, bool isOutputField = false );
98  virtual NCInputField * createInputField ( YWidget * parent, const std::string & label, bool passwordMode = false );
99  virtual NCCheckBox * createCheckBox ( YWidget * parent, const std::string & label, bool isChecked = false );
100  virtual NCRadioButton * createRadioButton ( YWidget * parent, const std::string & label, bool isChecked = false );
101  virtual NCComboBox * createComboBox ( YWidget * parent, const std::string & label, bool editable = false );
102  virtual NCSelectionBox * createSelectionBox ( YWidget * parent, const std::string & label );
103  virtual NCTree * createTree ( YWidget * parent, const std::string & label, bool multiselection = false, bool recursiveselection = false );
104  virtual NCTable * createTable ( YWidget * parent, YTableHeader * tableHeader, bool multiSelection = false );
105  virtual NCProgressBar * createProgressBar ( YWidget * parent, const std::string & label, int maxValue = 100 );
106  virtual NCRichText * createRichText ( YWidget * parent, const std::string & text = std::string(), bool plainTextMode = false );
107 
108 
109  //
110  // Less Common Leaf Widgets
111  //
112 
113  virtual NCIntField * createIntField ( YWidget * parent, const std::string & label, int minVal, int maxVal, int initialVal );
114  virtual NCMenuButton * createMenuButton ( YWidget * parent, const std::string & label );
115  virtual NCMenuBar * createMenuBar ( YWidget * parent );
116  virtual NCMultiLineEdit * createMultiLineEdit ( YWidget * parent, const std::string & label );
117  virtual NCImage * createImage ( YWidget * parent, const std::string & imagePath, bool animated = false );
118  virtual NCLogView * createLogView ( YWidget * parent, const std::string & label, int visibleLines, int storedLines = 0 );
119  virtual NCMultiSelectionBox*createMultiSelectionBox ( YWidget * parent, const std::string & label );
120  virtual YPackageSelector * createPackageSelector ( YWidget * parent, long ModeFlags = 0 );
121  virtual NCBusyIndicator * createBusyIndicator ( YWidget * parent, const std::string & label, int timeout = 1000 );
122 
123  // NCurses only
124  virtual YWidget * createPkgSpecial ( YWidget * parent, const std::string & subwidgetName );
125 
126 
127  //
128  // Layout Helpers
129  //
130 
131  virtual NCSpacing * createSpacing ( YWidget * parent, YUIDimension dim, bool stretchable = false, YLayoutSize_t size = 0.0 );
132  virtual NCEmpty * createEmpty ( YWidget * parent );
133  virtual NCAlignment * createAlignment ( YWidget * parent, YAlignmentType horAlignment, YAlignmentType vertAlignment );
134  virtual NCSquash * createSquash ( YWidget * parent, bool horSquash, bool vertSquash );
135 
136 
137  //
138  // Visual Grouping
139  //
140 
141  virtual NCFrame * createFrame ( YWidget * parent, const std::string & label );
142  virtual NCCheckBoxFrame * createCheckBoxFrame ( YWidget * parent, const std::string & label, bool checked );
143 
144 
145  //
146  // Logical Grouping
147  //
148 
149  virtual NCRadioButtonGroup *createRadioButtonGroup ( YWidget * parent );
150  virtual NCReplacePoint * createReplacePoint ( YWidget * parent );
151 
152 
153  //
154  // More leaf widgets (moved to the end to maintain ABI compatibility)
155  //
156 
157  virtual NCItemSelector * createItemSelector ( YWidget * parent, bool enforceSingleSelection = true );
158  virtual NCCustomStatusItemSelector * createCustomStatusItemSelector ( YWidget * parent, const YItemCustomStatusVector & customStates );
159 
160 
161 protected:
162 
163  friend class YNCursesUI;
164 
165  /**
166  * Constructor.
167  *
168  * Use YUI::widgetFactory() to get the singleton for this class.
169  **/
170  NCWidgetFactory();
171 
172  /**
173  * Destructor.
174  **/
175  virtual ~NCWidgetFactory();
176 
177 }; // class NCWidgetFactory
178 
179 
180 #endif // NCWidgetFactory_h
NCTree
A tree selection widget with one-column tree items and optionally multy selection.
Definition: NCTree.h:47
NCRadioButton
Definition: NCRadioButton.h:37
NCLayoutBox
Definition: NCLayoutBox.h:37
YNCursesUI
Definition: YNCursesUI.h:39
NCDialog
Definition: NCDialog.h:40
NCSpacing
Definition: NCSpacing.h:37
NCComboBox
Definition: NCComboBox.h:38
NCProgressBar
Definition: NCProgressBar.h:37
NCBusyIndicator
Definition: NCBusyIndicator.h:42
NCAlignment
Definition: NCAlignment.h:35
NCLogView
Definition: NCLogView.h:35
NCPushButton
Definition: NCPushButton.h:35
NCItemSelector
Definition: NCItemSelector.h:302
NCMenuButton
Definition: NCMenuButton.h:36
NCMenuBar
Definition: NCMenuBar.h:34
NCCheckBox
Definition: NCCheckBox.h:35
NCTable
A table with rows and columns.
Definition: NCTable.h:43
NCRadioButtonGroup
Definition: NCRadioButtonGroup.h:38
NCMultiSelectionBox
Definition: NCMultiSelectionBox.h:36
NCWidgetFactory::~NCWidgetFactory
virtual ~NCWidgetFactory()
Destructor.
Definition: NCWidgetFactory.cc:44
NCSquash
Definition: NCSquash.h:35
NCLabel
Definition: NCLabel.h:38
NCCheckBoxFrame
Definition: NCCheckBoxFrame.h:38
NCWidgetFactory
Concrete widget factory for mandatory widgets.
Definition: NCWidgetFactory.h:71
NCButtonBox
Definition: NCButtonBox.h:37
NCIntField
Definition: NCIntField.h:35
NCFrame
Definition: NCFrame.h:37
NCMultiLineEdit
Definition: NCMultiLineEdit.h:36
NCImage
Definition: NCImage.h:37
NCCustomStatusItemSelector
Definition: NCCustomStatusItemSelector.h:82
NCInputField
Definition: NCInputField.h:35
NCReplacePoint
Definition: NCReplacePoint.h:37
NCRichText
Definition: NCRichText.h:36
NCWidgetFactory::NCWidgetFactory
NCWidgetFactory()
Constructor.
Definition: NCWidgetFactory.cc:37
NCEmpty
Definition: NCEmpty.h:35
NCSelectionBox
Definition: NCSelectionBox.h:36