picking up branches/tmp/sh/qt4-port/, merging it with trunk
[duncan/yast2-qt4.git] / src / YQRadioButton.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQRadioButton.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #ifndef YQRadioButton_h
21 #define YQRadioButton_h
22
23 #include <q3groupbox.h>
24 #include "YRadioButton.h"
25
26
27
28 class QRadioButton;
29 using std::string;
30
31
32 class YQRadioButton : public Q3GroupBox, public YRadioButton
33 {
34     Q_OBJECT
35
36 public:
37     /**
38      * Constructor.
39      **/
40     YQRadioButton( YWidget *            parent,
41                    const string &       label,
42                    bool                 checked );
43
44     /**
45      * Return the "checked" state of the RadioButton.
46      *
47      * Reimplemented from YRadioButton.
48      **/
49     virtual bool value();
50
51     /**
52      * Set the "checked" state of the RadioButton.
53      *
54      * Reimplemented from YRadioButton.
55      **/
56     virtual void setValue( bool checked );
57
58     /**
59      * Change the label (the text) on the RadioButton.
60      *
61      * Reimplemented from YRadioButton.
62      **/
63     virtual void setLabel( const string & label );
64
65     /**
66      * Use a bold font.
67      *
68      * Reimplemented from YRadioButton.
69      **/
70     virtual void setUseBoldFont( bool bold = true );
71
72     /**
73      * Set enabled / disabled state.
74      *
75      * Reimplemented from YWidget.
76      **/
77     virtual void setEnabled( bool enabled );
78
79     /**
80      * Preferred width of the widget.
81      *
82      * Reimplemented from YWidget.
83      **/
84     virtual int preferredWidth();
85
86     /**
87      * Preferred height of the widget.
88      *
89      * Reimplemented from YWidget.
90      **/
91     virtual int preferredHeight();
92
93     /**
94      * Set the new size of the widget.
95      *
96      * Reimplemented from YWidget.
97      **/
98     virtual void setSize( int newWidth, int newHeight );
99
100     /**
101      * Accept the keyboard focus.
102      *
103      * Reimplemented from YWidget.
104      **/
105     virtual bool setKeyboardFocus();
106
107     /**
108      * Return the actual qt button. Used by YQButtonGroup.
109      **/
110     QRadioButton * getQtButton();
111
112
113 protected slots:
114     /**
115      * Triggered when the RadioButton is toggled.
116      **/
117     void changed( bool newState );
118
119     /**
120      * Redirect events to this object.
121      **/
122     bool eventFilter( QObject * obj, QEvent * event );
123
124
125 protected:
126
127     QRadioButton * _qt_radioButton;
128 };
129
130 #endif // YQRadioButton_h