src/hbwidgets/popups/hbmessagebox.h
changeset 6 c3690ec91ef8
parent 2 06ff229162e9
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
5:627c4a0fd0e7 6:c3690ec91ef8
    31 #include <hbicon.h>
    31 #include <hbicon.h>
    32 
    32 
    33 class HbMessageBoxPrivate;
    33 class HbMessageBoxPrivate;
    34 class HbStyleOptionMessageBox;
    34 class HbStyleOptionMessageBox;
    35 
    35 
       
    36 
    36 class HB_WIDGETS_EXPORT HbMessageBox : public HbDialog
    37 class HB_WIDGETS_EXPORT HbMessageBox : public HbDialog
    37 {
    38 {
    38     Q_OBJECT
    39     Q_OBJECT
       
    40     Q_FLAGS(StandardButton StandardButtons)
       
    41     Q_ENUMS(MessageBoxType StandardButton )
    39     Q_PROPERTY( QString text READ text WRITE setText )
    42     Q_PROPERTY( QString text READ text WRITE setText )
    40     Q_PROPERTY( HbIcon icon READ icon WRITE setIcon )
    43     Q_PROPERTY( HbIcon icon READ icon WRITE setIcon )
    41     Q_PROPERTY( bool iconVisible READ iconVisible WRITE setIconVisible )
    44     Q_PROPERTY( bool iconVisible READ iconVisible WRITE setIconVisible )
       
    45     Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons)
    42 public:
    46 public:
    43     enum MessageBoxType {
    47     enum MessageBoxType {
       
    48         MessageTypeNone,
    44         MessageTypeInformation,
    49         MessageTypeInformation,
    45         MessageTypeQuestion,
    50         MessageTypeQuestion,
    46         MessageTypeWarning
    51         MessageTypeWarning
    47     };
    52     };
    48     explicit HbMessageBox(MessageBoxType type=MessageTypeInformation,QGraphicsItem *parent = 0);
    53 
    49     explicit HbMessageBox(const QString &text,MessageBoxType type =MessageTypeInformation, QGraphicsItem *parent = 0);
    54     enum StandardButton {
       
    55         NoButton           = 0x00000000,
       
    56         Ok                 = 0x00000400,
       
    57         Save               = 0x00000800,
       
    58         Open               = 0x00001000,
       
    59         Yes                = 0x00002000,
       
    60         Continue           = 0x00004000,
       
    61         Delete             = 0x00008000,
       
    62         No                 = 0x00010000,
       
    63         Retry              = 0x00020000,
       
    64         Close              = 0x00040000,
       
    65         Cancel             = 0x00080000,
       
    66         Help               = 0x00100000,
       
    67         Apply              = 0x00200000,
       
    68         Reset              = 0x00400000
       
    69     };    
       
    70 
       
    71     Q_DECLARE_FLAGS(StandardButtons, StandardButton)
       
    72 
       
    73     explicit HbMessageBox(MessageBoxType type=MessageTypeNone,QGraphicsItem *parent = 0);
       
    74     explicit HbMessageBox(const QString &text,MessageBoxType type =MessageTypeNone, QGraphicsItem *parent = 0);
    50     virtual ~HbMessageBox();
    75     virtual ~HbMessageBox();
    51 
    76 
    52     void setText(const QString &text);
    77     void setText(const QString &text);
    53     QString text() const;
    78     QString text() const;
    54 
    79 
    56     HbIcon icon() const;
    81     HbIcon icon() const;
    57 
    82 
    58     void setIconVisible(bool visible);
    83     void setIconVisible(bool visible);
    59     bool  iconVisible() const;
    84     bool  iconVisible() const;
    60 
    85 
       
    86     void setStandardButtons(StandardButtons buttons);
       
    87     StandardButtons standardButtons() const;
       
    88     
    61     QGraphicsItem *primitive(HbStyle::Primitive primitive) const;
    89     QGraphicsItem *primitive(HbStyle::Primitive primitive) const;
    62     enum { Type = Hb::ItemType_MessageBox };
    90     enum { Type = Hb::ItemType_MessageBox };
    63     int type() const { return Type; }
    91     int type() const { return Type; }
    64 
    92 
    65 public:
    93 public:
    84                             const char *member = 0,
   112                             const char *member = 0,
    85                             QGraphicsWidget *headWidget = 0,
   113                             QGraphicsWidget *headWidget = 0,
    86                             QGraphicsScene *scene = 0,
   114                             QGraphicsScene *scene = 0,
    87                             QGraphicsItem *parent = 0 );
   115                             QGraphicsItem *parent = 0 );
    88 
   116 
       
   117     static void question(const QString &questionText,
       
   118                             QObject *receiver ,
       
   119                             const char *member,
       
   120                             HbMessageBox::StandardButtons buttons,
       
   121                             QGraphicsWidget *headingWidget = 0,
       
   122                             QGraphicsScene *scene = 0,
       
   123                             QGraphicsItem *parent = 0);
       
   124 	 
       
   125     static void information(const QString &informationText,
       
   126                             QObject *receiver,
       
   127                             const char *member,
       
   128                             HbMessageBox::StandardButtons buttons ,
       
   129                             QGraphicsWidget *headingWidget=0,
       
   130                             QGraphicsScene *scene = 0,
       
   131                             QGraphicsItem *parent = 0 );
       
   132 
       
   133     static void warning(const QString &warningText,
       
   134                             QObject *receiver ,
       
   135                             const char *member,
       
   136                             HbMessageBox::StandardButtons buttons,
       
   137                             QGraphicsWidget *headingWidget = 0,
       
   138                             QGraphicsScene *scene = 0,
       
   139                             QGraphicsItem *parent = 0 );
       
   140 
    89 public slots:
   141 public slots:
    90     void updatePrimitives();
   142     void updatePrimitives();
    91 
   143 
    92 protected:
   144 protected:
    93     HbMessageBox(HbMessageBoxPrivate &dd, QGraphicsItem *parent);
   145     HbMessageBox(HbMessageBoxPrivate &dd, QGraphicsItem *parent);
    94     void initStyleOption(HbStyleOptionMessageBox *option) const;
   146     void initStyleOption(HbStyleOptionMessageBox *option) const;
    95 
   147 
    96 private:
   148 private:
    97     Q_PRIVATE_SLOT(d_func(), void _q_closeOnGesture())
   149     Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked())
    98     Q_DECLARE_PRIVATE_D(d_ptr, HbMessageBox)
   150     Q_DECLARE_PRIVATE_D(d_ptr, HbMessageBox)
    99     Q_DISABLE_COPY(HbMessageBox)    
   151     Q_DISABLE_COPY(HbMessageBox)    
   100 	
   152 	
   101 };
   153 };
       
   154 Q_DECLARE_OPERATORS_FOR_FLAGS(HbMessageBox::StandardButtons)
   102 
   155 
   103 #endif // HB_MESSAGEBOX_H
   156 #endif // HB_MESSAGEBOX_H
   104 
   157