Small dialog improvements.
[dorian] / widgets / adopterwindow.h
1 #ifndef ADOPTERWINDOW_H
2 #define ADOPTERWINDOW_H
3
4 #include <QMainWindow>
5 #include <QList>
6
7 class QWidget;
8 class QToolBar;
9 class QAction;
10
11 /**
12   * A main window that can adopt other windows' children, and grabs the
13   * zoom (volume) keys on Maemo.
14   */
15 class AdopterWindow: public QMainWindow
16 {
17     Q_OBJECT
18 public:
19     explicit AdopterWindow(QWidget *parent = 0);
20     void grabZoomKeys(bool grab);
21     void takeChildren(QWidget *main, const QList<QWidget *> &others);
22     void leaveChildren();
23
24     /**
25      * Add action that is visible on the tool bar (except on Symbian, where
26      * it is visible on the Options menu.
27      */
28     QAction *addToolBarAction(QObject *receiver, const char *slot,
29                               const QString &iconName, const QString &text);
30
31     /** Add space. */
32     void addToolBarSpace();
33
34     /** Show window. */
35     void show();
36
37 signals:
38
39 public slots:
40
41 protected:
42     void showEvent(QShowEvent *e);
43     void doGrabZoomKeys(bool grab);
44     bool grabbingZoomKeys;
45     QWidget *mainChild;
46 #ifndef Q_OS_SYMBIAN
47     QToolBar *toolBar;
48 #endif
49 };
50
51 #endif // ADOPTERWINDOW_H