00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YMultiProgressMeter.h 00014 00015 Author: Stefan Hundhammer <sh@suse.de> 00016 00017 /-*/ 00018 00019 #ifndef YMultiProgressMeter_h 00020 #define YMultiProgressMeter_h 00021 00022 #include "YWidget.h" 00023 #include <ycp/YCPList.h> 00024 #include <vector> 00025 00026 00030 class YMultiProgressMeter : public YWidget 00031 { 00032 public: 00033 00034 typedef long long Value_t; 00035 00039 YMultiProgressMeter( const YWidgetOpt & opt, 00040 bool horizontal, 00041 const YCPList & maxValues ); 00042 00047 virtual char *widgetClass() { return "YMultiProgressMeter"; } 00048 00052 YCPValue changeWidget( const YCPSymbol & property, const YCPValue & newValue ); 00053 00057 YCPValue queryWidget( const YCPSymbol & property ); 00058 00062 int segments() const { return (int) _maxValues.size(); } 00063 00067 Value_t maxValue( int segment ) const; 00068 00073 Value_t currentValue( int segment ) const; 00074 00079 void setCurrentValue( int segment, Value_t value ); 00080 00084 bool horizontal() const { return _horizontal; } 00085 00089 bool vertical() const { return ! _horizontal; } 00090 00091 00092 protected: 00093 00098 virtual void doUpdate() = 0; 00099 00100 00101 private: 00102 00103 bool _horizontal; 00104 std::vector<Value_t> _maxValues; 00105 std::vector<Value_t> _currentValues; 00106 }; 00107 00108 00109 #endif // YMultiProgressMeter_h