libyui  3.0.10
/usr/src/RPM/BUILD/libyui-3.0.10/src/YBusyIndicator.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:         YBusyIndicator.h
00020 
00021   Author:       Thomas Goettlicher <tgoettlicher@suse.de>
00022 
00023 /-*/
00024 
00025 #ifndef YBusyIndicator_h
00026 #define YBusyIndicator_h
00027 
00028 #include "YWidget.h"
00029 
00030 class YBusyIndicatorPrivate;
00031 
00032 
00033 class YBusyIndicator : public YWidget
00034 {
00035 protected:
00036     /**
00037      * Constructor.
00038      **/
00039     YBusyIndicator( YWidget *           parent,
00040                   const std::string &   label,
00041                   int                   timeout = 1000,
00042                   bool                  alive = true );
00043 
00044 public:
00045     /**
00046      * Destructor.
00047      **/
00048     virtual ~YBusyIndicator();
00049 
00050     /**
00051      * Returns a descriptive name of this widget class for logging,
00052      * debugging etc.
00053      **/
00054     virtual const char * widgetClass() const { return "YBusyIndicator"; }
00055 
00056     /**
00057      * Get the label (the caption above the progress bar).
00058      **/
00059     std::string label();
00060 
00061     /**
00062      * Set the label (the caption above the progress bar).
00063      *
00064      * Derived classes are free to reimplement this, but they should call this
00065      * base class method at the end of the overloaded function.
00066      **/
00067     virtual void setLabel( const std::string & label );
00068 
00069     /**
00070      * Return the current timeout in milliseconds.
00071      **/
00072     int timeout() const;
00073 
00074     /**
00075      * Set the timeout in milliseconds after that the widget shows 'stalled'
00076      * when no new tick is received.
00077      *
00078      * Derived classes should reimplement this, but they should call this
00079      * base class method at the end of the overloaded function.
00080      **/
00081     virtual void setTimeout( int newTimeout );
00082 
00083     /**
00084      * Return whether busy indicator is alive or in stalled stated.
00085      **/
00086     bool alive() const;
00087 
00088 
00089     /**
00090      * Send a keep alive message to prevent BusyIndicator from changing
00091      * to 'stalled' state.
00092      *
00093      * Derived classes should reimplement this, but they should call this
00094      * base class method at the end of the overloaded function.
00095      **/
00096     virtual void setAlive( bool newAlive );
00097 
00098 
00099     /**
00100      * Set a property.
00101      * Reimplemented from YWidget.
00102      *
00103      * This function may throw YUIPropertyExceptions.
00104      *
00105      * This function returns 'true' if the value was successfully set and
00106      * 'false' if that value requires special handling (not in error cases:
00107      * those are covered by exceptions).
00108      **/
00109     virtual bool setProperty( const std::string & propertyName,
00110                               const YPropertyValue & val );
00111 
00112     /**
00113      * Get a property.
00114      * Reimplemented from YWidget.
00115      *
00116      * This method may throw YUIPropertyExceptions.
00117      **/
00118     virtual YPropertyValue getProperty( const std::string & propertyName );
00119 
00120     /**
00121      * Return this class's property set.
00122      * This also initializes the property upon the first call.
00123      *
00124      * Reimplemented from YWidget.
00125      **/
00126     virtual const YPropertySet & propertySet();
00127 
00128 
00129 private:
00130 
00131     ImplPtr<YBusyIndicatorPrivate> priv;
00132 };
00133 
00134 
00135 #endif // YBusyIndicator_h
 All Classes Functions Variables Enumerations Friends