libyui  3.0.10
/usr/src/RPM/BUILD/libyui-3.0.10/src/YProgressBar.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:         YProgressBar.h
00020 
00021   Author:       Stefan Hundhammer <sh@suse.de>
00022 
00023 /-*/
00024 
00025 #ifndef YProgressBar_h
00026 #define YProgressBar_h
00027 
00028 #include "YWidget.h"
00029 
00030 class YProgressBarPrivate;
00031 
00032 
00033 class YProgressBar : public YWidget
00034 {
00035 protected:
00036     /**
00037      * Constructor.
00038      **/
00039     YProgressBar( YWidget *             parent,
00040                   const std::string &   label,
00041                   int                   maxValue = 100 );
00042 
00043 public:
00044     /**
00045      * Destructor.
00046      **/
00047     virtual ~YProgressBar();
00048 
00049     /**
00050      * Returns a descriptive name of this widget class for logging,
00051      * debugging etc.
00052      **/
00053     virtual const char * widgetClass() const { return "YProgressBar"; }
00054 
00055     /**
00056      * Get the label (the caption above the progress bar).
00057      **/
00058     std::string label();
00059 
00060     /**
00061      * Set the label (the caption above the progress bar).
00062      *
00063      * Derived classes are free to reimplement this, but they should call this
00064      * base class method at the end of the overloaded function.
00065      **/
00066     virtual void setLabel( const std::string & label );
00067 
00068     /**
00069      * Return the maximum progress value.
00070      * Notice that this value can only be set in the constructor.
00071      **/
00072     int maxValue() const;
00073 
00074     /**
00075      * Return the current progress value.
00076      **/
00077     int value() const;
00078 
00079     /**
00080      * Set the current progress value ( <= maxValue() ).
00081      *
00082      * Derived classes should reimplement this, but they should call this
00083      * base class method at the end of the overloaded function.
00084      **/
00085     virtual void setValue( int newValue );
00086 
00087     /**
00088      * Set a property.
00089      * Reimplemented from YWidget.
00090      *
00091      * This function may throw YUIPropertyExceptions.
00092      *
00093      * This function returns 'true' if the value was successfully set and
00094      * 'false' if that value requires special handling (not in error cases:
00095      * those are covered by exceptions).
00096      **/
00097     virtual bool setProperty( const std::string & propertyName,
00098                               const YPropertyValue & val );
00099 
00100     /**
00101      * Get a property.
00102      * Reimplemented from YWidget.
00103      *
00104      * This method may throw YUIPropertyExceptions.
00105      **/
00106     virtual YPropertyValue getProperty( const std::string & propertyName );
00107 
00108     /**
00109      * Return this class's property set.
00110      * This also initializes the property upon the first call.
00111      *
00112      * Reimplemented from YWidget.
00113      **/
00114     virtual const YPropertySet & propertySet();
00115 
00116 
00117 private:
00118 
00119     ImplPtr<YProgressBarPrivate> priv;
00120 };
00121 
00122 
00123 #endif // YProgressBar_h
 All Classes Functions Variables Enumerations Friends