- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# qdialogbuttonbox.h

Go to the documentation of this file.

    00001 /****************************************************************************
    00002 **
    00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    00004 ** All rights reserved.
    00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
    00006 **
    00007 ** This file is part of the QtGui module of the Qt Toolkit.
    00008 **
    00009 ** $QT_BEGIN_LICENSE:LGPL$
    00010 ** Commercial Usage
    00011 ** Licensees holding valid Qt Commercial licenses may use this file in
    00012 ** accordance with the Qt Commercial License Agreement provided with the
    00013 ** Software or, alternatively, in accordance with the terms contained in
    00014 ** a written agreement between you and Nokia.
    00015 **
    00016 ** GNU Lesser General Public License Usage
    00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
    00018 ** General Public License version 2.1 as published by the Free Software
    00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
    00020 ** packaging of this file.  Please review the following information to
    00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
    00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    00023 **
    00024 ** In addition, as a special exception, Nokia gives you certain additional
    00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
    00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
    00027 **
    00028 ** GNU General Public License Usage
    00029 ** Alternatively, this file may be used under the terms of the GNU
    00030 ** General Public License version 3.0 as published by the Free Software
    00031 ** Foundation and appearing in the file LICENSE.GPL included in the
    00032 ** packaging of this file.  Please review the following information to
    00033 ** ensure the GNU General Public License version 3.0 requirements will be
    00034 ** met: http://www.gnu.org/copyleft/gpl.html.
    00035 **
    00036 ** If you have questions regarding the use of this file, please contact
    00037 ** Nokia at qt-info@nokia.com.
    00038 ** $QT_END_LICENSE$
    00039 **
    00040 ****************************************************************************/
    00041
    00042 #ifndef QDIALOGBUTTONBOX_H
    00043 #define QDIALOGBUTTONBOX_H
    00044
    00045 #include <QtGui/qwidget.h>
    00046
    00047 QT_BEGIN_HEADER
    00048
    00049 QT_BEGIN_NAMESPACE
    00050
    00051 QT_MODULE(Gui)
    00052
    00053 class QAbstractButton;
    00054 class QPushButton;
    00055 class QDialogButtonBoxPrivate;
    00056
    00057 class Q_GUI_EXPORT QDialogButtonBox : public QWidget
    00058 {
    00059     Q_OBJECT
    00060     Q_FLAGS(StandardButtons)
    00061     Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
    00062     Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons)
    00063     Q_PROPERTY(bool centerButtons READ centerButtons WRITE setCenterButtons)
    00064
    00065 public:
    00066     enum ButtonRole {
    00067         // keep this in sync with QMessageBox::ButtonRole
    00068         InvalidRole = -1,
    00069         AcceptRole,
    00070         RejectRole,
    00071         DestructiveRole,
    00072         ActionRole,
    00073         HelpRole,
    00074         YesRole,
    00075         NoRole,
    00076         ResetRole,
    00077         ApplyRole,
    00078
    00079         NRoles
    00080     };
    00081
    00082     enum StandardButton {
    00083         // keep this in sync with QMessageBox::StandardButton
    00084         NoButton           = 0x00000000,
    00085         Ok                 = 0x00000400,
    00086         Save               = 0x00000800,
    00087         SaveAll            = 0x00001000,
    00088         Open               = 0x00002000,
    00089         Yes                = 0x00004000,
    00090         YesToAll           = 0x00008000,
    00091         No                 = 0x00010000,
    00092         NoToAll            = 0x00020000,
    00093         Abort              = 0x00040000,
    00094         Retry              = 0x00080000,
    00095         Ignore             = 0x00100000,
    00096         Close              = 0x00200000,
    00097         Cancel             = 0x00400000,
    00098         Discard            = 0x00800000,
    00099         Help               = 0x01000000,
    00100         Apply              = 0x02000000,
    00101         Reset              = 0x04000000,
    00102         RestoreDefaults    = 0x08000000,
    00103
    00104 #ifndef Q_MOC_RUN
    00105         FirstButton        = Ok,
    00106         LastButton         = RestoreDefaults
    00107 #endif
    00108     };
    00109
    00110     Q_DECLARE_FLAGS(StandardButtons, StandardButton)
    00111
    00112     enum ButtonLayout {
    00113         WinLayout,
    00114         MacLayout,
    00115         KdeLayout,
    00116         GnomeLayout
    00117     };
    00118
    00119     QDialogButtonBox(QWidget *parent = 0);
    00120     QDialogButtonBox(Qt::Orientation orientation, QWidget *parent = 0);
    00121     QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation = Qt::Horizontal,
    00122                      QWidget *parent = 0);
    00123     ~QDialogButtonBox();
    00124
    00125     void setOrientation(Qt::Orientation orientation);
    00126     Qt::Orientation orientation() const;
    00127
    00128     void addButton(QAbstractButton *button, ButtonRole role);
    00129     QPushButton *addButton(const QString &text, ButtonRole role);
    00130     QPushButton *addButton(StandardButton button);
    00131     void removeButton(QAbstractButton *button);
    00132     void clear();
    00133
    00134     QList<QAbstractButton *> buttons() const;
    00135     ButtonRole buttonRole(QAbstractButton *button) const;
    00136
    00137     void setStandardButtons(StandardButtons buttons);
    00138     StandardButtons standardButtons() const;
    00139     StandardButton standardButton(QAbstractButton *button) const;
    00140     QPushButton *button(StandardButton which) const;
    00141
    00142     void setCenterButtons(bool center);
    00143     bool centerButtons() const;
    00144
    00145 Q_SIGNALS:
    00146     void clicked(QAbstractButton *button);
    00147     void accepted();
    00148     void helpRequested();
    00149     void rejected();
    00150
    00151 protected:
    00152     void changeEvent(QEvent *event);
    00153     bool event(QEvent *event);
    00154
    00155 private:
    00156     Q_DISABLE_COPY(QDialogButtonBox)
    00157     Q_DECLARE_PRIVATE(QDialogButtonBox)
    00158     Q_PRIVATE_SLOT(d_func(), void _q_handleButtonClicked())
    00159     Q_PRIVATE_SLOT(d_func(), void _q_handleButtonDestroyed())
    00160 };
    00161
    00162 Q_DECLARE_OPERATORS_FOR_FLAGS(QDialogButtonBox::StandardButtons)
    00163
    00164 QT_END_NAMESPACE
    00165
    00166 QT_END_HEADER
    00167
    00168 #endif // QDIALOGBUTTONBOX_H