diff -r 730c025d4b77 -r f378acbc9cfb src/hbwidgets/popups/hbmessagebox.h --- a/src/hbwidgets/popups/hbmessagebox.h Thu Jul 15 14:03:49 2010 +0100 +++ b/src/hbwidgets/popups/hbmessagebox.h Thu Jul 22 16:36:53 2010 +0100 @@ -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