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