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