libyui-ncurses
Loading...
Searching...
No Matches
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
35class NCBusyIndicator;
36
37
38
39
40
41class NCBusyIndicator : public YBusyIndicator, public NCWidget
42{
43private:
44
45 friend std::ostream & operator<<( std::ostream & str, 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
68protected:
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
78public:
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
Definition NCBusyIndicator.h:42
virtual void wRedraw()
Definition NCBusyIndicator.cc:275
virtual void setEnabled(bool do_bv)
Definition NCBusyIndicator.cc:122
void handler(int sig_num)
Definition NCBusyIndicator.cc:193
virtual void setAlive(bool newAlive)
Definition NCBusyIndicator.cc:252
Definition NCWidget.h:46
Multi-line string, with optional hotkey, drawable.
Definition NCtext.h:82
C++ class for windows.
Definition ncursesw.h:907
A rectangle is defined by its position and size: wpos Pos, wsze Sze.
Definition position.h:194