]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/YQWidgetFactory.h
follow the widget state - for reference: you don't
[duncan/yast2-qt4.git] / src / YQWidgetFactory.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:         YQWidgetFactory.h
14
15   Author:       Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19 #ifndef YQWidgetFactory_h
20 #define YQWidgetFactory_h
21
22
23 #include "YWidgetFactory.h"
24
25 #include "YQAlignment.h"
26 #include "YQCheckBox.h"
27 #include "YQCheckBoxFrame.h"
28 #include "YQComboBox.h"
29 #include "YQDialog.h"
30 #include "YQEmpty.h"
31 #include "YQFrame.h"
32 #include "YQImage.h"
33 #include "YQInputField.h"
34 #include "YQIntField.h"
35 #include "YQLabel.h"
36 #include "YQLayoutBox.h"
37 #include "YQLogView.h"
38 #include "YQMenuButton.h"
39 #include "YQMultiLineEdit.h"
40 #include "YQMultiSelectionBox.h"
41 #include "YQPackageSelector.h"
42 #include "YQProgressBar.h"
43 #include "YQPushButton.h"
44 #include "YQRadioButton.h"
45 #include "YQRadioButtonGroup.h"
46 #include "YQReplacePoint.h"
47 #include "YQRichText.h"
48 #include "YQSelectionBox.h"
49 #include "YQSpacing.h"
50 #include "YQSquash.h"
51 #include "YQTable.h"
52 #include "YQTimeField.h"
53 #include "YQTree.h"
54
55 using std::string;
56
57
58 /**
59  * Concrete widget factory for mandatory widgets.
60  **/
61 class YQWidgetFactory: public YWidgetFactory
62 {
63 public:
64     // Note: Using covariant return types for all createSomeWidget() methods
65     // (returning YQSomeWidget where the base class declares virtual methods that
66     // return YSomeWidget) 
67
68
69     //
70     // Dialogs
71     //
72
73     virtual YQDialog *          createMainDialog();
74     virtual YQDialog *          createPopupDialog();
75
76     //
77     // Layout Boxes
78     //
79
80     virtual YQLayoutBox *       createLayoutBox( YWidget * parent, YUIDimension dim );
81
82     //
83     // Common Leaf Widgets
84     //
85
86     virtual YQPushButton *      createPushButton        ( YWidget * parent, const string & label );
87     virtual YQLabel *           createLabel             ( YWidget * parent, const string & text, bool isHeading = false, bool isOutputField = false );
88     virtual YQInputField *      createInputField        ( YWidget * parent, const string & label, bool passwordMode = false );
89     virtual YQCheckBox *        createCheckBox          ( YWidget * parent, const string & label, bool isChecked = false );
90     virtual YQRadioButton *     createRadioButton       ( YWidget * parent, const string & label, bool isChecked = false );
91     virtual YQComboBox *        createComboBox          ( YWidget * parent, const string & label, bool editable  = false );
92     virtual YQSelectionBox *    createSelectionBox      ( YWidget * parent, const string & label );
93     virtual YQTree *            createTree              ( YWidget * parent, const string & label );
94     virtual YQTable *           createTable             ( YWidget * parent, YTableHeader * header );
95     virtual YQProgressBar *     createProgressBar       ( YWidget * parent, const string & label, int maxValue = 100 );
96     virtual YQRichText *        createRichText          ( YWidget * parent, const string & text = string(), bool plainTextMode = false );
97
98     //
99     // Less Common Leaf Widgets
100     //
101
102     virtual YQIntField *        createIntField          ( YWidget * parent, const string & label, int minVal, int maxVal, int initialVal );
103     virtual YQMenuButton *      createMenuButton        ( YWidget * parent, const string & label );
104     virtual YQMultiLineEdit *   createMultiLineEdit     ( YWidget * parent, const string & label );
105     virtual YQImage *           createImage             ( YWidget * parent, const string & imageFileName, bool animated = false );
106     virtual YQLogView *         createLogView           ( YWidget * parent, const string & label, int visibleLines, int storedLines = 0 );
107     virtual YQMultiSelectionBox *createMultiSelectionBox( YWidget * parent, const string & label );
108
109     virtual YQPackageSelector * createPackageSelector   ( YWidget * parent, long modeFlags = 0 );
110     virtual YWidget *           createPkgSpecial        ( YWidget * parent, const string & name ); // NCurses only, will throw exception in the Qt UI
111
112     //
113     // Layout Helpers
114     //
115
116     virtual YQSpacing *         createSpacing           ( YWidget * parent, YUIDimension dim, bool stretchable = false, YLayoutSize_t size = 0.0 );
117     virtual YQEmpty *           createEmpty             ( YWidget * parent );
118     virtual YQAlignment *       createAlignment         ( YWidget * parent, YAlignmentType horAlignment, YAlignmentType vertAlignment );
119     virtual YQSquash *          createSquash            ( YWidget * parent, bool horSquash, bool vertSquash );
120
121     //
122     // Visual Grouping
123     //
124
125     virtual YQFrame *           createFrame             ( YWidget * parent, const string & label );
126     virtual YQCheckBoxFrame *   createCheckBoxFrame     ( YWidget * parent, const string & label, bool checked );
127
128     //
129     // Logical Grouping
130     //
131
132     virtual YQRadioButtonGroup *createRadioButtonGroup  ( YWidget * parent );
133     virtual YQReplacePoint *    createReplacePoint      ( YWidget * parent );
134
135
136 protected:
137
138     friend class YQUI;
139
140     /**
141      * Constructor.
142      *
143      * Use YUI::widgetFactory() to get the singleton for this class.
144      **/
145     YQWidgetFactory();
146
147     /**
148      * Destructory.
149      **/
150     virtual ~YQWidgetFactory();
151
152 }; // class YWidgetFactory
153
154
155 #endif // YQWidgetFactory_h