libyui-qt  2.46.1
 All Classes Functions Variables
YQBarGraph.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: YQBarGraph.h
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23 /-*/
24 
25 
26 #ifndef YQBarGraph_h
27 #define YQBarGraph_h
28 
29 #include "qframe.h"
30 #include "qevent.h"
31 #include "qtooltip.h"
32 #include <yui/YBarGraph.h>
33 #include <map>
34 
35 using namespace std;
36 
37 class QPainter;
38 
39 
40 class YQBarGraph : public QFrame, public YBarGraph
41 {
42  Q_OBJECT
43 
44 public:
45 
46  /**
47  * Constructor.
48  **/
49  YQBarGraph( YWidget * parent );
50 
51  /**
52  * Destructor.
53  **/
54  virtual ~YQBarGraph();
55 
56  /**
57  * Perform a visual update on the screen.
58  *
59  * Implemented from YBarGraph.
60  **/
61  virtual void doUpdate();
62 
63  /**
64  * Set enabled/disabled state.
65  *
66  * Reimplemented from YWidget.
67  **/
68  virtual void setEnabled( bool enabled );
69 
70  /**
71  * Preferred width of the widget.
72  *
73  * Reimplemented from YWidget.
74  **/
75  virtual int preferredWidth();
76 
77  /**
78  * Preferred height of the widget.
79  *
80  * Reimplemented from YWidget.
81  **/
82  virtual int preferredHeight();
83 
84  /**
85  * Set the new size of the widget.
86  *
87  * Reimplemented from YWidget.
88  **/
89  virtual void setSize( int newWidth, int newHeight );
90 
91 
92 protected:
93 
94  virtual bool event( QEvent * event );
95  /**
96  * Draw the contents.
97  *
98  * Reimplemented from QFrame.
99  **/
100  virtual void paintEvent( QPaintEvent * painter );
101 
102  /**
103  * Return one from a set of default segment background colors.
104  **/
105  YColor defaultSegmentColor( unsigned index );
106 
107  /**
108  * Return one from a set of default text colors. This text color is
109  * guaranteed to contrast with the defaultSegmentColor with the same index.
110  **/
111  YColor defaultTextColor( unsigned index );
112 
113 private:
114  map <int, QString> toolTips ;
115 
116 };
117 
118 
119 #endif // YQBarGraph_h