]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/YQSlider.h
don't create QObjects in ycp thread - make timeouts work
[duncan/yast2-qt4.git] / src / YQSlider.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQSlider.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #ifndef YQSlider_h
21 #define YQSlider_h
22
23 #include <QFrame>
24 #include "YSlider.h"
25
26
27 class YQWidgetCaption;
28 class QSlider;
29 class QSpinBox;
30
31 class YQSlider : public QFrame, public YSlider
32 {
33     Q_OBJECT
34
35 public:
36
37     /**
38      * Constructor.
39      *
40      * 'reverseLayout' creates the QSpinBox to the left and the QSlider to the right.
41      **/
42     YQSlider( YWidget *         parent,
43               const string &    label,
44               int               minValue,
45               int               maxValue,
46               int               initialValue,
47               bool              reverseLayout = false );
48
49     /**
50      * Destructor.
51      **/
52     virtual ~YQSlider();
53
54     /**
55      * Get the current value (the number entered by the user or set from the
56      * outside) of this slider.
57      *
58      * Implemented from YSlider / YIntField.
59      **/
60     virtual int value();
61
62 protected:
63
64     /**
65      * Set the current value (the number entered by the user or set from the
66      * outside) of this slider. 'val' is guaranteed to be between minValue
67      * and maxValue; no further checks are required.
68      *
69      * Implemented from YSlider/ YIntField.
70      **/
71     virtual void setValueInternal( int val );
72
73 public:
74
75     /**
76      * Set the label (the caption above the input field).
77      *
78      * Reimplemented from YSlider / YIntField.
79      **/
80     virtual void setLabel( const string & label );
81
82     /**
83      * Set enabled/disabled state.
84      *
85      * Reimplemented from YWidget.
86      **/
87     virtual void setEnabled( bool enabled );
88
89     /**
90      * Preferred width of the widget.
91      *
92      * Reimplemented from YWidget.
93      **/
94     virtual int preferredWidth();
95
96     /**
97      * Preferred height of the widget.
98      *
99      * Reimplemented from YWidget.
100      **/
101     virtual int preferredHeight();
102
103     /**
104      * Set the new size of the widget.
105      *
106      * Reimplemented from YWidget.
107      **/
108     virtual void setSize( int newWidth, int newHeight );
109
110     /**
111      * Accept the keyboard focus.
112      **/
113     virtual bool setKeyboardFocus();
114
115
116 public slots:
117     /**
118      * Slot for "value changed". This will send a ValueChanged event if
119      * 'notify' is set.
120      **/
121     void valueChangedSlot( int newValue );
122
123 signals:
124
125     /**
126      * Emitted when the value changes (regardless of the notify flag).
127      **/
128     void valueChanged( int newValue );
129
130
131 protected:
132
133     YQWidgetCaption *   _caption;
134     QSlider *           _qt_slider;
135     QSpinBox *          _qt_spinBox;
136     QFrame *            _hbox;
137 };
138
139
140 #endif // YQSlider_h