|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Orbit stubs for Live Comms UI unit tests |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef HBMESSAGEBOX_H |
|
19 #define HBMESSAGEBOX_H |
|
20 |
|
21 #include <hbglobal.h> |
|
22 #include <hbdialog.h> |
|
23 #include <hbicon.h> |
|
24 |
|
25 class HbMessageBoxPrivate; |
|
26 class HbStyleOptionMessageBox; |
|
27 |
|
28 class HB_WIDGETS_EXPORT HbMessageBox : public HbDialog |
|
29 { |
|
30 |
|
31 public: |
|
32 enum MessageBoxType { |
|
33 MessageTypeInformation, |
|
34 MessageTypeQuestion, |
|
35 MessageTypeWarning |
|
36 }; |
|
37 |
|
38 enum StandardButton { |
|
39 NoButton = 0x00000000, |
|
40 Ok = 0x00000400, |
|
41 Save = 0x00000800, |
|
42 Open = 0x00001000, |
|
43 Yes = 0x00002000, |
|
44 Continue = 0x00004000, |
|
45 Delete = 0x00008000, |
|
46 No = 0x00010000, |
|
47 Retry = 0x00020000, |
|
48 Close = 0x00040000, |
|
49 Cancel = 0x00080000, |
|
50 Help = 0x00100000, |
|
51 Apply = 0x00200000, |
|
52 Reset = 0x00400000 |
|
53 }; |
|
54 |
|
55 Q_DECLARE_FLAGS(StandardButtons, StandardButton) |
|
56 |
|
57 explicit HbMessageBox(MessageBoxType type=MessageTypeInformation,QGraphicsItem *parent = 0); |
|
58 explicit HbMessageBox(const QString &text,MessageBoxType type =MessageTypeInformation, QGraphicsItem *parent = 0); |
|
59 virtual ~HbMessageBox(); |
|
60 |
|
61 void setText(const QString &text); |
|
62 QString text() const; |
|
63 |
|
64 void setIcon(const HbIcon &icon); |
|
65 HbIcon icon() const; |
|
66 |
|
67 void setIconAlignment(Qt::Alignment align); |
|
68 Qt::Alignment iconAlignment() const; |
|
69 |
|
70 enum { Type = Hb::ItemType_MessageBox }; |
|
71 int type() const { return Type; } |
|
72 |
|
73 void setStandardButtons(int buttons); |
|
74 int standardButtons() const; |
|
75 |
|
76 public: |
|
77 static bool launchQuestionMessageBox(const QString &questionText, |
|
78 const QString &primaryButtonText = tr("Yes"), |
|
79 const QString &secondaryButtonText = tr("No"), |
|
80 QGraphicsWidget *headWidget = 0, |
|
81 QGraphicsScene *scene = 0, |
|
82 QGraphicsItem *parent = 0 ); |
|
83 |
|
84 static void launchInformationMessageBox(const QString &informationText, |
|
85 QGraphicsWidget *headWidget = 0, |
|
86 QGraphicsScene *scene = 0, |
|
87 QGraphicsItem *parent = 0 ); |
|
88 |
|
89 static void launchWarningMessageBox(const QString &warningText, |
|
90 QGraphicsWidget *headWidget = 0, |
|
91 QGraphicsScene *scene = 0, |
|
92 QGraphicsItem *parent = 0 ); |
|
93 |
|
94 public slots: |
|
95 void updatePrimitives(); |
|
96 |
|
97 protected: |
|
98 HbMessageBox(HbMessageBoxPrivate &dd, QGraphicsItem *parent); |
|
99 void initStyleOption(HbStyleOptionMessageBox *option) const; |
|
100 void keyPressEvent(QKeyEvent *event); |
|
101 }; |
|
102 |
|
103 #endif // HB_MESSAGEBOX_H |
|
104 |