src/hbwidgets/popups/hbinputdialog.h
changeset 0 16d8024aca5e
child 2 06ff229162e9
equal deleted inserted replaced
-1:000000000000 0:16d8024aca5e
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (developer.feedback@nokia.com)
       
     6 **
       
     7 ** This file is part of the HbWidgets module of the UI Extensions for Mobile.
       
     8 **
       
     9 ** GNU Lesser General Public License Usage
       
    10 ** This file may be used under the terms of the GNU Lesser General Public
       
    11 ** License version 2.1 as published by the Free Software Foundation and
       
    12 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
       
    13 ** Please review the following information to ensure the GNU Lesser General
       
    14 ** Public License version 2.1 requirements will be met:
       
    15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    16 **
       
    17 ** In addition, as a special exception, Nokia gives you certain additional
       
    18 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    20 **
       
    21 ** If you have questions regarding the use of this file, please contact
       
    22 ** Nokia at developer.feedback@nokia.com.
       
    23 **
       
    24 ****************************************************************************/
       
    25 
       
    26 
       
    27 #ifndef HBINPUT_DIALOG_H
       
    28 #define HBINPUT_DIALOG_H
       
    29 
       
    30 #include <hbdialog.h>
       
    31 #include <hblineedit.h>
       
    32 
       
    33 class HbInputDialogPrivate;
       
    34 class HbStyleOptionInputDialog;
       
    35 class HbValidator;
       
    36 
       
    37 class HB_WIDGETS_EXPORT HbInputDialog : public HbDialog
       
    38 {
       
    39     Q_OBJECT
       
    40 
       
    41 public:
       
    42     enum InputMode {
       
    43         TextInput,
       
    44         IntInput,
       
    45         RealInput,
       
    46         IpInput
       
    47     };
       
    48 
       
    49     explicit HbInputDialog(QGraphicsItem *parent= 0);
       
    50     ~HbInputDialog();
       
    51 
       
    52     void setInputMode(InputMode mode, int row = 0);
       
    53     InputMode inputMode(int row = 0) const;
       
    54 
       
    55     void setPromptText(const QString &text, int row = 0);
       
    56     QString promptText(int row = 0) const;
       
    57 
       
    58     void setValue(const QVariant &value, int row = 0);
       
    59     QVariant value(int row = 0) const;
       
    60 
       
    61     void setAdditionalRowVisible(bool visible = false);
       
    62     bool isAdditionalRowVisible();
       
    63 
       
    64     void setValidator(HbValidator *validator, int row=0);
       
    65     HbValidator* validator(int row=0) const;
       
    66 
       
    67     HbLineEdit* lineEdit(int row=0) const;
       
    68 
       
    69     void setEchoMode(HbLineEdit::EchoMode echoMode=HbLineEdit::Normal,int row=0);
       
    70     HbLineEdit::EchoMode echoMode(int row=0) const;
       
    71 
       
    72 
       
    73 public:
       
    74     static void getText(const QString &heading
       
    75             ,QObject *receiver
       
    76             ,const char *member
       
    77             ,const QString &text=QString()
       
    78             ,QGraphicsScene *scene=0
       
    79             ,QGraphicsItem *parent=0);
       
    80    static void getInteger(const QString &label
       
    81             ,QObject *receiver
       
    82             ,const char *member
       
    83             ,int value = 0
       
    84             ,QGraphicsScene *scene = 0
       
    85             ,QGraphicsItem *parent = 0);
       
    86     static void getDouble(const QString &label
       
    87             ,QObject *receiver
       
    88             ,const char *member
       
    89             ,double value = 0
       
    90             , QGraphicsScene *scene = 0
       
    91             , QGraphicsItem *parent = 0);
       
    92 
       
    93     static void getIp(const QString &label
       
    94             ,QObject *receiver
       
    95             ,const char *member
       
    96             , const QString &ipaddress = QString()
       
    97             , QGraphicsScene *scene = 0
       
    98             , QGraphicsItem *parent = 0);
       
    99 
       
   100     QGraphicsItem* primitive(HbStyle::Primitive primitive) const;
       
   101 
       
   102     enum { Type = Hb::ItemType_InputDialog };
       
   103     int type() const { return Type; }
       
   104 
       
   105 public:
       
   106     static QString getText(const QString &label,const QString &text = QString(),bool *ok = 0, QGraphicsScene *scene = 0, QGraphicsItem *parent = 0);
       
   107     static int getInteger(const QString &label, int value = 0,bool *ok = 0, QGraphicsScene *scene = 0, QGraphicsItem *parent = 0);
       
   108 
       
   109     static double getDouble(const QString &label, double value = 0,bool *ok = 0, QGraphicsScene *scene = 0, QGraphicsItem *parent = 0);
       
   110     static QString getIp(const QString &label, const QString &ipaddress = QString(),bool *ok = 0, QGraphicsScene *scene = 0, QGraphicsItem *parent = 0);
       
   111     
       
   112 public slots:
       
   113     void updatePrimitives();
       
   114 
       
   115 protected:
       
   116     HbInputDialog(HbDialogPrivate &dd, QGraphicsItem *parent);
       
   117     void initStyleOption(HbStyleOptionInputDialog *option) const;
       
   118 
       
   119 private:
       
   120     Q_DISABLE_COPY(HbInputDialog)
       
   121     Q_DECLARE_PRIVATE_D(d_ptr, HbInputDialog)
       
   122     Q_PRIVATE_SLOT(d_func(), void _q_notesOrientationChanged(Qt::Orientation))
       
   123 };
       
   124 
       
   125 #endif //HBINPUT_DIALOG_H
       
   126