telutils/dialpad/inc/dialpadkeypad.h
changeset 12 ae8abd0db65c
child 13 e32024264ebb
equal deleted inserted replaced
0:ff3b6d0fd310 12:ae8abd0db65c
       
     1 /*!
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Dialpad keypad
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef DIALPADKEYPAD_H
       
    19 #define DIALPADKEYPAD_H
       
    20 
       
    21 #include <hbwidget.h>
       
    22 
       
    23 class DialpadButton;
       
    24 class DialpadButtonStyle;
       
    25 class DialpadInputField;
       
    26 class DialpadButton;
       
    27 class QSignalMapper;
       
    28 class QGraphicsGridLayout;
       
    29 
       
    30 const int DialpadButtonCount = 13;
       
    31 
       
    32 class DialpadKeypad : public HbWidget
       
    33 {
       
    34     Q_OBJECT
       
    35 
       
    36 public:
       
    37     explicit DialpadKeypad(
       
    38         DialpadInputField& inputField,
       
    39         QGraphicsItem* parent=0);
       
    40 
       
    41     ~DialpadKeypad();
       
    42 
       
    43 public:
       
    44     void setLongPressDuration(int duration);
       
    45 
       
    46     void setCallButtonEnabled(bool enabled);
       
    47 
       
    48     void createButtonGrid();
       
    49 
       
    50 protected slots:
       
    51     void setButtonTexts();
       
    52     void handleKeyPressed(int key);
       
    53     void handleKeyClicked(int key);
       
    54     void handleKeyReleased(int key);
       
    55     void handleLongPress();
       
    56 
       
    57 protected:
       
    58     void showEvent(QShowEvent *event);
       
    59 
       
    60 private:
       
    61     void postKeyEvent(QEvent::Type type, int key);
       
    62     void sendKeyEventToEditor(QEvent::Type type, int key);
       
    63     inline bool isNumericKey(int key);
       
    64 
       
    65 private:
       
    66     DialpadInputField& mInputField;
       
    67     QGraphicsGridLayout* mGridLayout;
       
    68     DialpadButton* mButtons[DialpadButtonCount];
       
    69     DialpadButtonStyle* mNormalButtonStyle;
       
    70     DialpadButtonStyle* mCallButtonStyle;
       
    71     QSignalMapper* mKeyPressedSignalMapper;
       
    72     QSignalMapper* mKeyReleasedSignalMapper;
       
    73     QSignalMapper* mKeyClickedSignalMapper;
       
    74     QMap<int,QChar> mGeneratedChar;
       
    75     int mPressedNumericKey;
       
    76     QTimer* mLongPressTimer;
       
    77     int mLongPressDuration;
       
    78 };
       
    79 
       
    80 #endif // DIALPADKEYPAD_H