BuildmLearn Toolkit  2.0.4
BuildmLearn Toolkit is an easy-to-use program that helps users make mobile apps without any knowledge of application development.
 All Classes Functions Enumerations Groups Pages
custommessagebox.h
1 /*
2  Copyright (c) 2012, BuildmLearn Contributors listed at http://buildmlearn.org/people/
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 
11  * Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15  * Neither the name of the BuildmLearn nor the names of its
16  contributors may be used to endorse or promote products derived from
17  this software without specific prior written permission.
18 
19  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 
31 #ifndef MESSAGEBOX_H
32 #define MESSAGEBOX_H
33 
34 #include <QMessageBox>
35 #include <QDialogButtonBox>
36 
37 
38 /// \brief Custom message boxes.
39 class CustomMessageBox : public QMessageBox {
40  Q_OBJECT
41 
42  public:
43  /// \brief Constructor.
44  explicit CustomMessageBox(QWidget *parent = 0);
45  virtual ~CustomMessageBox();
46 
47  /// \brief Custom icon setting.
48  /// \param icon Icon to set.
49  void setIcon(Icon icon);
50 
51  /// \brief Performs icon replacements for given button box.
52  /// \param button_box Button box to work with.
53  static void iconify(QDialogButtonBox *button_box);
54 
55  /// \brief Displays custom message box.
56  /// \param parent Parent object.
57  /// \param icon Icon of message box.
58  /// \param title Title of message box.
59  /// \param text Text of message box.
60  /// \param informative_text Informative text of message box.
61  /// \param detailed_text Detailed text of message box.
62  /// \param buttons Which buttons to display?
63  /// \param default_button Which button highlight as default one?
64  /// \return Returns the status of message box (e.g. which button was pressed.
65  static QMessageBox::StandardButton show(QWidget *parent,
66  QMessageBox::Icon icon,
67  const QString &title,
68  const QString &text,
69  const QString &informative_text = QString(),
70  const QString &detailed_text = QString(),
71  QMessageBox::StandardButtons buttons = QMessageBox::Ok,
72  QMessageBox::StandardButton default_button = QMessageBox::Ok);
73 
74  private:
75  // Returns icons for standard roles/statuses.
76  static QIcon iconForRole(QDialogButtonBox::StandardButton button);
77  static QIcon iconForStatus(QMessageBox::Icon status);
78 };
79 
80 #endif // MESSAGEBOX_H
static void iconify(QDialogButtonBox *button_box)
Performs icon replacements for given button box.
Custom message boxes.
static QMessageBox::StandardButton show(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, const QString &informative_text=QString(), const QString &detailed_text=QString(), QMessageBox::StandardButtons buttons=QMessageBox::Ok, QMessageBox::StandardButton default_button=QMessageBox::Ok)
Displays custom message box.
void setIcon(Icon icon)
Custom icon setting.
CustomMessageBox(QWidget *parent=0)
Constructor.