telutils/dialpad/tsrc/unit/ut_dialpadkeysequenceeventfilter/hblineedit.h
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
child 21 0a6dd2dc9970
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
     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 #ifndef HBLINEEDIT_H
       
    27 #define HBLINEEDIT_H
       
    28 
       
    29 #include <hbglobal.h>
       
    30 #include <hbnamespace.h>
       
    31 #include <hbabstractedit.h>
       
    32 #include <QFont>
       
    33 
       
    34 class HbLineEditPrivate;
       
    35 
       
    36 class HB_WIDGETS_EXPORT HbLineEdit: public QObject
       
    37 {
       
    38     Q_OBJECT
       
    39 
       
    40     Q_ENUMS(EchoMode)
       
    41 
       
    42     Q_PROPERTY(QString text READ text WRITE setText USER true)
       
    43     Q_PROPERTY(QString displayText READ displayText)
       
    44     Q_PROPERTY(int maxLength READ maxLength WRITE setMaxLength)
       
    45     Q_PROPERTY(bool hasSelectedText READ hasSelectedText)
       
    46     Q_PROPERTY(QString selectedText READ selectedText)
       
    47     Q_PROPERTY(int selectionStart READ selectionStart)
       
    48     Q_PROPERTY(int maxRows READ maxRows WRITE setMaxRows)
       
    49     Q_PROPERTY(int minRows READ minRows WRITE setMinRows)
       
    50     Q_PROPERTY(bool expandable READ isExpandable)
       
    51     Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode)
       
    52 
       
    53 public:
       
    54 
       
    55     explicit HbLineEdit(QGraphicsItem *parent = 0);
       
    56     explicit HbLineEdit(const QString &text, QGraphicsItem *parent = 0);
       
    57     virtual ~HbLineEdit();
       
    58 
       
    59     enum {
       
    60         Type = Hb::ItemType_LineEdit
       
    61     };
       
    62 
       
    63     int type() const;
       
    64 
       
    65     int maxLength() const;
       
    66     void setMaxLength(int length);
       
    67 
       
    68     void setMinRows(int rows);
       
    69     int minRows() const;
       
    70 
       
    71     void setMaxRows(int rows);
       
    72     int maxRows() const;
       
    73 
       
    74     bool isExpandable() const;
       
    75 
       
    76     QString text() const;
       
    77     QString displayText() const;
       
    78 
       
    79     bool hasSelectedText() const;
       
    80     QString selectedText() const;
       
    81     int selectionStart() const;
       
    82     void setSelection(int start, int length);
       
    83 
       
    84     int cursorPosition() const;
       
    85     void setCursorPosition(int pos);
       
    86 
       
    87     enum EchoMode { Normal, NoEcho, Password, PasswordEchoOnEdit };
       
    88     EchoMode echoMode() const;
       
    89     void setEchoMode(EchoMode);
       
    90 
       
    91     void setCapitalization ( QFont::Capitalization caps );
       
    92     QFont::Capitalization capitalization () const;
       
    93 
       
    94 public slots:
       
    95     void setText(const QString &text);
       
    96 
       
    97 signals:
       
    98     void editingFinished();
       
    99     void textChanged(const QString &text);
       
   100     void selectionChanged();
       
   101 
       
   102 protected:
       
   103     HbLineEdit(HbLineEditPrivate &dd, QGraphicsItem *parent);
       
   104 
       
   105     void inputMethodEvent(QInputMethodEvent *event);
       
   106     void keyPressEvent(QKeyEvent *event);
       
   107     void keyReleaseEvent(QKeyEvent *event);
       
   108 
       
   109     void resizeEvent(QGraphicsSceneResizeEvent *event);
       
   110 
       
   111     bool canInsertFromMimeData(const QMimeData *source) const;
       
   112     void insertFromMimeData(const QMimeData *source);
       
   113 
       
   114     void focusOutEvent ( QFocusEvent * event );
       
   115     void focusInEvent ( QFocusEvent * event );
       
   116 private:
       
   117     Q_DISABLE_COPY(HbLineEdit)
       
   118     //Q_DECLARE_PRIVATE_D(d_ptr, HbLineEdit)
       
   119     //Q_PRIVATE_SLOT(d_func(), void _q_textChanged())
       
   120 };
       
   121 
       
   122 #endif // HBLINEEDIT_H