libyui  3.4.2
YProgressBar.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: YProgressBar.h
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23 /-*/
24 
25 #ifndef YProgressBar_h
26 #define YProgressBar_h
27 
28 #include "YWidget.h"
29 
31 
32 
33 /**
34  * A progress bar, showing completion of value() out of maxValue() parts.
35  **/
36 class YProgressBar : public YWidget
37 {
38 protected:
39  /**
40  * Constructor.
41  **/
43  const std::string & label,
44  int maxValue = 100 );
45 
46 public:
47  /**
48  * Destructor.
49  **/
50  virtual ~YProgressBar();
51 
52  /**
53  * Returns a descriptive name of this widget class for logging,
54  * debugging etc.
55  **/
56  virtual const char * widgetClass() const { return "YProgressBar"; }
57 
58  /**
59  * Get the label (the caption above the progress bar).
60  **/
61  std::string label();
62 
63  /**
64  * Set the label (the caption above the progress bar).
65  *
66  * Derived classes are free to reimplement this, but they should call this
67  * base class method at the end of the overloaded function.
68  **/
69  virtual void setLabel( const std::string & label );
70 
71  /**
72  * Return the maximum progress value.
73  * Notice that this value can only be set in the constructor.
74  **/
75  int maxValue() const;
76 
77  /**
78  * Return the current progress value.
79  **/
80  int value() const;
81 
82  /**
83  * Set the current progress value ( <= maxValue() ).
84  *
85  * Derived classes should reimplement this, but they should call this
86  * base class method at the end of the overloaded function.
87  **/
88  virtual void setValue( int newValue );
89 
90  /**
91  * Set a property.
92  * Reimplemented from YWidget.
93  *
94  * This function may throw YUIPropertyExceptions.
95  *
96  * This function returns 'true' if the value was successfully set and
97  * 'false' if that value requires special handling (not in error cases:
98  * those are covered by exceptions).
99  **/
100  virtual bool setProperty( const std::string & propertyName,
101  const YPropertyValue & val );
102 
103  /**
104  * Get a property.
105  * Reimplemented from YWidget.
106  *
107  * This method may throw YUIPropertyExceptions.
108  **/
109  virtual YPropertyValue getProperty( const std::string & propertyName );
110 
111  /**
112  * Return this class's property set.
113  * This also initializes the property upon the first call.
114  *
115  * Reimplemented from YWidget.
116  **/
117  virtual const YPropertySet & propertySet();
118 
119 
120 private:
121 
123 };
124 
125 
126 #endif // YProgressBar_h
YProgressBar(YWidget *parent, const std::string &label, int maxValue=100)
Constructor.
Definition: YProgressBar.cc:52
int maxValue() const
Return the maximum progress value.
Definition: YProgressBar.cc:83
virtual ~YProgressBar()
Destructor.
Definition: YProgressBar.cc:65
Transport class for the value of simple properties.
Definition: YProperty.h:104
A set of properties to check names and types against.
Definition: YProperty.h:197
YWidget * parent() const
Return this widget&#39;s parent or 0 if it doesn&#39;t have a parent.
Definition: YWidget.cc:269
virtual void setLabel(const std::string &label)
Set the label (the caption above the progress bar).
Definition: YProgressBar.cc:77
std::string label()
Get the label (the caption above the progress bar).
Definition: YProgressBar.cc:71
virtual const YPropertySet & propertySet()
Return this class&#39;s property set.
virtual void setValue(int newValue)
Set the current progress value ( <= maxValue() ).
Definition: YProgressBar.cc:95
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Set a property.
virtual const char * widgetClass() const
Returns a descriptive name of this widget class for logging, debugging etc.
Definition: YProgressBar.h:56
A progress bar, showing completion of value() out of maxValue() parts.
Definition: YProgressBar.h:36
Abstract base class of all UI widgets.
Definition: YWidget.h:54
int value() const
Return the current progress value.
Definition: YProgressBar.cc:89
virtual YPropertyValue getProperty(const std::string &propertyName)
Get a property.