]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/QY2ComboTabWidget.h
remove one FIXME
[duncan/yast2-qt4.git] / src / QY2ComboTabWidget.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                          contributed Qt widgets                      |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       QY2ComboTabWidget.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17   This is a pure Qt widget - it can be used independently of YaST2.
18
19 /-*/
20
21
22 #ifndef QY2ComboTabWidget_h
23 #define QY2ComboTabWidget_h
24
25 #include <QString>
26 #include <QHash>
27
28 class QComboBox;
29 class QLabel;
30 class QStackedWidget;
31 class QWidget;
32
33
34 /**
35  * This widget is very much like a QTabWidget, but it uses a combo box above
36  * the tab pages rather than a ( scrolled ) one-line row of tabs.
37  **/
38 class QY2ComboTabWidget : public QWidget
39 {
40     Q_OBJECT
41
42 public:
43
44     /**
45      * Constructor. 'combo_box_label' is the user-visible label of the combo
46      * box that is used to switch between the different tab pages.
47      **/
48     QY2ComboTabWidget( const QString &  combo_box_label,
49                        QWidget *        parent = 0,
50                        const char *     name   = 0 );
51
52     /**
53      * Destructor.
54      **/
55     virtual ~QY2ComboTabWidget();
56
57     /**
58      * Add a page. 'page_label' will be the user-visible combo box entry for
59      * that page.
60      **/
61     void addPage( const QString & page_label, QWidget * page );
62
63     
64 signals:
65
66     /**
67      * Emitted when the current page changes.
68      * NOT emitted initially for the very first page that is shown.
69      **/
70     void currentChanged( QWidget * newCurrentPage );
71
72     
73 public slots:
74
75     /**
76      * Show a page. Updates the combo box contents accordingly.
77      * This is an expensive operation: All combo box items are searched for the
78      * item that corresponds to this page.
79      **/
80     void showPage( QWidget * page );
81
82
83
84 protected slots:
85
86     /**
87      * Show a page identified by its index. Does NOT update the combo box
88      * contents.
89      **/
90     void showPage( int index );
91
92
93 protected:
94
95     QComboBox           * combo_box;
96     QLabel              * combo_label;
97     QStackedWidget      * widget_stack;
98     QHash<int, QWidget *>         pages;
99 };
100
101 #endif // QY2ComboTabWidget_h