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