- Don't create layouts with parent. Qt 4.x automatically reparents
[duncan/yast2-qt4.git] / src / YQCheckBoxFrame.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQCheckBoxFrame.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #ifndef YQCheckBoxFrame_h
21 #define YQCheckBoxFrame_h
22
23 #include <qgroupbox.h>
24 #include "YCheckBoxFrame.h"
25
26
27 class QWidget;
28 class QCheckBox;
29
30 class YQCheckBoxFrame : public QGroupBox, public YCheckBoxFrame
31 {
32     Q_OBJECT
33
34 public:
35
36     /**
37      * Constructor.
38      **/
39     YQCheckBoxFrame( YWidget *          parent,
40                      const string &     label,
41                      bool               checked );
42
43     /**
44      * Change the label text on the CheckBoxFrame.
45      *
46      * Reimplemented from YCheckBoxFrame.
47      **/
48     virtual void setLabel( const string & label );
49
50     /**
51      * Check or uncheck the CheckBoxFrame's check box.
52      *
53      * Reimplemented from YCheckBoxFrame.
54      **/
55     virtual void setValue( bool isChecked );
56
57     /**
58      * Get the status of the CheckBoxFrame's check box.
59      *
60      * Reimplemented from YCheckBoxFrame.
61      **/
62     virtual bool value();
63
64     /**
65      * Set enabled / disabled state.
66      *
67      * Reimplemented from YWidget.
68      **/
69     virtual void setEnabled( bool enabled );
70
71     /**
72      * Preferred width of the widget.
73      *
74      * Reimplemented from YWidget.
75      **/
76     virtual int preferredWidth();
77
78     /**
79      * Preferred height of the widget.
80      *
81      * Reimplemented from YWidget.
82      **/
83     virtual int preferredHeight();
84
85     /**
86      * Set the new size of the widget.
87      *
88      * Reimplemented from YWidget.
89      **/
90     virtual void setSize( int newWidth, int newHeight );
91
92     /**
93      * Accept the keyboard focus.
94      *
95      * Reimplemented from YWidget.
96      **/
97     virtual bool setKeyboardFocus();
98
99
100 private slots:
101
102     /**
103      * Triggered when the on/off status is changed
104      **/
105     void stateChanged( bool newState );
106
107
108 protected:
109
110     /**
111      * Reimplemented from QGroupBox to prevent QGroupBox from disabling
112      * children according to the check box status as the children are inserted.
113      **/
114     virtual void childEvent( QChildEvent * );
115
116     virtual bool event(QEvent *e);
117
118     //
119     // Data members
120     //
121
122     QCheckBox * _checkBox;
123 };
124
125
126 #endif // YQCheckBoxFrame_h