libyui-ncurses  2.44.1
 All Classes Functions Variables
NCBusyIndicator.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: NCBusyIndicator.h
20 
21  Author: Thomas Goettlicher <tgoettlicher@suse.de>
22  Maintainer: Thomas Goettlicher <tgoettlicher@suse.de>
23 
24 /-*/
25 
26 #ifndef NCBusyIndicator_h
27 #define NCBusyIndicator_h
28 
29 #include <iosfwd>
30 
31 #include <yui/YBusyIndicator.h>
32 #include "NCWidget.h"
33 
34 
35 class NCBusyIndicator;
36 
37 
38 
39 
40 
41 class NCBusyIndicator : public YBusyIndicator, public NCWidget
42 {
43 private:
44 
45  friend std::ostream & operator<<( std::ostream & STREAM, const NCBusyIndicator & OBJ );
46 
47  NCBusyIndicator & operator=( const NCBusyIndicator & );
49 
50  typedef long long Value_t;
51 
52  NClabel _label;
53  Value_t _timeout;
54  NCursesWindow * _lwin;
55  NCursesWindow * _twin;
56 
57  void setDefsze();
58  void tUpdate();
59  void update();
60 
61  float _position; // the position of the bar
62  bool _rightwards; // direction the bar moves
63  bool _alive; // the widget is alive or stalled
64  float _timer_divisor; // =repaint interval devided by timeout
65  float _timer_progress; // progress until widget goes to stalled state
66 
67 
68 protected:
69 
70 
71  virtual const char * location() const { return "NCBusyIndicator"; }
72 
73  virtual void wCreate( const wrect & newrect );
74  virtual void wDelete();
75 
76  virtual void wRedraw();
77 
78 public:
79 
80  NCBusyIndicator( YWidget * parent,
81  const std::string & label,
82  int timeout = 1000 );
83  virtual ~NCBusyIndicator();
84 
85  virtual int preferredWidth();
86  virtual int preferredHeight();
87 
88  virtual void setSize( int newWidth, int newHeight );
89 
90  virtual void setLabel( const std::string & nlabel );
91 
92  virtual void setTimeout( int newTimeout );
93 
94  virtual void setAlive( bool newAlive );
95 
96  virtual void setEnabled( bool do_bv );
97 
98  int timeout() const { return _timeout; }
99 
100  void handler( int sig_num );
101 
102  static void staticHandler( int sig_num );
103 };
104 
105 
106 #endif // NCBusyIndicator_h
C++ class for windows.
Definition: ncursesw.h:904
virtual void setAlive(bool newAlive)
virtual void setEnabled(bool do_bv)
void handler(int sig_num)
virtual void wRedraw()
Definition: NCtext.h:81