libyui

/data/gitorious.org/libyui/libyui-master/src/YWidgetFactory.h

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