CFx SDK Documentation  2023 SP0
FxMessageBox.h
Go to the documentation of this file.
1 //
2 // (C) Copyright 2005-2022 by Graebert GmbH.
3 //
4 // Permission to use, copy, modify, and distribute this software in
5 // object code form for any purpose and without fee is hereby granted,
6 // provided that the above copyright notice appears in all copies and
7 // that both that copyright notice and the limited warranty and
8 // restricted rights notice below appear in all supporting
9 // documentation.
10 //
11 // GRAEBERT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
12 // GRAEBERT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
13 // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. GRAEBERT GMBH
14 // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
15 // UNINTERRUPTED OR ERROR FREE.
16 
17 #pragma once
18 
19 #include "FxPragmaPush.h"
20 
21 #include "DDKERNEL.h"
22 
23 #include <QtWidgets/QMessageBox>
24 
25 #define MB_SAVEDISCARDCANCEL 0x00000009L
26 
27 class CFxMessageBoxImpl;
28 
34 class DDKERNEL_API CFxMessageBox : public QMessageBox
35 {
36  Q_OBJECT
37 
38 public:
39  explicit CFxMessageBox(QWidget *parent = 0);
40  CFxMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text,
41  QMessageBox::StandardButtons buttons = NoButton, QWidget *parent = 0,
42  Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
43  CFxMessageBox(const QString &title, const QString &text, QMessageBox::Icon icon,
44  int button0, int button1, int button2,
45  QWidget *parent = 0,
46  Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
47  virtual ~CFxMessageBox();
48 
56  void addButton(QAbstractButton *button, QMessageBox::ButtonRole role);
57 
67  QPushButton *addButton(const QString &text, QMessageBox::ButtonRole role);
68 
77  QPushButton *addButton(QMessageBox::StandardButton button);
78 
86  void setStandardButtons(StandardButtons buttons, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
87 
100  static QMessageBox::StandardButton information(QWidget *parent, const QString &title,
101  const QString &text, QMessageBox::StandardButtons buttons = Ok,
102  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
103 
115  static QMessageBox::StandardButton question(QWidget *parent, const QString &title,
116  const QString &text, QMessageBox::StandardButtons buttons = Ok,
117  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
118 
131  static QMessageBox::StandardButton warning(QWidget *parent, const QString &title,
132  const QString &text, QMessageBox::StandardButtons buttons = Ok,
133  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
134 
147  static QMessageBox::StandardButton critical(QWidget *parent, const QString &title,
148  const QString &text, QMessageBox::StandardButtons buttons = Ok,
149  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
150 
156  virtual int exec();
157 
158 protected:
159  bool event( QEvent * e ) override;
160  bool nativeEvent( const QByteArray& eventType, void *msg, long *result ) override;
161 
162 private:
163  static QMessageBox::StandardButton showMessageBox(QMessageBox::Icon icon, QString title, QString text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton, QWidget *parent);
164 
165  virtual void showEvent(QShowEvent *);
166  virtual void hideEvent(QHideEvent *);
167 
168  QCursor m_PreviousCursor;
169  CFxMessageBoxImpl* m_pImpl;
170 };
171 
172 #include "FxPragmaPop.h"
#define DDKERNEL_API
Definition: DDKERNEL.h:32
static QMessageBox::StandardButton question(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons=Ok, QMessageBox::StandardButton defaultButton=QMessageBox::NoButton)
QPushButton * addButton(QMessageBox::StandardButton button)
virtual int exec()
QPushButton * addButton(const QString &text, QMessageBox::ButtonRole role)
static QMessageBox::StandardButton critical(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons=Ok, QMessageBox::StandardButton defaultButton=QMessageBox::NoButton)
bool event(QEvent *e) override
static QMessageBox::StandardButton information(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons=Ok, QMessageBox::StandardButton defaultButton=QMessageBox::NoButton)
CFxMessageBox(const QString &title, const QString &text, QMessageBox::Icon icon, int button0, int button1, int button2, QWidget *parent=0, Qt::WindowFlags f=Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint)
void setStandardButtons(StandardButtons buttons, QMessageBox::StandardButton defaultButton=QMessageBox::NoButton)
static QMessageBox::StandardButton warning(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons=Ok, QMessageBox::StandardButton defaultButton=QMessageBox::NoButton)
virtual ~CFxMessageBox()
CFxMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons=NoButton, QWidget *parent=0, Qt::WindowFlags f=Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint)
void addButton(QAbstractButton *button, QMessageBox::ButtonRole role)
CFxMessageBox(QWidget *parent=0)
bool nativeEvent(const QByteArray &eventType, void *msg, long *result) override
GLfloat f
Definition: gles2_ext.h:564