23 #include <QSpinBox> |
23 #include <QSpinBox> |
24 #include <map> |
24 #include <map> |
25 #include "common.h" |
25 #include "common.h" |
26 #include "types.h" |
26 #include "types.h" |
27 |
27 |
|
28 class QIcon; |
28 class QCheckBox; |
29 class QCheckBox; |
29 class QButtonGroup; |
30 class QButtonGroup; |
30 class QBoxLayout; |
31 class QBoxLayout; |
31 class QRadioButton; |
32 class QRadioButton; |
32 |
33 |
33 // ============================================================================= |
34 // ============================================================================= |
34 // RadioBox |
35 // RadioGroup |
35 // |
36 // |
36 // Convenience widget - is a groupbox of radio buttons. |
37 // Convenience widget - is a groupbox of radio buttons. |
37 // ============================================================================= |
38 // ============================================================================= |
38 class RadioBox : public QGroupBox { |
39 class RadioGroup : public QGroupBox { |
39 Q_OBJECT |
40 Q_OBJECT |
40 |
41 |
41 public: |
42 public: |
42 typedef List<QRadioButton*>::it it; |
43 typedef List<QRadioButton*>::it it; |
43 |
44 |
44 explicit RadioBox() { init (Qt::Vertical); } |
45 explicit RadioGroup() { init (Qt::Vertical); } |
45 explicit RadioBox (QWidget* parent = null) : QGroupBox (parent) { init (Qt::Vertical); } |
46 explicit RadioGroup (QWidget* parent = null) : QGroupBox (parent) { init (Qt::Vertical); } |
46 explicit RadioBox (const QString& title, QWidget* parent = null); |
47 explicit RadioGroup (const QString& title, QWidget* parent = null); |
47 explicit RadioBox (const QString& title, initlist<char const*> entries, int const defaultId, |
48 explicit RadioGroup (const QString& title, initlist<char const*> entries, int const defaultId, |
48 const Qt::Orientation orient = Qt::Vertical, QWidget* parent = null); |
49 const Qt::Orientation orient = Qt::Vertical, QWidget* parent = null); |
49 |
50 |
50 void addButton (const char* entry); |
51 void addButton (const char* entry); |
51 void addButton (QRadioButton* button); |
52 void addButton (QRadioButton* button); |
52 it begin (); |
53 it begin (); |
57 void setCurrentRow (uint row); |
58 void setCurrentRow (uint row); |
58 void setValue (int val); |
59 void setValue (int val); |
59 int value () const; |
60 int value () const; |
60 |
61 |
61 QRadioButton* operator[] (uint n) const; |
62 QRadioButton* operator[] (uint n) const; |
62 RadioBox& operator<< (QRadioButton* button); |
63 RadioGroup& operator<< (QRadioButton* button); |
63 RadioBox& operator<< (const char* entry); |
64 RadioGroup& operator<< (const char* entry); |
64 |
65 |
65 signals: |
66 signals: |
66 void buttonPressed (int btn); |
67 void buttonPressed (int btn); |
67 void buttonReleased (int btn); |
68 void buttonReleased (int btn); |
68 void valueChanged (int val); |
69 void valueChanged (int val); |
74 QBoxLayout* m_currentLayout; |
75 QBoxLayout* m_currentLayout; |
75 bool m_vert; |
76 bool m_vert; |
76 int m_curId, m_defId, m_oldId; |
77 int m_curId, m_defId, m_oldId; |
77 QButtonGroup* m_buttonGroup; |
78 QButtonGroup* m_buttonGroup; |
78 |
79 |
79 Q_DISABLE_COPY (RadioBox) |
80 Q_DISABLE_COPY (RadioGroup) |
80 |
81 |
81 private slots: |
82 private slots: |
82 void slot_buttonPressed (int btn); |
83 void slot_buttonPressed (int btn); |
83 void slot_buttonReleased (int btn); |
84 void slot_buttonReleased (int btn); |
84 }; |
85 }; |