1 /****************************************************************************
2 ** $Id: qt/qdialogbuttons_p.h   3.3.8   edited Jan 11 14:46 $
3 **
4 ** Definition of QDialogButtons class.
5 **
6 ** Copyright (C) 2005-2007 Trolltech ASA.  All rights reserved.
7 **
8 ** This file is part of the widgets module of the Qt GUI Toolkit.
9 **
10 ** This file may be distributed under the terms of the Q Public License
11 ** as defined by Trolltech ASA of Norway and appearing in the file
12 ** LICENSE.QPL included in the packaging of this file.
13 **
14 ** This file may be distributed and/or modified under the terms of the
15 ** GNU General Public License version 2 as published by the Free Software
16 ** Foundation and appearing in the file LICENSE.GPL included in the
17 ** packaging of this file.
18 **
19 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
20 ** licenses may use this file in accordance with the Qt Commercial License
21 ** Agreement provided with the Software.
22 **
23 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25 **
26 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
27 **   information about Qt Commercial License Agreements.
28 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
29 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
30 **
31 ** Contact info@trolltech.com if any conditions of this licensing are
32 ** not clear to you.
33 **
34 **********************************************************************/
35 
36 #ifndef QDIALOGBUTTONS_P_H
37 #define QDIALOGBUTTONS_P_H
38 
39 #ifndef QT_H
40 #ifndef QT_H
41 #include "qwidget.h"
42 #endif // QT_H
43 #endif
44 
45 #ifndef QT_NO_DIALOGBUTTONS
46 struct QDialogButtonsPrivate;
47 
48 class
49 QDialogButtons : public QWidget
50 {
51     Q_OBJECT
52 public:
53     enum Button { None=0, Accept=0x01, Reject=0x02, Help=0x04, Apply=0x08, All=0x10, Abort=0x20, Retry=0x40, Ignore=0x80 };
54 #ifndef QT_NO_DIALOG
55     QDialogButtons(QDialog *parent, bool autoConnect = TRUE, Q_UINT32 buttons = Accept | Reject,
56 		   Orientation orient = Horizontal, const char *name = NULL);
57 #endif // QT_NO_DIALOG
58     QDialogButtons(QWidget *parent, Q_UINT32 buttons = Accept | Reject,
59 		   Orientation orient = Horizontal, const char *name = NULL);
60     ~QDialogButtons();
61 
62     void setQuestionMode(bool);
63     bool questionMode() const;
64 
65     void setButtonEnabled(Button button, bool enabled);
66     bool isButtonEnabled(Button) const;
67 
showButton(Button b)68     inline void showButton(Button b) { setButtonVisible(b, TRUE) ; }
hideButton(Button b)69     inline void hideButton(Button b) { setButtonVisible(b, FALSE); }
70     virtual void setButtonVisible(Button, bool visible);
71     bool isButtonVisible(Button) const;
72 
73     void addWidget(QWidget *);
74 
75     virtual void setDefaultButton(Button);
76     Button defaultButton() const;
77 
78     virtual void setButtonText(Button, const QString &);
79     QString buttonText(Button) const;
80 
81     void setOrientation(Orientation);
82     Orientation orientation() const;
83 
84     virtual QSize sizeHint(Button) const;
85     QSize minimumSizeHint() const;
86     QSize sizeHint() const;
87 
88 protected:
89     void layoutButtons();
90     virtual QWidget *createButton(Button);
91 
92     void showEvent(QShowEvent *);
93     void resizeEvent(QResizeEvent *);
94     void styleChanged(QStyle &);
95 
96 private slots:
97     void handleClicked();
98 
99 signals:
100     void clicked(Button);
101     void acceptClicked();
102     void rejectClicked();
103     void helpClicked();
104     void applyClicked();
105     void allClicked();
106     void retryClicked();
107     void ignoreClicked();
108     void abortClicked();
109 
110 private:
111     QDialogButtonsPrivate *d;
112     void init(Q_UINT32, Orientation);
113 };
114 #endif //QT_NO_DIALOGBUTTONS
115 #endif //QDIALOGBUTTONS_P_H
116