libyui  3.0.10
/usr/src/RPM/BUILD/libyui-3.0.10/src/YWidgetFactory.h
00001 /*
00002   Copyright (C) 2000-2012 Novell, Inc
00003   This library is free software; you can redistribute it and/or modify
00004   it under the terms of the GNU Lesser General Public License as
00005   published by the Free Software Foundation; either version 2.1 of the
00006   License, or (at your option) version 3.0 of the License. This library
00007   is distributed in the hope that it will be useful, but WITHOUT ANY
00008   WARRANTY; without even the implied warranty of MERCHANTABILITY or 
00009   FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00010   License for more details. You should have received a copy of the GNU
00011   Lesser General Public License along with this library; if not, write
00012   to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
00013   Floor, Boston, MA 02110-1301 USA
00014 */
00015 
00016 
00017 /*-/
00018 
00019   File:         YWidgetFactory.h
00020 
00021   Author:       Stefan Hundhammer <sh@suse.de>
00022 
00023 /-*/
00024 
00025 #ifndef YWidgetFactory_h
00026 #define YWidgetFactory_h
00027 
00028 #include <string>
00029 
00030 #include "YTypes.h"
00031 
00032 
00033 class YWidget;
00034 class YAlignment;
00035 class YButtonBox;
00036 class YCheckBox;
00037 class YCheckBoxFrame;
00038 class YComboBox;
00039 class YDialog;
00040 class YEmpty;
00041 class YFrame;
00042 class YImage;
00043 class YInputField;
00044 class YIntField;
00045 class YLabel;
00046 class YLayoutBox;
00047 class YLogView;
00048 class YMenuButton;
00049 class YMultiLineEdit;
00050 class YMultiSelectionBox;
00051 class YPackageSelector;
00052 class YProgressBar;
00053 class YPushButton;
00054 class YRadioButton;
00055 class YRadioButtonGroup;
00056 class YReplacePoint;
00057 class YRichText;
00058 class YSelectionBox;
00059 class YSpacing;
00060 class YSquash;
00061 class YTable;
00062 class YTableHeader;
00063 class YTimeField;
00064 class YTree;
00065 class YBusyIndicator;
00066 
00067 
00068 
00069 /**
00070  * Abstract widget factory for mandatory widgets.
00071  * Use YOptionalWidgetFactory for optional ("special") widgets.
00072  *
00073  * Refer to the respective widget's documentation (in the header file) for
00074  * documentation about the function parameters.
00075  **/
00076 class YWidgetFactory
00077 {
00078 public:
00079 
00080     //
00081     // Dialogs
00082     //
00083 
00084     YDialog *                   createMainDialog        ( YDialogColorMode colorMode = YDialogNormalColor );
00085     YDialog *                   createPopupDialog       ( YDialogColorMode colorMode = YDialogNormalColor );
00086     virtual YDialog *           createDialog            ( YDialogType dialogType, YDialogColorMode colorMode = YDialogNormalColor ) = 0;
00087 
00088     //
00089     // Layout Boxes
00090     //
00091 
00092     YLayoutBox *                createVBox              ( YWidget * parent );
00093     YLayoutBox *                createHBox              ( YWidget * parent );
00094     virtual YLayoutBox *        createLayoutBox         ( YWidget * parent, YUIDimension dimension )                            = 0;
00095     virtual YButtonBox *        createButtonBox         ( YWidget * parent )                                                    = 0;
00096 
00097     //
00098     // Common Leaf Widgets
00099     //
00100 
00101     virtual YPushButton *       createPushButton        ( YWidget * parent, const std::string & label )                         = 0;
00102     virtual YLabel *            createLabel             ( YWidget * parent, const std::string & text, bool isHeading = false, bool isOutputField = false ) = 0;
00103     YLabel *                    createHeading           ( YWidget * parent, const std::string & label );
00104     virtual YInputField *       createInputField        ( YWidget * parent, const std::string & label, bool passwordMode = false )      = 0;
00105     virtual YCheckBox *         createCheckBox          ( YWidget * parent, const std::string & label, bool isChecked = false ) = 0;
00106     virtual YRadioButton *      createRadioButton       ( YWidget * parent, const std::string & label, bool isChecked = false ) = 0;
00107     virtual YComboBox *         createComboBox          ( YWidget * parent, const std::string & label, bool editable     = false )      = 0;
00108     virtual YSelectionBox *     createSelectionBox      ( YWidget * parent, const std::string & label )                         = 0;
00109     virtual YTree *             createTree              ( YWidget * parent, const std::string & label, bool multiselection = false, bool recursiveselection = false ) = 0;
00110     virtual YTable *            createTable             ( YWidget * parent, YTableHeader * header_disown, bool multiSelection = false  ) = 0;
00111     virtual YProgressBar *      createProgressBar       ( YWidget * parent, const std::string & label, int maxValue = 100 )             = 0;
00112     virtual YRichText *         createRichText          ( YWidget * parent, const std::string & text = std::string(), bool plainTextMode = false )      = 0;
00113     virtual YBusyIndicator *    createBusyIndicator     ( YWidget * parent, const std::string & label, int timeout = 1000 )             = 0;
00114 
00115     //
00116     // Less Common Leaf Widgets
00117     //
00118 
00119     YPushButton *               createIconButton        ( YWidget * parent, const std::string & iconName, const std::string & fallbackTextLabel );
00120     YLabel *                    createOutputField       ( YWidget * parent, const std::string & label );
00121     virtual YIntField *         createIntField          ( YWidget * parent, const std::string & label, int minVal, int maxVal, int initialVal ) = 0;
00122     YInputField *               createPasswordField     ( YWidget * parent, const std::string & label );
00123 
00124     virtual YMenuButton *       createMenuButton        ( YWidget * parent, const std::string & label )                                         = 0;
00125     virtual YMultiLineEdit *    createMultiLineEdit     ( YWidget * parent, const std::string & label )                                         = 0;
00126     virtual YImage *            createImage             ( YWidget * parent, const std::string & imageFileName, bool animated = false )          = 0;
00127     virtual YLogView *          createLogView           ( YWidget * parent, const std::string & label, int visibleLines, int storedLines = 0 )  = 0;
00128     virtual YMultiSelectionBox *createMultiSelectionBox ( YWidget * parent, const std::string & label )                                         = 0;
00129 
00130     virtual YPackageSelector *  createPackageSelector   ( YWidget * parent, long ModeFlags = 0 )                = 0;
00131     virtual YWidget *           createPkgSpecial        ( YWidget * parent, const std::string & subwidgetName ) = 0; // NCurses only
00132 
00133     //
00134     // Layout Helpers
00135     //
00136 
00137     YSpacing *                  createHStretch          ( YWidget * parent );
00138     YSpacing *                  createVStretch          ( YWidget * parent );
00139     YSpacing *                  createHSpacing          ( YWidget * parent, YLayoutSize_t size = 1.0 );
00140     YSpacing *                  createVSpacing          ( YWidget * parent, YLayoutSize_t size = 1.0 );
00141     virtual YSpacing *          createSpacing           ( YWidget * parent, YUIDimension dim, bool stretchable = false, YLayoutSize_t size = 0.0 ) = 0;
00142     virtual YEmpty *            createEmpty             ( YWidget * parent )    = 0;
00143 
00144     YAlignment *                createLeft              ( YWidget * parent );
00145     YAlignment *                createRight             ( YWidget * parent );
00146     YAlignment *                createTop               ( YWidget * parent );
00147     YAlignment *                createBottom            ( YWidget * parent );
00148     YAlignment *                createHCenter           ( YWidget * parent );
00149     YAlignment *                createVCenter           ( YWidget * parent );
00150     YAlignment *                createHVCenter          ( YWidget * parent );
00151 
00152     YAlignment *                createMarginBox         ( YWidget * parent, YLayoutSize_t horMargin, YLayoutSize_t vertMargin );
00153     YAlignment *                createMarginBox         ( YWidget * parent,
00154                                                           YLayoutSize_t leftMargin, YLayoutSize_t rightMargin,
00155                                                           YLayoutSize_t topMargin,  YLayoutSize_t bottomMargin );
00156 
00157     YAlignment *                createMinWidth          ( YWidget * parent, YLayoutSize_t minWidth  );
00158     YAlignment *                createMinHeight         ( YWidget * parent, YLayoutSize_t minHeight );
00159     YAlignment *                createMinSize           ( YWidget * parent, YLayoutSize_t minWidth, YLayoutSize_t minHeight );
00160 
00161     virtual YAlignment *        createAlignment         ( YWidget * parent, YAlignmentType horAlignment, YAlignmentType vertAlignment ) = 0;
00162 
00163     YSquash *                   createHSquash           ( YWidget * parent );
00164     YSquash *                   createVSquash           ( YWidget * parent );
00165     YSquash *                   createHVSquash          ( YWidget * parent );
00166     virtual YSquash *           createSquash            ( YWidget * parent, bool horSquash, bool vertSquash ) = 0;
00167 
00168     //
00169     // Visual Grouping
00170     //
00171 
00172     virtual YFrame *            createFrame             ( YWidget * parent, const std::string & label )                 = 0;
00173     virtual YCheckBoxFrame *    createCheckBoxFrame     ( YWidget * parent, const std::string & label, bool checked )   = 0;
00174 
00175     //
00176     // Logical Grouping
00177     //
00178 
00179     virtual YRadioButtonGroup * createRadioButtonGroup  ( YWidget * parent )    = 0;
00180     virtual YReplacePoint *     createReplacePoint      ( YWidget * parent )    = 0;
00181 
00182 
00183 protected:
00184 
00185     friend class YUI;
00186 
00187     /**
00188      * Constructor.
00189      *
00190      * Use YUI::widgetFactory() to get the singleton for this class.
00191      **/
00192     YWidgetFactory();
00193 
00194     /**
00195      * Destructor.
00196      **/
00197     virtual ~YWidgetFactory();
00198 
00199 }; // class YWidgetFactory
00200 
00201 
00202 #endif // YWidgetFactory_h
 All Classes Functions Variables Enumerations Friends