libyui  3.4.2
YBusyIndicator.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YBusyIndicator.h
20 
21  Author: Thomas Goettlicher <tgoettlicher@suse.de>
22 
23 /-*/
24 
25 #ifndef YBusyIndicator_h
26 #define YBusyIndicator_h
27 
28 #include "YWidget.h"
29 
31 
32 
33 /**
34  * Indicates that something is in progress and has not frozen yet.
35  * It has a label and an "indeterminate" progress bar which will be "ticking"
36  * until a timeout occurs or until it receives an "alive" message.
37  */
38 class YBusyIndicator : public YWidget
39 {
40 protected:
41  /**
42  * Constructor.
43  **/
45  const std::string & label,
46  int timeout = 1000,
47  bool alive = true );
48 
49 public:
50  /**
51  * Destructor.
52  **/
53  virtual ~YBusyIndicator();
54 
55  /**
56  * Returns a descriptive name of this widget class for logging,
57  * debugging etc.
58  **/
59  virtual const char * widgetClass() const { return "YBusyIndicator"; }
60 
61  /**
62  * Get the label (the caption above the progress bar).
63  **/
64  std::string label();
65 
66  /**
67  * Set the label (the caption above the progress bar).
68  *
69  * Derived classes are free to reimplement this, but they should call this
70  * base class method at the end of the overloaded function.
71  **/
72  virtual void setLabel( const std::string & label );
73 
74  /**
75  * Return the current timeout in milliseconds.
76  **/
77  int timeout() const;
78 
79  /**
80  * Set the timeout in milliseconds after that the widget shows 'stalled'
81  * when no new tick is received.
82  *
83  * Derived classes should reimplement this, but they should call this
84  * base class method at the end of the overloaded function.
85  **/
86  virtual void setTimeout( int newTimeout );
87 
88  /**
89  * Return whether busy indicator is alive or in stalled stated.
90  **/
91  bool alive() const;
92 
93 
94  /**
95  * Send a keep alive message to prevent BusyIndicator from changing
96  * to 'stalled' state.
97  *
98  * Derived classes should reimplement this, but they should call this
99  * base class method at the end of the overloaded function.
100  **/
101  virtual void setAlive( bool newAlive );
102 
103 
104  /**
105  * Set a property.
106  * Reimplemented from YWidget.
107  *
108  * This function may throw YUIPropertyExceptions.
109  *
110  * This function returns 'true' if the value was successfully set and
111  * 'false' if that value requires special handling (not in error cases:
112  * those are covered by exceptions).
113  **/
114  virtual bool setProperty( const std::string & propertyName,
115  const YPropertyValue & val );
116 
117  /**
118  * Get a property.
119  * Reimplemented from YWidget.
120  *
121  * This method may throw YUIPropertyExceptions.
122  **/
123  virtual YPropertyValue getProperty( const std::string & propertyName );
124 
125  /**
126  * Return this class's property set.
127  * This also initializes the property upon the first call.
128  *
129  * Reimplemented from YWidget.
130  **/
131  virtual const YPropertySet & propertySet();
132 
133 
134 private:
135 
137 };
138 
139 
140 #endif // YBusyIndicator_h
virtual YPropertyValue getProperty(const std::string &propertyName)
Get a property.
std::string label()
Get the label (the caption above the progress bar).
Transport class for the value of simple properties.
Definition: YProperty.h:104
virtual void setAlive(bool newAlive)
Send a keep alive message to prevent BusyIndicator from changing to &#39;stalled&#39; state.
virtual ~YBusyIndicator()
Destructor.
A set of properties to check names and types against.
Definition: YProperty.h:197
int timeout() const
Return the current timeout in milliseconds.
virtual const char * widgetClass() const
Returns a descriptive name of this widget class for logging, debugging etc.
YWidget * parent() const
Return this widget&#39;s parent or 0 if it doesn&#39;t have a parent.
Definition: YWidget.cc:269
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Set a property.
bool alive() const
Return whether busy indicator is alive or in stalled stated.
virtual void setLabel(const std::string &label)
Set the label (the caption above the progress bar).
virtual void setTimeout(int newTimeout)
Set the timeout in milliseconds after that the widget shows &#39;stalled&#39; when no new tick is received...
virtual const YPropertySet & propertySet()
Return this class&#39;s property set.
Indicates that something is in progress and has not frozen yet.
YBusyIndicator(YWidget *parent, const std::string &label, int timeout=1000, bool alive=true)
Constructor.
Abstract base class of all UI widgets.
Definition: YWidget.h:54