libyui-ncurses
2.44.1
|
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: NCBusyIndicator.h 00020 00021 Author: Thomas Goettlicher <tgoettlicher@suse.de> 00022 Maintainer: Thomas Goettlicher <tgoettlicher@suse.de> 00023 00024 /-*/ 00025 00026 #ifndef NCBusyIndicator_h 00027 #define NCBusyIndicator_h 00028 00029 #include <iosfwd> 00030 00031 #include <yui/YBusyIndicator.h> 00032 #include "NCWidget.h" 00033 00034 00035 class NCBusyIndicator; 00036 00037 00038 00039 00040 00041 class NCBusyIndicator : public YBusyIndicator, public NCWidget 00042 { 00043 private: 00044 00045 friend std::ostream & operator<<( std::ostream & STREAM, const NCBusyIndicator & OBJ ); 00046 00047 NCBusyIndicator & operator=( const NCBusyIndicator & ); 00048 NCBusyIndicator( const NCBusyIndicator & ); 00049 00050 typedef long long Value_t; 00051 00052 NClabel _label; 00053 Value_t _timeout; 00054 NCursesWindow * _lwin; 00055 NCursesWindow * _twin; 00056 00057 void setDefsze(); 00058 void tUpdate(); 00059 void update(); 00060 00061 float _position; // the position of the bar 00062 bool _rightwards; // direction the bar moves 00063 bool _alive; // the widget is alive or stalled 00064 float _timer_divisor; // =repaint interval devided by timeout 00065 float _timer_progress; // progress until widget goes to stalled state 00066 00067 00068 protected: 00069 00070 00071 virtual const char * location() const { return "NCBusyIndicator"; } 00072 00073 virtual void wCreate( const wrect & newrect ); 00074 virtual void wDelete(); 00075 00076 virtual void wRedraw(); 00077 00078 public: 00079 00080 NCBusyIndicator( YWidget * parent, 00081 const std::string & label, 00082 int timeout = 1000 ); 00083 virtual ~NCBusyIndicator(); 00084 00085 virtual int preferredWidth(); 00086 virtual int preferredHeight(); 00087 00088 virtual void setSize( int newWidth, int newHeight ); 00089 00090 virtual void setLabel( const std::string & nlabel ); 00091 00092 virtual void setTimeout( int newTimeout ); 00093 00094 virtual void setAlive( bool newAlive ); 00095 00096 virtual void setEnabled( bool do_bv ); 00097 00098 int timeout() const { return _timeout; } 00099 00100 void handler( int sig_num ); 00101 00102 static void staticHandler( int sig_num ); 00103 }; 00104 00105 00106 #endif // NCBusyIndicator_h