src/hbwidgets/popups/hbmessagebox.h
changeset 6 c3690ec91ef8
parent 2 06ff229162e9
child 21 4633027730f5
child 34 ed14f46c0e55
--- a/src/hbwidgets/popups/hbmessagebox.h	Fri Jun 11 13:58:22 2010 +0300
+++ b/src/hbwidgets/popups/hbmessagebox.h	Wed Jun 23 18:33:25 2010 +0300
@@ -33,20 +33,45 @@
 class HbMessageBoxPrivate;
 class HbStyleOptionMessageBox;
 
+
 class HB_WIDGETS_EXPORT HbMessageBox : public HbDialog
 {
     Q_OBJECT
+    Q_FLAGS(StandardButton StandardButtons)
+    Q_ENUMS(MessageBoxType StandardButton )
     Q_PROPERTY( QString text READ text WRITE setText )
     Q_PROPERTY( HbIcon icon READ icon WRITE setIcon )
     Q_PROPERTY( bool iconVisible READ iconVisible WRITE setIconVisible )
+    Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons)
 public:
     enum MessageBoxType {
+        MessageTypeNone,
         MessageTypeInformation,
         MessageTypeQuestion,
         MessageTypeWarning
     };
-    explicit HbMessageBox(MessageBoxType type=MessageTypeInformation,QGraphicsItem *parent = 0);
-    explicit HbMessageBox(const QString &text,MessageBoxType type =MessageTypeInformation, QGraphicsItem *parent = 0);
+
+    enum StandardButton {
+        NoButton           = 0x00000000,
+        Ok                 = 0x00000400,
+        Save               = 0x00000800,
+        Open               = 0x00001000,
+        Yes                = 0x00002000,
+        Continue           = 0x00004000,
+        Delete             = 0x00008000,
+        No                 = 0x00010000,
+        Retry              = 0x00020000,
+        Close              = 0x00040000,
+        Cancel             = 0x00080000,
+        Help               = 0x00100000,
+        Apply              = 0x00200000,
+        Reset              = 0x00400000
+    };    
+
+    Q_DECLARE_FLAGS(StandardButtons, StandardButton)
+
+    explicit HbMessageBox(MessageBoxType type=MessageTypeNone,QGraphicsItem *parent = 0);
+    explicit HbMessageBox(const QString &text,MessageBoxType type =MessageTypeNone, QGraphicsItem *parent = 0);
     virtual ~HbMessageBox();
 
     void setText(const QString &text);
@@ -58,6 +83,9 @@
     void setIconVisible(bool visible);
     bool  iconVisible() const;
 
+    void setStandardButtons(StandardButtons buttons);
+    StandardButtons standardButtons() const;
+    
     QGraphicsItem *primitive(HbStyle::Primitive primitive) const;
     enum { Type = Hb::ItemType_MessageBox };
     int type() const { return Type; }
@@ -86,6 +114,30 @@
                             QGraphicsScene *scene = 0,
                             QGraphicsItem *parent = 0 );
 
+    static void question(const QString &questionText,
+                            QObject *receiver ,
+                            const char *member,
+                            HbMessageBox::StandardButtons buttons,
+                            QGraphicsWidget *headingWidget = 0,
+                            QGraphicsScene *scene = 0,
+                            QGraphicsItem *parent = 0);
+	 
+    static void information(const QString &informationText,
+                            QObject *receiver,
+                            const char *member,
+                            HbMessageBox::StandardButtons buttons ,
+                            QGraphicsWidget *headingWidget=0,
+                            QGraphicsScene *scene = 0,
+                            QGraphicsItem *parent = 0 );
+
+    static void warning(const QString &warningText,
+                            QObject *receiver ,
+                            const char *member,
+                            HbMessageBox::StandardButtons buttons,
+                            QGraphicsWidget *headingWidget = 0,
+                            QGraphicsScene *scene = 0,
+                            QGraphicsItem *parent = 0 );
+
 public slots:
     void updatePrimitives();
 
@@ -94,11 +146,12 @@
     void initStyleOption(HbStyleOptionMessageBox *option) const;
 
 private:
-    Q_PRIVATE_SLOT(d_func(), void _q_closeOnGesture())
+    Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked())
     Q_DECLARE_PRIVATE_D(d_ptr, HbMessageBox)
     Q_DISABLE_COPY(HbMessageBox)    
 	
 };
+Q_DECLARE_OPERATORS_FOR_FLAGS(HbMessageBox::StandardButtons)
 
 #endif // HB_MESSAGEBOX_H